aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-06-04 05:45:53 -0400
committerAndrew Manning <tamanning@zoho.com>2016-06-04 05:45:53 -0400
commitc08f428b5e7979e87250c2b0a30cd16344b395d9 (patch)
tree4da053975141628a0ead27f5a50606e9aec4fc27 /include/bbcode.php
parentb93e398674b375a3b14718fc6dd2a815aad9b387 (diff)
parent20a79c7acf1850f431f4fd52972ea0b6acf8ce0c (diff)
downloadvolse-hubzilla-c08f428b5e7979e87250c2b0a30cd16344b395d9.tar.gz
volse-hubzilla-c08f428b5e7979e87250c2b0a30cd16344b395d9.tar.bz2
volse-hubzilla-c08f428b5e7979e87250c2b0a30cd16344b395d9.zip
Merge remote-tracking branch 'upstream/dev' into wiki
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 42741b392..ed332146f 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -66,6 +66,19 @@ function bb_unspacefy_and_trim($st) {
}
+function bb_emoji($mtch) {
+ $s = strtolower($mtch[1]);
+ if(strpos($s,'x')) {
+ $e = substr($s,strpos($s,'x')+1);
+ if(file_exists('images/emoji/' . $e . '.png')) {
+ return '<img width="24" height="24" src="' . z_root() . '/images/emoji/' . $e . '.png" alt="emoji" />';
+ }
+ else {
+ return $mtch[0];
+ }
+ }
+}
+
function bb_extract_images($body) {
$saved_image = array();
@@ -1001,6 +1014,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim', $Text);
}
+ $Text = preg_replace_callback('/\[\&amp\;([#a-z0-9]+)\;\]/', 'bb_emoji', $Text);
$Text = preg_replace('/\[\&amp\;([#a-z0-9]+)\;\]/', '&$1;', $Text);
// fix any escaped ampersands that may have been converted into links