Source for file Required.php
Documentation is available at Required.php
* Definition that allows a set of elements, but disallows empty children.
* Lookup table of allowed elements.
* @param $elements List of allowed element names (lowercase).
$elements =
explode('|', $elements);
foreach ($elements as $i =>
$x) {
if (empty($i)) unset
($elements[$i]); // remove blank
public $type =
'required';
// if there are no tokens, delete parent node
if (empty($tokens_of_children)) return false;
// the new set of children
// current depth into the nest
// whether or not we're deleting a node
// whether or not parsed character data is allowed
// this controls whether or not we silently drop a tag
// or generate escaped HTML from it
$pcdata_allowed = isset
($this->elements['#PCDATA']);
// a little sanity check to make sure it's not ALL whitespace
$escape_invalid_children =
$config->get('Core', 'EscapeInvalidChildren');
foreach ($tokens_of_children as $token) {
if (!empty($token->is_whitespace)) {
$all_whitespace =
false; // phew, we're not talking about whitespace
$is_child =
($nesting ==
0);
if (!isset
($this->elements[$token->name])) {
} elseif ($pcdata_allowed &&
$escape_invalid_children) {
$gen->generateFromToken($token)
} elseif ($pcdata_allowed &&
$escape_invalid_children) {
$gen->generateFromToken($token)
if (empty($result)) return false;
if ($all_whitespace) return false;
if ($tokens_of_children ==
$result) return true;
Documentation generated on Thu, 19 Jun 2008 18:50:16 -0400 by phpDocumentor 1.4.2