BBcode, Tags - changes for #pullrequestreview-197771905

This commit is contained in:
Peter Liebetrau 2019-01-29 22:34:28 +01:00
parent 5080778ea6
commit c3e5c77eb3

View file

@ -2441,12 +2441,11 @@ class Item extends BaseObject
"#$2", $item["body"]); "#$2", $item["body"]);
foreach ($tags as $tag) { foreach ($tags as $tag) {
if ((strpos($tag, '#') !== 0) || strpos($tag, '[url=')) { if ((strpos($tag, '#') !== 0) || strpos($tag, '[url=') || $tag[1] == '#') {
continue; continue;
} }
$basetag = str_replace('_',' ',substr($tag,1)); $basetag = str_replace('_',' ',substr($tag,1));
if($basetag[0] != '#') {
$newtag = '#[url=' . System::baseUrl() . '/search?tag=' . $basetag . ']' . $basetag . '[/url]'; $newtag = '#[url=' . System::baseUrl() . '/search?tag=' . $basetag . ']' . $basetag . '[/url]';
$item["body"] = str_replace($tag, $newtag, $item["body"]); $item["body"] = str_replace($tag, $newtag, $item["body"]);
@ -2458,7 +2457,6 @@ class Item extends BaseObject
$item["tag"] = $newtag . $item["tag"]; $item["tag"] = $newtag . $item["tag"];
} }
} }
}
// Convert back the masked hashtags // Convert back the masked hashtags
$item["body"] = str_replace("#", "#", $item["body"]); $item["body"] = str_replace("#", "#", $item["body"]);