Class CHtmlPurifier
CHtmlPurifier is wrapper of 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')),
- CComponent
- CBaseController
- CWidget
- CFilterWidget implements IFilter
- COutputProcessor
- CHtmlPurifier
Package: system\web\widgets
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/widgets/CHtmlPurifier.php
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/widgets/CHtmlPurifier.php
public
|
#
processOutput( string $output )
Processes the captured output. This method purifies the output using HTML Purifier. |
public
mixed
|
|
public
static
|
#
setOptions( mixed $options )
Set the options for HTML Purifier and create a new HTML Purifier instance based on these options. |
public
mixed
|
|
protected
|
|
protected
|
init(),
onProcessOutput(),
run()
|
__construct(),
filter(),
getIsFilter()
|
actions(),
getController(),
getId(),
getOwner(),
getViewFile(),
getViewPath(),
render(),
setId()
|
beginCache(),
beginClip(),
beginContent(),
beginWidget(),
createWidget(),
endCache(),
endClip(),
endContent(),
endWidget(),
renderFile(),
renderInternal(),
widget()
|
$stopAction
|
$actionPrefix,
$skin
|
$isFilter
|
$controller,
$id,
$owner,
$viewPath
|