diff --git a/NEWS b/NEWS index 03eb4179..1b20b3cb 100644 --- a/NEWS +++ b/NEWS @@ -17,10 +17,14 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier HTMLPurifier.php is insufficient--in such cases include HTMLPurifier.autoload.php as well to register our autoload handler (or modify your autoload function to check HTMLPurifier_Bootstrap::getPath($class)). +# HTMLPurifier_ConfigSchema static functions are officially deprecated. Schema + information is stored in the ConfigSchema directory, and the + maintenance/generate-schema-cache.php generates the schema.ser file, which + is now instantiated. Support for userland schema changes coming soon! ! Extra utility classes for testing and non-library operations can be found in extras/. Specifically, these are FSTools and ConfigSchema. You may find a use for these in your own project, but right now they - are highly experimental. + are highly experimental and volatile. - Autoclose now operates iteratively, i.e.
now has both span tags closed. . Plugins now get their own changelogs according to project conventions. @@ -31,6 +35,9 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier . Implemented recursive glob at FSTools->globr . ConfigSchema now has instance methods for all corresponding define* static methods. +. A couple of new historical maintenance scripts were added. +. HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php split into two files +. tests/index.php can now be run from any directory. 3.0.0, released 2008-01-06 # HTML Purifier is PHP 5 only! The 2.1.x branch will be maintained diff --git a/library/HTMLPurifier.auto.php b/library/HTMLPurifier.auto.php index 86cb3eaf..71bcf5de 100644 --- a/library/HTMLPurifier.auto.php +++ b/library/HTMLPurifier.auto.php @@ -8,6 +8,3 @@ set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); require_once 'HTMLPurifier/Bootstrap.php'; require_once 'HTMLPurifier.autoload.php'; - -// This is temporary until we get pure autoload working -require_once 'HTMLPurifier.includes.php'; diff --git a/library/HTMLPurifier.includes.php b/library/HTMLPurifier.includes.php index 4d3eb1a8..733c16a6 100644 --- a/library/HTMLPurifier.includes.php +++ b/library/HTMLPurifier.includes.php @@ -21,7 +21,6 @@ // Treat this file specially, as it is detached from the rest of the library require_once 'HTMLPurifier/Bootstrap.php'; -require 'HTMLPurifier/ConfigSchema.php'; require 'HTMLPurifier.php'; require 'HTMLPurifier/AttrCollections.php'; require 'HTMLPurifier/AttrDef.php'; @@ -32,6 +31,8 @@ require 'HTMLPurifier/Definition.php'; require 'HTMLPurifier/CSSDefinition.php'; require 'HTMLPurifier/ChildDef.php'; require 'HTMLPurifier/Config.php'; +require 'HTMLPurifier/ConfigDef.php'; +require 'HTMLPurifier/ConfigSchema.php'; require 'HTMLPurifier/ContentSets.php'; require 'HTMLPurifier/Context.php'; require 'HTMLPurifier/DefinitionCache.php'; @@ -119,6 +120,9 @@ require 'HTMLPurifier/ChildDef/Required.php'; require 'HTMLPurifier/ChildDef/Optional.php'; require 'HTMLPurifier/ChildDef/StrictBlockquote.php'; require 'HTMLPurifier/ChildDef/Table.php'; +require 'HTMLPurifier/ConfigDef/Directive.php'; +require 'HTMLPurifier/ConfigDef/DirectiveAlias.php'; +require 'HTMLPurifier/ConfigDef/Namespace.php'; require 'HTMLPurifier/DefinitionCache/Decorator.php'; require 'HTMLPurifier/DefinitionCache/Null.php'; require 'HTMLPurifier/DefinitionCache/Serializer.php'; @@ -143,8 +147,10 @@ require 'HTMLPurifier/HTMLModule/Text.php'; require 'HTMLPurifier/HTMLModule/Tidy.php'; require 'HTMLPurifier/HTMLModule/XMLCommonAttributes.php'; require 'HTMLPurifier/HTMLModule/Tidy/Proprietary.php'; -require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php'; require 'HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php'; +require 'HTMLPurifier/HTMLModule/Tidy/Strict.php'; +require 'HTMLPurifier/HTMLModule/Tidy/Transitional.php'; +require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php'; require 'HTMLPurifier/Injector/AutoParagraph.php'; require 'HTMLPurifier/Injector/Linkify.php'; require 'HTMLPurifier/Injector/PurifierLinkify.php'; diff --git a/library/HTMLPurifier.php b/library/HTMLPurifier.php index f428e833..b74a2780 100644 --- a/library/HTMLPurifier.php +++ b/library/HTMLPurifier.php @@ -42,7 +42,6 @@ // constants are slow, but we'll make one exception define('HTMLPURIFIER_PREFIX', dirname(__FILE__)); -// every class has an undocumented dependency to these, must be included! /** * Facade that coordinates HTML Purifier's subsystems in order to purify HTML. * diff --git a/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php b/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php index db5e05ea..babbb190 100644 --- a/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php +++ b/library/HTMLPurifier/HTMLModule/Tidy/Proprietary.php @@ -1,7 +1,6 @@ content_model_type != 'strictblockquote') return parent::getChildDef($def); + return new HTMLPurifier_ChildDef_StrictBlockquote($def->content_model); + } +} diff --git a/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php b/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php new file mode 100644 index 00000000..5a0e1170 --- /dev/null +++ b/library/HTMLPurifier/HTMLModule/Tidy/Transitional.php @@ -0,0 +1,8 @@ +content_model_type != 'strictblockquote') return parent::getChildDef($def); - return new HTMLPurifier_ChildDef_StrictBlockquote($def->content_model); - } -} - diff --git a/library/HTMLPurifier/HTMLModuleManager.php b/library/HTMLPurifier/HTMLModuleManager.php index d9f4d036..1c226089 100644 --- a/library/HTMLPurifier/HTMLModuleManager.php +++ b/library/HTMLPurifier/HTMLModuleManager.php @@ -146,14 +146,14 @@ class HTMLPurifier_HTMLModuleManager $ok = false; foreach ($this->prefixes as $prefix) { $module = $prefix . $original_module; - if ($this->_classExists($module)) { + if (class_exists($module)) { $ok = true; break; } } if (!$ok) { $module = $original_module; - if (!$this->_classExists($module)) { + if (!class_exists($module)) { trigger_error($original_module . ' module does not exist', E_USER_ERROR); return; @@ -168,15 +168,6 @@ class HTMLPurifier_HTMLModuleManager $this->registeredModules[$module->name] = $module; } - /** - * Safely tests for class existence without invoking __autoload in PHP5 - * or greater. - * @param $name String class name to test - */ - private function _classExists($name) { - return class_exists($name, false); - } - /** * Adds a module to the current doctype by first registering it, * and then tacking it on to the active doctype diff --git a/maintenance/generate-includes.php b/maintenance/generate-includes.php index aeb863bf..5e5e49c8 100644 --- a/maintenance/generate-includes.php +++ b/maintenance/generate-includes.php @@ -18,13 +18,11 @@ $FS = new FSTools(); $exclude_dirs = array( 'HTMLPurifier/Language/', 'HTMLPurifier/Filter/', - 'HTMLPurifier/ConfigDef/', // specially handled, remove this once fixed! ); $exclude_files = array( 'HTMLPurifier/Lexer/PEARSax3.php', 'HTMLPurifier/Lexer/PH5P.php', 'HTMLPurifier/Bootstrap.php', - 'HTMLPurifier/ConfigDef.php', // specially handled, remove this once fixed! ); // Determine what files need to be included: @@ -65,9 +63,6 @@ function get_dependency_lookup($file) { $deps = array(); while (!feof($fh)) { $line = fgets($fh); - if (strncmp('HTMLPurifier_ConfigSchema', $line, 25) === 0) { - $deps['HTMLPurifier/ConfigSchema.php'] = true; - } if (strncmp('class', $line, 5) === 0) { // The implementation here is fragile and will break if we attempt // to use interfaces. Beware! diff --git a/maintenance/merge-library.php b/maintenance/merge-library.php index e9c7416a..cf5ad1aa 100755 --- a/maintenance/merge-library.php +++ b/maintenance/merge-library.php @@ -145,6 +145,7 @@ $FS->rmdirr('standalone'); // ensure a clean copy // data files $FS->mkdirr('standalone/HTMLPurifier/DefinitionCache/Serializer'); make_dir_standalone('HTMLPurifier/EntityLookup'); +make_file_standalone('HTMLPurifier/ConfigSchema/schema.ser'); // non-standard inclusion setup make_dir_standalone('HTMLPurifier/Language'); diff --git a/tests/index.php b/tests/index.php index b4c992a5..42439503 100755 --- a/tests/index.php +++ b/tests/index.php @@ -15,6 +15,7 @@ define('HTMLPurifierTest', 1); define('HTMLPURIFIER_SCHEMA_STRICT', true); // validate schemas +chdir(dirname(__FILE__)); require_once 'common.php'; @@ -52,7 +53,7 @@ if ($AC['standalone']) { require_once '../library/HTMLPurifier.standalone.php'; } else { set_include_path(realpath('../library') . PATH_SEPARATOR . get_include_path() ); - require_once 'HTMLPurifier.includes.php'; + require_once 'HTMLPurifier.auto.php'; } require_once 'HTMLPurifier/Harness.php';