Class HTMLPurifier
Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
Note:
There are several points in which configuration can be specified
for HTML Purifier. The precedence of these (from lowest to
highest) is as follows:
-# Instance: new HTMLPurifier($config)
-# Invocation: purify($html, $config)
These configurations are entirely independent of each other and
are not merged (this behavior may change in the future).
Located at oops_lib/modules/protector/library/HTMLPurifier.php
Methods summary
public
|
#
__construct( HTMLPurifier_Config|mixed $config = null )
Initializes the purifier.
Initializes the purifier.
Parameters
- $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.
|
public
|
#
addFilter( HTMLPurifier_Filter $filter )
Adds a filter to process the output. First come first serve
Adds a filter to process the output. First come first serve
Parameters
- $filter
- HTMLPurifier_Filter object
|
public
string
|
#
purify( string $html, HTMLPurifier_Config $config = null )
Filters an HTML snippet/document to be XSS-free and standards-compliant.
Filters an HTML snippet/document to be XSS-free and standards-compliant.
Parameters
- $html
- String of HTML to purify
- $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
|
public
string[]
|
#
purifyArray( string[] $array_of_html, HTMLPurifier_Config $config = null )
Filters an array of HTML snippets
Filters an array of HTML snippets
Parameters
- $array_of_html
- Array of html snippets
- $config
Optional config object for this operation.
See HTMLPurifier::purify() for more details.
Returns
string[] Array of purified HTML
|
public static
HTMLPurifier
|
#
instance( HTMLPurifier |HTMLPurifier_Config $prototype = null )
Singleton for enforcing just one HTML Purifier in your system
Singleton for enforcing just one HTML Purifier in your system
Parameters
- $prototype
Optional prototype
HTMLPurifier instance to overload singleton with,
or HTMLPurifier_Config instance to configure the
generated version with.
Returns
|
public static
HTMLPurifier
|
#
getInstance( HTMLPurifier |HTMLPurifier_Config $prototype = null )
Singleton for enforcing just one HTML Purifier in your system
Singleton for enforcing just one HTML Purifier in your system
Parameters
- $prototype
Optional prototype
HTMLPurifier instance to overload singleton with,
or HTMLPurifier_Config instance to configure the
generated version with.
Returns
Note
Backwards compatibility, see instance()
|
Constants summary
string |
VERSION
Constant with version of HTML Purifier.
Constant with version of HTML Purifier.
|
|
Properties summary
public
string
|
$version
Version of HTML Purifier.
Version of HTML Purifier.
Type
string
|
|
public
|
$config
Global configuration object.
Global configuration object.
Type
HTMLPurifier_Config
|
|
protected
|
$strategy
Type
HTMLPurifier_Strategy_Core
|
|
protected
|
$generator
Type
HTMLPurifier_Generator
|
|
public
|
$context
Resultant context of last run purification.
Is an array of contexts if the last called method was purifyArray().
Resultant context of last run purification.
Is an array of contexts if the last called method was purifyArray().
Type
HTMLPurifier_Context
|
|