diff --git a/code/sitefeatures/PageComment.php b/code/sitefeatures/PageComment.php index 330b6dc1..170dae09 100755 --- a/code/sitefeatures/PageComment.php +++ b/code/sitefeatures/PageComment.php @@ -21,6 +21,8 @@ class PageComment extends DataObject { static $moderate = false; + static $bbcode = false; + /** * Return a link to this comment * @return string link to this comment. @@ -28,7 +30,11 @@ class PageComment extends DataObject { function Link() { return $this->Parent()->Link() . '#PageComment_'. $this->ID; } - + + function ParsedBBCode(){ + $parser = new BBCodeParser($this->Comment); + return $parser->parse(); + } function DeleteLink() { if(Permission::check('CMS_ACCESS_CMSMain')) { @@ -185,6 +191,15 @@ class PageComment extends DataObject { static function moderationEnabled() { return self::$moderate; } + + static function enableBBCode() { + self::$bbcode = true; + } + + static function bbCodeEnabled() { + return self::$bbcode; + } + } ?> \ No newline at end of file diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index 78c26540..a6d339bf 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -127,7 +127,6 @@ class PageCommentInterface_Form extends Form { $this->saveInto($comment); $comment->IsSpam = false; $comment->NeedsModeration = PageComment::moderationEnabled(); - $comment->write(); if(Director::is_ajax()) { diff --git a/templates/PageCommentInterface_singlecomment.ss b/templates/PageCommentInterface_singlecomment.ss index 52bc28d4..ad923ec4 100755 --- a/templates/PageCommentInterface_singlecomment.ss +++ b/templates/PageCommentInterface_singlecomment.ss @@ -1,5 +1,9 @@

- $Comment.XML + <% if bbCodeEnabled %> + $ParsedBBCode + <% else %> + $Comment.XML + <% end_if %>

<% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago)