ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
HTMLPurifier_ChildDef_Chameleon Class Reference

Definition that uses different definitions depending on context. More...

+ Inheritance diagram for HTMLPurifier_ChildDef_Chameleon:
+ Collaboration diagram for HTMLPurifier_ChildDef_Chameleon:

Public Member Functions

 __construct ($inline, $block)
 
 validateChildren ($children, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_ChildDef
 getAllowedElements ($config)
 Get lookup of tag names that should not close this element automatically. More...
 
 validateChildren ($children, $config, $context)
 Validates nodes according to definition and returns modification. More...
 

Data Fields

 $inline
 Instance of the definition object to use when inline. More...
 
 $block
 Instance of the definition object to use when block. More...
 
 $type = 'chameleon'
 string More...
 
- Data Fields inherited from HTMLPurifier_ChildDef
 $type
 Type of child definition, usually right-most part of class name lowercase. More...
 
 $allow_empty
 Indicates whether or not an empty array of children is okay. More...
 
 $elements = array()
 Lookup array of all elements that this definition could possibly allow. More...
 

Detailed Description

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.

Definition at line 12 of file Chameleon.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_ChildDef_Chameleon::__construct (   $inline,
  $block 
)
Parameters
array$inlineList of elements to allow when inline.
array$blockList of elements to allow when block.

Definition at line 36 of file Chameleon.php.

References $block, and $inline.

37  {
38  $this->inline = new HTMLPurifier_ChildDef_Optional($inline);
39  $this->block = new HTMLPurifier_ChildDef_Optional($block);
40  $this->elements = $this->block->elements;
41  }
Definition that allows a set of elements, and allows no children.
Definition: Optional.php:10
$block
Instance of the definition object to use when block.
Definition: Chameleon.php:25
$inline
Instance of the definition object to use when inline.
Definition: Chameleon.php:19

Member Function Documentation

◆ validateChildren()

HTMLPurifier_ChildDef_Chameleon::validateChildren (   $children,
  $config,
  $context 
)
Parameters
HTMLPurifier_Node[]$children
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool

Definition at line 49 of file Chameleon.php.

References $config, and $context.

50  {
51  if ($context->get('IsInline') === false) {
52  return $this->block->validateChildren(
53  $children,
54  $config,
55  $context
56  );
57  } else {
58  return $this->inline->validateChildren(
59  $children,
60  $config,
61  $context
62  );
63  }
64  }
$context
Definition: webdav.php:25
$config
Definition: bootstrap.php:15

Field Documentation

◆ $block

HTMLPurifier_ChildDef_Chameleon::$block

Instance of the definition object to use when block.

HTMLPurifier_ChildDef_Optional

Definition at line 25 of file Chameleon.php.

Referenced by __construct().

◆ $inline

HTMLPurifier_ChildDef_Chameleon::$inline

Instance of the definition object to use when inline.

Usually stricter. HTMLPurifier_ChildDef_Optional

Definition at line 19 of file Chameleon.php.

Referenced by __construct().

◆ $type

HTMLPurifier_ChildDef_Chameleon::$type = 'chameleon'

string

Definition at line 30 of file Chameleon.php.


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