Cheetah
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
HTMLPurifier Class Reference

Public Member Functions

 __construct ($config=null)
 
 addFilter ($filter)
 
 purify ($html, $config=null)
 
 purifyArray ($array_of_html, $config=null)
 

Static Public Member Functions

static instance ($prototype=null)
 
static getInstance ($prototype=null)
 

Public Attributes

 $version = '4.12.0'
 
const VERSION = '4.12.0'
 
 $config
 
 $context
 

Protected Attributes

 $strategy
 
 $generator
 

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).

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

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier::__construct (   $config = null)

Initializes the purifier.

Parameters
HTMLPurifier_Config | mixed$configOptional 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 134 of file HTMLPurifier.standalone.php.

Member Function Documentation

◆ addFilter()

HTMLPurifier::addFilter (   $filter)

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

Parameters
HTMLPurifier_Filter$filterHTMLPurifier_Filter object

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

◆ getInstance()

static HTMLPurifier::getInstance (   $prototype = null)
static

Singleton for enforcing just one HTML Purifier in your system

Parameters
HTMLPurifier | HTMLPurifier_Config$prototypeOptional prototype HTMLPurifier instance to overload singleton with, or HTMLPurifier_Config instance to configure the generated version with.
Returns
HTMLPurifier
Note
Backwards compatibility, see instance()

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

◆ instance()

static HTMLPurifier::instance (   $prototype = null)
static

Singleton for enforcing just one HTML Purifier in your system

Parameters
HTMLPurifier | HTMLPurifier_Config$prototypeOptional prototype HTMLPurifier instance to overload singleton with, or HTMLPurifier_Config instance to configure the generated version with.
Returns
HTMLPurifier

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

◆ purify()

HTMLPurifier::purify (   $html,
  $config = null 
)

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

Parameters
string$htmlString of HTML to purify
HTMLPurifier_Config$configConfig 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

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

◆ purifyArray()

HTMLPurifier::purifyArray (   $array_of_html,
  $config = null 
)

Filters an array of HTML snippets

Parameters
string[]$array_of_htmlArray of html snippets
HTMLPurifier_Config$configOptional config object for this operation. See HTMLPurifier::purify() for more details.
Returns
string[] Array of purified HTML

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

Member Data Documentation

◆ $config

HTMLPurifier::$config

Global configuration object. @type HTMLPurifier_Config

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

◆ $context

HTMLPurifier::$context

Resultant context of last run purification. Is an array of contexts if the last called method was purifyArray(). @type HTMLPurifier_Context

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

◆ $generator

HTMLPurifier::$generator
protected

@type HTMLPurifier_Generator

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

◆ $strategy

HTMLPurifier::$strategy
protected

@type HTMLPurifier_Strategy_Core

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

◆ $version

HTMLPurifier::$version = '4.12.0'

Version of HTML Purifier. @type string

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

◆ VERSION

const HTMLPurifier::VERSION = '4.12.0'

Constant with version of HTML Purifier.

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


The documentation for this class was generated from the following file: