Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / ChildDef / Chameleon.php
blobafe0299fa799d1f5e3c3921dc7f3b53e66205b10
1 <?php
3 require_once 'HTMLPurifier/ChildDef.php';
5 /**
6 * Definition that uses different definitions depending on context.
7 *
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
17 /**
18 * Instance of the definition object to use when inline. Usually stricter.
19 * @public
21 var $inline;
23 /**
24 * Instance of the definition object to use when block.
25 * @public
27 var $block;
29 var $type = 'chameleon';
31 /**
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);
44 } else {
45 return $this->inline->validateChildren(
46 $tokens_of_children, $config, $context);