File indexing completed on 2024-05-05 06:02:15

0001 <?php
0002 
0003 /**
0004  * Defines allowed child nodes and validates nodes against it.
0005  */
0006 abstract class HTMLPurifier_ChildDef
0007 {
0008     /**
0009      * Type of child definition, usually right-most part of class name lowercase.
0010      * Used occasionally in terms of context.
0011      * @type string
0012      */
0013     public $type;
0014 
0015     /**
0016      * Indicates whether or not an empty array of children is okay.
0017      *
0018      * This is necessary for redundant checking when changes affecting
0019      * a child node may cause a parent node to now be disallowed.
0020      * @type bool
0021      */
0022     public $allow_empty;
0023 
0024     /**
0025      * Lookup array of all elements that this definition could possibly allow.
0026      * @type array
0027      */
0028     public $elements = array();
0029 
0030     /**
0031      * Get lookup of tag names that should not close this element automatically.
0032      * All other elements will do so.
0033      * @param HTMLPurifier_Config $config HTMLPurifier_Config object
0034      * @return array
0035      */
0036     public function getAllowedElements($config)
0037     {
0038         return $this->elements;
0039     }
0040 
0041     /**
0042      * Validates nodes according to definition and returns modification.
0043      *
0044      * @param HTMLPurifier_Node[] $children Array of HTMLPurifier_Node
0045      * @param HTMLPurifier_Config $config HTMLPurifier_Config object
0046      * @param HTMLPurifier_Context $context HTMLPurifier_Context object
0047      * @return bool|array true to leave nodes as is, false to remove parent node, array of replacement children
0048      */
0049     abstract public function validateChildren($children, $config, $context);
0050 }
0051 
0052 // vim: et sw=4 sts=4