ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ($children, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_ChildDef_Required
 __construct ($elements)
 
 validateChildren ($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 ($children, $config, $context)
 Validates nodes according to definition and returns modification. More...
 

Data Fields

 $allow_empty = true
 bool More...
 
 $type = 'optional'
 string More...
 
- Data Fields inherited from HTMLPurifier_ChildDef_Required
 $elements = array()
 Lookup table of allowed elements. More...
 
 $allow_empty = false
 bool More...
 
 $type = 'required'
 string More...
 
- Data Fields inherited from HTMLPurifier_ChildDef
 $type
 Type of child definition, usually right-most part of class name lowercase. More...
 
 $allow_empty
 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 (   $children,
  $config,
  $context 
)
Parameters
array$children
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
array

Definition at line 28 of file Optional.php.

References $config, $result, and array.

29  {
30  $result = parent::validateChildren($children, $config, $context);
31  // we assume that $children is not modified
32  if ($result === false) {
33  if (empty($children)) {
34  return true;
35  } elseif ($this->whitespace) {
36  return $children;
37  } else {
38  return array();
39  }
40  }
41  return $result;
42  }
$result
Create styles array
The data for the language used.

Field Documentation

◆ $allow_empty

HTMLPurifier_ChildDef_Optional::$allow_empty = true

bool

Definition at line 15 of file Optional.php.

◆ $type

HTMLPurifier_ChildDef_Optional::$type = 'optional'

string

Definition at line 20 of file Optional.php.


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