Merged revisions 54619 via svnmerge from

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

........
  r54619 | sminnee | 2008-05-15 15:00:15 +1200 (Thu, 15 May 2008) | 1 line
  
  Fixed php/code snippets in forum posts
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56907 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2008-06-25 03:59:11 +00:00
parent 172bf71ead
commit b0c209a15d
2 changed files with 13 additions and 6 deletions

View File

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

View File

@ -65,8 +65,12 @@ class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter
'htmlclose' => 'q',
'allowed' => 'all',
'attributes'=> array('quote' =>'cite=%2$s%1$s%2$s')),
'code' => array('htmlopen' => 'pre',
'htmlclose' => 'pre',
'code' => array('htmlopen' => 'div class="codesnippet"',
'htmlclose' => 'div',
'allowed' => 'all',
'attributes' => array()),
'php' => array('htmlopen' => 'div class="codesnippet"',
'htmlclose' => 'div',
'allowed' => 'all',
'attributes' => array()),
'h1' => array('htmlopen' => 'h1',
@ -96,7 +100,9 @@ class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter
);
function _preparse() {
$this->_preparsed = str_replace("\t", "&nbsp;&nbsp;&nbsp;", $this->_text);
}
}
?>