sforkowany z mirror/friendica
Merge pull request #6516 from Ixiter/develop
BBCode - added preg_replaces for local [url] links without target="_blank"2022.09-rc
commit
2d49b71a4c
|
@ -1361,6 +1361,12 @@ class BBCode extends BaseObject
|
|||
. '</a>';
|
||||
}, $text);
|
||||
|
||||
// We need no target="_blank" for local links
|
||||
// convert links start with System::baseUrl() as local link without the target="_blank" attribute
|
||||
$escapedBaseUrl = preg_quote(System::baseUrl(), '/');
|
||||
$text = preg_replace("/\[url\](".$escapedBaseUrl."[$URLSearchString]*)\[\/url\]/ism", '<a href="$1">$1</a>', $text);
|
||||
$text = preg_replace("/\[url\=(".$escapedBaseUrl."[$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$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">$2</a>', $text);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue