diff options
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/include/text.php b/include/text.php index 52a6440cb..9ac6efdc2 100644 --- a/include/text.php +++ b/include/text.php @@ -1425,11 +1425,10 @@ function smilies($s, $sample = false, $terms = []) { || (local_channel() && intval(get_pconfig(local_channel(), 'system', 'no_smilies')))) return $s; - $s = preg_replace_callback('{<(pre|code)>.*?</\1>}ism', 'smile_shield', $s); + $s = preg_replace_callback('/<(pre|code)\b[^>]*>.*?<\/(pre|code)>/ism', 'smile_shield', $s); $s = preg_replace_callback('/<[a-z]+ .*?>/ism', 'smile_shield', $s); if (preg_match_all('/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/', $s, $match)) { - // emoji shortcodes $emojis = get_emojis(); foreach ($match[0] as $mtch) { @@ -1447,7 +1446,7 @@ function smilies($s, $sample = false, $terms = []) { } } - if (!$emoji) { + if (!$emoji || empty($emoji['filepath'])) { continue; } @@ -1611,7 +1610,7 @@ function theme_attachments(&$item) { $url = z_root() . '/magic?owa=1&bdest=' . bin2hex($r['href']); } - if (isset($label) && isset($url) && isset($icon) && isset($title)) { + if (isset($label, $url, $icon, $title)) { array_unshift($attaches, ['label' => $label, 'url' => $url, 'icon' => $icon, 'title' => $title]); } } @@ -2188,7 +2187,7 @@ function get_plink($item,$conversation_mode = true) { if(array_key_exists('author',$item) && $item['author']['xchan_network'] !== 'zot6') $zidify = false; - if(x($item,$key)) { + if(!empty($item[$key])) { return array( 'href' => (($zidify) ? zid($item[$key]) : $item[$key]), 'title' => t('Link to Source'), @@ -2381,17 +2380,19 @@ function item_post_type($item) { $post_type = t('event'); break; default: - $post_type = t('post'); + $post_type = t('conversation'); if($item['mid'] != $item['parent_mid']) - $post_type = t('comment'); + $post_type = t('message'); break; } - if(strlen($item['verb']) && (! activity_match($item['verb'],ACTIVITY_POST))) + if(strlen($item['verb']) && (!activity_match($item['verb'], ['Create', ACTIVITY_POST]))) { $post_type = t('activity'); + } - if($item['obj_type'] === 'Question') + if($item['obj_type'] === 'Question') { $post_type = t('poll'); + } return $post_type; } @@ -2652,7 +2653,7 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0) { $arr[] = "'" . dbesc($item['owner_xchan']) . "'"; if($item['author_xchan'] && (! in_array("'" . dbesc($item['author_xchan']) . "'",$arr))) $arr[] = "'" . dbesc($item['author_xchan']) . "'"; - if($item['source_xchan'] && (! in_array("'" . dbesc($item['source_xchan']) . "'",$arr))) + if(!empty($item['source_xchan']) && (! in_array("'" . dbesc($item['source_xchan']) . "'",$arr))) $arr[] = "'" . dbesc($item['source_xchan']) . "'"; } } @@ -2677,7 +2678,9 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0) { for($x = 0; $x < count($items); $x ++) { $items[$x]['owner'] = find_xchan_in_array($items[$x]['owner_xchan'],$chans); $items[$x]['author'] = find_xchan_in_array($items[$x]['author_xchan'],$chans); - $items[$x]['source'] = find_xchan_in_array($items[$x]['source_xchan'],$chans); + if (!empty($items[$x]['source_xchan'])) { + $items[$x]['source'] = find_xchan_in_array($items[$x]['source_xchan'],$chans); + } } } } @@ -3232,6 +3235,7 @@ function getIconFromType($type) { 'text/markdown' => 'bi-filetype-md', 'text/bbcode' => 'bi-file-earmark-text', 'text/html' => 'bi-filetype-html', + 'text/uri-list' => 'bi-box-arrow-up-right', 'application/msword' => 'bi-file-earmark-word', 'application/pdf' => 'bi-file-earmark-pdf', 'application/vnd.oasis.opendocument.text' => 'bifile--earmark-text', |