]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Remove the old hashtag functions, change it to the new functionality.
[friendica.git] / include / items.php
index faeea1eafeaeeb12a9806921c4a76d0638df57fa..e56b17aec2b2bf20cf63ee419b63909bffabc19c 100644 (file)
@@ -1610,7 +1610,16 @@ function item_body_set_hashtags(&$item) {
                        continue;
 
                $basetag = str_replace('_',' ',substr($tag,1));
-               $item["body"] = str_replace($tag,'#[url='.$a->get_baseurl().'/search?tag='.rawurlencode($basetag).']'.$basetag.'[/url]', $item["body"]);
+
+               $newtag = '#[url='.$a->get_baseurl().'/search?tag='.rawurlencode($basetag).']'.$basetag.'[/url]';
+
+               $item["body"] = str_replace($tag, $newtag, $item["body"]);
+
+               if(!stristr($item["tag"],"/search?tag=".$basetag."]".$basetag."[/url]")) {
+                       if(strlen($item["tag"]))
+                               $item["tag"] = ','.$item["tag"];
+                       $item["tag"] = $newtag.$item["tag"];
+               }
        }
 
        // Convert back the masked hashtags