BBCode - added preg_replacers for local [url] without target="_blank"
This commit is contained in:
parent
2b0610eaf5
commit
ae806a593d
|
@ -1361,6 +1361,15 @@ class BBCode extends BaseObject
|
||||||
. '</a>';
|
. '</a>';
|
||||||
}, $text);
|
}, $text);
|
||||||
|
|
||||||
|
// We need no target="_blank" for local links
|
||||||
|
// convert links start with System::baseUrl() as local link
|
||||||
|
$escapedBaseUrl = str_replace('://', '\:\/\/', System::baseUrl());
|
||||||
|
$text = preg_replace("/\[url\]($escapedBaseUrl)([$URLSearchString]*)\[\/url\]/ism", '<a href="$1$2">$1$2</a>', $text);
|
||||||
|
$text = preg_replace("/\[url\=($escapedBaseUrl)([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1$2">$3</a>', $text);
|
||||||
|
// convert links that start with / as local link
|
||||||
|
$text = preg_replace("/\[url\](\/[$URLSearchString]*)\[\/url\]/ism", '<a href="'.System::baseUrl().'$1">$1</a>', $text);
|
||||||
|
$text = preg_replace("/\[url\=(\/[$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="'.System::baseUrl().'$1">$2</a>', $text);
|
||||||
|
|
||||||
$text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$1</a>', $text);
|
$text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$1</a>', $text);
|
||||||
$text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $text);
|
$text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $text);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user