ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
HTMLPurifier_ChildDef_StrictBlockquote Class Reference

Takes the contents of blockquote when in strict and reformats for validation. More...

+ Inheritance diagram for HTMLPurifier_ChildDef_StrictBlockquote:
+ Collaboration diagram for HTMLPurifier_ChildDef_StrictBlockquote:

Public Member Functions

 getAllowedElements ($config)
 
 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 = 'strictblockquote'
 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...
 

Protected Attributes

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

Private Member Functions

 init ($config)
 

Detailed Description

Takes the contents of blockquote when in strict and reformats for validation.

Definition at line 6 of file StrictBlockquote.php.

Member Function Documentation

◆ getAllowedElements()

HTMLPurifier_ChildDef_StrictBlockquote::getAllowedElements (   $config)
Parameters
HTMLPurifier_Config$config
Returns
array
Note
We don't want MakeWellFormed to auto-close inline elements since they might be allowed.

Definition at line 39 of file StrictBlockquote.php.

References $config, $fake_elements, and init().

+ Here is the call graph for this function:

◆ init()

HTMLPurifier_ChildDef_StrictBlockquote::init (   $config)
private
Parameters
HTMLPurifier_Config$config

Definition at line 97 of file StrictBlockquote.php.

References $config, $def, and HTMLPurifier_ChildDef_Required\$elements.

Referenced by getAllowedElements(), and validateChildren().

98  {
99  if (!$this->init) {
100  $def = $config->getHTMLDefinition();
101  // allow all inline elements
102  $this->real_elements = $this->elements;
103  $this->fake_elements = $def->info_content_sets['Flow'];
104  $this->fake_elements['#PCDATA'] = true;
105  $this->init = true;
106  }
107  }
$def
Definition: croninfo.php:21
$elements
Lookup table of allowed elements.
Definition: Required.php:12
+ Here is the caller graph for this function:

◆ validateChildren()

HTMLPurifier_ChildDef_StrictBlockquote::validateChildren (   $children,
  $config,
  $context 
)
Parameters
array$children
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
array

Definition at line 51 of file StrictBlockquote.php.

References $config, $def, $fake_elements, $real_elements, $result, $ret, array, and init().

52  {
53  $this->init($config);
54 
55  // trick the parent class into thinking it allows more
56  $this->elements = $this->fake_elements;
57  $result = parent::validateChildren($children, $config, $context);
58  $this->elements = $this->real_elements;
59 
60  if ($result === false) {
61  return array();
62  }
63  if ($result === true) {
64  $result = $children;
65  }
66 
67  $def = $config->getHTMLDefinition();
68  $block_wrap_name = $def->info_block_wrapper;
69  $block_wrap = false;
70  $ret = array();
71 
72  foreach ($result as $node) {
73  if ($block_wrap === false) {
74  if (($node instanceof HTMLPurifier_Node_Text && !$node->is_whitespace) ||
75  ($node instanceof HTMLPurifier_Node_Element && !isset($this->elements[$node->name]))) {
76  $block_wrap = new HTMLPurifier_Node_Element($def->info_block_wrapper);
77  $ret[] = $block_wrap;
78  }
79  } else {
80  if ($node instanceof HTMLPurifier_Node_Element && isset($this->elements[$node->name])) {
81  $block_wrap = false;
82 
83  }
84  }
85  if ($block_wrap) {
86  $block_wrap->children[] = $node;
87  } else {
88  $ret[] = $node;
89  }
90  }
91  return $ret;
92  }
Concrete element node class.
Definition: Element.php:6
$result
Create styles array
The data for the language used.
Concrete text token class.
Definition: Text.php:12
$ret
Definition: parser.php:6
$def
Definition: croninfo.php:21
+ Here is the call graph for this function:

Field Documentation

◆ $allow_empty

HTMLPurifier_ChildDef_StrictBlockquote::$allow_empty = true

bool

Definition at line 21 of file StrictBlockquote.php.

◆ $fake_elements

HTMLPurifier_ChildDef_StrictBlockquote::$fake_elements
protected

array

Definition at line 16 of file StrictBlockquote.php.

Referenced by getAllowedElements(), and validateChildren().

◆ $init

HTMLPurifier_ChildDef_StrictBlockquote::$init = false
protected

bool

Definition at line 31 of file StrictBlockquote.php.

◆ $real_elements

HTMLPurifier_ChildDef_StrictBlockquote::$real_elements
protected

array

Definition at line 11 of file StrictBlockquote.php.

Referenced by validateChildren().

◆ $type

HTMLPurifier_ChildDef_StrictBlockquote::$type = 'strictblockquote'

string

Definition at line 26 of file StrictBlockquote.php.


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