From de378700110c202bc25e9378cb5fdb852d27f07a Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 13 Aug 2015 09:23:09 +0200 Subject: remove net url package and update composer deps --- .../library/HTMLPurifier/Injector/RemoveEmpty.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/RemoveEmpty.php') diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/RemoveEmpty.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/RemoveEmpty.php index cd885722e..01353ff1d 100644 --- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/RemoveEmpty.php +++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Injector/RemoveEmpty.php @@ -28,10 +28,10 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector private $removeNbspExceptions; /** + * Cached contents of %AutoFormat.RemoveEmpty.Predicate * @type array - * TODO: make me configurable */ - private $_exclude = array('colgroup' => 1, 'th' => 1, 'td' => 1, 'iframe' => 1); + private $exclude; /** * @param HTMLPurifier_Config $config @@ -45,6 +45,7 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector $this->context = $context; $this->removeNbsp = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp'); $this->removeNbspExceptions = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions'); + $this->exclude = $config->get('AutoFormat.RemoveEmpty.Predicate'); $this->attrValidator = new HTMLPurifier_AttrValidator(); } @@ -75,11 +76,15 @@ class HTMLPurifier_Injector_RemoveEmpty extends HTMLPurifier_Injector break; } if (!$next || ($next instanceof HTMLPurifier_Token_End && $next->name == $token->name)) { - if (isset($this->_exclude[$token->name])) { - return; - } $this->attrValidator->validateToken($token, $this->config, $this->context); $token->armor['ValidateAttributes'] = true; + if (isset($this->exclude[$token->name])) { + $r = true; + foreach ($this->exclude[$token->name] as $elem) { + if (!isset($token->attr[$elem])) $r = false; + } + if ($r) return; + } if (isset($token->attr['id']) || isset($token->attr['name'])) { return; } -- cgit v1.2.3