diff options
author | friendica <info@friendica.com> | 2014-06-30 22:46:17 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-06-30 22:46:17 -0700 |
commit | 8a84718163456efca2e7da151f01698c3d049607 (patch) | |
tree | 2b79736f338d15cdcb284683f0dd34cacdd1f847 /include/text.php | |
parent | 96ab09a267759327051b99ab595b40dd6c6a559f (diff) | |
download | volse-hubzilla-8a84718163456efca2e7da151f01698c3d049607.tar.gz volse-hubzilla-8a84718163456efca2e7da151f01698c3d049607.tar.bz2 volse-hubzilla-8a84718163456efca2e7da151f01698c3d049607.zip |
for non-post items (e.g. photos, events, whatever) add mention tags explicitly to the output rendering since they may not be present in the post body.
Diffstat (limited to 'include/text.php')
-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']) |