Source for file Chameleon.php

Documentation is available at Chameleon.php

  1. <?php
  2.  
  3. /**
  4.  * Definition that uses different definitions depending on context.
  5.  * 
  6.  * The del and ins tags are notable because they allow different types of
  7.  * elements depending on whether or not they're in a block or inline context.
  8.  * Chameleon allows this behavior to happen by using two different
  9.  * definitions depending on context.  While this somewhat generalized,
  10.  * it is specifically intended for those two tags.
  11.  */
  12. {
  13.     
  14.     /**
  15.      * Instance of the definition object to use when inline. Usually stricter.
  16.      */
  17.     public $inline;
  18.     
  19.     /**
  20.      * Instance of the definition object to use when block.
  21.      */
  22.     public $block;
  23.     
  24.     public $type = 'chameleon';
  25.     
  26.     /**
  27.      * @param $inline List of elements to allow when inline.
  28.      * @param $block List of elements to allow when block.
  29.      */
  30.     public function __construct($inline$block{
  31.         $this->inline = new HTMLPurifier_ChildDef_Optional($inline);
  32.         $this->block  = new HTMLPurifier_ChildDef_Optional($block);
  33.         $this->elements = $this->block->elements;
  34.     }
  35.     
  36.     public function validateChildren($tokens_of_children$config$context{
  37.         if ($context->get('IsInline'=== false{
  38.             return $this->block->validateChildren(
  39.                 $tokens_of_children$config$context);
  40.         else {
  41.             return $this->inline->validateChildren(
  42.                 $tokens_of_children$config$context);
  43.         }
  44.     }
  45. }

Documentation generated on Thu, 19 Jun 2008 18:48:55 -0400 by phpDocumentor 1.4.2