diff --git a/library/HTMLPurifier/AttrDef/URI.php b/library/HTMLPurifier/AttrDef/URI.php index a3ce6ded..b1dddff3 100644 --- a/library/HTMLPurifier/AttrDef/URI.php +++ b/library/HTMLPurifier/AttrDef/URI.php @@ -77,6 +77,14 @@ HTMLPurifier_ConfigSchema::define( 'This directive has been available since 1.3.0.' ); +HTMLPurifier_ConfigSchema::define( + 'URI', 'Disable', false, 'bool', + 'Disables all URIs in all forms. Not sure why you\'d want to do that '. + '(after all, the Internet\'s founded on the notion of a hyperlink). '. + 'This directive has been available since 1.3.0.' +); +HTMLPurifier_ConfigSchema::defineAlias('Attr', 'DisableURI', 'URI', 'Disable'); + /** * Validates a URI as defined by RFC 3986. * @note Scheme-specific mechanics deferred to HTMLPurifier_URIScheme @@ -102,6 +110,8 @@ class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef // We'll write stack-based parsers later, for now, use regexps to // get things working as fast as possible (irony) + if ($config->get('URI', 'Disable')) return false; + // parse as CDATA $uri = $this->parseCDATA($uri); diff --git a/library/HTMLPurifier/HTMLDefinition.php b/library/HTMLPurifier/HTMLDefinition.php index f39e43ff..0b66fc2f 100644 --- a/library/HTMLPurifier/HTMLDefinition.php +++ b/library/HTMLPurifier/HTMLDefinition.php @@ -38,6 +38,8 @@ require_once 'HTMLPurifier/HTMLModule/StyleAttribute.php'; require_once 'HTMLPurifier/HTMLModule/TransformToStrict.php'; require_once 'HTMLPurifier/HTMLModule/Legacy.php'; +// tweak modules + // this definition and its modules MUST NOT define configuration directives // outside of the HTML or Attr namespaces HTMLPurifier_ConfigSchema::define( @@ -103,13 +105,6 @@ HTMLPurifier_ConfigSchema::define( 'IDs at all. This directive has been available since 1.3.0.' ); -HTMLPurifier_ConfigSchema::define( - 'Attr', 'DisableURI', false, 'bool', - 'Disables all URIs in all forms. Not sure why you\'d want to do that '. - '(after all, the Internet\'s founded on the notion of a hyperlink). '. - 'This directive has been available since 1.3.0.' -); - /** * Definition of the purified HTML that describes allowed children, * attributes, and many other things. @@ -282,6 +277,8 @@ class HTMLPurifier_HTMLDefinition // modules + // early + // main $main_modules = array('Text', 'Hypertext', 'List', 'Presentation', 'Edit', 'Bdo', 'Tables', 'Image', 'StyleAttribute'); @@ -476,17 +473,6 @@ class HTMLPurifier_HTMLDefinition */ function setupCompat() { - // deprecated config setting, implement in DisableURI module - if ($this->config->get('Attr', 'DisableURI')) { - $this->info['a']->attr['href'] = - $this->info['img']->attr['longdesc'] = - $this->info['del']->attr['cite'] = - $this->info['ins']->attr['cite'] = - $this->info['blockquote']->attr['cite'] = - $this->info['q']->attr['cite'] = - $this->info['img']->attr['src'] = null; - } - // setup allowed elements, SubtractiveWhitelist module $allowed_elements = $this->config->get('HTML', 'AllowedElements'); if (is_array($allowed_elements)) {