PHP Класс HTMLPurifier_Config, yii

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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)

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
triggerError ( string $msg, integer $no ) Produces a nicely formatted error message by supplying the stack frame information OUTSIDE of HTMLPurifier_Config.

Приватные методы

Метод Описание
_listify ( array $lookup ) : string Convenience function for error reporting
initDefinition ( string $type ) : HTMLPurifier_CSSDefinition | HTMLPurifier_HTMLDefinition | HTMLPurifier_URIDefinition Initialise definition

Описание методов

__construct() публичный Метод

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

autoFinalize() публичный Метод

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

create() публичный статический Метод

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
Результат HTMLPurifier_Config Configured object

createDefault() публичный статический Метод

Convenience constructor that creates a default configuration object.
public static createDefault ( ) : HTMLPurifier_Config
Результат HTMLPurifier_Config default object.

finalize() публичный Метод

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

get() публичный Метод

Retrieves a value from the configuration.
public get ( string $key, mixed $a = null ) : mixed
$key string String key
$a mixed
Результат mixed

getAll() публичный Метод

Retrieves all directives, organized by namespace
public getAll ( )

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 $allowed, HTMLPurifier_ConfigSchema $schema = null ) : array
$allowed array List of allowed namespaces/directives
$schema HTMLPurifier_ConfigSchema Schema to use, if not global copy
Результат array

getBatch() публичный Метод

Retrieves an array of directives to values from a given namespace
public getBatch ( string $namespace ) : array
$namespace string String namespace
Результат array

getBatchSerial() публичный Метод

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
Результат string

getCSSDefinition() публичный Метод

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.
Результат HTMLPurifier_CSSDefinition

getDefinition() публичный Метод

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."
Результат HTMLPurifier_Definition

getHTMLDefinition() публичный Метод

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.
Результат HTMLPurifier_HTMLDefinition

getSerial() публичный Метод

Returns a SHA-1 signature for the entire configuration object that uniquely identifies that particular configuration
public getSerial ( ) : string
Результат string

getURIDefinition() публичный Метод

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.
Результат HTMLPurifier_URIDefinition

inherit() публичный статический Метод

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.
Результат HTMLPurifier_Config object with $config as its parent.

isFinalized() публичный Метод

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
Результат boolean

loadArray() публичный Метод

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() публичный статический Метод

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
Результат mixed

loadIni() публичный Метод

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

maybeGetRawCSSDefinition() публичный Метод

public maybeGetRawCSSDefinition ( ) : HTMLPurifier_CSSDefinition
Результат HTMLPurifier_CSSDefinition

maybeGetRawDefinition() публичный Метод

public maybeGetRawDefinition ( $name )

maybeGetRawHTMLDefinition() публичный Метод

public maybeGetRawHTMLDefinition ( ) : HTMLPurifier_HTMLDefinition
Результат HTMLPurifier_HTMLDefinition

maybeGetRawURIDefinition() публичный Метод

public maybeGetRawURIDefinition ( ) : HTMLPurifier_URIDefinition
Результат HTMLPurifier_URIDefinition

mergeArrayFromForm() публичный Метод

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() публичный статический Метод

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
Результат array

serialize() публичный Метод

Returns a serialized form of the configuration object that can be reconstituted.
public serialize ( ) : string
Результат string

set() публичный Метод

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

triggerError() защищенный Метод

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

Описание свойств

$autoFinalize публичное свойство

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

$chatty публичное свойство

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

$def публичное свойство

Reference HTMLPurifier_ConfigSchema for value checking.
public $def

$definitions защищенное свойство

Indexed array of definitions.
protected $definitions

$finalized защищенное свойство

Whether or not config is finalized.
protected $finalized

$parser защищенное свойство

Parser for variables.
protected $parser

$plist защищенное свойство

Property list containing configuration directives.
protected $plist

$serial защищенное свойство

Serial for entire configuration object.
protected $serial

$serials защищенное свойство

Namespace indexed array of serials for specific namespaces.
См. также: getSerial() for more info.
protected $serials

$version публичное свойство

HTML Purifier's version
public $version