CHtmlPurifier options

Hi I want to use ChtmlPurifier but it gives me error like "CHtmlPurifier does not have a method named "options"

CHtmlPurifier does not have a method named "options". My codes are below. Is there any example to use CHtmlPurifier or any help to fix my codes apporiciated

Thanks

Hi,

CHtmlPurifier is a widget. Here you have example: http://www.yiiframew…4.html#msg12444

I think I can use CHtmlPurifier as a object class as well and create object and call options and purify functions can't I?

http://www.yiiframew…56.html#msg1649

Hi,

options is property. You should write:

$p->options = array('URI.AllowedSchemes'=>array('http' => true,

  'https' => true,

  'mailto' => true,

  'ftp' => true,

  'nntp' => true,

  'news' => true,

  )

);

Even if I change that it gives me error saying that

preg_match() expects parameter 2 to be string, array given

very simple if I want to deny customer to enter script tag into textfield and my codes are below

It gives me same error. Any idea?

Thanks

Hi,

purify method get string parameter. So, if you want to parse textfield`s content you can try:

$site->content=$p->purify($_POST['Site']['content']);

where 'content' is your attribute of model.

If you will parse all attributes you have to use foreach loop.

Thanks