diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php index b6984af6..d8097738 100644 --- a/ext/bbcode/main.php +++ b/ext/bbcode/main.php @@ -3,6 +3,10 @@ class BBCode extends FormatterExtension { public function format($text) { $text = wordwrap($text, 80, " ", true); + $text = preg_replace_callback("/(\[img\]https?:\/\/.*?\[\/img\])/s", array($this, "unwrap"), $text); + $text = preg_replace_callback("/(\[url=(?:https?|ftp|irc|mailto):\/\/.*?\])/s", array($this, "unwrap"), $text); + $text = preg_replace_callback("/(\[url\](?:https?|ftp|irc|mailto):\/\/.*?\[\/url\])/s", array($this, "unwrap"), $text); + $text = $this->extract_code($text); $text = preg_replace("/\[b\](.*?)\[\/b\]/s", "\\1", $text); $text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text); @@ -12,6 +16,7 @@ class BBCode extends FormatterExtension { $text = preg_replace("/>>([^\d].+)/", "
\\1", $text); $text = preg_replace("/\[url=((?:https?|ftp|irc|mailto):\/\/.*?)\](.*?)\[\/url\]/s", "\\2", $text); $text = preg_replace("/\[url\]((?:https?|ftp|irc|mailto):\/\/.*?)\[\/url\]/s", "\\1", $text); + $text = preg_replace("/\[img\](https?:\/\/.*?)\[\/img\]/s", "