ILIAS  release_4-4 Revision
HTMLPurifier_ChildDef_Optional Class Reference

Definition that allows a set of elements, and allows no children. More...

+ Inheritance diagram for HTMLPurifier_ChildDef_Optional:
+ Collaboration diagram for HTMLPurifier_ChildDef_Optional:

Public Member Functions

 validateChildren ($tokens_of_children, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_ChildDef_Required
 __construct ($elements)
 
 validateChildren ($tokens_of_children, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_ChildDef
 getAllowedElements ($config)
 Get lookup of tag names that should not close this element automatically. More...
 
 validateChildren ($tokens_of_children, $config, $context)
 Validates nodes according to definition and returns modification. More...
 

Data Fields

 $allow_empty = true
 
 $type = 'optional'
 
- Data Fields inherited from HTMLPurifier_ChildDef_Required
 $elements = array()
 Lookup table of allowed elements. More...
 
 $allow_empty = false
 
 $type = 'required'
 
- Data Fields inherited from HTMLPurifier_ChildDef
 $type
 Type of child definition, usually right-most part of class name lowercase. More...
 
 $allow_empty
 Bool that indicates whether or not an empty array of children is okay. More...
 
 $elements = array()
 Lookup array of all elements that this definition could possibly allow. More...
 

Additional Inherited Members

- Protected Attributes inherited from HTMLPurifier_ChildDef_Required
 $whitespace = false
 Whether or not the last passed node was all whitespace. More...
 

Detailed Description

Definition that allows a set of elements, and allows no children.

Note
This is a hack to reuse code from HTMLPurifier_ChildDef_Required, really, one shouldn't inherit from the other. Only altered behavior is to overload a returned false with an array. Thus, it will never return false.

Definition at line 10 of file Optional.php.

Member Function Documentation

◆ validateChildren()

HTMLPurifier_ChildDef_Optional::validateChildren (   $tokens_of_children,
  $config,
  $context 
)

Definition at line 14 of file Optional.php.

References $result.

14  {
15  $result = parent::validateChildren($tokens_of_children, $config, $context);
16  // we assume that $tokens_of_children is not modified
17  if ($result === false) {
18  if (empty($tokens_of_children)) return true;
19  elseif ($this->whitespace) return $tokens_of_children;
20  else return array();
21  }
22  return $result;
23  }
$result

Field Documentation

◆ $allow_empty

HTMLPurifier_ChildDef_Optional::$allow_empty = true

Definition at line 12 of file Optional.php.

◆ $type

HTMLPurifier_ChildDef_Optional::$type = 'optional'

Definition at line 13 of file Optional.php.


The documentation for this class was generated from the following file: