2008-10-01 19:40:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_Strategy_MakeWellFormed_EndRewindInjector extends HTMLPurifier_Injector
|
|
|
|
{
|
|
|
|
public $name = 'EndRewindInjector';
|
|
|
|
public $needed = array('span');
|
2022-09-10 18:03:42 +00:00
|
|
|
private $deleteElement = false;
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function handleElement(&$token)
|
|
|
|
{
|
2022-09-10 18:03:42 +00:00
|
|
|
if ($this->deleteElement) {
|
2008-10-01 19:40:31 +00:00
|
|
|
$token = false;
|
2022-09-10 18:03:42 +00:00
|
|
|
$this->deleteElement = false;
|
2008-10-01 19:40:31 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-16 11:56:14 +00:00
|
|
|
public function handleText(&$token)
|
|
|
|
{
|
2008-10-01 19:40:31 +00:00
|
|
|
$token = false;
|
|
|
|
}
|
2013-07-16 11:56:14 +00:00
|
|
|
public function handleEnd(&$token)
|
|
|
|
{
|
2008-10-01 19:40:31 +00:00
|
|
|
$i = null;
|
|
|
|
if (
|
|
|
|
$this->backward($i, $prev) &&
|
|
|
|
$prev instanceof HTMLPurifier_Token_Start &&
|
|
|
|
$prev->name == 'span'
|
|
|
|
) {
|
|
|
|
$token = false;
|
2022-09-10 18:03:42 +00:00
|
|
|
$this->deleteElement = true;
|
2013-10-13 19:53:51 +00:00
|
|
|
$this->rewindOffset(1);
|
2008-10-01 19:40:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|