Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionActiveForm
  • ActionActiveFormBase
  • CActiveForm
  • CalendarEventActiveForm
  • CallActiveForm
  • CClipWidget
  • CContentDecorator
  • CFilterWidget
  • CFlexWidget
  • CHtmlPurifier
  • CInputWidget
  • CMarkdown
  • CMaskedTextField
  • CMultiFileUpload
  • COutputCache
  • COutputProcessor
  • CStarRating
  • CTabView
  • CTextHighlighter
  • CTreeView
  • CWidget
  • EventActiveForm
  • MobileActiveForm
  • NoteActiveForm
  • TimeActiveForm
  • X2ActiveForm
  • X2StarRating
  • Overview
  • Package
  • Class
  • Tree

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
Extended by CBaseController
Extended by CWidget
Extended by CFilterWidget implements IFilter
Extended by COutputProcessor
Extended by 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
Methods summary
public
# processOutput( string $output )

Processes the captured output. This method purifies the output using HTML Purifier.

Processes the captured output. This method purifies the output using HTML Purifier.

Parameters

$output
string
$output the captured output to be processed

Overrides

COutputProcessor::processOutput()
public mixed
# purify( mixed $content )

Purifies the HTML content by removing malicious code.

Purifies the HTML content by removing malicious code.

Parameters

$content
mixed
$content the content to be purified.

Returns

mixed
the purified content
public static
# setOptions( mixed $options )

Set the options for HTML Purifier and create a new HTML Purifier instance based on these options.

Set the options for HTML Purifier and create a new HTML Purifier instance based on these options.

Parameters

$options
mixed
$options the options for HTML Purifier

Returns

static
the object instance itself
public mixed
# getOptions( )

Get the options for the HTML Purifier instance.

Get the options for the HTML Purifier instance.

Returns

mixed
the HTML Purifier instance options
protected HTMLPurifier
# getPurifier( )

Get the HTML Purifier instance or create a new one if it doesn't exist.

Get the HTML Purifier instance or create a new one if it doesn't exist.

Returns

HTMLPurifier
protected HTMLPurifier
# createNewHtmlPurifierInstance( )

Create a new HTML Purifier instance.

Create a new HTML Purifier instance.

Returns

HTMLPurifier
Methods inherited from COutputProcessor
init(), onProcessOutput(), run()
Methods inherited from CFilterWidget
__construct(), filter(), getIsFilter()
Methods inherited from CWidget
actions(), getController(), getId(), getOwner(), getViewFile(), getViewPath(), render(), setId()
Methods inherited from CBaseController
beginCache(), beginClip(), beginContent(), beginWidget(), createWidget(), endCache(), endClip(), endContent(), endWidget(), renderFile(), renderInternal(), widget()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties inherited from CFilterWidget
$stopAction
Properties inherited from CWidget
$actionPrefix, $skin
Magic properties inherited from CFilterWidget
$isFilter
Magic properties inherited from CWidget
$controller, $id, $owner, $viewPath
API documentation generated by ApiGen 2.8.0