diff options
author | M. Dent <dentm42@gmail.com> | 2019-11-06 04:13:57 +0100 |
---|---|---|
committer | M. Dent <dentm42@gmail.com> | 2019-11-06 04:13:57 +0100 |
commit | 2a05bd9ed691437faabbfe130dbaab3dad878367 (patch) | |
tree | cc14d856ad2d5a5bfae660ea82b8890430441e78 /Zotlabs/Lib/Activity.php | |
parent | b7db9944ec43aee8d72835e79730ad49c86a678a (diff) | |
parent | b359b89aa1f528002e19b46fffc105715dd731c8 (diff) | |
download | volse-hubzilla-2a05bd9ed691437faabbfe130dbaab3dad878367.tar.gz volse-hubzilla-2a05bd9ed691437faabbfe130dbaab3dad878367.tar.bz2 volse-hubzilla-2a05bd9ed691437faabbfe130dbaab3dad878367.zip |
Merge branch 'cherry-pick-7cc8c2d1' into 'dev'
port fixes from zap to check for arrays
See merge request hubzilla/core!1767
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 5bad73123..2014d68af 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -401,26 +401,30 @@ class Activity { $ret = []; - if($item['tag']) { - foreach($item['tag'] as $t) { - if(! array_key_exists('type',$t)) + if ($item['tag'] && is_array($item['tag'])) { + $ptr = $item['tag']; + if (! array_key_exists(0,$ptr)) { + $ptr = [ $ptr ]; + } + foreach ($ptr as $t) { + if (! array_key_exists('type',$t)) $t['type'] = 'Hashtag'; switch($t['type']) { case 'Hashtag': - $ret[] = [ 'ttype' => TERM_HASHTAG, 'url' => ((isset($t['href'])) ? $t['href'] : $t['id']), 'term' => escape_tags((substr($t['name'],0,1) === '#') ? substr($t['name'],1) : $t['name']) ]; + $ret[] = [ 'ttype' => TERM_HASHTAG, 'url' => $t['href'], 'term' => escape_tags((substr($t['name'],0,1) === '#') ? substr($t['name'],1) : $t['name']) ]; break; case 'Mention': $mention_type = substr($t['name'],0,1); - if($mention_type === '!') { + if ($mention_type === '!') { $ret[] = [ 'ttype' => TERM_FORUM, 'url' => $t['href'], 'term' => escape_tags(substr($t['name'],1)) ]; } else { $ret[] = [ 'ttype' => TERM_MENTION, 'url' => $t['href'], 'term' => escape_tags((substr($t['name'],0,1) === '@') ? substr($t['name'],1) : $t['name']) ]; } break; - + default: break; } @@ -431,6 +435,7 @@ class Activity { } + static function encode_taxonomy($item) { $ret = []; |