ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
StrictBlockquote.php
Go to the documentation of this file.
1
<?
php
2
6
class
HTMLPurifier_ChildDef_StrictBlockquote
extends
HTMLPurifier_ChildDef_Required
7
{
11
protected
$real_elements
;
12
16
protected
$fake_elements
;
17
21
public
$allow_empty
=
true
;
22
26
public
$type
=
'strictblockquote'
;
27
31
protected
$init
=
false
;
32
39
public
function
getAllowedElements
(
$config
)
40
{
41
$this->
init
(
$config
);
42
return
$this->fake_elements
;
43
}
44
51
public
function
validateChildren
($children,
$config
,
$context
)
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
}
93
97
private
function
init
(
$config
)
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
}
108
}
109
110
// vim: et sw=4 sts=4
HTMLPurifier_Node_Element
Concrete element node class.
Definition:
Element.php:6
HTMLPurifier_ChildDef_Required
Definition that allows a set of elements, but disallows empty children.
Definition:
Required.php:6
$context
$context
Definition:
webdav.php:25
$config
$config
Definition:
bootstrap.php:15
$result
$result
Definition:
CleanUpTest.php:463
HTMLPurifier_ChildDef_StrictBlockquote\$allow_empty
$allow_empty
bool
Definition:
StrictBlockquote.php:21
HTMLPurifier_ChildDef_StrictBlockquote\validateChildren
validateChildren($children, $config, $context)
Definition:
StrictBlockquote.php:51
HTMLPurifier_ChildDef_StrictBlockquote
Takes the contents of blockquote when in strict and reformats for validation.
Definition:
StrictBlockquote.php:6
HTMLPurifier_ChildDef_StrictBlockquote\$type
$type
string
Definition:
StrictBlockquote.php:26
HTMLPurifier_ChildDef_StrictBlockquote\getAllowedElements
getAllowedElements($config)
Definition:
StrictBlockquote.php:39
HTMLPurifier_Node_Text
Concrete text token class.
Definition:
Text.php:12
$ret
$ret
Definition:
parser.php:6
$def
$def
Definition:
croninfo.php:21
php
HTMLPurifier_ChildDef_StrictBlockquote\$fake_elements
$fake_elements
array
Definition:
StrictBlockquote.php:16
HTMLPurifier_ChildDef_StrictBlockquote\$real_elements
$real_elements
array
Definition:
StrictBlockquote.php:11
HTMLPurifier_ChildDef_StrictBlockquote\$init
$init
bool
Definition:
StrictBlockquote.php:31
HTMLPurifier_ChildDef_StrictBlockquote\init
init($config)
Definition:
StrictBlockquote.php:97
HTMLPurifier_ChildDef_Required\$elements
$elements
Lookup table of allowed elements.
Definition:
Required.php:12
libs
composer
vendor
ezyang
htmlpurifier
library
HTMLPurifier
ChildDef
StrictBlockquote.php
Generated on Thu Jan 30 2025 19:01:16 for ILIAS by
1.8.13 (using
Doxyfile
)