1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-05 21:57:26 +02:00

[3.1.0] Implement more validators, add in missing DEFAULTs for many tests.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1626 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-03-23 01:29:57 +00:00
parent aedfbd1e93
commit 82c9a737f4
11 changed files with 72 additions and 17 deletions

View File

@@ -48,6 +48,16 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
$type = explode('/', $hash->offsetGet('TYPE'));
if (isset($type[1])) $directive->typeAllowsNull = true;
$directive->type = $type[0];
} else {
throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '{$directive->id}' not defined");
}
if (isset($hash['DEFAULT'])) {
try {
$directive->default = $this->varParser->parse($hash->offsetGet('DEFAULT'), $directive->type, $directive->typeAllowsNull);
} catch (HTMLPurifier_VarParserException $e) {
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '{$directive->id}'");
}
}
if (isset($hash['DESCRIPTION'])) {
@@ -59,7 +69,15 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
}
if (isset($hash['VALUE-ALIASES'])) {
$directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
$value_aliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
try {
foreach ($value_aliases as $alias => $real) {
$directive->valueAliases[$this->varParser->parse($alias, $directive->type, $directive->typeAllowsNull)] =
$this->varParser->parse($real, $directive->type, $directive->typeAllowsNull);
}
} catch (HTMLPurifier_VarParserException $e) {
throw new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in $alias => $real in VALUE-ALIASES in directive hash '{$directive->id}'");
}
}
if (isset($hash['ALIASES'])) {