3 require_once 'HTMLPurifier/ChildDef/Required.php';
6 * Takes the contents of blockquote when in strict and reformats for validation.
8 * From XHTML 1.0 Transitional to Strict, there is a notable change where
10 class HTMLPurifier_ChildDef_StrictBlockquote
11 extends HTMLPurifier_ChildDef_Required
13 var $allow_empty = true;
14 var $type = 'strictblockquote';
16 function HTMLPurifier_ChildDef_StrictBlockquote() {}
17 function validateChildren($tokens_of_children, $config, &$context) {
19 $def = $config->getHTMLDefinition();
21 // allow all inline elements
22 $this->elements
= $def->info_flow_elements
;
23 $this->elements
['#PCDATA'] = true;
27 $result = parent
::validateChildren($tokens_of_children, $config, $context);
28 if ($result === false) return array();
29 if ($result === true) $result = $tokens_of_children;
31 $block_wrap_start = new HTMLPurifier_Token_Start($def->info_block_wrapper
);
32 $block_wrap_end = new HTMLPurifier_Token_End( $def->info_block_wrapper
);
37 // assuming that there are no comment tokens
38 foreach ($result as $i => $token) {
40 // ifs are nested for readability
43 if (($token->type
== 'text') ||
44 ($def->info
[$token->name
]->type
== 'inline')) {
46 $ret[] = $block_wrap_start;
51 // starting tokens have been inline text / empty
52 if ($token->type
== 'start' ||
$token->type
== 'empty') {
53 if ($def->info
[$token->name
]->type
== 'block') {
55 $ret[] = $block_wrap_end;
62 if ($token->type
== 'start') $depth++
;
63 if ($token->type
== 'end') $depth--;
65 if ($is_inline) $ret[] = $block_wrap_end;