mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
git-svn-id: file:///svn/phpbb/trunk@6804 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
ae1cb0316e
commit
f0129b6f27
1 changed files with 3 additions and 6 deletions
|
@ -84,15 +84,12 @@ class bbcode_firstpass extends bbcode
|
|||
function prepare_bbcodes()
|
||||
{
|
||||
// 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);
|
||||
|
||||
// We strip newlines and spaces after and before quotes in quotes (trimming)
|
||||
$this->message = preg_replace(array('#\[quote(=".*?")?\]([\s|\n]+)#ius', '#([\s|\n]+)\[\/quote\]#ius'), array("[quote\\1]", "[/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);
|
||||
// We strip newlines and spaces after and before quotes in quotes (trimming) and then add exactly one newline
|
||||
$this->message = preg_replace('#\[quote(=".*?")?\]\s*(.*?)\s*\[/quote\]#siu', '[quote\1]' . "\n" . '\2' ."\n[/quote]", $this->message);
|
||||
}
|
||||
|
||||
// Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...)
|
||||
|
|
Loading…
Add table
Reference in a new issue