ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Chameleon.php
Go to the documentation of this file.
1 <?php
2 
13 {
14 
19  public $inline;
20 
25  public $block;
26 
30  public $type = 'chameleon';
31 
36  public function __construct($inline, $block)
37  {
38  $this->inline = new HTMLPurifier_ChildDef_Optional($inline);
39  $this->block = new HTMLPurifier_ChildDef_Optional($block);
40  $this->elements = $this->block->elements;
41  }
42 
49  public function validateChildren($children, $config, $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  }
65 }
66 
67 // vim: et sw=4 sts=4
__construct($inline, $block)
Definition: Chameleon.php:36
validateChildren($children, $config, $context)
Definition: Chameleon.php:49
Definition that allows a set of elements, and allows no children.
Definition: Optional.php:10
Definition that uses different definitions depending on context.
Definition: Chameleon.php:12
$block
Instance of the definition object to use when block.
Definition: Chameleon.php:25
Defines allowed child nodes and validates nodes against it.
Definition: ChildDef.php:6
$inline
Instance of the definition object to use when inline.
Definition: Chameleon.php:19