]> git.mxchange.org Git - friendica.git/commitdiff
Apply suggestions from code review
authorMichael Vogel <icarus@dabo.de>
Mon, 5 Oct 2020 15:40:06 +0000 (17:40 +0200)
committerGitHub <noreply@github.com>
Mon, 5 Oct 2020 15:40:06 +0000 (17:40 +0200)
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
src/Content/Text/BBCode.php

index 1b0fa9c7402ee33a0f908a1b39d92b8cbb78b1a4..94b1c35d1b67b3c8465c44d03ada8fb87fc5b1c9 100644 (file)
@@ -1222,14 +1222,11 @@ class BBCode
 
        public static function removeLinks(string $bbcode)
        {
-               $bbcode = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", ' ', $bbcode);
                $bbcode = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/ism", ' $1 ', $bbcode);
-               $bbcode = preg_replace("/\[img\](.*?)\[\/img\]/ism", ' ', $bbcode);
+               $bbcode = preg_replace("/\[img.*?\[\/img\]/ism", ' ', $bbcode);
 
-               $bbcode = preg_replace('/([@!#])\[url\=(.*?)\](.*?)\[\/url\]/ism', '', $bbcode);
-               $bbcode = preg_replace("/\[url\](.*?)\[\/url\]/ism", ' ', $bbcode);
                $bbcode = preg_replace("/\[url=[^\[\]]*\](.*)\[\/url\]/Usi", ' $1 ', $bbcode);
-               $bbcode = preg_replace("/\[url\](.*?)\[\/url\]/ism", ' ', $bbcode);
+               $bbcode = preg_replace('/[@!#]?\[url.*?\[\/url\]/ism', '', $bbcode);
                return $bbcode;
        }