HumHub Documentation (unofficial)

HTMLPurifier_ConfigSchema
in package

Configuration definition, defines directives and their defaults.

Table of Contents

Properties

$defaultPlist  : mixed
The default property list. Do not edit this property list.
$defaults  : mixed
Defaults of the directives and namespaces.
$info  : mixed
Definition of the directives.
$singleton  : mixed
Application-wide singleton

Methods

__construct()  : mixed
add()  : mixed
Defines a directive for configuration
addAlias()  : mixed
Defines a directive alias for backwards compatibility
addAllowedValues()  : mixed
Defines a set of allowed values for a directive.
addValueAliases()  : mixed
Defines a directive value alias.
instance()  : HTMLPurifier_ConfigSchema
Retrieves an instance of the application-wide configuration definition.
makeFromSerial()  : HTMLPurifier_ConfigSchema
Unserializes the default ConfigSchema.
postProcess()  : mixed
Replaces any stdClass that only has the type property with type integer.

Properties

$defaultPlist

The default property list. Do not edit this property list.

public mixed $defaultPlist
Tags
type

array

$defaults

Defaults of the directives and namespaces.

public mixed $defaults = array()
Tags
type

array

note

This shares the exact same structure as HTMLPurifier_Config::$conf

$info

Definition of the directives.

public mixed $info = array()

The structure of this is:

array( 'Namespace' => array( 'Directive' => new stdClass(), ) )

The stdClass may have the following properties:

  • If isAlias isn't set:
    • type: Integer type of directive, see HTMLPurifier_VarParser for definitions
    • allow_null: If set, this directive allows null values
    • aliases: If set, an associative array of value aliases to real values
    • allowed: If set, a lookup array of allowed (string) values
  • If isAlias is set:
    • namespace: Namespace this directive aliases to
    • name: Directive name this directive aliases to

In certain degenerate cases, stdClass will actually be an integer. In that case, the value is equivalent to an stdClass with the type property set to the integer. If the integer is negative, type is equal to the absolute value of integer, and allow_null is true.

This class is friendly with HTMLPurifier_Config. If you need introspection about the schema, you're better of using the ConfigSchema_Interchange, which uses more memory but has much richer information.

Tags
type

array

$singleton

Application-wide singleton

protected static mixed $singleton
Tags
type

HTMLPurifier_ConfigSchema

Methods

add()

Defines a directive for configuration

public add(string $key, mixed $default, string $type, bool $allow_null) : mixed
Parameters
$key : string

Name of directive

$default : mixed

Default value of directive

$type : string

Allowed type of the directive. See HTMLPurifier_VarParser::$types for allowed values

$allow_null : bool

Whether or not to allow null values

Tags
warning

Will fail of directive's namespace is defined.

warning

This method's signature is slightly different from the legacy define() static method! Beware!

addAlias()

Defines a directive alias for backwards compatibility

public addAlias(string $key, string $new_key) : mixed
Parameters
$key : string

Directive that will be aliased

$new_key : string

Directive that the alias will be to

addAllowedValues()

Defines a set of allowed values for a directive.

public addAllowedValues(string $key, array<string|int, mixed> $allowed) : mixed
Parameters
$key : string

Name of directive

$allowed : array<string|int, mixed>

Lookup array of allowed values

Tags
warning

This is slightly different from the corresponding static method definition.

addValueAliases()

Defines a directive value alias.

public addValueAliases(string $key, array<string|int, mixed> $aliases) : mixed

Directive value aliases are convenient for developers because it lets them set a directive to several values and get the same result.

Parameters
$key : string

Name of Directive

$aliases : array<string|int, mixed>

Hash of aliased values to the real alias

postProcess()

Replaces any stdClass that only has the type property with type integer.

public postProcess() : mixed

        
On this page

Search results