diff --git a/code/model/Comment.php b/code/model/Comment.php index b79282b..2bfb0cf 100755 --- a/code/model/Comment.php +++ b/code/model/Comment.php @@ -649,8 +649,10 @@ class Comment extends DataObject */ public function purifyHtml($dirtyHtml) { - $purifier = $this->getHtmlPurifierService(); - return $purifier->purify($dirtyHtml); + if ($service = $this->getHtmlPurifierService()) { + return $service->purify($dirtyHtml); + } + return $dirtyHtml; } /** @@ -658,6 +660,10 @@ class Comment extends DataObject */ public function getHtmlPurifierService() { + if (!class_exists('HTMLPurifier_Config')) { + return null; + } + $config = HTMLPurifier_Config::createDefault(); $allowedElements = $this->getOption('html_allowed_elements'); $config->set('HTML.AllowedElements', $allowedElements);