Class HTMLPurifier

InheritanceHTMLPurifier

Facade that coordinates HTML Purifier's subsystems in order to purify HTML.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$config Global configuration object. HTMLPurifier
$context Resultant context of last run purification. HTMLPurifier
$version Version of HTML Purifier. HTMLPurifier

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$generator HTMLPurifier
$strategy HTMLPurifier

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Initializes the purifier. HTMLPurifier
addFilter() Adds a filter to process the output. First come first serve HTMLPurifier
getInstance() Singleton for enforcing just one HTML Purifier in your system HTMLPurifier
instance() Singleton for enforcing just one HTML Purifier in your system HTMLPurifier
purify() Filters an HTML snippet/document to be XSS-free and standards-compliant. HTMLPurifier
purifyArray() Filters an array of HTML snippets HTMLPurifier

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
VERSION '4.6.0' Constant with version of HTML Purifier. HTMLPurifier

Property Details

$config public property
public $config null
$context public property

Is an array of contexts if the last called method was purifyArray().

public $context null
$generator protected property
protected $generator null
$strategy protected property
protected $strategy null
$version public property
public $version '4.6.0'

Method Details

__construct() public method

Initializes the purifier.

public void __construct ( $config null )
$config HTMLPurifier_Config

Optional HTMLPurifier_Config object

           for all instances of the purifier, if omitted, a default
           configuration is supplied (which can be overridden on a
           per-use basis).
           The parameter can also be any type that
           HTMLPurifier_Config::create() supports.
addFilter() public method

Adds a filter to process the output. First come first serve

public void addFilter ( $filter )
$filter HTMLPurifier_Filter

HTMLPurifier_Filter object

getInstance() public static method

Singleton for enforcing just one HTML Purifier in your system

public static HTMLPurifier getInstance ( $prototype null )
$prototype HTMLPurifier|HTMLPurifier_Config

Optional prototype

              HTMLPurifier instance to overload singleton with,
              or HTMLPurifier_Config instance to configure the
              generated version with.
instance() public static method

Singleton for enforcing just one HTML Purifier in your system

public static HTMLPurifier instance ( $prototype null )
$prototype HTMLPurifier|HTMLPurifier_Config

Optional prototype

              HTMLPurifier instance to overload singleton with,
              or HTMLPurifier_Config instance to configure the
              generated version with.
purify() public method

Filters an HTML snippet/document to be XSS-free and standards-compliant.

public string purify ( $html, $config null )
$html string

String of HTML to purify

$config HTMLPurifier_Config

Config object for this operation,

           if omitted, defaults to the config object specified during this
           object's construction. The parameter can also be any type
           that HTMLPurifier_Config::create() supports.
return string

Purified HTML

purifyArray() public method

Filters an array of HTML snippets

public string[] purifyArray ( $array_of_html, $config null )
$array_of_html string[]

Array of html snippets

$config HTMLPurifier_Config

Optional config object for this operation.

           See HTMLPurifier::purify() for more details.
return string[]

Array of purified HTML