diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php index 98a8c779..4030d216 100644 --- a/ext/bbcode/main.php +++ b/ext/bbcode/main.php @@ -28,9 +28,12 @@ class BBCode implements Extension { $text = preg_replace("/\[h2\](.*?)\[\/h2\]/s", "

\\1

", $text); $text = preg_replace("/\[h3\](.*?)\[\/h3\]/s", "

\\1

", $text); $text = preg_replace("/\[h4\](.*?)\[\/h4\]/s", "

\\1

", $text); - $text = preg_replace("/\[list\](.*?)\[\/list\]/s", "", $text); - $text = preg_replace("/\[ul\](.*?)\[\/ul\]/s", "", $text); - $text = preg_replace("/\[ol\](.*?)\[\/ol\]/s", "
    \\1
", $text); + while(preg_match("/\[list\](.*?)\[\/list\]/s", $text)) + $text = preg_replace("/\[list\](.*?)\[\/list\]/s", "", $text); + while(preg_match("/\[ul\](.*?)\[\/ul\]/s", $text)) + $text = preg_replace("/\[ul\](.*?)\[\/ul\]/s", "", $text); + while(preg_match("/\[ol\](.*?)\[\/ol\]/s", $text)) + $text = preg_replace("/\[ol\](.*?)\[\/ol\]/s", "
    \\1
", $text); $text = preg_replace("/\[li\](.*?)\[\/li\]/s", "
  • \\1
  • ", $text); $text = preg_replace("#\[\*\]#s", "
  • ", $text); $text = preg_replace("#
    <(li|ul|ol|/ul|/ol)>#s", "<\\1>", $text); @@ -55,9 +58,7 @@ class BBCode implements Extension { $text = preg_replace("/\[h2\](.*?)\[\/h2\]/s", "\\1", $text); $text = preg_replace("/\[h3\](.*?)\[\/h3\]/s", "\\1", $text); $text = preg_replace("/\[h4\](.*?)\[\/h4\]/s", "\\1", $text); - $text = preg_replace("/\[list\](.*?)\[\/list\]/s", "\\1", $text); - $text = preg_replace("/\[ul\](.*?)\[\/ul\]/s", "\\1", $text); - $text = preg_replace("/\[ol\](.*?)\[\/ol\]/s", "\\1", $text); + $text = preg_replace("/\[\/?(list|ul|ol)\]/", "", $text); $text = preg_replace("/\[li\](.*?)\[\/li\]/s", "\\1", $text); $text = preg_replace("/\[\*\](.*?)/s", "\\1", $text); $text = $this->strip_spoiler($text);