HTMLPurifier Class Reference

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

List of all members.

Public Member Functions

 __construct ($config=null)
 Initializes the purifier.
 addFilter ($filter)
 Adds a filter to process the output.
 purify ($html, $config=null)
 Filters an HTML snippet/document to be XSS-free and standards-compliant.
 purifyArray ($array_of_html, $config=null)
 Filters an array of HTML snippets.
 __construct ($config=null)
 Initializes the purifier.
 addFilter ($filter)
 Adds a filter to process the output.
 purify ($html, $config=null)
 Filters an HTML snippet/document to be XSS-free and standards-compliant.
 purifyArray ($array_of_html, $config=null)
 Filters an array of HTML snippets.

Static Public Member Functions

static instance ($prototype=null)
 Singleton for enforcing just one HTML Purifier in your system.
static getInstance ($prototype=null)
 
Note:
Backwards compatibility, see instance()

static instance ($prototype=null)
 Singleton for enforcing just one HTML Purifier in your system.
static getInstance ($prototype=null)
 
Note:
Backwards compatibility, see instance()


Public Attributes

 $version = '3.1.1'
 Version of HTML Purifier.
const VERSION = '3.1.1'
 Constant with version of HTML Purifier.
 $config
 Global configuration object.
 $context
 Resultant HTMLPurifier_Context of last run purification.

Protected Attributes

 $strategy
 $generator

Private Attributes

 $filters = array()
 Array of extra HTMLPurifier_Filter objects to run on HTML, for backwards compatibility.

Static Private Attributes

static $instance
 Single instance of HTML Purifier.


Detailed Description

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:
  1. Instance: new HTMLPurifier($config)
  2. Invocation: purify($html, $config) These configurations are entirely independent of each other and are *not* merged (this behavior may change in the future).
Todo:
We need an easier way to inject strategies using the configuration object.
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:
  1. Instance: new HTMLPurifier($config)
  2. Invocation: purify($html, $config) These configurations are entirely independent of each other and are *not* merged (this behavior may change in the future).
Todo:
We need an easier way to inject strategies using the configuration object.

Definition at line 54 of file HTMLPurifier.php.


Constructor & Destructor Documentation

HTMLPurifier::__construct ( config = null  ) 

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.

Definition at line 88 of file HTMLPurifier.php.

References $config, and HTMLPurifier_Config::create().

HTMLPurifier::__construct ( config = null  ) 

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.

Definition at line 108 of file HTMLPurifier.standalone.php.

References $config, and HTMLPurifier_Config::create().


Member Function Documentation

HTMLPurifier::addFilter ( filter  ) 

Adds a filter to process the output.

First come first serve

Parameters:
$filter HTMLPurifier_Filter object

Definition at line 100 of file HTMLPurifier.php.

HTMLPurifier::purify ( html,
config = null 
)

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

Parameters:
$html String of HTML to purify
$config HTMLPurifier_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:
Purified HTML

Definition at line 115 of file HTMLPurifier.php.

References $config, $context, $filters, HTMLPurifier_IDAccumulator::build(), HTMLPurifier_Encoder::convertFromUTF8(), HTMLPurifier_Encoder::convertToUTF8(), HTMLPurifier_Lexer::create(), HTMLPurifier_Config::create(), and HTMLPurifier_LanguageFactory::instance().

Referenced by purifyArray().

HTMLPurifier::purifyArray ( array_of_html,
config = null 
)

Filters an array of HTML snippets.

Parameters:
$config Optional HTMLPurifier_Config object for this operation. See HTMLPurifier::purify() for more details.
Returns:
Array of purified HTML

Definition at line 198 of file HTMLPurifier.php.

References $config, and purify().

static HTMLPurifier::instance ( prototype = null  )  [static]

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.

Definition at line 214 of file HTMLPurifier.php.

References HTMLPurifier().

Referenced by getInstance().

static HTMLPurifier::getInstance ( prototype = null  )  [static]

Note:
Backwards compatibility, see instance()

Definition at line 230 of file HTMLPurifier.php.

References instance().

Referenced by phorum_htmlpurifier_before_editor(), phorum_htmlpurifier_common(), phorum_htmlpurifier_editor_after_subject(), phorum_htmlpurifier_format(), phorum_htmlpurifier_quote(), and HTMLPurifier_ConfigSchema_Builder_Xml::writeHTMLDiv().

HTMLPurifier::addFilter ( filter  ) 

Adds a filter to process the output.

First come first serve

Parameters:
$filter HTMLPurifier_Filter object

Definition at line 120 of file HTMLPurifier.standalone.php.

HTMLPurifier::purify ( html,
config = null 
)

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

Parameters:
$html String of HTML to purify
$config HTMLPurifier_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:
Purified HTML

Definition at line 135 of file HTMLPurifier.standalone.php.

References $config, $context, $filters, HTMLPurifier_IDAccumulator::build(), HTMLPurifier_Encoder::convertFromUTF8(), HTMLPurifier_Encoder::convertToUTF8(), HTMLPurifier_Lexer::create(), HTMLPurifier_Config::create(), and HTMLPurifier_LanguageFactory::instance().

HTMLPurifier::purifyArray ( array_of_html,
config = null 
)

Filters an array of HTML snippets.

Parameters:
$config Optional HTMLPurifier_Config object for this operation. See HTMLPurifier::purify() for more details.
Returns:
Array of purified HTML

Definition at line 218 of file HTMLPurifier.standalone.php.

References $config, and purify().

static HTMLPurifier::instance ( prototype = null  )  [static]

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.

Definition at line 234 of file HTMLPurifier.standalone.php.

References HTMLPurifier().

static HTMLPurifier::getInstance ( prototype = null  )  [static]

Note:
Backwards compatibility, see instance()

Definition at line 250 of file HTMLPurifier.standalone.php.

References instance().


Member Data Documentation

HTMLPurifier::$version = '3.1.1'

Version of HTML Purifier.

Definition at line 58 of file HTMLPurifier.php.

const HTMLPurifier::VERSION = '3.1.1'

Constant with version of HTML Purifier.

Definition at line 61 of file HTMLPurifier.php.

HTMLPurifier::$config

Global configuration object.

Definition at line 64 of file HTMLPurifier.php.

Referenced by __construct(), purify(), and purifyArray().

HTMLPurifier::$filters = array() [private]

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

Definition at line 67 of file HTMLPurifier.php.

Referenced by purify().

HTMLPurifier::$instance [static, private]

Single instance of HTML Purifier.

Definition at line 70 of file HTMLPurifier.php.

HTMLPurifier::$strategy [protected]

Definition at line 72 of file HTMLPurifier.php.

HTMLPurifier::$generator [protected]

Definition at line 72 of file HTMLPurifier.php.

HTMLPurifier::$context

Resultant HTMLPurifier_Context of last run purification.

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

Definition at line 78 of file HTMLPurifier.php.

Referenced by purify().


The documentation for this class was generated from the following files:
Generated on Thu Jun 19 18:47:28 2008 for HTMLPurifier by  doxygen 1.5.3