From 7b492d2bd3ea6089f30b89ad5d37843b500d907a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 6 Sep 2018 16:40:13 -0700 Subject: [PATCH] federated emoji support --- Zotlabs/Lib/Activity.php | 13 ++++++++++++- boot.php | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 1398e3418..ca5bffea2 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -293,7 +293,11 @@ class Activity { $ret[] = [ 'ttype' => TERM_MENTION, 'url' => $t['href'], 'term' => escape_tags((substr($t['name'],0,1) === '@') ? substr($t['name'],1) : $t['name']) ]; } break; - + + case 'Emoji': + $ret[] = [ 'ttype' => TERM_EMOJI, 'url' => t['icon']['url'], 'term' => escape_tags($t['name']) ]; + break; + default: break; } @@ -1501,6 +1505,13 @@ class Activity { $a = self::decode_taxonomy($act->obj); if($a) { $s['term'] = $a; + foreach($a as $b) { + if($b['ttype'] === TERM_EMOJI) { + $s['title'] = str_replace($b['term'],'[img=16x16]' . $b['url'] . '[/img]',$s['title']); + $s['summary'] = str_replace($b['term'],'[img=16x16]' . $b['url'] . '[/img]',$s['summary']); + $s['body'] = str_replace($b['term'],'[img=16x16]' . $b['url'] . '[/img]',$s['body']); + } + } } $a = self::decode_attachment($act->obj); diff --git a/boot.php b/boot.php index 17fb47ea6..46a26f08b 100755 --- a/boot.php +++ b/boot.php @@ -407,6 +407,7 @@ define ( 'TERM_BOOKMARK', 8 ); define ( 'TERM_HIERARCHY', 9 ); define ( 'TERM_COMMUNITYTAG', 10 ); define ( 'TERM_FORUM', 11 ); +define ( 'TERM_EMOJI', 12 ); define ( 'TERM_OBJ_POST', 1 ); define ( 'TERM_OBJ_PHOTO', 2 );