Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
HTMLPurifier_HTMLDefinition Class Reference
Inheritance diagram for HTMLPurifier_HTMLDefinition:
HTMLPurifier_Definition

Public Member Functions

 __construct ()
 Performs low-cost, preliminary initialization.
 
 addAttribute ($element_name, $attr_name, $def)
 Adds a custom attribute to a pre-existing element.
 
 addBlankElement ($element_name)
 Adds a blank element to your HTML definition, for overriding existing behavior.
 
 addElement ($element_name, $type, $contents, $attr_collections, $attributes=array())
 Adds a custom element to your HTML definition.
 
 getAnonymousModule ()
 Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.
 
 parseTinyMCEAllowedList ($list)
 Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing.
 
 setup ($config)
 Setup function that aborts if already setup.
 

Public Attributes

 $doctype
 Doctype object @type HTMLPurifier_Doctype.
 
 $info = array()
 Associative array of element names to HTMLPurifier_ElementDef.
 
 $info_attr_transform_post = array()
 Indexed list of HTMLPurifier_AttrTransform to be performed after validation.
 
 $info_attr_transform_pre = array()
 Indexed list of HTMLPurifier_AttrTransform to be performed before validation.
 
 $info_block_wrapper = 'p'
 String name of element used to wrap inline elements in block context.
 
 $info_content_sets = array()
 Nested lookup array of content set name (Block, Inline) to element name to whether or not it belongs in that content set.
 
 $info_global_attr = array()
 Associative array of global attribute name to attribute definition.
 
 $info_injector = array()
 Indexed list of HTMLPurifier_Injector to be used.
 
 $info_parent = 'div'
 String name of parent element HTML will be going into.
 
 $info_parent_def
 Definition for parent element, allows parent element to be a tag that's not allowed inside the HTML fragment.
 
 $info_tag_transform = array()
 Associative array of deprecated tag name to HTMLPurifier_TagTransform.
 
 $manager
 @type HTMLPurifier_HTMLModuleManager
 
 $optimized = null
 If true, write out the final definition object to the cache after setup.
 
 $setup = false
 Has setup() been called yet? @type bool.
 
 $type = 'HTML'
 @type string
 

Protected Member Functions

 doSetup ($config)
 
 processModules ($config)
 Extract out the information from the manager.
 
 setupConfigStuff ($config)
 Sets up stuff based on config.
 

Member Function Documentation

◆ addAttribute()

HTMLPurifier_HTMLDefinition::addAttribute ( $element_name,
$attr_name,
$def )

Adds a custom attribute to a pre-existing element.

Note
This is strictly convenience, and does not have a corresponding method in HTMLPurifier_HTMLModule
Parameters
string$element_nameElement name to add attribute to
string$attr_nameName of attribute
mixed$defAttribute definition, can be string or object, see HTMLPurifier_AttrTypes for details

◆ addBlankElement()

HTMLPurifier_HTMLDefinition::addBlankElement ( $element_name)

Adds a blank element to your HTML definition, for overriding existing behavior.

Parameters
string$element_name
Return values
HTMLPurifier_ElementDef
See also
HTMLPurifier_HTMLModule\addBlankElement() for detailed parameter and return value descriptions.

◆ addElement()

HTMLPurifier_HTMLDefinition::addElement ( $element_name,
$type,
$contents,
$attr_collections,
$attributes = array() )

Adds a custom element to your HTML definition.

See also
HTMLPurifier_HTMLModule\addElement() for detailed parameter and return value descriptions.

◆ doSetup()

HTMLPurifier_HTMLDefinition::doSetup ( $config)
protected
Parameters
HTMLPurifier_Config$config

Reimplemented from HTMLPurifier_Definition.

◆ getAnonymousModule()

HTMLPurifier_HTMLDefinition::getAnonymousModule ( )

Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.

Return values
HTMLPurifier_HTMLModule

◆ parseTinyMCEAllowedList()

HTMLPurifier_HTMLDefinition::parseTinyMCEAllowedList ( $list)

Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing.

Format is element[attr1|attr2],element2...

Warning
Although it's largely drawn from TinyMCE's implementation, it is different, and you'll probably have to modify your lists
Parameters
array$listString list to parse
Return values
array
Todo
Give this its own class, probably static interface

◆ processModules()

HTMLPurifier_HTMLDefinition::processModules ( $config)
protected

Extract out the information from the manager.

Parameters
HTMLPurifier_Config$config

◆ setup()

HTMLPurifier_Definition::setup ( $config)
inherited

Setup function that aborts if already setup.

Parameters
HTMLPurifier_Config$config

◆ setupConfigStuff()

HTMLPurifier_HTMLDefinition::setupConfigStuff ( $config)
protected

Sets up stuff based on config.

We need a better way of doing this.

Parameters
HTMLPurifier_Config$config

Member Data Documentation

◆ $info

HTMLPurifier_HTMLDefinition::$info = array()

Associative array of element names to HTMLPurifier_ElementDef.

@type HTMLPurifier_ElementDef[]

◆ $info_attr_transform_post

HTMLPurifier_HTMLDefinition::$info_attr_transform_post = array()

Indexed list of HTMLPurifier_AttrTransform to be performed after validation.

@type HTMLPurifier_AttrTransform[]

◆ $info_attr_transform_pre

HTMLPurifier_HTMLDefinition::$info_attr_transform_pre = array()

Indexed list of HTMLPurifier_AttrTransform to be performed before validation.

@type HTMLPurifier_AttrTransform[]

◆ $info_block_wrapper

HTMLPurifier_HTMLDefinition::$info_block_wrapper = 'p'

String name of element used to wrap inline elements in block context.

@type string

Note
This is rarely used except for BLOCKQUOTEs in strict mode

◆ $info_content_sets

HTMLPurifier_HTMLDefinition::$info_content_sets = array()

Nested lookup array of content set name (Block, Inline) to element name to whether or not it belongs in that content set.

@type array

◆ $info_global_attr

HTMLPurifier_HTMLDefinition::$info_global_attr = array()

Associative array of global attribute name to attribute definition.

@type array

◆ $info_injector

HTMLPurifier_HTMLDefinition::$info_injector = array()

Indexed list of HTMLPurifier_Injector to be used.

@type HTMLPurifier_Injector[]

◆ $info_parent

HTMLPurifier_HTMLDefinition::$info_parent = 'div'

String name of parent element HTML will be going into.

@type string

◆ $info_parent_def

HTMLPurifier_HTMLDefinition::$info_parent_def

Definition for parent element, allows parent element to be a tag that's not allowed inside the HTML fragment.

@type HTMLPurifier_ElementDef

◆ $info_tag_transform

HTMLPurifier_HTMLDefinition::$info_tag_transform = array()

Associative array of deprecated tag name to HTMLPurifier_TagTransform.

@type array

◆ $optimized

HTMLPurifier_Definition::$optimized = null
inherited

If true, write out the final definition object to the cache after setup.

This will be true only if all invocations to get a raw definition object are also optimized. This does not cause file system thrashing because on subsequent calls the cached object is used and any writes to the raw definition object are short circuited. See enduser-customize.html for the high-level picture. @type bool


The documentation for this class was generated from the following file: