port fixes from zap to check for arrays
(cherry picked from commit 7cc8c2d127b09b7e53c7916c6ea104fa566971db)
This commit is contained in:
parent
64c6e25896
commit
b359b89aa1
@ -401,14 +401,18 @@ class Activity {
|
|||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
|
|
||||||
if($item['tag']) {
|
if ($item['tag'] && is_array($item['tag'])) {
|
||||||
foreach($item['tag'] as $t) {
|
$ptr = $item['tag'];
|
||||||
|
if (! array_key_exists(0,$ptr)) {
|
||||||
|
$ptr = [ $ptr ];
|
||||||
|
}
|
||||||
|
foreach ($ptr as $t) {
|
||||||
if (! array_key_exists('type',$t))
|
if (! array_key_exists('type',$t))
|
||||||
$t['type'] = 'Hashtag';
|
$t['type'] = 'Hashtag';
|
||||||
|
|
||||||
switch($t['type']) {
|
switch($t['type']) {
|
||||||
case 'Hashtag':
|
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;
|
break;
|
||||||
|
|
||||||
case 'Mention':
|
case 'Mention':
|
||||||
@ -431,6 +435,7 @@ class Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static function encode_taxonomy($item) {
|
static function encode_taxonomy($item) {
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
|
Reference in New Issue
Block a user