mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 05:11:52 +00:00
[3.1.0] Emit notice if setting configuration alias, and fix up our test code not to use aliases
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1643 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
870a4029ec
commit
dac98cdb06
3
NEWS
3
NEWS
@ -21,6 +21,9 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
||||
information is stored in the ConfigSchema directory, and the
|
||||
maintenance/generate-schema-cache.php generates the schema.ser file, which
|
||||
is now instantiated. Support for userland schema changes coming soon!
|
||||
# HTMLPurifier_Config will now throw E_USER_NOTICE when you use a directive
|
||||
alias; to get rid of these errors just modify your configuration to use
|
||||
the new directive name.
|
||||
! Extra utility classes for testing and non-library operations can
|
||||
be found in extras/. Specifically, these are FSTools and ConfigDoc.
|
||||
You may find a use for these in your own project, but right now they
|
||||
|
1
TODO
1
TODO
@ -27,7 +27,6 @@ DOCUMENTATION
|
||||
IMPORTANT FEATURES
|
||||
- Get everything into configuration objects (filters, I'm looking at you)
|
||||
- Factor out command line parser into its own class, and unit test it
|
||||
- Emit notices when aliases are used (allow muting these errors)
|
||||
|
||||
CONFIGDOC
|
||||
- Properly integrate new ConfigSchema system into configdoc. DESCRIPTIONS
|
||||
|
@ -199,11 +199,13 @@ class HTMLPurifier_Config
|
||||
if ($this->def->info[$namespace][$key]->class == 'alias') {
|
||||
if ($from_alias) {
|
||||
trigger_error('Double-aliases not allowed, please fix '.
|
||||
'ConfigSchema bug with' . "$namespace.$key");
|
||||
'ConfigSchema bug with' . "$namespace.$key", E_USER_ERROR);
|
||||
return;
|
||||
}
|
||||
$this->set($this->def->info[$namespace][$key]->namespace,
|
||||
$this->def->info[$namespace][$key]->name,
|
||||
$this->set($new_ns = $this->def->info[$namespace][$key]->namespace,
|
||||
$new_dir = $this->def->info[$namespace][$key]->name,
|
||||
$value, true);
|
||||
trigger_error("$namespace.$key is an alias, preferred directive name is $new_ns.$new_dir", E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
@ -161,6 +161,7 @@ class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness
|
||||
$this->expectError('Cannot get value from aliased directive, use real name Home.Rug');
|
||||
$config->get('Home', 'Carpet');
|
||||
|
||||
$this->expectError('Home.Carpet is an alias, preferred directive name is Home.Rug');
|
||||
$config->set('Home', 'Carpet', 999);
|
||||
$this->assertIdentical($config->get('Home', 'Rug'), 999);
|
||||
|
||||
|
@ -160,7 +160,7 @@ class HTMLPurifier_GeneratorTest extends HTMLPurifier_ComplexHarness
|
||||
|
||||
|
||||
$this->config = HTMLPurifier_Config::createDefault();
|
||||
$this->config->set('Core', 'CommentScriptContents', false);
|
||||
$this->config->set('Output', 'CommentScriptContents', false);
|
||||
|
||||
$this->assertGeneration(
|
||||
array(
|
||||
@ -174,7 +174,7 @@ class HTMLPurifier_GeneratorTest extends HTMLPurifier_ComplexHarness
|
||||
|
||||
function test_generateFromTokens_XHTMLoff() {
|
||||
$this->config = HTMLPurifier_Config::createDefault();
|
||||
$this->config->set('Core', 'XHTML', false);
|
||||
$this->config->set('HTML', 'XHTML', false);
|
||||
|
||||
// omit trailing slash
|
||||
$this->assertGeneration(
|
||||
|
@ -6,7 +6,7 @@ class HTMLPurifier_HTMLModule_ScriptingTest extends HTMLPurifier_HTMLModuleHarne
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->config->set('HTML', 'Trusted', true);
|
||||
$this->config->set('Core', 'CommentScriptContents', false);
|
||||
$this->config->set('Output', 'CommentScriptContents', false);
|
||||
}
|
||||
|
||||
function testDefaultRemoval() {
|
||||
|
@ -6,7 +6,7 @@ class HTMLPurifier_Strategy_ValidateAttributes_IDTest extends HTMLPurifier_Strat
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->obj = new HTMLPurifier_Strategy_ValidateAttributes();
|
||||
$this->config->set('HTML', 'EnableAttrID', true);
|
||||
$this->config->set('Attr', 'EnableID', true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +72,7 @@ class HTMLPurifierTest extends HTMLPurifier_Harness
|
||||
|
||||
function testDisableURI() {
|
||||
|
||||
$this->purifier = new HTMLPurifier( array('Attr.DisableURI' => true) );
|
||||
$this->purifier = new HTMLPurifier( array('URI.Disable' => true) );
|
||||
|
||||
$this->assertPurification(
|
||||
'<img src="foobar"/>',
|
||||
@ -105,7 +105,7 @@ class HTMLPurifierTest extends HTMLPurifier_Harness
|
||||
'<span>foobar</span>'
|
||||
);
|
||||
|
||||
$this->purifier = new HTMLPurifier(array('HTML.EnableAttrID' => true));
|
||||
$this->purifier = new HTMLPurifier(array('Attr.EnableID' => true));
|
||||
$this->assertPurification('<span id="moon">foobar</span>');
|
||||
$this->assertPurification('<img id="folly" src="folly.png" alt="Omigosh!" />');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user