HTMLPurifier_ChildDef_Chameleon
extends HTMLPurifier_ChildDef
in package
Definition that uses different definitions depending on context.
The del and ins tags are notable because they allow different types of elements depending on whether or not they're in a block or inline context. Chameleon allows this behavior to happen by using two different definitions depending on context. While this somewhat generalized, it is specifically intended for those two tags.
Table of Contents
Properties
- $allow_empty : mixed
- Indicates whether or not an empty array of children is okay.
- $block : mixed
- Instance of the definition object to use when block.
- $elements : mixed
- Lookup array of all elements that this definition could possibly allow.
- $inline : mixed
- Instance of the definition object to use when inline. Usually stricter.
- $type : mixed
- Type of child definition, usually right-most part of class name lowercase.
Methods
- __construct() : mixed
- getAllowedElements() : array<string|int, mixed>
- Get lookup of tag names that should not close this element automatically.
- validateChildren() : bool
- Validates nodes according to definition and returns modification.
Properties
$allow_empty
Indicates whether or not an empty array of children is okay.
public
mixed
$allow_empty
This is necessary for redundant checking when changes affecting a child node may cause a parent node to now be disallowed.
Tags
$block
Instance of the definition object to use when block.
public
mixed
$block
Tags
$elements
Lookup array of all elements that this definition could possibly allow.
public
mixed
$elements
= array()
Tags
$inline
Instance of the definition object to use when inline. Usually stricter.
public
mixed
$inline
Tags
$type
Type of child definition, usually right-most part of class name lowercase.
public
mixed
$type
= 'chameleon'
Tags
Methods
__construct()
public
__construct(array<string|int, mixed> $inline, array<string|int, mixed> $block) : mixed
Parameters
- $inline : array<string|int, mixed>
-
List of elements to allow when inline.
- $block : array<string|int, mixed>
-
List of elements to allow when block.
getAllowedElements()
Get lookup of tag names that should not close this element automatically.
public
getAllowedElements(HTMLPurifier_Config $config) : array<string|int, mixed>
All other elements will do so.
Parameters
- $config : HTMLPurifier_Config
-
HTMLPurifier_Config object
Return values
array<string|int, mixed>validateChildren()
Validates nodes according to definition and returns modification.
public
validateChildren(array<string|int, HTMLPurifier_Node> $children, HTMLPurifier_Config $config, HTMLPurifier_Context $context) : bool
Parameters
- $children : array<string|int, HTMLPurifier_Node>
- $config : HTMLPurifier_Config
- $context : HTMLPurifier_Context