PHP Class HTMLPurifier_HTMLModule, yii

显示文件 Open project: yiisoft/yii Class Usage Examples

Public Properties

Property Type Description
$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.
$content_sets 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.
$defines_child_def 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!
$elements Not used in any significant way.
$info Some definitions may be incomplete, to be merged in later with the full definition.
$info_attr_transform_post List of HTMLPurifier_AttrTransform to be performed after validation.
$info_attr_transform_pre List of HTMLPurifier_AttrTransform to be performed before validation.
$info_injector 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.
$info_tag_transform Associative array of deprecated tag name to HTMLPurifier_TagTransform.
$name Short unique string identifier of the module.
$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")

Public Methods

Method Description
addBlankElement ( string $element ) : HTMLPurifier_ElementDef Convenience function that creates a totally blank, non-standalone element.
addElement ( string $element, string | boolean $type, string $contents, array $attr_includes = [], array $attr = [] ) : HTMLPurifier_ElementDef Convenience function that sets up a new element
addElementToContentSet ( string $element, string $type ) Convenience function that registers an element to a content set
getChildDef ( HTMLPurifier_ElementDef $def ) : HTMLPurifier_ChildDef 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.
makeLookup ( string $list ) : array Convenience function that generates a lookup table with boolean true as value.
mergeInAttrIncludes ( array &$attr, array $attr_includes ) Convenience function that merges a list of attribute includes into an attribute array.
parseContents ( string $contents ) : array Convenience function that transforms single-string contents into separate content model and content model type
setup ( HTMLPurifier_Config $config ) Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available.

Method Details

addBlankElement() public method

Convenience function that creates a totally blank, non-standalone element.
public addBlankElement ( string $element ) : HTMLPurifier_ElementDef
$element string Name of element to create
return HTMLPurifier_ElementDef Created element

addElement() public method

Convenience function that sets up a new element
public addElement ( string $element, string | boolean $type, string $contents, array $attr_includes = [], array $attr = [] ) : HTMLPurifier_ElementDef
$element string Name of element to add
$type string | boolean What content set should element be registered to? Set as false to skip this step.
$contents string Allowed children in form of: "$content_model_type: $content_model"
$attr_includes array What attribute collections to register to element?
$attr array What unique attributes does the element define?
return HTMLPurifier_ElementDef Created element definition object, so you can set advanced parameters

addElementToContentSet() public method

Convenience function that registers an element to a content set
public addElementToContentSet ( string $element, string $type )
$element string Element to register
$type string Name content set (warning: case sensitive, usually upper-case first letter)

getChildDef() public method

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 getChildDef ( HTMLPurifier_ElementDef $def ) : HTMLPurifier_ChildDef
$def HTMLPurifier_ElementDef
return HTMLPurifier_ChildDef subclass

makeLookup() public method

Convenience function that generates a lookup table with boolean true as value.
public makeLookup ( string $list ) : array
$list string List of values to turn into a lookup
return array array equivalent of list

mergeInAttrIncludes() public method

Convenience function that merges a list of attribute includes into an attribute array.
public mergeInAttrIncludes ( array &$attr, array $attr_includes )
$attr array Reference to attr array to modify
$attr_includes array Array of includes / string include to merge in

parseContents() public method

Convenience function that transforms single-string contents into separate content model and content model type
public parseContents ( string $contents ) : array
$contents string Allowed children in form of: "$content_model_type: $content_model"
return array

setup() public method

Lazy load construction of the module after determining whether or not it's needed, and also when a finalized configuration object is available.
public setup ( HTMLPurifier_Config $config )
$config HTMLPurifier_Config

Property Details

$attr_collections public_oe property

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.
public $attr_collections

$content_sets public_oe property

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.
public $content_sets

$defines_child_def public_oe property

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!
public $defines_child_def

$elements public_oe property

Not used in any significant way.
public $elements

$info public_oe property

Some definitions may be incomplete, to be merged in later with the full definition.
public $info

$info_attr_transform_post public_oe property

List of HTMLPurifier_AttrTransform to be performed after validation.
public $info_attr_transform_post

$info_attr_transform_pre public_oe property

List of HTMLPurifier_AttrTransform to be performed before validation.
public $info_attr_transform_pre

$info_injector public_oe property

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.
public $info_injector

$info_tag_transform public_oe property

Associative array of deprecated tag name to HTMLPurifier_TagTransform.
public $info_tag_transform

$name public_oe property

Short unique string identifier of the module.
public $name

$safe public_oe property

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")
public $safe