Class HTMLPurifier_HTMLDefinition
Inheritance | HTMLPurifier_HTMLDefinition » HTMLPurifier_Definition |
---|
Definition of the purified HTML that describes allowed children, attributes, and many other things.
Conventions:
All member variables that are prefixed with info (including the main $info array) are used by HTML Purifier internals and should not be directly edited when customizing the HTMLDefinition. They can usually be set via configuration directives or custom modules.
On the other hand, member variables without the info prefix are used internally by the HTMLDefinition and MUST NOT be used by other HTML Purifier internals. Many of them, however, are public, and may be edited by userspace code to tweak the behavior of HTMLDefinition.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$doctype | Doctype object | HTMLPurifier_HTMLDefinition | |
$info | Associative array of element names to HTMLPurifier_ElementDef. | HTMLPurifier_HTMLDefinition | |
$info_attr_transform_post | Indexed list of HTMLPurifier_AttrTransform to be performed after validation. | HTMLPurifier_HTMLDefinition | |
$info_attr_transform_pre | Indexed list of HTMLPurifier_AttrTransform to be performed before validation. | HTMLPurifier_HTMLDefinition | |
$info_block_wrapper | String name of element used to wrap inline elements in block context. | HTMLPurifier_HTMLDefinition | |
$info_content_sets | Nested lookup array of content set name (Block, Inline) to element name to whether or not it belongs in that content set. | HTMLPurifier_HTMLDefinition | |
$info_global_attr | Associative array of global attribute name to attribute definition. | HTMLPurifier_HTMLDefinition | |
$info_injector | Indexed list of HTMLPurifier_Injector to be used. | HTMLPurifier_HTMLDefinition | |
$info_parent | String name of parent element HTML will be going into. | HTMLPurifier_HTMLDefinition | |
$info_parent_def | Definition for parent element, allows parent element to be a tag that's not allowed inside the HTML fragment. | HTMLPurifier_HTMLDefinition | |
$info_tag_transform | Associative array of deprecated tag name to HTMLPurifier_TagTransform. | HTMLPurifier_HTMLDefinition | |
$manager | HTMLPurifier_HTMLDefinition | ||
$optimized | 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. | HTMLPurifier_Definition | |
$setup | Has setup() been called yet? | HTMLPurifier_Definition | |
$type | HTMLPurifier_HTMLDefinition |
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Performs low-cost, preliminary initialization. | HTMLPurifier_HTMLDefinition |
addAttribute() | Adds a custom attribute to a pre-existing element | HTMLPurifier_HTMLDefinition |
addBlankElement() | Adds a blank element to your HTML definition, for overriding existing behavior | HTMLPurifier_HTMLDefinition |
addElement() | Adds a custom element to your HTML definition | HTMLPurifier_HTMLDefinition |
getAnonymousModule() | Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module. | HTMLPurifier_HTMLDefinition |
parseTinyMCEAllowedList() | Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing. Format is element[attr1|attr2],element2. | HTMLPurifier_HTMLDefinition |
setup() | Setup function that aborts if already setup | HTMLPurifier_Definition |
Protected Methods
Method | Description | Defined By |
---|---|---|
doSetup() | HTMLPurifier_HTMLDefinition | |
processModules() | Extract out the information from the manager | HTMLPurifier_HTMLDefinition |
setupConfigStuff() | Sets up stuff based on config. We need a better way of doing this. | HTMLPurifier_HTMLDefinition |
Property Details
Method Details
Performs low-cost, preliminary initialization.
public void __construct ( ) |
Adds a custom attribute to a pre-existing element
public void addAttribute ( $element_name, $attr_name, $def ) | ||
$element_name | string | Element name to add attribute to |
$attr_name | string | Name of attribute |
$def | mixed | Attribute definition, can be string or object, see
|
Adds a blank element to your HTML definition, for overriding existing behavior
See also HTMLPurifier_HTMLModule::addBlankElement() for detailed parameter and return value descriptions.
public HTMLPurifier_ElementDef addBlankElement ( $element_name ) | ||
$element_name | string |
Adds a custom element to your HTML definition
See also HTMLPurifier_HTMLModule::addElement() for detailed parameter and return value descriptions.
public void addElement ( $element_name, $type, $contents, $attr_collections, $attributes = [] ) | ||
$element_name | ||
$type | ||
$contents | ||
$attr_collections | ||
$attributes |
protected void doSetup ( $config ) | ||
$config | HTMLPurifier_Config |
Retrieves a reference to the anonymous module, so you can bust out advanced features without having to make your own module.
public HTMLPurifier_HTMLModule getAnonymousModule ( ) |
Parses a TinyMCE-flavored Allowed Elements and Attributes list into separate lists for processing. Format is element[attr1|attr2],element2.
..
public array parseTinyMCEAllowedList ( $list ) | ||
$list | array | String list to parse |
Extract out the information from the manager
protected void processModules ( $config ) | ||
$config | HTMLPurifier_Config |
Sets up stuff based on config. We need a better way of doing this.
protected void setupConfigStuff ( $config ) | ||
$config | HTMLPurifier_Config |