HTMLPurifier_ConfigSchema Class Reference

Configuration definition, defines directives and their defaults. More...

List of all members.

Public Member Functions

 add ($namespace, $name, $default, $type, $allow_null)
 Defines a directive for configuration.
 addNamespace ($namespace)
 Defines a namespace for directives to be put into.
 addValueAliases ($namespace, $name, $aliases)
 Defines a directive value alias.
 addAllowedValues ($namespace, $name, $allowed)
 Defines a set of allowed values for a directive.
 addAlias ($namespace, $name, $new_namespace, $new_name)
 Defines a directive alias for backwards compatibility.
 postProcess ()
 Replaces any stdclass that only has the type property with type integer.
 validate ($a, $b, $c=false)
 add ($namespace, $name, $default, $type, $allow_null)
 Defines a directive for configuration.
 addNamespace ($namespace)
 Defines a namespace for directives to be put into.
 addValueAliases ($namespace, $name, $aliases)
 Defines a directive value alias.
 addAllowedValues ($namespace, $name, $allowed)
 Defines a set of allowed values for a directive.
 addAlias ($namespace, $name, $new_namespace, $new_name)
 Defines a directive alias for backwards compatibility.
 postProcess ()
 Replaces any stdclass that only has the type property with type integer.
 validate ($a, $b, $c=false)

Static Public Member Functions

static makeFromSerial ()
 Unserializes the default ConfigSchema.
static instance ($prototype=null)
 Retrieves an instance of the application-wide configuration definition.
static define ($namespace, $name, $default, $type, $description)
 
See also:
HTMLPurifier_ConfigSchema->set()

static defineNamespace ($namespace, $description)
 
See also:
HTMLPurifier_ConfigSchema->addNamespace()

static defineValueAliases ($namespace, $name, $aliases)
 
See also:
HTMLPurifier_ConfigSchema->addValueAliases()

static defineAllowedValues ($namespace, $name, $allowed_values)
 
See also:
HTMLPurifier_ConfigSchema->addAllowedValues()

static defineAlias ($namespace, $name, $new_namespace, $new_name)
 
See also:
HTMLPurifier_ConfigSchema->addAlias()

static makeFromSerial ()
 Unserializes the default ConfigSchema.
static instance ($prototype=null)
 Retrieves an instance of the application-wide configuration definition.
static define ($namespace, $name, $default, $type, $description)
 
See also:
HTMLPurifier_ConfigSchema->set()

static defineNamespace ($namespace, $description)
 
See also:
HTMLPurifier_ConfigSchema->addNamespace()

static defineValueAliases ($namespace, $name, $aliases)
 
See also:
HTMLPurifier_ConfigSchema->addValueAliases()

static defineAllowedValues ($namespace, $name, $allowed_values)
 
See also:
HTMLPurifier_ConfigSchema->addAllowedValues()

static defineAlias ($namespace, $name, $new_namespace, $new_name)
 
See also:
HTMLPurifier_ConfigSchema->addAlias()


Public Attributes

 $defaults = array()
 Defaults of the directives and namespaces.
 $info = array()
 Definition of the directives.

Static Protected Attributes

static $singleton
 Application-wide singleton.

Static Private Member Functions

static deprecated ($method)
 Throws an E_USER_NOTICE stating that a method is deprecated.
static deprecated ($method)
 Throws an E_USER_NOTICE stating that a method is deprecated.


Detailed Description

Configuration definition, defines directives and their defaults.

Definition at line 6 of file ConfigSchema.php.


Member Function Documentation

static HTMLPurifier_ConfigSchema::makeFromSerial (  )  [static]

Unserializes the default ConfigSchema.

Definition at line 53 of file ConfigSchema.php.

Referenced by instance().

static HTMLPurifier_ConfigSchema::instance ( prototype = null  )  [static]

Retrieves an instance of the application-wide configuration definition.

Definition at line 60 of file ConfigSchema.php.

References $singleton, and makeFromSerial().

Referenced by HTMLPurifier_Config::createDefault(), define(), defineAlias(), defineAllowedValues(), defineNamespace(), defineValueAliases(), and HTMLPurifier_Config::getAllowedDirectivesForForm().

