HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/ChildDef/Chameleon.php
Go to the documentation of this file.
00001 <?php
00002 
00012 class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
00013 {
00014 
00018     public $inline;
00019 
00023     public $block;
00024 
00025     public $type = 'chameleon';
00026 
00031     public function __construct($inline, $block) {
00032         $this->inline = new HTMLPurifier_ChildDef_Optional($inline);
00033         $this->block  = new HTMLPurifier_ChildDef_Optional($block);
00034         $this->elements = $this->block->elements;
00035     }
00036 
00037     public function validateChildren($tokens_of_children, $config, $context) {
00038         if ($context->get('IsInline') === false) {
00039             return $this->block->validateChildren(
00040                 $tokens_of_children, $config, $context);
00041         } else {
00042             return $this->inline->validateChildren(
00043                 $tokens_of_children, $config, $context);
00044         }
00045     }
00046 }
00047 
00048 // vim: et sw=4 sts=4