0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-18 18:25:18 +00:00

Blacklist more tags from RemoveEmpty.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Edward Z. Yang 2012-10-27 02:32:48 -07:00
parent a44187a5c1
commit 087145a71b
2 changed files with 5 additions and 1 deletions

1
NEWS
View File

@ -26,6 +26,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- Fix bug with non lower-case color names in HTML
- Fix bug where data URI validation doesn't remove temporary files.
Thanks Javier Marín Ros <javiermarinros@gmail.com> for reporting.
- Don't remove certain empty tags on RemoveEmpty.
4.4.0, released 2012-01-18
# Removed PEARSax3 handler.

View File

@ -5,6 +5,9 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector
private $context, $config, $attrValidator, $removeNbsp, $removeNbspExceptions;
// TODO: make me configurable
private $_exclude = array('colgroup' => 1, 'th' => 1, 'td' => 1, 'iframe' => 1);
public function prepare($config, $context) {
parent::prepare($config, $context);
$this->config = $config;
@ -30,7 +33,7 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector
break;
}
if (!$next || ($next instanceof HTMLPurifier_Token_End && $next->name == $token->name)) {
if ($token->name == 'colgroup') return;
if (isset($this->_exclude[$token->name])) return;
$this->attrValidator->validateToken($token, $this->config, $this->context);
$token->armor['ValidateAttributes'] = true;
if (isset($token->attr['id']) || isset($token->attr['name'])) return;