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.
|
2013-07-16 11:56:14 +00:00
|
|
|
* @type string
|
2006-08-19 23:06:59 +00:00
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $type;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-19 23:06:59 +00:00
|
|
|
/**
|
2013-07-16 11:56:14 +00:00
|
|
|
* Indicates whether or not an empty array of children is okay.
|
2008-12-06 07:28:20 +00:00
|
|
|
*
|
2006-08-19 23:06:59 +00:00
|
|
|
* This is necessary for redundant checking when changes affecting
|
|
|
|
* a child node may cause a parent node to now be disallowed.
|
2013-07-16 11:56:14 +00:00
|
|
|
* @type bool
|
2006-08-19 23:06:59 +00:00
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $allow_empty;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-06-23 20:52:57 +00:00
|
|
|
/**
|
2013-07-16 11:56:14 +00:00
|
|
|
* Lookup array of all elements that this definition could possibly allow.
|
|
|
|
* @type array
|
2007-06-23 20:52:57 +00:00
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $elements = array();
|
2008-12-06 07:28:20 +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.
|
2013-07-16 11:56:14 +00:00
|
|
|
* @param HTMLPurifier_Config $config HTMLPurifier_Config object
|
|
|
|
* @return array
|
2008-08-02 00:52:06 +00:00
|
|
|
*/
|
2013-07-16 11:56:14 +00:00
|
|
|
public function getAllowedElements($config)
|
|
|
|
{
|
2008-08-02 00:52:06 +00:00
|
|
|
return $this->elements;
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-19 23:06:59 +00:00
|
|
|
/**
|
|
|
|
* Validates nodes according to definition and returns modification.
|
2008-12-06 07:28:20 +00:00
|
|
|
*
|
2013-07-16 11:56:14 +00:00
|
|
|
* @param HTMLPurifier_Token[] $tokens_of_children Array of HTMLPurifier_Token
|
|
|
|
* @param HTMLPurifier_Config $config HTMLPurifier_Config object
|
|
|
|
* @param HTMLPurifier_Context $context HTMLPurifier_Context object
|
|
|
|
* @return bool|array true to leave nodes as is, false to remove parent node, array of replacement child tokens
|
2006-08-19 23:06:59 +00:00
|
|
|
*/
|
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
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|