mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 05:37:49 +02:00
PSR-2 reformatting PHPDoc corrections
With minor corrections. Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk> Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
committed by
Edward Z. Yang
parent
19eee14899
commit
fac747bdbd
@@ -14,33 +14,52 @@ class HTMLPurifier_ChildDef_Chameleon extends HTMLPurifier_ChildDef
|
||||
|
||||
/**
|
||||
* Instance of the definition object to use when inline. Usually stricter.
|
||||
* @type HTMLPurifier_ChildDef_Optional
|
||||
*/
|
||||
public $inline;
|
||||
|
||||
/**
|
||||
* Instance of the definition object to use when block.
|
||||
* @type HTMLPurifier_ChildDef_Optional
|
||||
*/
|
||||
public $block;
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'chameleon';
|
||||
|
||||
/**
|
||||
* @param $inline List of elements to allow when inline.
|
||||
* @param $block List of elements to allow when block.
|
||||
* @param array $inline List of elements to allow when inline.
|
||||
* @param array $block List of elements to allow when block.
|
||||
*/
|
||||
public function __construct($inline, $block) {
|
||||
public function __construct($inline, $block)
|
||||
{
|
||||
$this->inline = new HTMLPurifier_ChildDef_Optional($inline);
|
||||
$this->block = new HTMLPurifier_ChildDef_Optional($block);
|
||||
$this->block = new HTMLPurifier_ChildDef_Optional($block);
|
||||
$this->elements = $this->block->elements;
|
||||
}
|
||||
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return bool
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
if ($context->get('IsInline') === false) {
|
||||
return $this->block->validateChildren(
|
||||
$tokens_of_children, $config, $context);
|
||||
$tokens_of_children,
|
||||
$config,
|
||||
$context
|
||||
);
|
||||
} else {
|
||||
return $this->inline->validateChildren(
|
||||
$tokens_of_children, $config, $context);
|
||||
$tokens_of_children,
|
||||
$config,
|
||||
$context
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,28 +8,42 @@
|
||||
*/
|
||||
class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
|
||||
{
|
||||
public $type = 'custom';
|
||||
public $allow_empty = false;
|
||||
/**
|
||||
* Allowed child pattern as defined by the DTD
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'custom';
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $allow_empty = false;
|
||||
|
||||
/**
|
||||
* Allowed child pattern as defined by the DTD.
|
||||
* @type string
|
||||
*/
|
||||
public $dtd_regex;
|
||||
|
||||
/**
|
||||
* PCRE regex derived from $dtd_regex
|
||||
* @private
|
||||
* PCRE regex derived from $dtd_regex.
|
||||
* @type string
|
||||
*/
|
||||
private $_pcre_regex;
|
||||
|
||||
/**
|
||||
* @param $dtd_regex Allowed child pattern from the DTD
|
||||
*/
|
||||
public function __construct($dtd_regex) {
|
||||
public function __construct($dtd_regex)
|
||||
{
|
||||
$this->dtd_regex = $dtd_regex;
|
||||
$this->_compileRegex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles the PCRE regex from a DTD regex ($dtd_regex to $_pcre_regex)
|
||||
*/
|
||||
protected function _compileRegex() {
|
||||
protected function _compileRegex()
|
||||
{
|
||||
$raw = str_replace(' ', '', $this->dtd_regex);
|
||||
if ($raw{0} != '(') {
|
||||
$raw = "($raw)";
|
||||
@@ -57,11 +71,21 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
|
||||
|
||||
$this->_pcre_regex = $reg;
|
||||
}
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return bool
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
$list_of_children = '';
|
||||
$nesting = 0; // depth into the nest
|
||||
foreach ($tokens_of_children as $token) {
|
||||
if (!empty($token->is_whitespace)) continue;
|
||||
if (!empty($token->is_whitespace)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$is_child = ($nesting == 0); // direct
|
||||
|
||||
@@ -79,11 +103,10 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
|
||||
$list_of_children = ',' . rtrim($list_of_children, ',');
|
||||
$okay =
|
||||
preg_match(
|
||||
'/^,?'.$this->_pcre_regex.'$/',
|
||||
'/^,?' . $this->_pcre_regex . '$/',
|
||||
$list_of_children
|
||||
);
|
||||
|
||||
return (bool) $okay;
|
||||
return (bool)$okay;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -9,10 +9,28 @@
|
||||
*/
|
||||
class HTMLPurifier_ChildDef_Empty extends HTMLPurifier_ChildDef
|
||||
{
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $allow_empty = true;
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'empty';
|
||||
public function __construct() {}
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return array
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
@@ -5,16 +5,32 @@
|
||||
*/
|
||||
class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
|
||||
{
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'list';
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
// lying a little bit, so that we can handle ul and ol ourselves
|
||||
// XXX: This whole business with 'wrap' is all a bit unsatisfactory
|
||||
public $elements = array('li' => true, 'ul' => true, 'ol' => true);
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return array
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
// Flag for subclasses
|
||||
$this->whitespace = false;
|
||||
|
||||
// if there are no tokens, delete parent node
|
||||
if (empty($tokens_of_children)) return false;
|
||||
if (empty($tokens_of_children)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// the new set of children
|
||||
$result = array();
|
||||
@@ -62,7 +78,7 @@ class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
|
||||
$result[] = new HTMLPurifier_Token_Start('li');
|
||||
} else {
|
||||
// backtrack until </li> found
|
||||
while(true) {
|
||||
while (true) {
|
||||
$t = array_pop($result);
|
||||
if ($t instanceof HTMLPurifier_Token_End) {
|
||||
// XXX actually, these invariants could very plausibly be violated
|
||||
@@ -84,7 +100,10 @@ class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
|
||||
break;
|
||||
} else {
|
||||
if (!$t->is_whitespace) {
|
||||
trigger_error("Only whitespace present invariant violated in List ChildDef", E_USER_ERROR);
|
||||
trigger_error(
|
||||
"Only whitespace present invariant violated in List ChildDef",
|
||||
E_USER_ERROR
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -108,11 +127,15 @@ class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
|
||||
if ($need_close_li) {
|
||||
$result[] = new HTMLPurifier_Token_End('li');
|
||||
}
|
||||
if (empty($result)) return false;
|
||||
if (empty($result)) {
|
||||
return false;
|
||||
}
|
||||
if ($all_whitespace) {
|
||||
return false;
|
||||
}
|
||||
if ($tokens_of_children == $result) return true;
|
||||
if ($tokens_of_children == $result) {
|
||||
return true;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@@ -9,15 +9,34 @@
|
||||
*/
|
||||
class HTMLPurifier_ChildDef_Optional extends HTMLPurifier_ChildDef_Required
|
||||
{
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $allow_empty = true;
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'optional';
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return array
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
$result = parent::validateChildren($tokens_of_children, $config, $context);
|
||||
// we assume that $tokens_of_children is not modified
|
||||
if ($result === false) {
|
||||
if (empty($tokens_of_children)) return true;
|
||||
elseif ($this->whitespace) return $tokens_of_children;
|
||||
else return array();
|
||||
if (empty($tokens_of_children)) {
|
||||
return true;
|
||||
} elseif ($this->whitespace) {
|
||||
return $tokens_of_children;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@@ -7,17 +7,21 @@ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
|
||||
{
|
||||
/**
|
||||
* Lookup table of allowed elements.
|
||||
* @public
|
||||
* @type array
|
||||
*/
|
||||
public $elements = array();
|
||||
|
||||
/**
|
||||
* Whether or not the last passed node was all whitespace.
|
||||
* @type bool
|
||||
*/
|
||||
protected $whitespace = false;
|
||||
|
||||
/**
|
||||
* @param $elements List of allowed element names (lowercase).
|
||||
* @param array|string $elements List of allowed element names (lowercase).
|
||||
*/
|
||||
public function __construct($elements) {
|
||||
public function __construct($elements)
|
||||
{
|
||||
if (is_string($elements)) {
|
||||
$elements = str_replace(' ', '', $elements);
|
||||
$elements = explode('|', $elements);
|
||||
@@ -27,19 +31,39 @@ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
|
||||
$elements = array_flip($elements);
|
||||
foreach ($elements as $i => $x) {
|
||||
$elements[$i] = true;
|
||||
if (empty($i)) unset($elements[$i]); // remove blank
|
||||
if (empty($i)) {
|
||||
unset($elements[$i]);
|
||||
} // remove blank
|
||||
}
|
||||
}
|
||||
$this->elements = $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $allow_empty = false;
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'required';
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return array
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
// Flag for subclasses
|
||||
$this->whitespace = false;
|
||||
|
||||
// if there are no tokens, delete parent node
|
||||
if (empty($tokens_of_children)) return false;
|
||||
if (empty($tokens_of_children)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// the new set of children
|
||||
$result = array();
|
||||
@@ -104,12 +128,16 @@ class HTMLPurifier_ChildDef_Required extends HTMLPurifier_ChildDef
|
||||
// drop silently
|
||||
}
|
||||
}
|
||||
if (empty($result)) return false;
|
||||
if (empty($result)) {
|
||||
return false;
|
||||
}
|
||||
if ($all_whitespace) {
|
||||
$this->whitespace = true;
|
||||
return false;
|
||||
}
|
||||
if ($tokens_of_children == $result) return true;
|
||||
if ($tokens_of_children == $result) {
|
||||
return true;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@@ -5,23 +5,51 @@
|
||||
*/
|
||||
class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Required
|
||||
{
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
protected $real_elements;
|
||||
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
protected $fake_elements;
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $allow_empty = true;
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'strictblockquote';
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
protected $init = false;
|
||||
|
||||
/**
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @return array
|
||||
* @note We don't want MakeWellFormed to auto-close inline elements since
|
||||
* they might be allowed.
|
||||
*/
|
||||
public function getAllowedElements($config) {
|
||||
public function getAllowedElements($config)
|
||||
{
|
||||
$this->init($config);
|
||||
return $this->fake_elements;
|
||||
}
|
||||
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return array
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
$this->init($config);
|
||||
|
||||
// trick the parent class into thinking it allows more
|
||||
@@ -29,12 +57,16 @@ class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Requi
|
||||
$result = parent::validateChildren($tokens_of_children, $config, $context);
|
||||
$this->elements = $this->real_elements;
|
||||
|
||||
if ($result === false) return array();
|
||||
if ($result === true) $result = $tokens_of_children;
|
||||
if ($result === false) {
|
||||
return array();
|
||||
}
|
||||
if ($result === true) {
|
||||
$result = $tokens_of_children;
|
||||
}
|
||||
|
||||
$def = $config->getHTMLDefinition();
|
||||
$block_wrap_start = new HTMLPurifier_Token_Start($def->info_block_wrapper);
|
||||
$block_wrap_end = new HTMLPurifier_Token_End( $def->info_block_wrapper);
|
||||
$block_wrap_end = new HTMLPurifier_Token_End($def->info_block_wrapper);
|
||||
$is_inline = false;
|
||||
$depth = 0;
|
||||
$ret = array();
|
||||
@@ -45,13 +77,11 @@ class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Requi
|
||||
// ifs are nested for readability
|
||||
if (!$is_inline) {
|
||||
if (!$depth) {
|
||||
if (
|
||||
($token instanceof HTMLPurifier_Token_Text && !$token->is_whitespace) ||
|
||||
(!$token instanceof HTMLPurifier_Token_Text && !isset($this->elements[$token->name]))
|
||||
) {
|
||||
if (($token instanceof HTMLPurifier_Token_Text && !$token->is_whitespace) ||
|
||||
(!$token instanceof HTMLPurifier_Token_Text && !isset($this->elements[$token->name]))) {
|
||||
$is_inline = true;
|
||||
$ret[] = $block_wrap_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!$depth) {
|
||||
@@ -66,14 +96,24 @@ class HTMLPurifier_ChildDef_StrictBlockquote extends HTMLPurifier_ChildDef_Requi
|
||||
}
|
||||
}
|
||||
$ret[] = $token;
|
||||
if ($token instanceof HTMLPurifier_Token_Start) $depth++;
|
||||
if ($token instanceof HTMLPurifier_Token_End) $depth--;
|
||||
if ($token instanceof HTMLPurifier_Token_Start) {
|
||||
$depth++;
|
||||
}
|
||||
if ($token instanceof HTMLPurifier_Token_End) {
|
||||
$depth--;
|
||||
}
|
||||
}
|
||||
if ($is_inline) {
|
||||
$ret[] = $block_wrap_end;
|
||||
}
|
||||
if ($is_inline) $ret[] = $block_wrap_end;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function init($config) {
|
||||
/**
|
||||
* @param HTMLPurifier_Config $config
|
||||
*/
|
||||
private function init($config)
|
||||
{
|
||||
if (!$this->init) {
|
||||
$def = $config->getHTMLDefinition();
|
||||
// allow all inline elements
|
||||
|
@@ -31,13 +31,44 @@
|
||||
*/
|
||||
class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
{
|
||||
/**
|
||||
* @type bool
|
||||
*/
|
||||
public $allow_empty = false;
|
||||
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
public $type = 'table';
|
||||
public $elements = array('tr' => true, 'tbody' => true, 'thead' => true,
|
||||
'tfoot' => true, 'caption' => true, 'colgroup' => true, 'col' => true);
|
||||
public function __construct() {}
|
||||
public function validateChildren($tokens_of_children, $config, $context) {
|
||||
if (empty($tokens_of_children)) return false;
|
||||
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
public $elements = array(
|
||||
'tr' => true,
|
||||
'tbody' => true,
|
||||
'thead' => true,
|
||||
'tfoot' => true,
|
||||
'caption' => true,
|
||||
'colgroup' => true,
|
||||
'col' => true
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $tokens_of_children
|
||||
* @param HTMLPurifier_Config $config
|
||||
* @param HTMLPurifier_Context $context
|
||||
* @return array
|
||||
*/
|
||||
public function validateChildren($tokens_of_children, $config, $context)
|
||||
{
|
||||
if (empty($tokens_of_children)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// this ensures that the loop gets run one last time before closing
|
||||
// up. It's a little bit of a hack, but it works! Just make sure you
|
||||
@@ -46,23 +77,23 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
|
||||
// only one of these elements is allowed in a table
|
||||
$caption = false;
|
||||
$thead = false;
|
||||
$tfoot = false;
|
||||
$thead = false;
|
||||
$tfoot = false;
|
||||
|
||||
// as many of these as you want
|
||||
$cols = array();
|
||||
$cols = array();
|
||||
$content = array();
|
||||
|
||||
$nesting = 0; // current depth so we can determine nodes
|
||||
$is_collecting = false; // are we globbing together tokens to package
|
||||
// into one of the collectors?
|
||||
// into one of the collectors?
|
||||
$collection = array(); // collected nodes
|
||||
// INVARIANT: if $is_collecting, then !empty($collection)
|
||||
// The converse does NOT hold, see [WHITESPACE]
|
||||
$tag_index = 0; // the first node might be whitespace,
|
||||
// so this tells us where the start tag is
|
||||
// so this tells us where the start tag is
|
||||
$tbody_mode = false; // if true, then we need to wrap any stray
|
||||
// <tr>s with a <tbody>.
|
||||
// <tr>s with a <tbody>.
|
||||
|
||||
foreach ($tokens_of_children as $token) {
|
||||
$is_child = ($nesting == 0);
|
||||
@@ -88,7 +119,9 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
$content[] = $collection;
|
||||
break;
|
||||
case 'caption':
|
||||
if ($caption !== false) break;
|
||||
if ($caption !== false) {
|
||||
break;
|
||||
}
|
||||
$caption = $collection;
|
||||
break;
|
||||
case 'thead':
|
||||
@@ -116,11 +149,11 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
// doesn't float an extra tfoot to the
|
||||
// bottom like it does for the first one.
|
||||
$collection[$tag_index]->name = 'tbody';
|
||||
$collection[count($collection)-1]->name = 'tbody';
|
||||
$collection[count($collection) - 1]->name = 'tbody';
|
||||
$content[] = $collection;
|
||||
}
|
||||
break;
|
||||
case 'colgroup':
|
||||
case 'colgroup':
|
||||
$cols[] = $collection;
|
||||
break;
|
||||
}
|
||||
@@ -134,7 +167,9 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
}
|
||||
|
||||
// terminate
|
||||
if ($token === false) break;
|
||||
if ($token === false) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($is_child) {
|
||||
// determine what we're dealing with
|
||||
@@ -147,7 +182,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
$tag_index = 0;
|
||||
continue;
|
||||
}
|
||||
switch($token->name) {
|
||||
switch ($token->name) {
|
||||
case 'caption':
|
||||
case 'colgroup':
|
||||
case 'thead':
|
||||
@@ -172,7 +207,9 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($content)) return false;
|
||||
if (empty($content)) {
|
||||
return false;
|
||||
}
|
||||
// INVARIANT: all members of content are non-empty. This can
|
||||
// be shown by observing when things are pushed onto content:
|
||||
// they are only ever pushed when is_collecting is true, and
|
||||
@@ -180,10 +217,20 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
// that collections are non-empty when is_collecting is true.
|
||||
|
||||
$ret = array();
|
||||
if ($caption !== false) $ret = array_merge($ret, $caption);
|
||||
if ($cols !== false) foreach ($cols as $token_array) $ret = array_merge($ret, $token_array);
|
||||
if ($thead !== false) $ret = array_merge($ret, $thead);
|
||||
if ($tfoot !== false) $ret = array_merge($ret, $tfoot);
|
||||
if ($caption !== false) {
|
||||
$ret = array_merge($ret, $caption);
|
||||
}
|
||||
if ($cols !== false) {
|
||||
foreach ($cols as $token_array) {
|
||||
$ret = array_merge($ret, $token_array);
|
||||
}
|
||||
}
|
||||
if ($thead !== false) {
|
||||
$ret = array_merge($ret, $thead);
|
||||
}
|
||||
if ($tfoot !== false) {
|
||||
$ret = array_merge($ret, $tfoot);
|
||||
}
|
||||
|
||||
if ($tbody_mode) {
|
||||
// a little tricky, since the start of the collection may be
|
||||
@@ -228,7 +275,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($collection) && $is_collecting == false){
|
||||
if (!empty($collection) && $is_collecting == false) {
|
||||
// grab the trailing space
|
||||
$ret = array_merge($ret, $collection);
|
||||
}
|
||||
|
Reference in New Issue
Block a user