0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-08 23:11:52 +00:00

Renamed ConfigDef to ConfigSchema. (Required major internal restructuring but should not affect end-users)

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@424 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-09-16 22:36:58 +00:00
parent f43616f72d
commit 3b30c2ca5b
17 changed files with 67 additions and 66 deletions

1
NEWS
View File

@ -8,6 +8,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- Directive documentation generation using XSLT - Directive documentation generation using XSLT
- Table child definition made more flexible, will fix up poorly ordered elements - Table child definition made more flexible, will fix up poorly ordered elements
- XHTML generation can now be turned off, allowing things like <br> - XHTML generation can now be turned off, allowing things like <br>
- Renamed ConfigDef to ConfigSchema
1.0.1, released 2006-09-04 1.0.1, released 2006-09-04
- Fixed slight bug in DOMLex attribute parsing - Fixed slight bug in DOMLex attribute parsing

View File

@ -18,7 +18,7 @@
* However, most users will only need to interface with the HTMLPurifier * However, most users will only need to interface with the HTMLPurifier
* class, so this massive amount of infrastructure is usually concealed. * class, so this massive amount of infrastructure is usually concealed.
* If you plan on working with the internals, be sure to include * If you plan on working with the internals, be sure to include
* HTMLPurifier_ConfigDef and HTMLPurifier_Config. * HTMLPurifier_ConfigSchema and HTMLPurifier_Config.
*/ */
/* /*
@ -42,7 +42,7 @@
// almost every class has an undocumented dependency to these, so make sure // almost every class has an undocumented dependency to these, so make sure
// they get included // they get included
require_once 'HTMLPurifier/ConfigDef.php'; require_once 'HTMLPurifier/ConfigSchema.php';
require_once 'HTMLPurifier/Config.php'; require_once 'HTMLPurifier/Config.php';
require_once 'HTMLPurifier/Lexer.php'; require_once 'HTMLPurifier/Lexer.php';

View File

@ -5,7 +5,7 @@ require_once 'HTMLPurifier/URIScheme.php';
require_once 'HTMLPurifier/URISchemeRegistry.php'; require_once 'HTMLPurifier/URISchemeRegistry.php';
require_once 'HTMLPurifier/AttrDef/Host.php'; require_once 'HTMLPurifier/AttrDef/Host.php';
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'URI', 'DefaultScheme', 'http', 'string', 'URI', 'DefaultScheme', 'http', 'string',
'Defines through what scheme the output will be served, in order to '. 'Defines through what scheme the output will be served, in order to '.
'select the proper object validator when no scheme information is present.' 'select the proper object validator when no scheme information is present.'

View File

@ -4,13 +4,13 @@ require_once 'HTMLPurifier/AttrTransform.php';
// this MUST be placed in post, as it assumes that any value in dir is valid // this MUST be placed in post, as it assumes that any value in dir is valid
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Attr', 'DefaultTextDir', 'ltr', 'string', 'Attr', 'DefaultTextDir', 'ltr', 'string',
'Defines the default text direction (ltr or rtl) of the document '. 'Defines the default text direction (ltr or rtl) of the document '.
'being parsed. This generally is the same as the value of the dir '. 'being parsed. This generally is the same as the value of the dir '.
'attribute in HTML, or ltr if that is not specified.' 'attribute in HTML, or ltr if that is not specified.'
); );
HTMLPurifier_ConfigDef::defineAllowedValues( HTMLPurifier_ConfigSchema::defineAllowedValues(
'Attr', 'DefaultTextDir', array( 'ltr', 'rtl' ) 'Attr', 'DefaultTextDir', array( 'ltr', 'rtl' )
); );

View File

@ -4,7 +4,7 @@ require_once 'HTMLPurifier/AttrTransform.php';
// must be called POST validation // must be called POST validation
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Attr', 'DefaultInvalidImage', '', 'string', 'Attr', 'DefaultInvalidImage', '', 'string',
'This is the default image an img tag will be pointed to if it does '. 'This is the default image an img tag will be pointed to if it does '.
'not have a valid src attribute. In future versions, we may allow the '. 'not have a valid src attribute. In future versions, we may allow the '.
@ -12,7 +12,7 @@ HTMLPurifier_ConfigDef::define(
'not possible right now.' 'not possible right now.'
); );
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Attr', 'DefaultInvalidImageAlt', 'Invalid image', 'string', 'Attr', 'DefaultInvalidImageAlt', 'Invalid image', 'string',
'This is the content of the alt tag of an invalid image if the user '. 'This is the content of the alt tag of an invalid image if the user '.
'had not previously specified an alt attribute. It has no effect when the '. 'had not previously specified an alt attribute. It has no effect when the '.

View File

@ -5,7 +5,7 @@
// false = delete parent node and all children // false = delete parent node and all children
// array(...) = replace children nodes with these // array(...) = replace children nodes with these
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'EscapeInvalidChildren', false, 'bool', 'Core', 'EscapeInvalidChildren', false, 'bool',
'When true, a child is found that is not allowed in the context of the '. 'When true, a child is found that is not allowed in the context of the '.
'parent element will be transformed into text as if it were ASCII. When '. 'parent element will be transformed into text as if it were ASCII. When '.

View File

@ -21,7 +21,7 @@ class HTMLPurifier_Config
var $conf; var $conf;
/** /**
* Reference HTMLPurifier_ConfigDef for value checking * Reference HTMLPurifier_ConfigSchema for value checking
*/ */
var $def; var $def;
@ -36,7 +36,7 @@ class HTMLPurifier_Config
var $css_definition; var $css_definition;
/** /**
* @param $definition HTMLPurifier_ConfigDef that defines what directives * @param $definition HTMLPurifier_ConfigSchema that defines what directives
* are allowed. * are allowed.
*/ */
function HTMLPurifier_Config(&$definition) { function HTMLPurifier_Config(&$definition) {
@ -49,7 +49,7 @@ class HTMLPurifier_Config
* @return Default HTMLPurifier_Config object. * @return Default HTMLPurifier_Config object.
*/ */
function createDefault() { function createDefault() {
$definition =& HTMLPurifier_ConfigDef::instance(); $definition =& HTMLPurifier_ConfigSchema::instance();
$config = new HTMLPurifier_Config($definition); $config = new HTMLPurifier_Config($definition);
return $config; return $config;
} }

View File

@ -19,7 +19,7 @@
* might be implementation difficulties in ini files regarding order of * might be implementation difficulties in ini files regarding order of
* execution. * execution.
*/ */
class HTMLPurifier_ConfigDef { class HTMLPurifier_ConfigSchema {
/** /**
* Defaults of the directives and namespaces. * Defaults of the directives and namespaces.
@ -73,7 +73,7 @@ class HTMLPurifier_ConfigDef {
if ($prototype !== null) { if ($prototype !== null) {
$instance = $prototype; $instance = $prototype;
} elseif ($instance === null || $prototype === true) { } elseif ($instance === null || $prototype === true) {
$instance = new HTMLPurifier_ConfigDef(); $instance = new HTMLPurifier_ConfigSchema();
$instance->initialize(); $instance->initialize();
} }
return $instance; return $instance;
@ -96,7 +96,7 @@ class HTMLPurifier_ConfigDef {
$namespace, $name, $default, $type, $namespace, $name, $default, $type,
$description $description
) { ) {
$def =& HTMLPurifier_ConfigDef::instance(); $def =& HTMLPurifier_ConfigSchema::instance();
if (!isset($def->info[$namespace])) { if (!isset($def->info[$namespace])) {
trigger_error('Cannot define directive for undefined namespace', trigger_error('Cannot define directive for undefined namespace',
E_USER_ERROR); E_USER_ERROR);
@ -143,7 +143,7 @@ class HTMLPurifier_ConfigDef {
* @param $description Description of the namespace * @param $description Description of the namespace
*/ */
function defineNamespace($namespace, $description) { function defineNamespace($namespace, $description) {
$def =& HTMLPurifier_ConfigDef::instance(); $def =& HTMLPurifier_ConfigSchema::instance();
if (isset($def->info[$namespace])) { if (isset($def->info[$namespace])) {
trigger_error('Cannot redefine namespace', E_USER_ERROR); trigger_error('Cannot redefine namespace', E_USER_ERROR);
return; return;
@ -170,7 +170,7 @@ class HTMLPurifier_ConfigDef {
* @param $real Value aliased value will be converted into * @param $real Value aliased value will be converted into
*/ */
function defineValueAliases($namespace, $name, $aliases) { function defineValueAliases($namespace, $name, $aliases) {
$def =& HTMLPurifier_ConfigDef::instance(); $def =& HTMLPurifier_ConfigSchema::instance();
if (!isset($def->info[$namespace][$name])) { if (!isset($def->info[$namespace][$name])) {
trigger_error('Cannot set value alias for non-existant directive', trigger_error('Cannot set value alias for non-existant directive',
E_USER_ERROR); E_USER_ERROR);
@ -200,7 +200,7 @@ class HTMLPurifier_ConfigDef {
* @param $allowed_values Arraylist of allowed values * @param $allowed_values Arraylist of allowed values
*/ */
function defineAllowedValues($namespace, $name, $allowed_values) { function defineAllowedValues($namespace, $name, $allowed_values) {
$def =& HTMLPurifier_ConfigDef::instance(); $def =& HTMLPurifier_ConfigSchema::instance();
if (!isset($def->info[$namespace][$name])) { if (!isset($def->info[$namespace][$name])) {
trigger_error('Cannot define allowed values for undefined directive', trigger_error('Cannot define allowed values for undefined directive',
E_USER_ERROR); E_USER_ERROR);

View File

@ -2,7 +2,7 @@
require_once 'HTMLPurifier/EntityLookup.php'; require_once 'HTMLPurifier/EntityLookup.php';
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Encoding', 'utf-8', 'istring', 'Core', 'Encoding', 'utf-8', 'istring',
'If for some reason you are unable to convert all webpages to UTF-8, '. 'If for some reason you are unable to convert all webpages to UTF-8, '.
'you can use this directive as a stop-gap compatibility change to '. 'you can use this directive as a stop-gap compatibility change to '.
@ -17,20 +17,20 @@ HTMLPurifier_ConfigDef::define(
if ( !function_exists('iconv') ) { if ( !function_exists('iconv') ) {
// only encodings with native PHP support // only encodings with native PHP support
HTMLPurifier_ConfigDef::defineAllowedValues( HTMLPurifier_ConfigSchema::defineAllowedValues(
'Core', 'Encoding', array( 'Core', 'Encoding', array(
'utf-8', 'utf-8',
'iso-8859-1' 'iso-8859-1'
) )
); );
HTMLPurifier_ConfigDef::defineValueAliases( HTMLPurifier_ConfigSchema::defineValueAliases(
'Core', 'Encoding', array( 'Core', 'Encoding', array(
'iso8859-1' => 'iso-8859-1' 'iso8859-1' => 'iso-8859-1'
) )
); );
} }
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Test', 'ForceNoIconv', false, 'bool', 'Test', 'ForceNoIconv', false, 'bool',
'When set to true, HTMLPurifier_Encoder will act as if iconv does not '. 'When set to true, HTMLPurifier_Encoder will act as if iconv does not '.
'exist and use only pure PHP implementations.' 'exist and use only pure PHP implementations.'

View File

@ -4,7 +4,7 @@
require_once 'HTMLPurifier/Lexer.php'; require_once 'HTMLPurifier/Lexer.php';
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'CleanUTF8DuringGeneration', false, 'bool', 'Core', 'CleanUTF8DuringGeneration', false, 'bool',
'When true, HTMLPurifier_Generator will also check all strings it '. 'When true, HTMLPurifier_Generator will also check all strings it '.
'escapes for UTF-8 well-formedness as a defense in depth measure. '. 'escapes for UTF-8 well-formedness as a defense in depth measure. '.
@ -15,7 +15,7 @@ HTMLPurifier_ConfigDef::define(
'generateFromTokens.' 'generateFromTokens.'
); );
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'XHTML', true, 'bool', 'Core', 'XHTML', true, 'bool',
'Determines whether or not output is XHTML or not. When disabled, HTML '. 'Determines whether or not output is XHTML or not. When disabled, HTML '.
'Purifier goes into HTML 4.01 removes XHTML-specific markup constructs, '. 'Purifier goes into HTML 4.01 removes XHTML-specific markup constructs, '.

View File

@ -4,7 +4,7 @@ require_once 'HTMLPurifier/Token.php';
require_once 'HTMLPurifier/Encoder.php'; require_once 'HTMLPurifier/Encoder.php';
require_once 'HTMLPurifier/EntityParser.php'; require_once 'HTMLPurifier/EntityParser.php';
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'AcceptFullDocuments', true, 'bool', 'Core', 'AcceptFullDocuments', true, 'bool',
'This parameter determines whether or not the filter should accept full '. 'This parameter determines whether or not the filter should accept full '.
'HTML documents, not just HTML fragments. When on, it will '. 'HTML documents, not just HTML fragments. When on, it will '.

View File

@ -8,7 +8,7 @@
* features, such as custom tags, custom parsing of text, etc. * features, such as custom tags, custom parsing of text, etc.
*/ */
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'EscapeInvalidTags', false, 'bool', 'Core', 'EscapeInvalidTags', false, 'bool',
'When true, invalid tags will be written back to the document as plain '. 'When true, invalid tags will be written back to the document as plain '.
'text. Otherwise, they are silently dropped.' 'text. Otherwise, they are silently dropped.'

View File

@ -3,10 +3,10 @@
require_once 'HTMLPurifier/Strategy.php'; require_once 'HTMLPurifier/Strategy.php';
require_once 'HTMLPurifier/HTMLDefinition.php'; require_once 'HTMLPurifier/HTMLDefinition.php';
require_once 'HTMLPurifier/IDAccumulator.php'; require_once 'HTMLPurifier/IDAccumulator.php';
require_once 'HTMLPurifier/ConfigDef.php'; require_once 'HTMLPurifier/ConfigSchema.php';
require_once 'HTMLPurifier/AttrContext.php'; require_once 'HTMLPurifier/AttrContext.php';
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Attr', 'IDBlacklist', array(), 'list', 'Attr', 'IDBlacklist', array(), 'list',
'Array of IDs not allowed in the document.'); 'Array of IDs not allowed in the document.');

View File

@ -1,6 +1,6 @@
<?php <?php
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'URI', 'AllowedSchemes', array( 'URI', 'AllowedSchemes', array(
'http' => true, // "Hypertext Transfer Protocol", nuf' said 'http' => true, // "Hypertext Transfer Protocol", nuf' said
'https' => true, // HTTP over SSL (Secure Socket Layer) 'https' => true, // HTTP over SSL (Secure Socket Layer)
@ -16,7 +16,7 @@ HTMLPurifier_ConfigDef::define(
'prevents XSS attacks from using pseudo-schemes like javascript or mocha.' 'prevents XSS attacks from using pseudo-schemes like javascript or mocha.'
); );
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'URI', 'OverrideAllowedSchemes', true, 'bool', 'URI', 'OverrideAllowedSchemes', true, 'bool',
'If this is set to true (which it is by default), you can override '. 'If this is set to true (which it is by default), you can override '.
'%URI.AllowedSchemes by simply registering a HTMLPurifier_URIScheme '. '%URI.AllowedSchemes by simply registering a HTMLPurifier_URIScheme '.

View File

@ -1,8 +1,8 @@
<?php <?php
require_once 'HTMLPurifier/ConfigDef.php'; require_once 'HTMLPurifier/ConfigSchema.php';
class HTMLPurifier_ConfigDefTest extends UnitTestCase class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
{ {
var $old_copy; var $old_copy;
@ -13,16 +13,16 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// you pay for using Singletons. Good thing we can overload it. // you pay for using Singletons. Good thing we can overload it.
// first, let's get a clean copy to do tests // first, let's get a clean copy to do tests
$our_copy = new HTMLPurifier_ConfigDef(); $our_copy = new HTMLPurifier_ConfigSchema();
// get the old copy // get the old copy
$this->old_copy = HTMLPurifier_ConfigDef::instance(); $this->old_copy = HTMLPurifier_ConfigSchema::instance();
// put in our copy, and reassign to the REAL reference // put in our copy, and reassign to the REAL reference
$this->our_copy =& HTMLPurifier_ConfigDef::instance($our_copy); $this->our_copy =& HTMLPurifier_ConfigSchema::instance($our_copy);
} }
function tearDown() { function tearDown() {
// testing is done, restore the old copy // testing is done, restore the old copy
HTMLPurifier_ConfigDef::instance($this->old_copy); HTMLPurifier_ConfigSchema::instance($this->old_copy);
} }
function testNormal() { function testNormal() {
@ -31,7 +31,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// define a namespace // define a namespace
$description = 'Configuration that is always available.'; $description = 'Configuration that is always available.';
HTMLPurifier_ConfigDef::defineNamespace( HTMLPurifier_ConfigSchema::defineNamespace(
'Core', $description 'Core', $description
); );
$this->assertIdentical($this->our_copy->defaults, array( $this->assertIdentical($this->our_copy->defaults, array(
@ -50,7 +50,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// define a directive // define a directive
$description = 'This is a description of the directive.'; $description = 'This is a description of the directive.';
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Name', 'default value', 'string', 'Core', 'Name', 'default value', 'string',
$description $description
); $line = __LINE__; ); $line = __LINE__;
@ -71,7 +71,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// define a directive in an undefined namespace // define a directive in an undefined namespace
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Extension', 'Name', false, 'bool', 'Extension', 'Name', false, 'bool',
'This is for an extension, but we have not defined its namespace!' 'This is for an extension, but we have not defined its namespace!'
); );
@ -83,7 +83,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// redefine a value in a valid manner // redefine a value in a valid manner
$description = 'Alternative configuration definition'; $description = 'Alternative configuration definition';
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Name', 'default value', 'string', 'Core', 'Name', 'default value', 'string',
$description $description
); $line = __LINE__; ); $line = __LINE__;
@ -98,7 +98,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// redefine a directive in an invalid manner // redefine a directive in an invalid manner
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Name', 'different default', 'string', 'Core', 'Name', 'different default', 'string',
'Inconsistent default or type, cannot redefine' 'Inconsistent default or type, cannot redefine'
); );
@ -109,7 +109,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// make an enumeration // make an enumeration
HTMLPurifier_ConfigDef::defineAllowedValues( HTMLPurifier_ConfigSchema::defineAllowedValues(
'Core', 'Name', array( 'Core', 'Name', array(
'Real Value', 'Real Value',
'Real Value 2' 'Real Value 2'
@ -128,7 +128,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// redefinition of enumeration is cumulative // redefinition of enumeration is cumulative
HTMLPurifier_ConfigDef::defineAllowedValues( HTMLPurifier_ConfigSchema::defineAllowedValues(
'Core', 'Name', array( 'Core', 'Name', array(
'Real Value 3', 'Real Value 3',
) )
@ -143,7 +143,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// cannot define enumeration for undefined directive // cannot define enumeration for undefined directive
HTMLPurifier_ConfigDef::defineAllowedValues( HTMLPurifier_ConfigSchema::defineAllowedValues(
'Core', 'Foobar', array( 'Core', 'Foobar', array(
'Real Value 9', 'Real Value 9',
) )
@ -155,7 +155,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// test defining value aliases for an enumerated value // test defining value aliases for an enumerated value
HTMLPurifier_ConfigDef::defineValueAliases( HTMLPurifier_ConfigSchema::defineValueAliases(
'Core', 'Name', array( 'Core', 'Name', array(
'Aliased Value' => 'Real Value' 'Aliased Value' => 'Real Value'
) )
@ -170,7 +170,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// redefine should be cumulative // redefine should be cumulative
HTMLPurifier_ConfigDef::defineValueAliases( HTMLPurifier_ConfigSchema::defineValueAliases(
'Core', 'Name', array( 'Core', 'Name', array(
'Aliased Value 2' => 'Real Value 2' 'Aliased Value 2' => 'Real Value 2'
) )
@ -185,7 +185,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// cannot create alias to not-allowed value // cannot create alias to not-allowed value
HTMLPurifier_ConfigDef::defineValueAliases( HTMLPurifier_ConfigSchema::defineValueAliases(
'Core', 'Name', array( 'Core', 'Name', array(
'Aliased Value 3' => 'Invalid Value' 'Aliased Value 3' => 'Invalid Value'
) )
@ -197,7 +197,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// cannot create alias for already allowed value // cannot create alias for already allowed value
HTMLPurifier_ConfigDef::defineValueAliases( HTMLPurifier_ConfigSchema::defineValueAliases(
'Core', 'Name', array( 'Core', 'Name', array(
'Real Value' => 'Real Value 2' 'Real Value' => 'Real Value 2'
) )
@ -209,7 +209,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// define a directive with an invalid type // define a directive with an invalid type
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Foobar', false, 'omen', 'Core', 'Foobar', false, 'omen',
'Omen is not a valid type, so we reject this.' 'Omen is not a valid type, so we reject this.'
); );
@ -221,7 +221,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// define a directive with inconsistent type // define a directive with inconsistent type
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Foobaz', 10, 'string', 'Core', 'Foobaz', 10, 'string',
'If we say string, we should mean it, not integer 10.' 'If we say string, we should mean it, not integer 10.'
); );
@ -232,7 +232,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
// define a directive with bad characters // define a directive with bad characters
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Core.Attr', 10, 'int', 'Core', 'Core.Attr', 10, 'int',
'No periods! >:-(' 'No periods! >:-('
); );
@ -242,7 +242,7 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
$this->swallowErrors(); $this->swallowErrors();
// define a namespace with bad characters // define a namespace with bad characters
HTMLPurifier_ConfigDef::defineNamespace( HTMLPurifier_ConfigSchema::defineNamespace(
'Foobar&Gromit', $description 'Foobar&Gromit', $description
); );

View File

@ -8,41 +8,41 @@ class HTMLPurifier_ConfigTest extends UnitTestCase
var $our_copy, $old_copy; var $our_copy, $old_copy;
function setUp() { function setUp() {
$our_copy = new HTMLPurifier_ConfigDef(); $our_copy = new HTMLPurifier_ConfigSchema();
$this->old_copy = HTMLPurifier_ConfigDef::instance(); $this->old_copy = HTMLPurifier_ConfigSchema::instance();
$this->our_copy =& HTMLPurifier_ConfigDef::instance($our_copy); $this->our_copy =& HTMLPurifier_ConfigSchema::instance($our_copy);
} }
function tearDown() { function tearDown() {
HTMLPurifier_ConfigDef::instance($this->old_copy); HTMLPurifier_ConfigSchema::instance($this->old_copy);
} }
function test() { function test() {
HTMLPurifier_ConfigDef::defineNamespace('Core', 'Corestuff'); HTMLPurifier_ConfigSchema::defineNamespace('Core', 'Corestuff');
HTMLPurifier_ConfigDef::defineNamespace('Attr', 'Attributes'); HTMLPurifier_ConfigSchema::defineNamespace('Attr', 'Attributes');
HTMLPurifier_ConfigDef::defineNamespace('Extension', 'Extensible'); HTMLPurifier_ConfigSchema::defineNamespace('Extension', 'Extensible');
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Key', false, 'bool', 'A boolean directive.' 'Core', 'Key', false, 'bool', 'A boolean directive.'
); );
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Attr', 'Key', 42, 'int', 'An integer directive.' 'Attr', 'Key', 42, 'int', 'An integer directive.'
); );
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Extension', 'Pert', 'foo', 'string', 'A string directive.' 'Extension', 'Pert', 'foo', 'string', 'A string directive.'
); );
HTMLPurifier_ConfigDef::define( HTMLPurifier_ConfigSchema::define(
'Core', 'Encoding', 'utf-8', 'istring', 'Case insensitivity!' 'Core', 'Encoding', 'utf-8', 'istring', 'Case insensitivity!'
); );
HTMLPurifier_ConfigDef::defineAllowedValues( HTMLPurifier_ConfigSchema::defineAllowedValues(
'Extension', 'Pert', array('foo', 'moo') 'Extension', 'Pert', array('foo', 'moo')
); );
HTMLPurifier_ConfigDef::defineValueAliases( HTMLPurifier_ConfigSchema::defineValueAliases(
'Extension', 'Pert', array('cow' => 'moo') 'Extension', 'Pert', array('cow' => 'moo')
); );
HTMLPurifier_ConfigDef::defineAllowedValues( HTMLPurifier_ConfigSchema::defineAllowedValues(
'Core', 'Encoding', array('utf-8', 'iso-8859-1') 'Core', 'Encoding', array('utf-8', 'iso-8859-1')
); );

View File

@ -40,7 +40,7 @@ require_once 'HTMLPurifier.php';
// define callable test files // define callable test files
$test_files = array(); $test_files = array();
$test_files[] = 'ConfigTest.php'; $test_files[] = 'ConfigTest.php';
$test_files[] = 'ConfigDefTest.php'; $test_files[] = 'ConfigSchemaTest.php';
$test_files[] = 'LexerTest.php'; $test_files[] = 'LexerTest.php';
$test_files[] = 'Lexer/DirectLexTest.php'; $test_files[] = 'Lexer/DirectLexTest.php';
$test_files[] = 'TokenTest.php'; $test_files[] = 'TokenTest.php';