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:
39
library/HTMLPurifier/ConfigSchema/Validator.php
Normal file
39
library/HTMLPurifier/ConfigSchema/Validator.php
Normal 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) {}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user