HTMLPurifier_ConfigSchema::add ( namespace,
name,
default,
type,
allow_null 
)

Defines a directive for configuration.

Warning:
Will fail of directive's namespace is defined.

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

Parameters:
$namespace Namespace the directive is in
$name Key of directive
$default Default value of directive
$type Allowed type of the directive. See HTMLPurifier_DirectiveDef::$type for allowed values
$allow_null Whether or not to allow null values

Definition at line 81 of file ConfigSchema.php.

References HTMLPurifier_VarParser::$types.

HTMLPurifier_ConfigSchema::addNamespace ( namespace  ) 

Defines a namespace for directives to be put into.

Warning:
This is slightly different from the corresponding static method.
Parameters:
$namespace Namespace's name

Definition at line 95 of file ConfigSchema.php.

HTMLPurifier_ConfigSchema::addValueAliases ( namespace,
name,
aliases 
)

Defines a directive value alias.

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

Parameters:
$namespace Directive's namespace
$name Name of Directive
$aliases Hash of aliased values to the real alias

Definition at line 109 of file ConfigSchema.php.

HTMLPurifier_ConfigSchema::addAllowedValues ( namespace,
name,
allowed 
)

Defines a set of allowed values for a directive.

Warning:
This is slightly different from the corresponding static method definition.
Parameters:
$namespace Namespace of directive
$name Name of directive
$allowed Lookup array of allowed values

Definition at line 126 of file ConfigSchema.php.

HTMLPurifier_ConfigSchema::addAlias ( namespace,
name,
new_namespace,
new_name 
)

Defines a directive alias for backwards compatibility.

Parameters:
$namespace 
$name Directive that will be aliased
$new_namespace 
$new_name Directive that the alias will be to

Definition at line 137 of file ConfigSchema.php.

HTMLPurifier_ConfigSchema::postProcess (  ) 

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

Definition at line 148 of file ConfigSchema.php.

References $info.

static HTMLPurifier_ConfigSchema::define ( namespace,
name,
default,
type,
description 
) [static]

See also:
HTMLPurifier_ConfigSchema->set()

Definition at line 163 of file ConfigSchema.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineNamespace ( namespace,
description 
) [static]

See also:
HTMLPurifier_ConfigSchema->addNamespace()

Definition at line 174 of file ConfigSchema.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineValueAliases ( namespace,
name,
aliases 
) [static]

See also:
HTMLPurifier_ConfigSchema->addValueAliases()

Definition at line 181 of file ConfigSchema.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineAllowedValues ( namespace,
name,
allowed_values 
) [static]

See also:
HTMLPurifier_ConfigSchema->addAllowedValues()

Definition at line 188 of file ConfigSchema.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineAlias ( namespace,
name,
new_namespace,
new_name 
) [static]

See also:
HTMLPurifier_ConfigSchema->addAlias()

Definition at line 199 of file ConfigSchema.php.

References deprecated(), and instance().

HTMLPurifier_ConfigSchema::validate ( a,
b,
c = false 
)

Deprecated:
, use HTMLPurifier_VarParser->parse()

Definition at line 206 of file ConfigSchema.php.

static HTMLPurifier_ConfigSchema::deprecated ( method  )  [static, private]

Throws an E_USER_NOTICE stating that a method is deprecated.

Definition at line 215 of file ConfigSchema.php.

Referenced by define(), defineAlias(), defineAllowedValues(), defineNamespace(), and defineValueAliases().

static HTMLPurifier_ConfigSchema::makeFromSerial (  )  [static]

Unserializes the default ConfigSchema.

Definition at line 1765 of file HTMLPurifier.standalone.php.

static HTMLPurifier_ConfigSchema::instance ( prototype = null  )  [static]

Retrieves an instance of the application-wide configuration definition.

Definition at line 1772 of file HTMLPurifier.standalone.php.

References $singleton, and makeFromSerial().

HTMLPurifier_ConfigSchema::add ( namespace,
name,
default,
type,
allow_null 
)

Defines a directive for configuration.

Warning:
Will fail of directive's namespace is defined.

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

