]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Text/BBCode.php
Merge pull request #6580 from MrPetovan/bug/6575-escaped-field-input-attributes
[friendica.git] / src / Content / Text / BBCode.php
index 2c2054750c5f0d06fb631b66d0ee65fe97ac034c..a8b5ec2025546e7ffa0e694597d2f38524ccd8b1 100644 (file)
@@ -1178,7 +1178,7 @@ class BBCode extends BaseObject
                // Extracting multi-line code blocks before the whitespace processing
                $codeblocks = [];
 
-               $text = preg_replace_callback("#\[code(?:=([^\]]*))?\](.*?)\[\/code\]#is",
+               $text = preg_replace_callback("#\[code(?:=([^\]]*))?\](.*?)\[\/code\]#ism",
                        function ($matches) use (&$codeblocks) {
                                $return = $matches[0];
                                if (strpos($matches[2], "\n") !== false) {
@@ -1293,7 +1293,7 @@ class BBCode extends BaseObject
                                $text);
                } elseif ($simple_html == 7) {
                        $text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
-                               '$1<span class="vcard"><a href="$2" class="url" title="$3"><span class="fn nickname mention">$3</span></a></span>',
+                               '$1<span class="vcard"><a href="$2" class="url u-url mention" title="$3"><span class="fn nickname mention">$3</span></a></span>',
                                $text);
                } elseif (!$simple_html) {
                        $text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
@@ -1743,7 +1743,7 @@ class BBCode extends BaseObject
 
                // Clean up the HTML by loading and saving the HTML with the DOM.
                // Bad structured html can break a whole page.
-               // For performance reasons do it only with ativated item cache or at export.
+               // For performance reasons do it only with activated item cache or at export.
                if (!$try_oembed || (get_itemcachepath() != "")) {
                        $doc = new DOMDocument();
                        $doc->preserveWhiteSpace = false;
@@ -1959,7 +1959,7 @@ class BBCode extends BaseObject
         $string = preg_replace('/#\[url\=([^\[\]]*)\](.*?)\[\/url\]/ism', '#$2', $string);
 
         // ignore anything in a code block
-        $string = preg_replace('/\[code\](.*?)\[\/code\]/sm', '', $string);
+        $string = preg_replace('/\[code.*?\].*?\[\/code\]/sm', '', $string);
 
         // Force line feeds at bbtags
         $string = str_replace(['[', ']'], ["\n[", "]\n"], $string);