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

index b436fb20ecf45fd62b680802f564427d274c2eda..24118ef57750f17bede2624ecf2b86c7c4ae01f0 100644 (file)
@@ -1364,8 +1364,8 @@ 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 = 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);             
+               $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);