2006-07-23 00:11:03 +00:00
|
|
|
<?php
|
|
|
|
|
2006-08-17 20:29:34 +00:00
|
|
|
/**
|
2006-08-19 23:06:59 +00:00
|
|
|
* Defines allowed child nodes and validates tokens against it.
|
2006-08-17 20:29:34 +00:00
|
|
|
*/
|
2008-04-23 02:40:17 +00:00
|
|
|
abstract class HTMLPurifier_ChildDef
|
2006-07-31 03:04:57 +00:00
|
|
|
{
|
2006-08-19 23:06:59 +00:00
|
|
|
/**
|
2006-11-25 05:05:32 +00:00
|
|
|
* Type of child definition, usually right-most part of class name lowercase.
|
|
|
|
* Used occasionally in terms of context.
|
2006-08-19 23:06:59 +00:00
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $type;
|
2006-08-19 23:06:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bool that indicates whether or not an empty array of children is okay
|
|
|
|
*
|
|
|
|
* This is necessary for redundant checking when changes affecting
|
|
|
|
* a child node may cause a parent node to now be disallowed.
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $allow_empty;
|
2006-08-19 23:06:59 +00:00
|
|
|
|
2007-06-23 20:52:57 +00:00
|
|
|
/**
|
|
|
|
* Lookup array of all elements that this definition could possibly allow
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $elements = array();
|
2007-06-23 20:52:57 +00:00
|
|
|
|
2008-08-02 00:52:06 +00:00
|
|
|
/**
|
|
|
|
* Get lookup of tag names that should not close this element automatically.
|
|
|
|
* All other elements will do so.
|
|
|
|
*/
|
|
|
|
public function getNonAutoCloseElements($config) {
|
|
|
|
return $this->elements;
|
|
|
|
}
|
|
|
|
|
2006-08-19 23:06:59 +00:00
|
|
|
/**
|
|
|
|
* Validates nodes according to definition and returns modification.
|
|
|
|
*
|
|
|
|
* @param $tokens_of_children Array of HTMLPurifier_Token
|
|
|
|
* @param $config HTMLPurifier_Config object
|
2006-10-01 20:47:07 +00:00
|
|
|
* @param $context HTMLPurifier_Context object
|
2006-08-19 23:06:59 +00:00
|
|
|
* @return bool true to leave nodes as is
|
|
|
|
* @return bool false to remove parent node
|
|
|
|
* @return array of replacement child tokens
|
|
|
|
*/
|
2008-04-23 02:40:17 +00:00
|
|
|
abstract public function validateChildren($tokens_of_children, $config, $context);
|
2006-07-31 03:04:57 +00:00
|
|
|
}
|
|
|
|
|
2007-06-27 13:58:32 +00:00
|
|
|
|