I am trying to use the HTMLPurifier class in my model in the beforeSave() method but the thing is that when I use $purify = new HTMLPurifier, it says that Yii cannot include HTMLPurifier.php.
Where do I put the reference to the file?
I am trying to use the HTMLPurifier class in my model in the beforeSave() method but the thing is that when I use $purify = new HTMLPurifier, it says that Yii cannot include HTMLPurifier.php.
Where do I put the reference to the file?
Yii offers a wrapper: CHtmlPurifier
That is what I am trying to use. Following is the code so far-
public function beforeSave()
{
// Purify the HTML
$purify = new HTMLPurifier;
$this->content = $purify->purify($this->content);
die("Content: \n" . $this->content);
return true;
}
When I initiate the class, it says that it cannot find it whereas it is already included in Yii. What do I do?
EDIT: I had to use new CHtmlPurifier
That’s what I said. Hope everything works for you now.