1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 21:28:06 +02:00

[3.1.0] Continue building up validation functions

- Remove incorrect parsing of value aliases
- Implement most allowed and value alias checks
- Add assertIsBool, assertIsArray and assertIsLookup to ValidatorAtom
- Publish string types in VarParser

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1647 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-04-04 21:33:37 +00:00
parent 6b21a841c4
commit 0ee090bc7b
15 changed files with 247 additions and 15 deletions

View File

@@ -3,6 +3,9 @@
class HTMLPurifier_ConfigSchema_InterchangeBuilder
{
/**
* Used for processing DEFAULT, nothing else.
*/
protected $varParser;
public function __construct($varParser = null) {
@@ -70,18 +73,7 @@ class HTMLPurifier_ConfigSchema_InterchangeBuilder
}
if (isset($hash['VALUE-ALIASES'])) {
$value_aliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
// :TODO: Build corresponding test in Validator.php
try {
foreach ($value_aliases as $alias => $real) {
// might want to allow users to use a different var parser
// in this case
$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 '$id'");
}
$directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
}
if (isset($hash['ALIASES'])) {