]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Text/BBCode.php
Restructure Cache to follow new paradigm
[friendica.git] / src / Content / Text / BBCode.php
index 696cc7d8c50de16c71978844d549c97ec092e4e9..da95c3d67338204aea087cb1f9fef0e9f02f277b 100644 (file)
@@ -1560,9 +1560,6 @@ class BBCode
                                        $text = self::convertAttachment($text, $simple_html, $try_oembed, [], $uriid);
                                }
 
-                               // Add HTML new lines
-                               $text = str_replace("\n", '<br>', $text);
-
                                $nosmile = strpos($text, '[nosmile]') !== false;
                                $text = str_replace('[nosmile]', '', $text);
 
@@ -1645,7 +1642,10 @@ class BBCode
                                // Check for list text
                                $text = str_replace("[*]", "<li>", $text);
 
-                               // Check for style sheet commands
+                               // Check for block-level custom CSS
+                               $text = preg_replace('#(?<=^|\n)\[style=(.*?)](.*?)\[/style](?:\n|$)#ism', '<div style="$1">$2</div>', $text);
+
+                               // Check for inline custom CSS
                                $text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism", '<span style="$1">$2</span>', $text);
 
                                // Mastodon Emoji (internal tag, do not document for users)
@@ -1654,6 +1654,8 @@ class BBCode
                                // Check for CSS classes
                                // @deprecated since 2021.12, left for backward-compatibility reasons
                                $text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '<span class="$1">$2</span>', $text);
+                               // Add HTML new lines
+                               $text = str_replace("\n", '<br>', $text);
 
                                // handle nested lists
                                $endlessloop = 0;