aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-31 17:03:07 -0700
committerfriendica <info@friendica.com>2014-03-31 17:03:07 -0700
commit93f90040a12cdf7ba70d16773b36a29afa5ad83a (patch)
tree7b84c3388d1591dcf0964da8becaad8d71f83f21 /include/text.php
parent03c53502cb7770d9994776d9a2818c4621befb66 (diff)
downloadvolse-hubzilla-93f90040a12cdf7ba70d16773b36a29afa5ad83a.tar.gz
volse-hubzilla-93f90040a12cdf7ba70d16773b36a29afa5ad83a.tar.bz2
volse-hubzilla-93f90040a12cdf7ba70d16773b36a29afa5ad83a.zip
community tags don't show up in the tagged posts because we removed the displayed list of hashtags at the bottom (which are usually redundant since hashtags are usually present in the message text). This brings them back, but only for tags which aren't currently present in the message body (e.g. community tags)
Diffstat (limited to 'include/text.php')
-rwxr-xr-xinclude/text.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index d549f206e..95e59c54c 100755
--- a/include/text.php
+++ b/include/text.php
@@ -1190,6 +1190,33 @@ function format_categories(&$item,$writeable) {
return $s;
}
+// Add any hashtags which weren't mentioned in the message body, e.g. community tags
+
+function format_hashtags(&$item) {
+
+ $s = '';
+ $terms = get_terms_oftype($item['term'],TERM_HASHTAG);
+ 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 .= '&nbsp';
+
+ $s .= '#<a href="' . zid($t['url']) . '" >' . $term . '</a>';
+ }
+ }
+ return $s;
+}
+
+
+
+
function format_filer(&$item) {
@@ -1242,6 +1269,9 @@ function prepare_body(&$item,$attach = false) {
$writeable = ((get_observer_hash() == $item['owner_xchan']) ? true : false);
+
+ $s .= format_hashtags($item);
+
$s .= format_categories($item,$writeable);
if(local_user() == $item['uid'])