aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php14
-rw-r--r--include/features.php1
-rw-r--r--include/text.php2
3 files changed, 16 insertions, 1 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
diff --git a/include/features.php b/include/features.php
index 38700f9f5..6d38bcfb4 100644
--- a/include/features.php
+++ b/include/features.php
@@ -94,6 +94,7 @@ function get_features($filtered = true) {
t('Post/Comment Tools'),
array('commtag', t('Community Tagging'), t('Ability to tag existing posts'),false,get_config('feature_lock','commtag')),
array('categories', t('Post Categories'), t('Add categories to your posts'),false,get_config('feature_lock','categories')),
+ array('emojis', t('Emoji Reactions'), t('Add emoji reaction ability to posts'),true,get_config('feature_lock','emojis')),
array('filing', t('Saved Folders'), t('Ability to file posts under folders'),false,get_config('feature_lock','filing')),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'),false,get_config('feature_lock','dislike')),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'),false,get_config('feature_lock','star_posts')),
diff --git a/include/text.php b/include/text.php
index 834eec920..72db9c5ea 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1473,7 +1473,7 @@ function prepare_body(&$item,$attach = false) {
if($is_photo) {
- $object = json_decode($item['object'],true);
+ $object = json_decode($item['obj'],true);
// if original photo width is <= 640px prepend it to item body
if($object['link'][0]['width'] && $object['link'][0]['width'] <= 640) {