diff --git a/library/HTMLPurifier/AttrTypes.php b/library/HTMLPurifier/AttrTypes.php index f186d260..9bf64023 100644 --- a/library/HTMLPurifier/AttrTypes.php +++ b/library/HTMLPurifier/AttrTypes.php @@ -16,12 +16,13 @@ class HTMLPurifier_AttrTypes { /** * Lookup array of attribute string identifiers to concrete implementations - * @public + * @protected */ var $info = array(); /** - * Constructs the info array + * Constructs the info array, supplying default implementations for attribute + * types. */ function HTMLPurifier_AttrTypes() { $this->info['CDATA'] = new HTMLPurifier_AttrDef_Text(); @@ -40,15 +41,27 @@ class HTMLPurifier_AttrTypes /** * Retrieves a type + * @param $type String type name + * @return Object AttrDef for type */ function get($type) { - // maybe some extra initialization could be done + // If $type is complicated, we may to clone the attribute + // definition and make custom changes if (!isset($this->info[$type])) { trigger_error('Cannot retrieve undefined attribute type ' . $type, E_USER_ERROR); return; } return $this->info[$type]; } + + /** + * Sets a new implementation for a type + * @param $type String type name + * @param $impl Object AttrDef for type + */ + function set($type, $impl) { + $this->info[$type] = $impl; + } } ?> diff --git a/library/HTMLPurifier/ContentSets.php b/library/HTMLPurifier/ContentSets.php index de5c532e..42d87b4d 100644 --- a/library/HTMLPurifier/ContentSets.php +++ b/library/HTMLPurifier/ContentSets.php @@ -6,6 +6,8 @@ require_once 'HTMLPurifier/ChildDef/Empty.php'; require_once 'HTMLPurifier/ChildDef/Required.php'; require_once 'HTMLPurifier/ChildDef/Optional.php'; +// NOT UNIT TESTED!!! + class HTMLPurifier_ContentSets { diff --git a/library/HTMLPurifier/EntityParser.php b/library/HTMLPurifier/EntityParser.php index 069c5ce1..d5422995 100644 --- a/library/HTMLPurifier/EntityParser.php +++ b/library/HTMLPurifier/EntityParser.php @@ -24,8 +24,8 @@ class HTMLPurifier_EntityParser * @protected */ var $_substituteEntitiesRegex = -'/&(?:[#]x([a-fA-F0-9]+)|[#]0*(\d+)|([A-Za-z]+));?/'; -// 1. hex 2. dec 3. string +'/&(?:[#]x([a-fA-F0-9]+)|[#]0*(\d+)|([A-Za-z_:][A-Za-z0-9.\-_:]*));?/'; +// 1. hex 2. dec 3. string (XML style) /** @@ -97,7 +97,6 @@ class HTMLPurifier_EntityParser } else { if (isset($this->_special_ent2dec[$matches[3]])) return $entity; if (!$this->_entity_lookup) { - require_once 'HTMLPurifier/EntityLookup.php'; $this->_entity_lookup = HTMLPurifier_EntityLookup::instance(); } if (isset($this->_entity_lookup->table[$matches[3]])) { diff --git a/library/HTMLPurifier/HTMLModule.php b/library/HTMLPurifier/HTMLModule.php index b1392ce9..54c61928 100644 --- a/library/HTMLPurifier/HTMLModule.php +++ b/library/HTMLPurifier/HTMLModule.php @@ -97,27 +97,6 @@ class HTMLPurifier_HTMLModule */ function getChildDef($def) {return false;} - /** - * Hook method that lets module perform arbitrary operations on - * HTMLPurifier_HTMLDefinition before the module gets processed. - * @param $definition Reference to HTMLDefinition being setup - */ - function preProcess(&$definition) {} - - /** - * Hook method that lets module perform arbitrary operations - * on HTMLPurifier_HTMLDefinition after the module gets processed. - * @param $definition Reference to HTMLDefinition being setup - */ - function postProcess(&$definition) {} - - /** - * Hook method that is called when a module gets registered to - * the definition. - * @param $definition Reference to HTMLDefinition being setup - */ - function setup(&$definition) {} - // -- Convenience ----------------------------------------------------- /** diff --git a/library/HTMLPurifier/Language.php b/library/HTMLPurifier/Language.php index ca6fe031..f4f638f5 100644 --- a/library/HTMLPurifier/Language.php +++ b/library/HTMLPurifier/Language.php @@ -2,6 +2,8 @@ require_once 'HTMLPurifier/LanguageFactory.php'; +// UNUSED + class HTMLPurifier_Language { diff --git a/library/HTMLPurifier/LanguageFactory.php b/library/HTMLPurifier/LanguageFactory.php index 7097ced7..57f97180 100644 --- a/library/HTMLPurifier/LanguageFactory.php +++ b/library/HTMLPurifier/LanguageFactory.php @@ -3,6 +3,8 @@ require_once 'HTMLPurifier/Language.php'; require_once 'HTMLPurifier/AttrDef/Lang.php'; +// UNUSED + /** * Class responsible for generating HTMLPurifier_Language objects, managing * caching and fallbacks. diff --git a/library/HTMLPurifier/Printer.php b/library/HTMLPurifier/Printer.php index 14135fd8..8325ff45 100644 --- a/library/HTMLPurifier/Printer.php +++ b/library/HTMLPurifier/Printer.php @@ -4,6 +4,8 @@ require_once 'HTMLPurifier/Generator.php'; require_once 'HTMLPurifier/Token.php'; require_once 'HTMLPurifier/Encoder.php'; +// OUT OF DATE, NEEDS UPDATING! + class HTMLPurifier_Printer {