From a811504a143d3f89c276bb2a8128e96af21bd1e3 Mon Sep 17 00:00:00 2001 From: shish Date: Mon, 10 Dec 2007 08:51:54 +0000 Subject: [PATCH] block quotes, arrow quotes, h1-4, ul, ol, li git-svn-id: file:///home/shish/svn/shimmie2/trunk@654 7f39781d-f577-437e-ae19-be835c7a54ca --- ext/bbcode/main.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php index 328dc7b7..811adeb8 100644 --- a/ext/bbcode/main.php +++ b/ext/bbcode/main.php @@ -15,13 +15,21 @@ class BBCode extends Extension { $text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text); $text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text); $text = preg_replace("/\[code\](.*?)\[\/code\]/s", "
\\1
", $text); - $text = preg_replace("/>>(\d+)/s", - ">>\\1", $text); + $text = preg_replace("/>>(\d+)/s", ">>\\1", $text); + $text = preg_replace("/>>([^\d].+)/", "
\\1
", $text); $text = preg_replace("/\[url=((?:https?|ftp|irc):\/\/.*?)\](.*?)\[\/url\]/s", "\\2", $text); $text = preg_replace("/\[url\]((?:https?|ftp|irc):\/\/.*?)\[\/url\]/s", "\\1", $text); - $text = preg_replace("/\[\[(.*?)\]\]/s", - "\\1", $text); + $text = preg_replace("/\[\[(.*?)\]\]/s", "\\1", $text); $text = str_replace("\n", "\n
", $text); + $text = preg_replace("/\[quote\](.*?)\[\/quote\]/s", "
\\1
", $text); + $text = preg_replace("/\[quote=(.*?)\](.*?)\[\/quote\]/s", "Quoting \\1
\\2
", $text); + $text = preg_replace("/\[h1\](.*?)\[\/h1\]/s", "

\\1

", $text); + $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("/\[ul\](.*?)\[\/ul\]/s", "", $text); + $text = preg_replace("/\[ol\](.*?)\[\/ol\]/s", "
    \\1
", $text); + $text = preg_replace("/\[li\](.*?)\[\/li\]/s", "
  • \\1
  • ", $text); return $text; } @@ -35,6 +43,15 @@ class BBCode extends Extension { $text = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/s", "\\2", $text); $text = preg_replace("/\[url\](.*?)\[\/url\]/s", "\\1", $text); $text = preg_replace("/\[\[(.*?)\]\]/s", "\\1", $text); + $text = preg_replace("/\[quote\](.*?)\[\/quote\]/s", "", $text); + $text = preg_replace("/\[quote=(.*?)\](.*?)\[\/quote\]/s", "", $text); + $text = preg_replace("/\[h1\](.*?)\[\/h1\]/s", "\\1", $text); + $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("/\[ul\](.*?)\[\/ul\]/s", "\\1", $text); + $text = preg_replace("/\[ol\](.*?)\[\/ol\]/s", "\\1", $text); + $text = preg_replace("/\[li\](.*?)\[\/li\]/s", "\\1", $text); return $text; } }