HumHub Documentation (unofficial)

HTMLPurifier_HTMLModuleManager
in package

Table of Contents

Properties

$attrCollections  : mixed
$attrTypes  : mixed
$contentSets  : mixed
$doctype  : mixed
Instance of current doctype.
$doctypes  : mixed
$elementLookup  : mixed
Associative array of element name to list of modules that have definitions for the element; this array is dynamically filled.
$modules  : mixed
Active instances of modules for the specified doctype are indexed, by name, in this array.
$prefixes  : mixed
List of prefixes we should use for registering small names.
$registeredModules  : mixed
Array of recognized HTMLPurifier_HTMLModule instances, indexed by module's class name. This array is usually lazy loaded, but a user can overload a module by pre-emptively registering it.
$trusted  : mixed
If set to true, unsafe elements and attributes will be allowed.
$userModules  : mixed
List of extra modules that were added by the user using addModule(). These get unconditionally merged into the current doctype, whatever it may be.

Methods

__construct()  : mixed
addModule()  : mixed
Adds a module to the current doctype by first registering it, and then tacking it on to the active doctype
addPrefix()  : mixed
Adds a class prefix that registerModule() will use to resolve a string name to a concrete class
getElement()  : HTMLPurifier_ElementDef
Retrieves a single merged element definition
getElements()  : array<string|int, mixed>
Retrieves merged element definitions.
processModule()  : mixed
Takes a module and adds it to the active module collection, registering it if necessary.
registerModule()  : mixed
Registers a module to the recognized module list, useful for overloading pre-existing modules.
setup()  : mixed
Performs processing on modules, after being called you may use getElement() and getElements()

Properties

$attrCollections

public mixed $attrCollections
Tags
type

HTMLPurifier_AttrCollections

$doctype

Instance of current doctype.

public mixed $doctype
Tags
type

string

$elementLookup

Associative array of element name to list of modules that have definitions for the element; this array is dynamically filled.

public mixed $elementLookup = array()
Tags
type

array

$modules

Active instances of modules for the specified doctype are indexed, by name, in this array.

public mixed $modules = array()
Tags
type

HTMLPurifier_HTMLModule[]

$prefixes

List of prefixes we should use for registering small names.

public mixed $prefixes = array('HTMLPurifier_HTMLModule_')
Tags
type

array

$registeredModules

Array of recognized HTMLPurifier_HTMLModule instances, indexed by module's class name. This array is usually lazy loaded, but a user can overload a module by pre-emptively registering it.

public mixed $registeredModules = array()
Tags
type

HTMLPurifier_HTMLModule[]

$trusted

If set to true, unsafe elements and attributes will be allowed.

public mixed $trusted = \false
Tags
type

bool

$userModules

List of extra modules that were added by the user using addModule(). These get unconditionally merged into the current doctype, whatever it may be.

public mixed $userModules = array()
Tags
type

HTMLPurifier_HTMLModule[]

Methods

addModule()

Adds a module to the current doctype by first registering it, and then tacking it on to the active doctype

public addModule(mixed $module) : mixed
Parameters
$module : mixed

addPrefix()

Adds a class prefix that registerModule() will use to resolve a string name to a concrete class

public addPrefix(mixed $prefix) : mixed
Parameters
$prefix : mixed

getElement()

Retrieves a single merged element definition

public getElement(string $name[, bool $trusted = null ]) : HTMLPurifier_ElementDef
Parameters
$name : string

Name of element

$trusted : bool = null

Boolean trusted overriding parameter: set to true if you want the full version of an element

Tags
note

You may notice that modules are getting iterated over twice (once in getElements() and once here). This is because

Return values
HTMLPurifier_ElementDef

Merged HTMLPurifier_ElementDef

getElements()

Retrieves merged element definitions.

public getElements() : array<string|int, mixed>
Return values
array<string|int, mixed>

of HTMLPurifier_ElementDef

processModule()

Takes a module and adds it to the active module collection, registering it if necessary.

public processModule(mixed $module) : mixed
Parameters
$module : mixed

registerModule()

Registers a module to the recognized module list, useful for overloading pre-existing modules.

public registerModule(mixed $module[, mixed $overload = false ]) : mixed
Parameters
$module : mixed

Mixed: string module name, with or without HTMLPurifier_HTMLModule prefix, or instance of subclass of HTMLPurifier_HTMLModule.

$overload : mixed = false

Boolean whether or not to overload previous modules. If this is not set, and you do overload a module, HTML Purifier will complain with a warning.

Tags
note

This function will not call autoload, you must instantiate (and thus invoke) autoload outside the method.

note

If a string is passed as a module name, different variants will be tested in this order:

  • Check for HTMLPurifier_HTMLModule_$name
  • Check all prefixes with $name in order they were added
  • Check for literal object name
  • Throw fatal error If your object name collides with an internal class, specify your module manually. All modules must have been included externally: registerModule will not perform inclusions for you!

        
On this page

Search results