0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 16:31:53 +00:00

[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
This commit is contained in:
Edward Z. Yang 2007-05-22 00:47:03 +00:00
parent ff7eec7424
commit 797d3e0393
9 changed files with 15 additions and 32 deletions

1
NEWS
View File

@ -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

View File

@ -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';

View File

@ -1,7 +1,6 @@
<?php
require_once 'HTMLPurifier/AttrTypes.php';
require_once 'HTMLPurifier/AttrDef/Lang.php';
/**
* Defines common attribute collections that modules reference

View File

@ -1,5 +1,12 @@
<?php
require_once 'HTMLPurifier/ConfigSchema.php';
// member variables
require_once 'HTMLPurifier/HTMLDefinition.php';
require_once 'HTMLPurifier/CSSDefinition.php';
require_once 'HTMLPurifier/Doctype.php';
/**
* Configuration object that triggers customizable behavior.
*

View File

@ -79,7 +79,7 @@ class HTMLPurifier_ElementDef
* have to worry about this one.
* @public
*/
var $descendants_are_inline;
var $descendants_are_inline = false;
/**
* Lookup table of tags excluded from all descendants of this tag.
@ -150,7 +150,7 @@ class HTMLPurifier_ElementDef
$this->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;
}

View File

@ -1,7 +1,5 @@
<?php
require_once 'HTMLPurifier/EntityLookup.php';
HTMLPurifier_ConfigSchema::define(
'Core', 'Encoding', 'utf-8', 'istring',
'If for some reason you are unable to convert all webpages to UTF-8, '.

View File

@ -1,19 +1,5 @@
<?php
require_once 'HTMLPurifier/Lexer.php';
HTMLPurifier_ConfigSchema::define(
'Output', 'EnableRedundantUTF8Cleaning', false, 'bool',
'When true, HTMLPurifier_Generator will also check all strings it '.
'escapes for UTF-8 well-formedness as a defense in depth measure. '.
'This could cause a considerable performance impact, and is not '.
'strictly necessary due to the fact that the Lexers should have '.
'ensured that all the UTF-8 strings were well-formed. Note that '.
'the configuration value is only read at the beginning of '.
'generateFromTokens.'
);
HTMLPurifier_ConfigSchema::defineAlias('Core', 'CleanUTF8DuringGeneration', 'Output', 'EnableRedundantUTF8Cleaning');
HTMLPurifier_ConfigSchema::define(
'Output', 'CommentScriptContents', true, 'bool',
'Determines whether or not HTML Purifier should attempt to fix up '.
@ -56,12 +42,6 @@ HTMLPurifier_ConfigSchema::defineAlias('Core', 'TidyFormat', 'Output', 'TidyForm
class HTMLPurifier_Generator
{
/**
* Bool cache of %Output.EnableRedundantUTF8Cleaning
* @private
*/
var $_clean_utf8 = false;
/**
* Bool cache of %HTML.XHTML
* @private
@ -89,7 +69,6 @@ class HTMLPurifier_Generator
function generateFromTokens($tokens, $config, &$context) {
$html = '';
if (!$config) $config = HTMLPurifier_Config::createDefault();
$this->_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');
}

View File

@ -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);
//####################################################################//

View File

@ -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