Merged revisions 56631 via svnmerge from

svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2.2

........
  r56631 | sminnee | 2008-06-20 12:45:34 +1200 (Fri, 20 Jun 2008) | 1 line
  
  Improved BBCode parser
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56913 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2008-06-25 04:03:06 +00:00
parent 4d616597ad
commit 5da717ed1d
2 changed files with 6 additions and 4 deletions

View File

@ -107,10 +107,10 @@ class BBCodeParser extends TextParser {
$this->content = str_replace(array('&', '<', '>'), array('&amp;', '&lt;', '&gt;'), $this->content);
$this->content = SSHTMLBBCodeParser::staticQparse($this->content);
$this->content = "<p>".$this->content."</p>";
$this->content = preg_replace("/([^>\s]\s*)\n\n/", '$1</p><p>', $this->content);
$this->content = preg_replace("/([^>\s]\s*)\n/", '$1<br />', $this->content);
$this->content = preg_replace("/\n\s*\n/", "</p><p>", $this->content);
$this->content = str_replace("\n", "<br />", $this->content);
return $this->content;
}
}
?>
?>

View File

@ -102,7 +102,9 @@ class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter
function _preparse() {
$this->_preparsed = str_replace("\t", "&nbsp;&nbsp;&nbsp;", $this->_text);
$this->_preparsed = preg_replace("/(\[php\])\s*/", '$1', $this->_preparsed);
$this->_preparsed = preg_replace("/\s*(\[\/php\])\s/", '$1', $this->_preparsed);
}
}
?>
?>