From 797d3e0393e812fc3b423fa2c68c7d10670a901a Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Tue, 22 May 2007 00:47:03 +0000 Subject: [PATCH] [1.7.0] Rewire dependencies, removing redundant includes and adding necessary ones - Rework descendants_are_inline to have default value as false, ins/del handling now works top-level when parent element is not block - Remove CleanUTF8OnGeneration, feature didn't even work git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1086 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 1 + library/HTMLPurifier.php | 2 +- library/HTMLPurifier/AttrCollections.php | 1 - library/HTMLPurifier/Config.php | 7 +++++++ library/HTMLPurifier/ElementDef.php | 4 ++-- library/HTMLPurifier/Encoder.php | 2 -- library/HTMLPurifier/Generator.php | 22 -------------------- library/HTMLPurifier/Strategy/FixNesting.php | 2 +- tests/HTMLPurifier/ElementDefTest.php | 6 +++--- 9 files changed, 15 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index 7d1cac0a..6f2f3acc 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier performed on it, ensuring that its internal state stays consistent. To revert this behavior, you can set the $autoFinalize member variable off, but it's not recommended. +- Deprecated and removed EnableRedundantUTF8Cleaning. It didn't even work! . Unit test for ElementDef created, ElementDef behavior modified to be more flexible . Added convenience functions for HTMLModule constructors diff --git a/library/HTMLPurifier.php b/library/HTMLPurifier.php index 3d538bca..dfd252f1 100644 --- a/library/HTMLPurifier.php +++ b/library/HTMLPurifier.php @@ -42,7 +42,7 @@ // almost every class has an undocumented dependency to these, so make sure // they get included -require_once 'HTMLPurifier/ConfigSchema.php'; +require_once 'HTMLPurifier/ConfigSchema.php'; // important require_once 'HTMLPurifier/Config.php'; require_once 'HTMLPurifier/Context.php'; diff --git a/library/HTMLPurifier/AttrCollections.php b/library/HTMLPurifier/AttrCollections.php index 9e056626..da5445db 100644 --- a/library/HTMLPurifier/AttrCollections.php +++ b/library/HTMLPurifier/AttrCollections.php @@ -1,7 +1,6 @@ child = false; } if(!is_null($def->child)) $this->child = $def->child; - if(!is_null($def->descendants_are_inline)) $this->descendants_are_inline = $def->descendants_are_inline; + if($def->descendants_are_inline) $this->descendants_are_inline = $def->descendants_are_inline; if(!is_null($def->safe)) $this->safe = $def->safe; } diff --git a/library/HTMLPurifier/Encoder.php b/library/HTMLPurifier/Encoder.php index 1a22b452..cddcdb40 100644 --- a/library/HTMLPurifier/Encoder.php +++ b/library/HTMLPurifier/Encoder.php @@ -1,7 +1,5 @@ _clean_utf8 = $config->get('Output', 'EnableRedundantUTF8Cleaning'); $this->_scriptFix = $config->get('Output', 'CommentScriptContents'); $doctype = $config->getDoctype(); @@ -204,7 +183,6 @@ class HTMLPurifier_Generator * @return String escaped data. */ function escape($string) { - if ($this->_clean_utf8) $string = HTMLPurifier_Lexer::cleanUTF8($string); return htmlspecialchars($string, ENT_COMPAT, 'UTF-8'); } diff --git a/library/HTMLPurifier/Strategy/FixNesting.php b/library/HTMLPurifier/Strategy/FixNesting.php index 08f90756..bed1818a 100644 --- a/library/HTMLPurifier/Strategy/FixNesting.php +++ b/library/HTMLPurifier/Strategy/FixNesting.php @@ -49,7 +49,7 @@ class HTMLPurifier_Strategy_FixNesting extends HTMLPurifier_Strategy $tokens[] = new HTMLPurifier_Token_End($parent_name); // setup the context variables - $is_inline = false; // reference var that we alter + $is_inline = $definition->info_parent_def->descendants_are_inline; $context->register('IsInline', $is_inline); //####################################################################// diff --git a/tests/HTMLPurifier/ElementDefTest.php b/tests/HTMLPurifier/ElementDefTest.php index 6ac7b521..23ef6e17 100644 --- a/tests/HTMLPurifier/ElementDefTest.php +++ b/tests/HTMLPurifier/ElementDefTest.php @@ -37,7 +37,7 @@ class HTMLPurifier_ElementDefTest extends UnitTestCase 'old' => true, 'removed-old' => true ); - $def1->descendants_are_inline = $overloaded_old; + $def1->descendants_are_inline = false; $def1->excludes = array( 'old' => true, 'removed-old' => true @@ -64,7 +64,7 @@ class HTMLPurifier_ElementDefTest extends UnitTestCase 'new' => true, 'removed-old' => false ); - $def2->descendants_are_inline = $overloaded_new; + $def2->descendants_are_inline = true; $def2->excludes = array( 'new' => true, 'removed-old' => false @@ -94,7 +94,7 @@ class HTMLPurifier_ElementDefTest extends UnitTestCase 'old' => true, 'new' => true )); - $this->assertIdentical($def1->descendants_are_inline, $overloaded_new); + $this->assertIdentical($def1->descendants_are_inline, true); $this->assertIdentical($def1->excludes, array( 'old' => true, 'new' => true