* @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2011 Yii Software LLC * @license http://www.yiiframework.com/license/ */ if(!class_exists('HTMLPurifier_Bootstrap',false)) { require_once(Yii::getPathOfAlias('system.vendors.htmlpurifier').DIRECTORY_SEPARATOR.'HTMLPurifier.standalone.php'); HTMLPurifier_Bootstrap::registerAutoload(); } /** * CHtmlPurifier is wrapper of {@link http://htmlpurifier.org HTML Purifier}. * * CHtmlPurifier removes all malicious code (better known as XSS) with a thoroughly audited, * secure yet permissive whitelist. It will also make sure the resulting code * is standard-compliant. * * CHtmlPurifier can be used as either a widget or a controller filter. * * Note: since HTML Purifier is a big package, its performance is not very good. * You should consider either caching the purification result or purifying the user input * before saving to database. * * Usage as a class: *
* $p = new CHtmlPurifier(); * $p->options = array('URI.AllowedSchemes'=>array( * 'http' => true, * 'https' => true, * )); * $text = $p->purify($text); ** * Usage as validation rule: *
* array('text','filter','filter'=>array($obj=new CHtmlPurifier(),'purify')), ** * @author Qiang Xue