1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 03:10:09 +02:00

Remove decorator pattern from validator; we'll only have one decorator which invokes the subsystem.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1586 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-03-02 02:57:31 +00:00
parent fa6b6fe85f
commit d81bcbd208
10 changed files with 87 additions and 99 deletions

View File

@@ -0,0 +1,39 @@
<?php
/**
* Base validator for HTMLPurifier_ConfigSchema_Interchange
*/
class HTMLPurifier_ConfigSchema_Validator
{
/**
* Validates and filters a namespace.
*/
public function validateNamespace(&$arr, $interchange) {
$this->validate($arr, $interchange, 'namespace');
}
/**
* Validates and filters a directive.
*/
public function validateDirective(&$arr, $interchange) {
$this->validate($arr, $interchange, 'directive');
}
/**
* Common validator, throwing an exception on error. It can
* also performing filtering or evaluation functions.
*
* @note This is strictly for convenience reasons when subclasing.
*
* @param $arr Array to validate.
* @param $interchange HTMLPurifier_ConfigSchema_Interchange object
* that is being processed.
* @param $type Type of object being validated, this saves a little work
* if only cosmetic changes are being made between namespaces
* and directives.
*/
protected function validate(&$arr, $interchange, $type) {}
}