Class HTMLPurifier_Config
Inheritance | HTMLPurifier_Config |
---|
Configuration object that triggers customizable behavior.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$autoFinalize | Whether or not to automatically finalize the object if a read operation is done. | HTMLPurifier_Config | |
$chatty | Set to false if you do not want line and file numbers in errors. | HTMLPurifier_Config | |
$def | Reference HTMLPurifier_ConfigSchema for value checking. | HTMLPurifier_Config | |
$version | HTML Purifier's version | HTMLPurifier_Config |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$definitions | Indexed array of definitions. | HTMLPurifier_Config | |
$finalized | Whether or not config is finalized. | HTMLPurifier_Config | |
$parser | Parser for variables. | HTMLPurifier_Config | |
$plist | Property list containing configuration directives. | HTMLPurifier_Config | |
$serial | Serial for entire configuration object. | HTMLPurifier_Config | |
$serials | Namespace indexed array of serials for specific namespaces. | HTMLPurifier_Config |
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Constructor | HTMLPurifier_Config |
autoFinalize() | Finalizes configuration only if auto finalize is on and not already finalized | HTMLPurifier_Config |
create() | Convenience constructor that creates a config object based on a mixed var | HTMLPurifier_Config |
createDefault() | Convenience constructor that creates a default configuration object. | HTMLPurifier_Config |
finalize() | Finalizes a configuration object, prohibiting further change | HTMLPurifier_Config |
get() | Retrieves a value from the configuration. | HTMLPurifier_Config |
getAll() | Retrieves all directives, organized by namespace | HTMLPurifier_Config |
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. | HTMLPurifier_Config |
getBatch() | Retrieves an array of directives to values from a given namespace | HTMLPurifier_Config |
getBatchSerial() | Returns a SHA-1 signature of a segment of the configuration object that uniquely identifies that particular configuration | HTMLPurifier_Config |
getCSSDefinition() | Retrieves object reference to the CSS definition | HTMLPurifier_Config |
getDefinition() | Retrieves a definition | HTMLPurifier_Config |
getHTMLDefinition() | Retrieves object reference to the HTML definition. | HTMLPurifier_Config |
getSerial() | Returns a SHA-1 signature for the entire configuration object that uniquely identifies that particular configuration | HTMLPurifier_Config |
getURIDefinition() | Retrieves object reference to the URI definition | HTMLPurifier_Config |
inherit() | Creates a new config object that inherits from a previous one. | HTMLPurifier_Config |
isFinalized() | Checks whether or not the configuration object is finalized. | HTMLPurifier_Config |
loadArray() | Loads configuration values from an array with the following structure: Namespace.Directive => Value | HTMLPurifier_Config |
loadArrayFromForm() | Loads configuration values from $_GET/$_POST that were posted via ConfigForm | HTMLPurifier_Config |
loadIni() | Loads configuration values from an ini file | HTMLPurifier_Config |
maybeGetRawCSSDefinition() | HTMLPurifier_Config | |
maybeGetRawDefinition() | HTMLPurifier_Config | |
maybeGetRawHTMLDefinition() | HTMLPurifier_Config | |
maybeGetRawURIDefinition() | HTMLPurifier_Config | |
mergeArrayFromForm() | Merges in configuration values from $_GET/$_POST to object. NOT STATIC. | HTMLPurifier_Config |
prepareArrayFromForm() | Prepares an array from a form into something usable for the more strict parts of HTMLPurifier_Config | HTMLPurifier_Config |
serialize() | Returns a serialized form of the configuration object that can be reconstituted. | HTMLPurifier_Config |
set() | Sets a value to configuration. | HTMLPurifier_Config |
Protected Methods
Method | Description | Defined By |
---|---|---|
triggerError() | Produces a nicely formatted error message by supplying the stack frame information OUTSIDE of HTMLPurifier_Config. | HTMLPurifier_Config |
Property Details
(useful when unit testing). This will also compress some errors and exceptions.
See also getSerial() for more info.
Method Details
Constructor
public void __construct ( $definition, $parent = null ) | ||
$definition | HTMLPurifier_ConfigSchema | ConfigSchema that defines what directives are allowed. |
$parent | HTMLPurifier_PropertyList |
Finalizes configuration only if auto finalize is on and not already finalized
public void autoFinalize ( ) |
Convenience constructor that creates a config object based on a mixed var
public static HTMLPurifier_Config create ( $config, $schema = null ) | ||
$config | mixed | Variable that defines the state of the config
|
$schema | HTMLPurifier_ConfigSchema | Schema object |
return | HTMLPurifier_Config | Configured object |
---|
Convenience constructor that creates a default configuration object.
public static HTMLPurifier_Config createDefault ( ) | ||
return | HTMLPurifier_Config | Default object. |
---|
Finalizes a configuration object, prohibiting further change
public void finalize ( ) |
Retrieves a value from the configuration.
public mixed get ( $key, $a = null ) | ||
$key | string | String key |
$a | mixed |
Retrieves all directives, organized by namespace
public void getAll ( ) |
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 array getAllowedDirectivesForForm ( $allowed, $schema = null ) | ||
$allowed | array | List of allowed namespaces/directives |
$schema | HTMLPurifier_ConfigSchema | Schema to use, if not global copy |
Retrieves an array of directives to values from a given namespace
public array getBatch ( $namespace ) | ||
$namespace | string | String namespace |
Returns a SHA-1 signature of a segment of the configuration object that uniquely identifies that particular configuration
public string getBatchSerial ( $namespace ) | ||
$namespace | string | Namespace to get serial for |
Retrieves object reference to the CSS definition
public HTMLPurifier_CSSDefinition getCSSDefinition ( $raw = false, $optimized = false ) | ||
$raw | bool | Return a copy that has not been setup yet. Must be
|
$optimized | bool | If true, this method may return null, to
|
Retrieves a definition
public HTMLPurifier_Definition getDefinition ( $type, $raw = false, $optimized = false ) | ||
$type | string | Type of definition: HTML, CSS, etc |
$raw | bool | Whether or not definition should be returned raw |
$optimized | bool | Only has an effect when $raw is true. Whether
|
throws | HTMLPurifier_Exception |
---|
Retrieves object reference to the HTML definition.
public HTMLPurifier_HTMLDefinition getHTMLDefinition ( $raw = false, $optimized = false ) | ||
$raw | bool | Return a copy that has not been setup yet. Must be
|
$optimized | bool | If true, this method may return null, to
|
Returns a SHA-1 signature for the entire configuration object that uniquely identifies that particular configuration
public string getSerial ( ) |
Retrieves object reference to the URI definition
public HTMLPurifier_URIDefinition getURIDefinition ( $raw = false, $optimized = false ) | ||
$raw | bool | Return a copy that has not been setup yet. Must be
|
$optimized | bool | If true, this method may return null, to
|
Creates a new config object that inherits from a previous one.
public static HTMLPurifier_Config inherit ( HTMLPurifier_Config $config ) | ||
$config | HTMLPurifier_Config | Configuration object to inherit from. |
return | HTMLPurifier_Config | Object with $config as its parent. |
---|
Checks whether or not the configuration object is finalized.
public bool isFinalized ( $error = false ) | ||
$error | string|bool | String error message, or false for no error |
Loads configuration values from an array with the following structure: Namespace.Directive => Value
public void loadArray ( $config_array ) | ||
$config_array | array | Configuration associative array |
Loads configuration values from $_GET/$_POST that were posted via ConfigForm
public static mixed loadArrayFromForm ( $array, $index = false, $allowed = true, $mq_fix = true, $schema = null ) | ||
$array | array | $_GET or $_POST array to import |
$index | string|bool | Index/name that the config variables are in |
$allowed | array|bool | List of allowed namespaces/directives |
$mq_fix | bool | Boolean whether or not to enable magic quotes fix |
$schema | HTMLPurifier_ConfigSchema | Schema to use, if not global copy |
Loads configuration values from an ini file
public void loadIni ( $filename ) | ||
$filename | string | Name of ini file |
public void maybeGetRawCSSDefinition ( ) |
public void maybeGetRawDefinition ( $name ) | ||
$name |
public void maybeGetRawHTMLDefinition ( ) |
public void maybeGetRawURIDefinition ( ) |
Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
public void mergeArrayFromForm ( $array, $index = false, $allowed = true, $mq_fix = true ) | ||
$array | array | $_GET or $_POST array to import |
$index | string|bool | Index/name that the config variables are in |
$allowed | array|bool | List of allowed namespaces/directives |
$mq_fix | bool | Boolean whether or not to enable magic quotes fix |
Prepares an array from a form into something usable for the more strict parts of HTMLPurifier_Config
public static array prepareArrayFromForm ( $array, $index = false, $allowed = true, $mq_fix = true, $schema = null ) | ||
$array | array | $_GET or $_POST array to import |
$index | string|bool | Index/name that the config variables are in |
$allowed | array|bool | List of allowed namespaces/directives |
$mq_fix | bool | Boolean whether or not to enable magic quotes fix |
$schema | HTMLPurifier_ConfigSchema | Schema to use, if not global copy |
Returns a serialized form of the configuration object that can be reconstituted.
public string serialize ( ) |
Sets a value to configuration.
public void set ( $key, $value, $a = null ) | ||
$key | string | Key |
$value | mixed | Value |
$a | mixed |
Produces a nicely formatted error message by supplying the stack frame information OUTSIDE of HTMLPurifier_Config.
protected void triggerError ( $msg, $no ) | ||
$msg | string | An error message |
$no | int | An error number |