Class HTMLPurifier_HTMLModule
Represents an XHTML 1.1 module, with information on elements, tags and attributes.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$attr_collections | Associative array of attribute collection names to attribute collection additions. More rarely used for adding attributes to the global collections. Example is the StyleAttribute module adding the style attribute to the Core. Corresponds to HTMLDefinition's attr_collections->info, since the object's data is only info, with extra behavior associated with it. | HTMLPurifier_HTMLModule | |
$content_sets | Associative array of content set names to content set additions. | HTMLPurifier_HTMLModule | |
$defines_child_def | Boolean flag that indicates whether or not getChildDef is implemented. | HTMLPurifier_HTMLModule | |
$elements | Informally, a list of elements this module changes. | HTMLPurifier_HTMLModule | |
$info | Associative array of element names to element definitions. | HTMLPurifier_HTMLModule | |
$info_attr_transform_post | List of HTMLPurifier_AttrTransform to be performed after validation. | HTMLPurifier_HTMLModule | |
$info_attr_transform_pre | List of HTMLPurifier_AttrTransform to be performed before validation. | HTMLPurifier_HTMLModule | |
$info_injector | List of HTMLPurifier_Injector to be performed during well-formedness fixing. | HTMLPurifier_HTMLModule | |
$info_tag_transform | Associative array of deprecated tag name to HTMLPurifier_TagTransform. | HTMLPurifier_HTMLModule | |
$name | Short unique string identifier of the module. | HTMLPurifier_HTMLModule | |
$safe | Boolean flag whether or not this module is safe. If it is not safe, all of its members are unsafe. Modules are safe by default (this might be slightly dangerous, but it doesn't make much sense to force HTML Purifier, which is based off of safe HTML, to explicitly say, "This is safe," even though there are modules which are "unsafe") | HTMLPurifier_HTMLModule |
Public Methods
Method | Description | Defined By |
---|---|---|
addBlankElement() | Convenience function that creates a totally blank, non-standalone element. | HTMLPurifier_HTMLModule |
addElement() | Convenience function that sets up a new element | HTMLPurifier_HTMLModule |
addElementToContentSet() | Convenience function that registers an element to a content set | HTMLPurifier_HTMLModule |
getChildDef() | Retrieves a proper HTMLPurifier_ChildDef subclass based on content_model and content_model_type member variables of the HTMLPurifier_ElementDef class. There is a similar function in HTMLPurifier_HTMLDefinition. | HTMLPurifier_HTMLModule |
makeLookup() | Convenience function that generates a lookup table with boolean true as value. | HTMLPurifier_HTMLModule |
mergeInAttrIncludes() | Convenience function that merges a list of attribute includes into an attribute array. | HTMLPurifier_HTMLModule |
parseContents() | Convenience function that transforms single-string contents into separate content model and content model type | HTMLPurifier_HTMLModule |
setup() | Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available. | HTMLPurifier_HTMLModule |
Property Details
This is commonly used to, say, add an A element to the Inline content set. This corresponds to an internal variable $content_sets and NOT info_content_sets member variable of HTMLDefinition.
For optimization reasons: may save a call to a function. Be sure to set it if you do implement getChildDef(), otherwise it will have no effect!
Not used in any significant way.
Some definitions may be incomplete, to be merged in later with the full definition.
An injector will only be invoked if all of it's pre-requisites are met; if an injector fails setup, there will be no error; it will simply be silently disabled.
Method Details
Convenience function that creates a totally blank, non-standalone element.
public HTMLPurifier_ElementDef addBlankElement ( $element ) | ||
$element | string | Name of element to create |
return | HTMLPurifier_ElementDef | Created element |
---|
Convenience function that sets up a new element
See also HTMLPurifier_ElementDef:: for in-depth descriptions of these parameters.
public HTMLPurifier_ElementDef addElement ( $element, $type, $contents, $attr_includes = [], $attr = [] ) | ||
$element | string | Name of element to add |
$type | string|bool | What content set should element be registered to?
|
$contents | string | Allowed children in form of:
|
$attr_includes | array | What attribute collections to register to
|
$attr | array | What unique attributes does the element define? |
return | HTMLPurifier_ElementDef | Created element definition object, so you
|
---|
Convenience function that registers an element to a content set
public void addElementToContentSet ( $element, $type ) | ||
$element | string | Element to register |
$type | string | Name content set (warning: case sensitive, usually upper-case
|
Retrieves a proper HTMLPurifier_ChildDef subclass based on content_model and content_model_type member variables of the HTMLPurifier_ElementDef class. There is a similar function in HTMLPurifier_HTMLDefinition.
public HTMLPurifier_ChildDef getChildDef ( $def ) | ||
$def | HTMLPurifier_ElementDef | |
return | HTMLPurifier_ChildDef | Subclass |
---|
Convenience function that generates a lookup table with boolean true as value.
public array makeLookup ( $list ) | ||
$list | string | List of values to turn into a lookup |
return | array | Array equivalent of list |
---|
Convenience function that merges a list of attribute includes into an attribute array.
public void mergeInAttrIncludes ( <b>&</b>$attr, $attr_includes ) | ||
$attr | array | Reference to attr array to modify |
$attr_includes | array | Array of includes / string include to merge in |
Convenience function that transforms single-string contents into separate content model and content model type
public array parseContents ( $contents ) | ||
$contents | string | Allowed children in form of:
|
Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available.
public void setup ( $config ) | ||
$config | HTMLPurifier_Config |