diff --git a/NEWS b/NEWS index ac6ffa5c..51a42359 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier this out. - Fix validation errors in configuration form - Hammer out a bunch of edge-case bugs in the standalone distribution +- Inclusion reflection removed from URISchemeRegistry; you must manually + include any new schema files you wish to use . Unit test refactoring for one logical test per test function . Config and context parameters in ComplexHarness deprecated: instead, edit the $config and $context member variables diff --git a/library/HTMLPurifier/URISchemeRegistry.php b/library/HTMLPurifier/URISchemeRegistry.php index 8cddb7f9..6837fada 100644 --- a/library/HTMLPurifier/URISchemeRegistry.php +++ b/library/HTMLPurifier/URISchemeRegistry.php @@ -1,5 +1,12 @@ true, // "Hypertext Transfer Protocol", nuf' said @@ -7,7 +14,6 @@ HTMLPurifier_ConfigSchema::define( // quite useful, but not necessary 'mailto' => true,// Email 'ftp' => true, // "File Transfer Protocol" - 'irc' => true, // "Internet Relay Chat", usually needs another app // for Usenet, these two are similar, but distinct 'nntp' => true, // individual Netnews articles 'news' => true // newsgroup or individual Netnews articles @@ -54,12 +60,6 @@ class HTMLPurifier_URISchemeRegistry */ var $schemes = array(); - /** - * Directory where scheme objects can be found - * @private - */ - var $_scheme_dir = null; - /** * Retrieves a scheme validator object * @param $scheme String scheme name like http or mailto @@ -79,21 +79,16 @@ class HTMLPurifier_URISchemeRegistry } if (isset($this->schemes[$scheme])) return $this->schemes[$scheme]; - if (empty($this->_dir)) $this->_dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier/URIScheme/'; - if (!isset($allowed_schemes[$scheme])) return $null; - // this bit of reflection is not very efficient, and a bit - // hacky too $class = 'HTMLPurifier_URIScheme_' . $scheme; - if (!class_exists($class)) include_once $this->_dir . $scheme . '.php'; if (!class_exists($class)) return $null; $this->schemes[$scheme] = new $class(); return $this->schemes[$scheme]; } /** - * Registers a custom scheme to the cache. + * Registers a custom scheme to the cache, bypassing reflection. * @param $scheme Scheme name * @param $scheme_obj HTMLPurifier_URIScheme object */ diff --git a/maintenance/merge-library.php b/maintenance/merge-library.php index 4ee7d3f0..2d73824b 100755 --- a/maintenance/merge-library.php +++ b/maintenance/merge-library.php @@ -174,8 +174,9 @@ function copy_and_remove_includes($file, $sfile) { */ function replace_includes_callback($matches) { $file = $matches[1]; - // PHP 5 only file - if ($file == 'HTMLPurifier/Lexer/DOMLex.php' || $file == 'HTMLPurifier/Printer.php') { + // PHP 5 only file / PEAR files + $preserve = array('HTMLPurifier/Lexer/DOMLex.php'=>1, 'HTMLPurifier/Printer.php'=>1, 'XML/HTMLSax3.php'=>1); + if (isset($preserve[$file])) { return $matches[0]; } if (isset($GLOBALS['loaded'][$file])) return ''; @@ -205,8 +206,8 @@ make_dir_standalone('HTMLPurifier/EntityLookup'); make_dir_standalone('HTMLPurifier/Language'); make_file_standalone('HTMLPurifier/Printer.php'); make_dir_standalone('HTMLPurifier/Printer'); -make_dir_standalone('HTMLPurifier/URIScheme'); make_dir_standalone('HTMLPurifier/Filter'); +make_file_standalone('HTMLPurifier/Lexer/PEARSax3.php'); // not incl by default // PHP 5 only files make_file_standalone('HTMLPurifier/Lexer/DOMLex.php'); make_file_standalone('HTMLPurifier/Lexer/PH5P.php');