\HTMLPurifier

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

Summary

Methods
Properties
Constants
__construct()
addFilter()
purify()
purifyArray()
instance()
getInstance()
$version
$config
$context
VERSION
No protected methods found
$strategy
$generator
N/A
No private methods found
$filters
$instance
N/A

Constants

VERSION

VERSION = '4.13.0'

Constant with version of HTML Purifier.

Properties

$version

$version

Version of HTML Purifier.

$config

$config

Global configuration object.

$context

$context

Resultant context of last run purification.

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

$strategy

$strategy

$generator

$generator

$filters

$filters

Array of extra filter objects to run on HTML, for backwards compatibility.

$instance

$instance

Single instance of HTML Purifier.

Methods

__construct()

__construct(\HTMLPurifier_Config|mixed  $config = null) : mixed

Initializes the purifier.

Parameters

\HTMLPurifier_Config|mixed $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.

Returns

mixed —

addFilter()

addFilter(\HTMLPurifier_Filter  $filter) : mixed

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

Parameters

\HTMLPurifier_Filter $filter

HTMLPurifier_Filter object

Returns

mixed —

purify()

purify(string  $html, \HTMLPurifier_Config  $config = null) : string

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

Parameters

string $html

String of HTML to purify

\HTMLPurifier_Config $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.

Returns

string —

Purified HTML

purifyArray()

purifyArray(string[]  $array_of_html, \HTMLPurifier_Config  $config = null) : string[]

Filters an array of HTML snippets

Parameters

string[] $array_of_html

Array of html snippets

\HTMLPurifier_Config $config

Optional config object for this operation. See HTMLPurifier::purify() for more details.

Returns

string[] —

Array of purified HTML

instance()

instance(\HTMLPurifier|\HTMLPurifier_Config  $prototype = null) : \HTMLPurifier

Singleton for enforcing just one HTML Purifier in your system

Parameters

\HTMLPurifier|\HTMLPurifier_Config $prototype

Optional prototype HTMLPurifier instance to overload singleton with, or HTMLPurifier_Config instance to configure the generated version with.

Returns

\HTMLPurifier —

getInstance()

getInstance(\HTMLPurifier|\HTMLPurifier_Config  $prototype = null) : \HTMLPurifier

Singleton for enforcing just one HTML Purifier in your system

Parameters

\HTMLPurifier|\HTMLPurifier_Config $prototype

Optional prototype HTMLPurifier instance to overload singleton with, or HTMLPurifier_Config instance to configure the generated version with.

Returns

\HTMLPurifier —