PHP Class HTMLPurifier_Config, yii

Afficher le fichier Open project: yiisoft/yii Class Usage Examples

Méthodes publiques

Свойство Type Description
$autoFinalize Whether or not to automatically finalize the object if a read operation is done.
$chatty (useful when unit testing). This will also compress some errors and exceptions.
$def Reference HTMLPurifier_ConfigSchema for value checking.
$version HTML Purifier's version

Protected Properties

Свойство Type Description
$definitions Indexed array of definitions.
$finalized Whether or not config is finalized.
$parser Parser for variables.
$plist Property list containing configuration directives.
$serial Serial for entire configuration object.
$serials Namespace indexed array of serials for specific namespaces.

Méthodes publiques

Méthode Description
__construct ( HTMLPurifier_ConfigSchema $definition, HTMLPurifier_PropertyList $parent = null ) Constructor
autoFinalize ( ) Finalizes configuration only if auto finalize is on and not already finalized
create ( mixed $config, HTMLPurifier_ConfigSchema $schema = null ) : 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 ( ) Finalizes a configuration object, prohibiting further change
get ( string $key, mixed $a = null ) : mixed Retrieves a value from the configuration.
getAll ( ) Retrieves all directives, organized by namespace
getAllowedDirectivesForForm ( array $allowed, HTMLPurifier_ConfigSchema $schema = null ) : array 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 ( string $namespace ) : array Retrieves an array of directives to values from a given namespace
getBatchSerial ( string $namespace ) : string Returns a SHA-1 signature of a segment of the configuration object that uniquely identifies that particular configuration
getCSSDefinition ( boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_CSSDefinition Retrieves object reference to the CSS definition
getDefinition ( string $type, boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_Definition Retrieves a definition
getHTMLDefinition ( boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_HTMLDefinition 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 ( boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_URIDefinition Retrieves object reference to the URI definition
inherit ( HTMLPurifier_Config $config ) : HTMLPurifier_Config Creates a new config object that inherits from a previous one.
isFinalized ( string | boolean $error = false ) : boolean Checks whether or not the configuration object is finalized.
loadArray ( array $config_array ) Loads configuration values from an array with the following structure: Namespace.Directive => Value
loadArrayFromForm ( array $array, string | boolean $index = false, array | boolean $allowed = true, boolean $mq_fix = true, HTMLPurifier_ConfigSchema $schema = null ) : mixed Loads configuration values from $_GET/$_POST that were posted via ConfigForm
loadIni ( string $filename ) Loads configuration values from an ini file
maybeGetRawCSSDefinition ( ) : HTMLPurifier_CSSDefinition
maybeGetRawDefinition ( $name )
maybeGetRawHTMLDefinition ( ) : HTMLPurifier_HTMLDefinition
maybeGetRawURIDefinition ( ) : HTMLPurifier_URIDefinition
mergeArrayFromForm ( array $array, string | boolean $index = false, array | boolean $allowed = true, boolean $mq_fix = true ) Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
prepareArrayFromForm ( array $array, string | boolean $index = false, array | boolean $allowed = true, boolean $mq_fix = true, HTMLPurifier_ConfigSchema $schema = null ) : array 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 ( string $key, mixed $value, mixed $a = null ) Sets a value to configuration.

Méthodes protégées

Méthode Description
triggerError ( string $msg, integer $no ) Produces a nicely formatted error message by supplying the stack frame information OUTSIDE of HTMLPurifier_Config.

Private Methods

Méthode Description
_listify ( array $lookup ) : string Convenience function for error reporting
initDefinition ( string $type ) : HTMLPurifier_CSSDefinition | HTMLPurifier_HTMLDefinition | HTMLPurifier_URIDefinition Initialise definition

Method Details

__construct() public méthode

Constructor
public __construct ( HTMLPurifier_ConfigSchema $definition, HTMLPurifier_PropertyList $parent = null )
$definition HTMLPurifier_ConfigSchema ConfigSchema that defines what directives are allowed.
$parent HTMLPurifier_PropertyList

autoFinalize() public méthode

Finalizes configuration only if auto finalize is on and not already finalized
public autoFinalize ( )

create() public static méthode

Convenience constructor that creates a config object based on a mixed var
public static create ( mixed $config, HTMLPurifier_ConfigSchema $schema = null ) : HTMLPurifier_Config
$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 Schema object
Résultat HTMLPurifier_Config Configured object

createDefault() public static méthode

Convenience constructor that creates a default configuration object.
public static createDefault ( ) : HTMLPurifier_Config
Résultat HTMLPurifier_Config default object.

finalize() public méthode

Finalizes a configuration object, prohibiting further change
public finalize ( )

get() public méthode

Retrieves a value from the configuration.
public get ( string $key, mixed $a = null ) : mixed
$key string String key
$a mixed
Résultat mixed

getAll() public méthode

Retrieves all directives, organized by namespace
public getAll ( )

getAllowedDirectivesForForm() public static méthode

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 $allowed, HTMLPurifier_ConfigSchema $schema = null ) : array
$allowed array List of allowed namespaces/directives
$schema HTMLPurifier_ConfigSchema Schema to use, if not global copy
Résultat array

getBatch() public méthode

Retrieves an array of directives to values from a given namespace
public getBatch ( string $namespace ) : array
$namespace string String namespace
Résultat array

getBatchSerial() public méthode

Returns a SHA-1 signature of a segment of the configuration object that uniquely identifies that particular configuration
public getBatchSerial ( string $namespace ) : string
$namespace string Namespace to get serial for
Résultat string

getCSSDefinition() public méthode

Retrieves object reference to the CSS definition
public getCSSDefinition ( boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_CSSDefinition
$raw boolean Return a copy that has not been setup yet. Must be called before it's been setup, otherwise won't work.
$optimized boolean 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.
Résultat HTMLPurifier_CSSDefinition

getDefinition() public méthode

Retrieves a definition
public getDefinition ( string $type, boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_Definition
$type string Type of definition: HTML, CSS, etc
$raw boolean Whether or not definition should be returned raw
$optimized boolean 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."
Résultat HTMLPurifier_Definition

getHTMLDefinition() public méthode

Retrieves object reference to the HTML definition.
public getHTMLDefinition ( boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_HTMLDefinition
$raw boolean Return a copy that has not been setup yet. Must be called before it's been setup, otherwise won't work.
$optimized boolean 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.
Résultat HTMLPurifier_HTMLDefinition

getSerial() public méthode

Returns a SHA-1 signature for the entire configuration object that uniquely identifies that particular configuration
public getSerial ( ) : string
Résultat string

getURIDefinition() public méthode

Retrieves object reference to the URI definition
public getURIDefinition ( boolean $raw = false, boolean $optimized = false ) : HTMLPurifier_URIDefinition
$raw boolean Return a copy that has not been setup yet. Must be called before it's been setup, otherwise won't work.
$optimized boolean 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.
Résultat HTMLPurifier_URIDefinition

inherit() public static méthode

Creates a new config object that inherits from a previous one.
public static inherit ( HTMLPurifier_Config $config ) : HTMLPurifier_Config
$config HTMLPurifier_Config Configuration object to inherit from.
Résultat HTMLPurifier_Config object with $config as its parent.

isFinalized() public méthode

Checks whether or not the configuration object is finalized.
public isFinalized ( string | boolean $error = false ) : boolean
$error string | boolean String error message, or false for no error
Résultat boolean

loadArray() public méthode

Loads configuration values from an array with the following structure: Namespace.Directive => Value
public loadArray ( array $config_array )
$config_array array Configuration associative array

loadArrayFromForm() public static méthode

Loads configuration values from $_GET/$_POST that were posted via ConfigForm
public static loadArrayFromForm ( array $array, string | boolean $index = false, array | boolean $allowed = true, boolean $mq_fix = true, HTMLPurifier_ConfigSchema $schema = null ) : mixed
$array array $_GET or $_POST array to import
$index string | boolean Index/name that the config variables are in
$allowed array | boolean List of allowed namespaces/directives
$mq_fix boolean Boolean whether or not to enable magic quotes fix
$schema HTMLPurifier_ConfigSchema Schema to use, if not global copy
Résultat mixed

loadIni() public méthode

Loads configuration values from an ini file
public loadIni ( string $filename )
$filename string Name of ini file

maybeGetRawCSSDefinition() public méthode

public maybeGetRawCSSDefinition ( ) : HTMLPurifier_CSSDefinition
Résultat HTMLPurifier_CSSDefinition

maybeGetRawDefinition() public méthode

public maybeGetRawDefinition ( $name )

maybeGetRawHTMLDefinition() public méthode

public maybeGetRawHTMLDefinition ( ) : HTMLPurifier_HTMLDefinition
Résultat HTMLPurifier_HTMLDefinition

maybeGetRawURIDefinition() public méthode

public maybeGetRawURIDefinition ( ) : HTMLPurifier_URIDefinition
Résultat HTMLPurifier_URIDefinition

mergeArrayFromForm() public méthode

Merges in configuration values from $_GET/$_POST to object. NOT STATIC.
public mergeArrayFromForm ( array $array, string | boolean $index = false, array | boolean $allowed = true, boolean $mq_fix = true )
$array array $_GET or $_POST array to import
$index string | boolean Index/name that the config variables are in
$allowed array | boolean List of allowed namespaces/directives
$mq_fix boolean Boolean whether or not to enable magic quotes fix

prepareArrayFromForm() public static méthode

Prepares an array from a form into something usable for the more strict parts of HTMLPurifier_Config
public static prepareArrayFromForm ( array $array, string | boolean $index = false, array | boolean $allowed = true, boolean $mq_fix = true, HTMLPurifier_ConfigSchema $schema = null ) : array
$array array $_GET or $_POST array to import
$index string | boolean Index/name that the config variables are in
$allowed array | boolean List of allowed namespaces/directives
$mq_fix boolean Boolean whether or not to enable magic quotes fix
$schema HTMLPurifier_ConfigSchema Schema to use, if not global copy
Résultat array

serialize() public méthode

Returns a serialized form of the configuration object that can be reconstituted.
public serialize ( ) : string
Résultat string

set() public méthode

Sets a value to configuration.
public set ( string $key, mixed $value, mixed $a = null )
$key string key
$value mixed value
$a mixed

triggerError() protected méthode

Produces a nicely formatted error message by supplying the stack frame information OUTSIDE of HTMLPurifier_Config.
protected triggerError ( string $msg, integer $no )
$msg string An error message
$no integer An error number

Property Details

$autoFinalize public_oe property

Whether or not to automatically finalize the object if a read operation is done.
public $autoFinalize

$chatty public_oe property

(useful when unit testing). This will also compress some errors and exceptions.
public $chatty

$def public_oe property

Reference HTMLPurifier_ConfigSchema for value checking.
public $def

$definitions protected_oe property

Indexed array of definitions.
protected $definitions

$finalized protected_oe property

Whether or not config is finalized.
protected $finalized

$parser protected_oe property

Parser for variables.
protected $parser

$plist protected_oe property

Property list containing configuration directives.
protected $plist

$serial protected_oe property

Serial for entire configuration object.
protected $serial

$serials protected_oe property

Namespace indexed array of serials for specific namespaces.
See also: getSerial() for more info.
protected $serials

$version public_oe property

HTML Purifier's version
public $version