From e0c0d8eab67175f22824831ad374cce8e6a1cec0 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Tue, 13 May 2008 02:02:27 +0000 Subject: [PATCH] [3.1.0] Allow arbitrary whitespace in %HTML.Allowed git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1707 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 1 + TODO | 8 ++++++-- library/HTMLPurifier/HTMLDefinition.php | 2 ++ tests/HTMLPurifier/HTMLDefinitionTest.php | 7 ++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index cc05dada..96abd22e 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier ! Added HTMLPurifier::VERSION constant ! Commas, not dashes, used for serializer IDs. This change is forwards-compatible and allows for version numbers like "3.1.0-dev". +! %HTML.Allowed deals gracefully with whitespace anywhere, anytime! - InterchangeBuilder now alphabetizes its lists - Validation error in configdoc output fixed - Iconv and other encoding errors muted even with custom error handlers that diff --git a/TODO b/TODO index ea330ff6..db82c4c2 100644 --- a/TODO +++ b/TODO @@ -15,8 +15,7 @@ afraid to cast your vote for the next feature to be implemented! in the scanner - Quick optimizations for empty strings and strings without HTML (make sure %HTML.Parent is accounted for) - Denis - - Write a var_export and memcached DefinitionCache - Denis - - Make %HTML.Allowed accept arbitrary whitespace - Denis + - Ensure cache files by Serializer are chmod'ed properly - Denis FUTURE VERSIONS --------------- @@ -83,9 +82,11 @@ AutoFormat Optimizations - Reduce size of internal data-structures (esp. HTMLDefinition) + - Research memory usage of objects versus arrays - Combine multiple strategies into a single, single-pass strategy - Get PH5P working with the latest versions of DOM, which have much more stringent error checking procedures. Maybe convert straight to tokens. + - Get rid of set_include_path(). Save this for another major release. Neat feature related ! Factor demo.php into a set of Printer classes, and then create a stub @@ -103,6 +104,9 @@ Neat feature related empty-cells:show is applied to have compatibility with Internet Explorer - Table of Contents generation (XHTML Compiler might be reusable). May also be out-of-band information. + - Full set of color keywords. Also, a way to add onto them without + finalizing the configuration object. + - Write a var_export and memcached DefinitionCache - Denis Maintenance related (slightly boring) # CHMOD install script for PEAR installs diff --git a/library/HTMLPurifier/HTMLDefinition.php b/library/HTMLPurifier/HTMLDefinition.php index d8e22ee9..ce299f79 100644 --- a/library/HTMLPurifier/HTMLDefinition.php +++ b/library/HTMLPurifier/HTMLDefinition.php @@ -369,6 +369,8 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier_Definition */ public function parseTinyMCEAllowedList($list) { + $list = str_replace(array(' ', "\t"), '', $list); + $elements = array(); $attributes = array(); diff --git a/tests/HTMLPurifier/HTMLDefinitionTest.php b/tests/HTMLPurifier/HTMLDefinitionTest.php index a396d100..b64c60a4 100644 --- a/tests/HTMLPurifier/HTMLDefinitionTest.php +++ b/tests/HTMLPurifier/HTMLDefinitionTest.php @@ -56,10 +56,15 @@ class HTMLPurifier_HTMLDefinitionTest extends HTMLPurifier_Harness strong a[href|title] '), - array(array('span' => true, 'strong' => true, 'a' => true), + $val = array(array('span' => true, 'strong' => true, 'a' => true), array('span.style' => true, 'a.href' => true, 'a.title' => true)) ); + $this->assertEqual( + $def->parseTinyMCEAllowedList(' span [ style ], strong'."\n\t".'a[href | title]'), + $val + ); + } function test_Allowed() { -- 2.11.4.GIT