Parameters:
$namespace Namespace the directive is in
$name Key of directive
$default Default value of directive
$type Allowed type of the directive. See HTMLPurifier_DirectiveDef::$type for allowed values
$allow_null Whether or not to allow null values

Definition at line 1793 of file HTMLPurifier.standalone.php.

References HTMLPurifier_VarParser::$types.

HTMLPurifier_ConfigSchema::addNamespace ( namespace  ) 

Defines a namespace for directives to be put into.

Warning:
This is slightly different from the corresponding static method.
Parameters:
$namespace Namespace's name

Definition at line 1807 of file HTMLPurifier.standalone.php.

HTMLPurifier_ConfigSchema::addValueAliases ( namespace,
name,
aliases 
)

Defines a directive value alias.

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

Parameters:
$namespace Directive's namespace
$name Name of Directive
$aliases Hash of aliased values to the real alias

Definition at line 1821 of file HTMLPurifier.standalone.php.

HTMLPurifier_ConfigSchema::addAllowedValues ( namespace,
name,
allowed 
)

Defines a set of allowed values for a directive.

Warning:
This is slightly different from the corresponding static method definition.
Parameters:
$namespace Namespace of directive
$name Name of directive
$allowed Lookup array of allowed values

Definition at line 1838 of file HTMLPurifier.standalone.php.

HTMLPurifier_ConfigSchema::addAlias ( namespace,
name,
new_namespace,
new_name 
)

Defines a directive alias for backwards compatibility.

Parameters:
$namespace 
$name Directive that will be aliased
$new_namespace 
$new_name Directive that the alias will be to

Definition at line 1849 of file HTMLPurifier.standalone.php.

HTMLPurifier_ConfigSchema::postProcess (  ) 

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

Definition at line 1860 of file HTMLPurifier.standalone.php.

References $info.

static HTMLPurifier_ConfigSchema::define ( namespace,
name,
default,
type,
description 
) [static]

See also:
HTMLPurifier_ConfigSchema->set()

Definition at line 1875 of file HTMLPurifier.standalone.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineNamespace ( namespace,
description 
) [static]

See also:
HTMLPurifier_ConfigSchema->addNamespace()

Definition at line 1886 of file HTMLPurifier.standalone.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineValueAliases ( namespace,
name,
aliases 
) [static]

See also:
HTMLPurifier_ConfigSchema->addValueAliases()

Definition at line 1893 of file HTMLPurifier.standalone.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineAllowedValues ( namespace,
name,
allowed_values 
) [static]

See also:
HTMLPurifier_ConfigSchema->addAllowedValues()

Definition at line 1900 of file HTMLPurifier.standalone.php.

References deprecated(), and instance().

static HTMLPurifier_ConfigSchema::defineAlias ( namespace,
name,
new_namespace,
new_name 
) [static]

See also:
HTMLPurifier_ConfigSchema->addAlias()

Definition at line 1911 of file HTMLPurifier.standalone.php.

References deprecated(), and instance().

HTMLPurifier_ConfigSchema::validate ( a,
b,
c = false 
)

Deprecated:
, use HTMLPurifier_VarParser->parse()

Definition at line 1918 of file HTMLPurifier.standalone.php.

static HTMLPurifier_ConfigSchema::deprecated ( method  )  [static, private]

Throws an E_USER_NOTICE stating that a method is deprecated.

Definition at line 1927 of file HTMLPurifier.standalone.php.


Member Data Documentation

HTMLPurifier_ConfigSchema::$defaults = array()

Defaults of the directives and namespaces.

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

Definition at line 12 of file ConfigSchema.php.

HTMLPurifier_ConfigSchema::$info = array()

Definition of the directives.

The structure of this is:

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

The stdclass may have the following properties:

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.

Definition at line 43 of file ConfigSchema.php.

Referenced by postProcess().

HTMLPurifier_ConfigSchema::$singleton [static, protected]

Application-wide singleton.

Definition at line 48 of file ConfigSchema.php.

Referenced by instance().


The documentation for this class was generated from the following files:
Generated on Thu Jun 19 18:47:29 2008 for HTMLPurifier by  doxygen 1.5.3