3 require_once 'HTMLPurifier/ChildDef.php';
6 * Definition that uses different definitions depending on context.
8 * The del and ins tags are notable because they allow different types of
9 * elements depending on whether or not they're in a block or inline context.
10 * Chameleon allows this behavior to happen by using two different
11 * definitions depending on context. While this somewhat generalized,
12 * it is specifically intended for those two tags.
14 class HTMLPurifier_ChildDef_Chameleon
extends HTMLPurifier_ChildDef
18 * Instance of the definition object to use when inline. Usually stricter.
24 * Instance of the definition object to use when block.
29 var $type = 'chameleon';
32 * @param $inline List of elements to allow when inline.
33 * @param $block List of elements to allow when block.
35 function HTMLPurifier_ChildDef_Chameleon($inline, $block) {
36 $this->inline
= new HTMLPurifier_ChildDef_Optional($inline);
37 $this->block
= new HTMLPurifier_ChildDef_Optional($block);
40 function validateChildren($tokens_of_children, $config, &$context) {
41 if ($context->get('IsInline') === false) {
42 return $this->block
->validateChildren(
43 $tokens_of_children, $config, $context);
45 return $this->inline
->validateChildren(
46 $tokens_of_children, $config, $context);