git-svn-id: file:///svn/phpbb/trunk@6804 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-12-24 14:28:01 +00:00
parent ae1cb0316e
commit f0129b6f27

View file

@ -84,15 +84,12 @@ class bbcode_firstpass extends bbcode
function prepare_bbcodes() function prepare_bbcodes()
{ {
// Add newline at the end and in front of each quote block to prevent parsing errors (urls, smilies, etc.) // Add newline at the end and in front of each quote block to prevent parsing errors (urls, smilies, etc.)
if (strpos($this->message, '[quote') !== false) if (strpos($this->message, '[quote') !== false && strpos($this->message, '[/quote]') !== false)
{ {
$this->message = str_replace("\r\n", "\n", $this->message); $this->message = str_replace("\r\n", "\n", $this->message);
// We strip newlines and spaces after and before quotes in quotes (trimming) // We strip newlines and spaces after and before quotes in quotes (trimming) and then add exactly one newline
$this->message = preg_replace(array('#\[quote(=".*?")?\]([\s|\n]+)#ius', '#([\s|\n]+)\[\/quote\]#ius'), array("[quote\\1]", "[/quote]"), $this->message); $this->message = preg_replace('#\[quote(=".*?")?\]\s*(.*?)\s*\[/quote\]#siu', '[quote\1]' . "\n" . '\2' ."\n[/quote]", $this->message);
// Now we add exactly one newline
$this->message = preg_replace(array('#\[quote(=".*?")?\]#is', '#\[\/quote\]#is'), array("[quote\\1]\n", "\n[/quote]"), $this->message);
} }
// Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...) // Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...)