ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 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
 @type bool More...
 
 $type = 'strictblockquote'
 @type string More...
 
- Data Fields inherited from HTMLPurifier_ChildDef_Required
 $elements = array()
 Lookup table of allowed elements. More...
 
 $allow_empty = false
 @type bool More...
 
 $type = 'required'
 @type 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
 @type array More...
 
 $fake_elements
 @type array More...
 
 $init = false
 @type 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.

Reimplemented from HTMLPurifier_ChildDef.

Definition at line 39 of file StrictBlockquote.php.

References $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.

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 }
$elements
Lookup table of allowed elements.
Definition: Required.php:12

References HTMLPurifier_ChildDef_Required\$elements, and init().

Referenced by getAllowedElements(), init(), and validateChildren().

+ Here is the call graph for this function:
+ 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

Reimplemented from HTMLPurifier_ChildDef_Required.

Definition at line 51 of file StrictBlockquote.php.

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 }
$result
Concrete element node class.
Definition: Element.php:7
Concrete text token class.
Definition: Text.php:13

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

+ Here is the call graph for this function:

Field Documentation

◆ $allow_empty

HTMLPurifier_ChildDef_StrictBlockquote::$allow_empty = true

@type bool

Definition at line 21 of file StrictBlockquote.php.

◆ $fake_elements

HTMLPurifier_ChildDef_StrictBlockquote::$fake_elements
protected

@type array

Definition at line 16 of file StrictBlockquote.php.

Referenced by getAllowedElements(), and validateChildren().

◆ $init

HTMLPurifier_ChildDef_StrictBlockquote::$init = false
protected

@type bool

Definition at line 31 of file StrictBlockquote.php.

◆ $real_elements

HTMLPurifier_ChildDef_StrictBlockquote::$real_elements
protected

@type array

Definition at line 11 of file StrictBlockquote.php.

Referenced by validateChildren().

◆ $type

HTMLPurifier_ChildDef_StrictBlockquote::$type = 'strictblockquote'

@type string

Definition at line 26 of file StrictBlockquote.php.


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