1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-10-22 00:56:14 +02:00

Gusev's proposed patch

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Edward Z. Yang
2013-10-12 21:24:38 -07:00
parent 6e37ecd1c8
commit c768146e4d
6 changed files with 426 additions and 4 deletions

View File

@@ -45,7 +45,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
protected $context;
public function execute($tokens, $config, $context) {
$tokens = new HTMLPurifier_Array($tokens);
$definition = $config->getHTMLDefinition();
// local variables
@@ -453,7 +453,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
$context->destroy('CurrentToken');
unset($this->injectors, $this->stack, $this->tokens, $this->t);
return $tokens;
return $tokens->getArray();
}
/**
@@ -490,6 +490,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
// array(number nodes to delete, new node 1, new node 2, ...)
$delete = array_shift($token);
throw new Exception("unsupported");
$old = array_splice($this->tokens, $this->t, $delete, $token);
if ($injector > -1) {
@@ -508,7 +509,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
* this token. You must reprocess after this.
*/
private function insertBefore($token) {
array_splice($this->tokens, $this->t, 0, array($token));
$this->tokens->insertBefore($this->t, $token);
}
/**
@@ -516,7 +517,7 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy
* occupied space. You must reprocess after this.
*/
private function remove() {
array_splice($this->tokens, $this->t, 1);
$this->tokens->remove($this->t);
}
/**