From 8a84718163456efca2e7da151f01698c3d049607 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Jun 2014 22:46:17 -0700 Subject: 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. --- include/text.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/text.php') 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 .= '@' . $term . ''; + } + } + 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']) -- cgit v1.2.3