mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-09 07:21:54 +00:00
[1.5.0] Rename %Attr.DisableURI to %URI.Disable and move it over to the AttrDef.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@742 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
cac22f01cf
commit
67befbc8a8
@ -77,6 +77,14 @@ HTMLPurifier_ConfigSchema::define(
|
|||||||
'This directive has been available since 1.3.0.'
|
'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.
|
* Validates a URI as defined by RFC 3986.
|
||||||
* @note Scheme-specific mechanics deferred to HTMLPurifier_URIScheme
|
* @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
|
// We'll write stack-based parsers later, for now, use regexps to
|
||||||
// get things working as fast as possible (irony)
|
// get things working as fast as possible (irony)
|
||||||
|
|
||||||
|
if ($config->get('URI', 'Disable')) return false;
|
||||||
|
|
||||||
// parse as CDATA
|
// parse as CDATA
|
||||||
$uri = $this->parseCDATA($uri);
|
$uri = $this->parseCDATA($uri);
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ require_once 'HTMLPurifier/HTMLModule/StyleAttribute.php';
|
|||||||
require_once 'HTMLPurifier/HTMLModule/TransformToStrict.php';
|
require_once 'HTMLPurifier/HTMLModule/TransformToStrict.php';
|
||||||
require_once 'HTMLPurifier/HTMLModule/Legacy.php';
|
require_once 'HTMLPurifier/HTMLModule/Legacy.php';
|
||||||
|
|
||||||
|
// tweak modules
|
||||||
|
|
||||||
// this definition and its modules MUST NOT define configuration directives
|
// this definition and its modules MUST NOT define configuration directives
|
||||||
// outside of the HTML or Attr namespaces
|
// outside of the HTML or Attr namespaces
|
||||||
HTMLPurifier_ConfigSchema::define(
|
HTMLPurifier_ConfigSchema::define(
|
||||||
@ -103,13 +105,6 @@ HTMLPurifier_ConfigSchema::define(
|
|||||||
'IDs at all. This directive has been available since 1.3.0.'
|
'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,
|
* Definition of the purified HTML that describes allowed children,
|
||||||
* attributes, and many other things.
|
* attributes, and many other things.
|
||||||
@ -282,6 +277,8 @@ class HTMLPurifier_HTMLDefinition
|
|||||||
|
|
||||||
// modules
|
// modules
|
||||||
|
|
||||||
|
// early
|
||||||
|
|
||||||
// main
|
// main
|
||||||
$main_modules = array('Text', 'Hypertext', 'List', 'Presentation',
|
$main_modules = array('Text', 'Hypertext', 'List', 'Presentation',
|
||||||
'Edit', 'Bdo', 'Tables', 'Image', 'StyleAttribute');
|
'Edit', 'Bdo', 'Tables', 'Image', 'StyleAttribute');
|
||||||
@ -476,17 +473,6 @@ class HTMLPurifier_HTMLDefinition
|
|||||||
*/
|
*/
|
||||||
function setupCompat() {
|
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
|
// setup allowed elements, SubtractiveWhitelist module
|
||||||
$allowed_elements = $this->config->get('HTML', 'AllowedElements');
|
$allowed_elements = $this->config->get('HTML', 'AllowedElements');
|
||||||
if (is_array($allowed_elements)) {
|
if (is_array($allowed_elements)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user