Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 920 lines (33 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

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

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

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

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.

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

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

return: array
param: string $namespace String namespace

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

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

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

return: string
param: array $lookup

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

return: HTMLPurifier_HTMLDefinition|null
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

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

return: HTMLPurifier_CSSDefinition|null
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

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

return: HTMLPurifier_URIDefinition|null
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

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

return: HTMLPurifier_Definition|null
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

initDefinition($type)   X-Ref
Initialise definition

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

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.

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

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

return: mixed
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

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

return: array
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

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.

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

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