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

Refactor validators so that they can be reused between directives and namespaces.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1589 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-03-02 04:39:14 +00:00
parent 18320d59a4
commit d8cb360f3b
12 changed files with 131 additions and 71 deletions

View File

@@ -6,34 +6,14 @@
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) {}
public function validate(&$arr, $interchange) {}
}