aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-04 11:14:44 +0000
committerMario <mario@mariovavti.com>2019-11-04 13:03:00 +0100
commitb359b89aa1f528002e19b46fffc105715dd731c8 (patch)
tree427652e1eda8788bda30bc0947e465380b226a1c /Zotlabs
parent64c6e25896bc5b8f899abdad4e52a9fe6c88a66c (diff)
downloadvolse-hubzilla-b359b89aa1f528002e19b46fffc105715dd731c8.tar.gz
volse-hubzilla-b359b89aa1f528002e19b46fffc105715dd731c8.tar.bz2
volse-hubzilla-b359b89aa1f528002e19b46fffc105715dd731c8.zip
port fixes from zap to check for arrays
(cherry picked from commit 7cc8c2d127b09b7e53c7916c6ea104fa566971db)
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Activity.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 844127ee3..a2e30e72b 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 = [];