Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403]

(no description)

File Size: 920 lines (32 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: HTMLPurifier_Config  - X-Ref

Configuration object that triggers customizable behavior.

__construct($definition, $parent = null)   X-Ref
Constructor

param: HTMLPurifier_ConfigSchema $definition ConfigSchema that defines
param: HTMLPurifier_PropertyList $parent

create($config, $schema = null)   X-Ref
Convenience constructor that creates a config object based on a mixed var

param: mixed $config Variable that defines the state of the config
param: HTMLPurifier_ConfigSchema $schema Schema object
return: HTMLPurifier_Config Configured object

inherit(HTMLPurifier_Config $config)   X-Ref
Creates a new config object that inherits from a previous one.

param: HTMLPurifier_Config $config Configuration object to inherit from.
return: HTMLPurifier_Config object with $config as its parent.

createDefault()   X-Ref
Convenience constructor that creates a default configuration object.

return: HTMLPurifier_Config default object.

get($key, $a = null)   X-Ref
Retrieves a value from the configuration.

param: string $key String key
param: mixed $a
return: mixed

getBatch($namespace)   X-Ref
Retrieves an array of directives to values from a given namespace

param: string $namespace String namespace
return: array

getBatchSerial($namespace)   X-Ref
Returns a SHA-1 signature of a segment of the configuration object
that uniquely identifies that particular configuration

param: string $namespace Namespace to get serial for
return: string

getSerial()   X-Ref
Returns a SHA-1 signature for the entire configuration object
that uniquely identifies that particular configuration

return: string

getAll()   X-Ref
Retrieves all directives, organized by namespace


set($key, $value, $a = null)   X-Ref
Sets a value to configuration.

param: string $key key
param: mixed $value value
param: mixed $a

_listify($lookup)   X-Ref
Convenience function for error reporting

param: array $lookup
return: string

getHTMLDefinition($raw = false, $optimized = false)   X-Ref
Retrieves object reference to the HTML definition.

param: bool $raw Return a copy that has not been setup yet. Must be
param: bool $optimized If true, this method may return null, to
return: HTMLPurifier_HTMLDefinition|null

getCSSDefinition($raw = false, $optimized = false)   X-Ref
Retrieves object reference to the CSS definition

param: bool $raw Return a copy that has not been setup yet. Must be
param: bool $optimized If true, this method may return null, to
return: HTMLPurifier_CSSDefinition|null

getURIDefinition($raw = false, $optimized = false)   X-Ref
Retrieves object reference to the URI definition

param: bool $raw Return a copy that has not been setup yet. Must be
param: bool $optimized If true, this method may return null, to
return: HTMLPurifier_URIDefinition|null

getDefinition($type, $raw = false, $optimized = false)   X-Ref
Retrieves a definition

param: string $type Type of definition: HTML, CSS, etc
param: bool $raw Whether or not definition should be returned raw
param: bool $optimized Only has an effect when $raw is true.  Whether
return: HTMLPurifier_Definition|null

initDefinition($type)   X-Ref
Initialise definition

param: string $type What type of definition to create
return: HTMLPurifier_CSSDefinition|HTMLPurifier_HTMLDefinition|HTMLPurifier_URIDefinition

maybeGetRawDefinition($name)   X-Ref
No description

maybeGetRawHTMLDefinition()   X-Ref

return: HTMLPurifier_HTMLDefinition|null

maybeGetRawCSSDefinition()   X-Ref

return: HTMLPurifier_CSSDefinition|null

maybeGetRawURIDefinition()   X-Ref

return: HTMLPurifier_URIDefinition|null

loadArray($config_array)   X-Ref
Loads configuration values from an array with the following structure:
Namespace.Directive => Value

param: array $config_array Configuration associative array

getAllowedDirectivesForForm($allowed, $schema = null)   X-Ref
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.

param: array $allowed List of allowed namespaces/directives
param: HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
return: array

loadArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null)   X-Ref
Loads configuration values from $_GET/$_POST that were posted
via ConfigForm

param: array $array $_GET or $_POST array to import
param: string|bool $index Index/name that the config variables are in
param: array|bool $allowed List of allowed namespaces/directives
param: bool $mq_fix Boolean whether or not to enable magic quotes fix
param: HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
return: mixed

mergeArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true)   X-Ref
Merges in configuration values from $_GET/$_POST to object. NOT STATIC.

param: array $array $_GET or $_POST array to import
param: string|bool $index Index/name that the config variables are in
param: array|bool $allowed List of allowed namespaces/directives
param: bool $mq_fix Boolean whether or not to enable magic quotes fix

prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null)   X-Ref
Prepares an array from a form into something usable for the more
strict parts of HTMLPurifier_Config

param: array $array $_GET or $_POST array to import
param: string|bool $index Index/name that the config variables are in
param: array|bool $allowed List of allowed namespaces/directives
param: bool $mq_fix Boolean whether or not to enable magic quotes fix
param: HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
return: array

loadIni($filename)   X-Ref
Loads configuration values from an ini file

param: string $filename Name of ini file

isFinalized($error = false)   X-Ref
Checks whether or not the configuration object is finalized.

param: string|bool $error String error message, or false for no error
return: bool

autoFinalize()   X-Ref
Finalizes configuration only if auto finalize is on and not
already finalized


finalize()   X-Ref
Finalizes a configuration object, prohibiting further change


triggerError($msg, $no)   X-Ref
Produces a nicely formatted error message by supplying the
stack frame information OUTSIDE of HTMLPurifier_Config.

param: string $msg An error message
param: int $no An error number

serialize()   X-Ref
Returns a serialized form of the configuration object that can
be reconstituted.

return: string