mask '#' in [url] url

fix #1514
This commit is contained in:
fabrixxm 2015-06-02 18:59:46 +02:00
parent 620455c4de
commit 20b14b053a

View file

@ -1697,12 +1697,12 @@ function item_body_set_hashtags(&$item) {
// mask hashtags inside of url, bookmarks and attachments to avoid urls in urls // mask hashtags inside of url, bookmarks and attachments to avoid urls in urls
$item["body"] = preg_replace_callback("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $item["body"] = preg_replace_callback("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
function ($match){ function ($match){
return("[url=".$match[1]."]".str_replace("#", "#", $match[2])."[/url]"); return("[url=".str_replace("#", "#", $match[1])."]".str_replace("#", "#", $match[2])."[/url]");
},$item["body"]); },$item["body"]);
$item["body"] = preg_replace_callback("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism", $item["body"] = preg_replace_callback("/\[bookmark\=([$URLSearchString]*)\](.*?)\[\/bookmark\]/ism",
function ($match){ function ($match){
return("[bookmark=".$match[1]."]".str_replace("#", "#", $match[2])."[/bookmark]"); return("[bookmark=".str_replace("#", "#", $match[1])."]".str_replace("#", "#", $match[2])."[/bookmark]");
},$item["body"]); },$item["body"]);
$item["body"] = preg_replace_callback("/\[attachment (.*)\](.*?)\[\/attachment\]/ism", $item["body"] = preg_replace_callback("/\[attachment (.*)\](.*?)\[\/attachment\]/ism",
@ -1714,6 +1714,7 @@ function item_body_set_hashtags(&$item) {
$item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
"#$2", $item["body"]); "#$2", $item["body"]);
foreach($tags as $tag) { foreach($tags as $tag) {
if(strpos($tag,'#') !== 0) if(strpos($tag,'#') !== 0)
continue; continue;