]> git.mxchange.org Git - friendica.git/commitdiff
BBCode - optimized preg escaping of searchstring
authorPeter Liebetrau <peter.liebetrau@gmail.com>
Fri, 25 Jan 2019 15:56:28 +0000 (16:56 +0100)
committerPeter Liebetrau <peter.liebetrau@gmail.com>
Fri, 25 Jan 2019 15:56:28 +0000 (16:56 +0100)
src/Content/Text/BBCode.php

index 0818e28b1ae0c3350d507712a9656dbd73470761..b436fb20ecf45fd62b680802f564427d274c2eda 100644 (file)
@@ -1363,7 +1363,7 @@ class BBCode extends BaseObject
 
                // We need no target="_blank" for local links
                // convert links start with System::baseUrl() as local link without the target="_blank" attribute
-               $escapedBaseUrl = str_replace('://', '\:\/\/', System::baseUrl());
+               $escapedBaseUrl = preg_quote(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);