HTMLPurifier_Config
in package
Configuration object that triggers customizable behavior.
Tags
Table of Contents
Properties
- $autoFinalize : mixed
- Whether or not to automatically finalize the object if a read operation is done.
- $chatty : mixed
- Set to false if you do not want line and file numbers in errors.
- $def : mixed
- Reference HTMLPurifier_ConfigSchema for value checking.
- $version : mixed
- HTML Purifier's version
- $definitions : mixed
- Indexed array of definitions.
- $finalized : mixed
- Whether or not config is finalized.
- $parser : mixed
- Parser for variables.
- $plist : mixed
- Property list containing configuration directives.
- $serial : mixed
- Serial for entire configuration object.
- $serials : mixed
- Namespace indexed array of serials for specific namespaces.
- $aliasMode : mixed
- Whether or not a set is taking place due to an alias lookup.
- $lock : mixed
- Current lock; only gets to this namespace are allowed.
Methods
- __construct() : mixed
- Constructor
- autoFinalize() : mixed
- Finalizes configuration only if auto finalize is on and not already finalized
- create() : HTMLPurifier_Config
- Convenience constructor that creates a config object based on a mixed var
- createDefault() : HTMLPurifier_Config
- Convenience constructor that creates a default configuration object.
- finalize() : mixed
- Finalizes a configuration object, prohibiting further change
- get() : mixed
- Retrieves a value from the configuration.
- getAll() : mixed
- Retrieves all directives, organized by namespace
- getAllowedDirectivesForForm() : array<string|int, mixed>
- Returns a list of array(namespace, directive) for all directives that are allowed in a web-form context as per an allowed namespaces/directives list.
- getBatch() : array<string|int, mixed>
- Retrieves an array of directives to values from a given namespace
- getBatchSerial() : string
- Returns a SHA-1 signature of a segment of the configuration object that uniquely identifies that particular configuration
- getCSSDefinition() : HTMLPurifier_CSSDefinition|null
- Retrieves object reference to the CSS definition
- getDefinition() : HTMLPurifier_Definition|null
- Retrieves a definition
- getHTMLDefinition() : HTMLPurifier_HTMLDefinition|null
- Retrieves object reference to the HTML definition.
- getSerial() : string
- Returns a SHA-1 signature for the entire configuration object that uniquely identifies that particular configuration
- getURIDefinition() : HTMLPurifier_URIDefinition|null
- Retrieves object reference to the URI definition
- inherit() : HTMLPurifier_Config
- Creates a new config object that inherits from a previous one.
- isFinalized() : bool
- Checks whether or not the configuration object is finalized.
- loadArray() : mixed
- Loads configuration values from an array with the following structure: Namespace.Directive => Value
- loadArrayFromForm() : mixed
- Loads configuration values from $_GET/$_POST that were posted via ConfigForm
- loadIni() : mixed
- Loads configuration values from an ini file
- maybeGetRawCSSDefinition() : HTMLPurifier_CSSDefinition|null
- maybeGetRawDefinition() : mixed
- maybeGetRawHTMLDefinition() : HTMLPurifier_HTMLDefinition|null
- maybeGetRawURIDefinition() : HTMLPurifier_URIDefinition|null
- mergeArrayFromForm() : mixed
- Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
- prepareArrayFromForm() : array<string|int, mixed>
- Prepares an array from a form into something usable for the more strict parts of HTMLPurifier_Config
- serialize() : string
- Returns a serialized form of the configuration object that can be reconstituted.
- set() : mixed
- Sets a value to configuration.
- triggerError() : mixed
- Produces a nicely formatted error message by supplying the stack frame information OUTSIDE of HTMLPurifier_Config.
- _listify() : string
- Convenience function for error reporting
- initDefinition() : HTMLPurifier_CSSDefinition|HTMLPurifier_HTMLDefinition|HTMLPurifier_URIDefinition
- Initialise definition
Properties
$autoFinalize
Whether or not to automatically finalize the object if a read operation is done.
public
mixed
$autoFinalize
= \true
Tags
$chatty
Set to false if you do not want line and file numbers in errors.
public
mixed
$chatty
= \true
(useful when unit testing). This will also compress some errors and exceptions.
Tags
$def
Reference HTMLPurifier_ConfigSchema for value checking.
public
mixed
$def
Tags
$version
HTML Purifier's version
public
mixed
$version
= '4.17.0'
Tags
$definitions
Indexed array of definitions.
protected
mixed
$definitions
Tags
$finalized
Whether or not config is finalized.
protected
mixed
$finalized
= \false
Tags
$parser
Parser for variables.
protected
mixed
$parser
= \null
Tags
$plist
Property list containing configuration directives.
protected
mixed
$plist
Tags
$serial
Serial for entire configuration object.
protected
mixed
$serial
Tags
$serials
Namespace indexed array of serials for specific namespaces.
protected
mixed
$serials
= array()
Tags
$aliasMode
Whether or not a set is taking place due to an alias lookup.
private
mixed
$aliasMode
Tags
$lock
Current lock; only gets to this namespace are allowed.
private
mixed
$lock
Tags
Methods
__construct()
Constructor
public
__construct(HTMLPurifier_ConfigSchema $definition[, HTMLPurifier_PropertyList $parent = null ]) : mixed
Parameters
- $definition : HTMLPurifier_ConfigSchema
-
ConfigSchema that defines what directives are allowed.
- $parent : HTMLPurifier_PropertyList = null
autoFinalize()
Finalizes configuration only if auto finalize is on and not already finalized
public
autoFinalize() : mixed
create()
Convenience constructor that creates a config object based on a mixed var
public
static create(mixed $config[, HTMLPurifier_ConfigSchema $schema = null ]) : HTMLPurifier_Config
Parameters
- $config : mixed
-
Variable that defines the state of the config object. Can be: a HTMLPurifier_Config() object, an array of directives based on loadArray(), or a string filename of an ini file.
- $schema : HTMLPurifier_ConfigSchema = null
-
Schema object
Return values
HTMLPurifier_Config —Configured object
createDefault()
Convenience constructor that creates a default configuration object.
public
static createDefault() : HTMLPurifier_Config
Return values
HTMLPurifier_Config —default object.
finalize()
Finalizes a configuration object, prohibiting further change
public
finalize() : mixed
get()
Retrieves a value from the configuration.
public
get(string $key[, mixed $a = null ]) : mixed
Parameters
- $key : string
-
String key
- $a : mixed = null
getAll()
Retrieves all directives, organized by namespace
public
getAll() : mixed
Tags
getAllowedDirectivesForForm()
Returns a list of array(namespace, directive) for all directives that are allowed in a web-form context as per an allowed namespaces/directives list.
public
static getAllowedDirectivesForForm(array<string|int, mixed> $allowed[, HTMLPurifier_ConfigSchema $schema = null ]) : array<string|int, mixed>
Parameters
- $allowed : array<string|int, mixed>
-
List of allowed namespaces/directives
- $schema : HTMLPurifier_ConfigSchema = null
-
Schema to use, if not global copy
Return values
array<string|int, mixed>getBatch()
Retrieves an array of directives to values from a given namespace
public
getBatch(string $namespace) : array<string|int, mixed>
Parameters
- $namespace : string
-
String namespace
Return values
array<string|int, mixed>getBatchSerial()
Returns a SHA-1 signature of a segment of the configuration object that uniquely identifies that particular configuration
public
getBatchSerial(string $namespace) : string
Parameters
- $namespace : string
-
Namespace to get serial for
Tags
Return values
stringgetCSSDefinition()
Retrieves object reference to the CSS definition
public
getCSSDefinition([bool $raw = false ][, bool $optimized = false ]) : HTMLPurifier_CSSDefinition|null
Parameters
- $raw : bool = false
-
Return a copy that has not been setup yet. Must be called before it's been setup, otherwise won't work.
- $optimized : bool = false
-
If true, this method may return null, to indicate that a cached version of the modified definition object is available and no further edits are necessary. Consider using maybeGetRawCSSDefinition, which is more explicitly named, instead.
Return values
HTMLPurifier_CSSDefinition|nullgetDefinition()
Retrieves a definition
public
getDefinition(string $type[, bool $raw = false ][, bool $optimized = false ]) : HTMLPurifier_Definition|null
Parameters
- $type : string
-
Type of definition: HTML, CSS, etc
- $raw : bool = false
-
Whether or not definition should be returned raw
- $optimized : bool = false
-
Only has an effect when $raw is true. Whether or not to return null if the result is already present in the cache. This is off by default for backwards compatibility reasons, but you need to do things this way in order to ensure that caching is done properly. Check out enduser-customize.html for more details. We probably won't ever change this default, as much as the maybe semantics is the "right thing to do."
Tags
Return values
HTMLPurifier_Definition|nullgetHTMLDefinition()
Retrieves object reference to the HTML definition.
public
getHTMLDefinition([bool $raw = false ][, bool $optimized = false ]) : HTMLPurifier_HTMLDefinition|null
Parameters
- $raw : bool = false
-
Return a copy that has not been setup yet. Must be called before it's been setup, otherwise won't work.
- $optimized : bool = false
-
If true, this method may return null, to indicate that a cached version of the modified definition object is available and no further edits are necessary. Consider using maybeGetRawHTMLDefinition, which is more explicitly named, instead.
Return values
HTMLPurifier_HTMLDefinition|nullgetSerial()
Returns a SHA-1 signature for the entire configuration object that uniquely identifies that particular configuration
public
getSerial() : string
Return values
stringgetURIDefinition()
Retrieves object reference to the URI definition
public
getURIDefinition([bool $raw = false ][, bool $optimized = false ]) : HTMLPurifier_URIDefinition|null
Parameters
- $raw : bool = false
-
Return a copy that has not been setup yet. Must be called before it's been setup, otherwise won't work.
- $optimized : bool = false
-
If true, this method may return null, to indicate that a cached version of the modified definition object is available and no further edits are necessary. Consider using maybeGetRawURIDefinition, which is more explicitly named, instead.
Return values
HTMLPurifier_URIDefinition|nullinherit()
Creates a new config object that inherits from a previous one.
public
static inherit(HTMLPurifier_Config $config) : HTMLPurifier_Config
Parameters
- $config : HTMLPurifier_Config
-
Configuration object to inherit from.
Return values
HTMLPurifier_Config —object with $config as its parent.
isFinalized()
Checks whether or not the configuration object is finalized.
public
isFinalized([string|bool $error = false ]) : bool
Parameters
- $error : string|bool = false
-
String error message, or false for no error
Return values
boolloadArray()
Loads configuration values from an array with the following structure: Namespace.Directive => Value
public
loadArray(array<string|int, mixed> $config_array) : mixed
Parameters
- $config_array : array<string|int, mixed>
-
Configuration associative array
loadArrayFromForm()
Loads configuration values from $_GET/$_POST that were posted via ConfigForm
public
static loadArrayFromForm(array<string|int, mixed> $array[, string|bool $index = false ][, array<string|int, mixed>|bool $allowed = true ][, bool $mq_fix = true ][, HTMLPurifier_ConfigSchema $schema = null ]) : mixed
Parameters
- $array : array<string|int, mixed>
-
$_GET or $_POST array to import
- $index : string|bool = false
-
Index/name that the config variables are in
- $allowed : array<string|int, mixed>|bool = true
-
List of allowed namespaces/directives
- $mq_fix : bool = true
-
Boolean whether or not to enable magic quotes fix
- $schema : HTMLPurifier_ConfigSchema = null
-
Schema to use, if not global copy
loadIni()
Loads configuration values from an ini file
public
loadIni(string $filename) : mixed
Parameters
- $filename : string
-
Name of ini file
maybeGetRawCSSDefinition()
public
maybeGetRawCSSDefinition() : HTMLPurifier_CSSDefinition|null
Return values
HTMLPurifier_CSSDefinition|nullmaybeGetRawDefinition()
public
maybeGetRawDefinition(mixed $name) : mixed
Parameters
- $name : mixed
maybeGetRawHTMLDefinition()
public
maybeGetRawHTMLDefinition() : HTMLPurifier_HTMLDefinition|null
Return values
HTMLPurifier_HTMLDefinition|nullmaybeGetRawURIDefinition()
public
maybeGetRawURIDefinition() : HTMLPurifier_URIDefinition|null
Return values
HTMLPurifier_URIDefinition|nullmergeArrayFromForm()
Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
public
mergeArrayFromForm(array<string|int, mixed> $array[, string|bool $index = false ][, array<string|int, mixed>|bool $allowed = true ][, bool $mq_fix = true ]) : mixed
Parameters
- $array : array<string|int, mixed>
-
$_GET or $_POST array to import
- $index : string|bool = false
-
Index/name that the config variables are in
- $allowed : array<string|int, mixed>|bool = true
-
List of allowed namespaces/directives
- $mq_fix : bool = true
-
Boolean whether or not to enable magic quotes fix
prepareArrayFromForm()
Prepares an array from a form into something usable for the more strict parts of HTMLPurifier_Config
public
static prepareArrayFromForm(array<string|int, mixed> $array[, string|bool $index = false ][, array<string|int, mixed>|bool $allowed = true ][, bool $mq_fix = true ][, HTMLPurifier_ConfigSchema $schema = null ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
$_GET or $_POST array to import
- $index : string|bool = false
-
Index/name that the config variables are in
- $allowed : array<string|int, mixed>|bool = true
-
List of allowed namespaces/directives
- $mq_fix : bool = true
-
Boolean whether or not to enable magic quotes fix
- $schema : HTMLPurifier_ConfigSchema = null
-
Schema to use, if not global copy
Return values
array<string|int, mixed>serialize()
Returns a serialized form of the configuration object that can be reconstituted.
public
serialize() : string
Return values
stringset()
Sets a value to configuration.
public
set(string $key, mixed $value[, mixed $a = null ]) : mixed
Parameters
- $key : string
-
key
- $value : mixed
-
value
- $a : mixed = null
triggerError()
Produces a nicely formatted error message by supplying the stack frame information OUTSIDE of HTMLPurifier_Config.
protected
triggerError(string $msg, int $no) : mixed
Parameters
- $msg : string
-
An error message
- $no : int
-
An error number
_listify()
Convenience function for error reporting
private
_listify(array<string|int, mixed> $lookup) : string
Parameters
- $lookup : array<string|int, mixed>
Return values
stringinitDefinition()
Initialise definition
private
initDefinition(string $type) : HTMLPurifier_CSSDefinition|HTMLPurifier_HTMLDefinition|HTMLPurifier_URIDefinition
Parameters
- $type : string
-
What type of definition to create