2006-07-23 00:11:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// HTMLPurifier_ChildDef and inheritance have three types of output:
|
|
|
|
// true = leave nodes as is
|
|
|
|
// false = delete parent node and all children
|
|
|
|
// array(...) = replace children nodes with these
|
|
|
|
|
2006-09-16 22:36:58 +00:00
|
|
|
HTMLPurifier_ConfigSchema::define(
|
2006-08-27 18:49:16 +00:00
|
|
|
'Core', 'EscapeInvalidChildren', false, 'bool',
|
2006-08-14 02:46:34 +00:00
|
|
|
'When true, a child is found that is not allowed in the context of the '.
|
|
|
|
'parent element will be transformed into text as if it were ASCII. When '.
|
2006-08-15 23:58:18 +00:00
|
|
|
'false, that element and all internal tags will be dropped, though text '.
|
|
|
|
'will be preserved. There is no option for dropping the element but '.
|
|
|
|
'preserving child nodes.'
|
2006-08-14 02:46:34 +00:00
|
|
|
);
|
|
|
|
|
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
|
|
|
*/
|
2006-07-23 00:11:03 +00:00
|
|
|
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
|
|
|
|
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
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public function validateChildren($tokens_of_children, $config, &$context) {
|
2006-07-31 03:04:57 +00:00
|
|
|
trigger_error('Call to abstract function', E_USER_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-27 13:58:32 +00:00
|
|
|
|