diff options
Diffstat (limited to 'include')
-rwxr-xr-x | include/text.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php index b5b8ec41a..6d6284ab2 100755 --- a/include/text.php +++ b/include/text.php @@ -1237,6 +1237,27 @@ function format_hashtags(&$item) { +function format_mentions(&$item) { + + $s = ''; + $terms = get_terms_oftype($item['term'],TERM_MENTION); + if($terms) { + $categories = array(); + foreach($terms as $t) { + $term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8',false) ; + if(! trim($term)) + continue; + if(strpos($item['body'], $t['url'])) + continue; + + if($s) + $s .= ' '; + + $s .= '@<a href="' . zid($t['url']) . '" >' . $term . '</a>'; + } + } + return $s; +} function format_filer(&$item) { @@ -1293,6 +1314,10 @@ function prepare_body(&$item,$attach = false) { $s .= format_hashtags($item); + if($item['resource_type']) + $s .= format_mentions($item); + + $s .= format_categories($item,$writeable); if(local_user() == $item['uid']) |