See Release Notes
Long Term Support Release
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 class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef 13 { 14 15 /** 16 * Instance of the definition object to use when inline. Usually stricter. 17 * @type HTMLPurifier_ChildDef_Optional 18 */ 19 public $inline; 20 21 /** 22 * Instance of the definition object to use when block. 23 * @type HTMLPurifier_ChildDef_Optional 24 */ 25 public $block; 26 27 /** 28 * @type string 29 */ 30 public $type = 'chameleon'; 31 32 /** 33 * @param array $inline List of elements to allow when inline. 34 * @param array $block List of elements to allow when block. 35 */ 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 43 /** 44 * @param HTMLPurifier_Node[] $children 45 * @param HTMLPurifier_Config $config 46 * @param HTMLPurifier_Context $context 47 * @return bool 48 */ 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
title
Description
Body
title
Description
Body
title
Description
Body
title
Body