mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 23:28:42 +00:00
[3.1.0] Make static ConfigSchema methods throw errors.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1571 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
6c9c8f2380
commit
f2863557f5
@ -80,8 +80,16 @@ class HTMLPurifier_ConfigSchema {
|
||||
return HTMLPurifier_ConfigSchema::$singleton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an E_USER_NOTICE stating that a method is deprecated.
|
||||
*/
|
||||
private static function deprecated($method) {
|
||||
trigger_error("Static HTMLPurifier_ConfigSchema::$method deprecated, use add*() method instead", E_USER_NOTICE);
|
||||
}
|
||||
|
||||
/** @see HTMLPurifier_ConfigSchema->set() */
|
||||
public static function define($namespace, $name, $default, $type, $description) {
|
||||
HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
|
||||
$def =& HTMLPurifier_ConfigSchema::instance();
|
||||
$def->add($namespace, $name, $default, $type, $description);
|
||||
}
|
||||
@ -155,6 +163,7 @@ class HTMLPurifier_ConfigSchema {
|
||||
|
||||
/** @see HTMLPurifier_ConfigSchema->addNamespace() */
|
||||
public static function defineNamespace($namespace, $description) {
|
||||
HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
|
||||
$def =& HTMLPurifier_ConfigSchema::instance();
|
||||
$def->addNamespace($namespace, $description);
|
||||
}
|
||||
@ -189,6 +198,7 @@ class HTMLPurifier_ConfigSchema {
|
||||
|
||||
/** @see HTMLPurifier_ConfigSchema->addValueAliases() */
|
||||
public static function defineValueAliases($namespace, $name, $aliases) {
|
||||
HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
|
||||
$def =& HTMLPurifier_ConfigSchema::instance();
|
||||
$def->addValueAliases($namespace, $name, $aliases);
|
||||
}
|
||||
@ -230,6 +240,7 @@ class HTMLPurifier_ConfigSchema {
|
||||
|
||||
/** @see HTMLPurifier_ConfigSchema->addAllowedValues() */
|
||||
public static function defineAllowedValues($namespace, $name, $allowed_values) {
|
||||
HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
|
||||
$def =& HTMLPurifier_ConfigSchema::instance();
|
||||
$def->addAllowedValues($namespace, $name, $allowed_values);
|
||||
}
|
||||
@ -273,6 +284,7 @@ class HTMLPurifier_ConfigSchema {
|
||||
|
||||
/** @see HTMLPurifier_ConfigSchema->addAlias() */
|
||||
public static function defineAlias($namespace, $name, $new_namespace, $new_name) {
|
||||
HTMLPurifier_ConfigSchema::deprecated(__METHOD__);
|
||||
$def =& HTMLPurifier_ConfigSchema::instance();
|
||||
$def->addAlias($namespace, $name, $new_namespace, $new_name);
|
||||
}
|
||||
|
@ -7,13 +7,6 @@ class HTMLPurifier_DefinitionCacheTest extends HTMLPurifier_Harness
|
||||
// using null subclass because parent is abstract
|
||||
$cache = new HTMLPurifier_DefinitionCache_Null('Test');
|
||||
|
||||
$old_copy = HTMLPurifier_ConfigSchema::instance();
|
||||
$o = new HTMLPurifier_ConfigSchema();
|
||||
HTMLPurifier_ConfigSchema::instance($o);
|
||||
|
||||
HTMLPurifier_ConfigSchema::defineNamespace('Test', 'Test namespace');
|
||||
HTMLPurifier_ConfigSchema::define('Test', 'DefinitionRev', 1, 'int', 'Definition revision.');
|
||||
|
||||
generate_mock_once('HTMLPurifier_Config');
|
||||
$config = new HTMLPurifier_ConfigMock();
|
||||
$config->version = '1.0.0'; // hopefully no conflicts
|
||||
@ -31,8 +24,6 @@ class HTMLPurifier_DefinitionCacheTest extends HTMLPurifier_Harness
|
||||
$this->assertIdentical($cache->isOld('1.0.0-hash2-1', $config), false); // if hash is different, don't touch!
|
||||
$this->assertIdentical($cache->isOld('1.0.0beta-hash2-11', $config), true);
|
||||
|
||||
HTMLPurifier_ConfigSchema::instance($old_copy);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user