mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-24 09:11:52 +00:00
d8cb360f3b
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1589 48356398-32a2-884e-a903-53898d9a118a
23 lines
561 B
PHP
23 lines
561 B
PHP
<?php
|
|
|
|
/**
|
|
* Validates that a field is alphanumeric in the array (does not check
|
|
* existence!)
|
|
*/
|
|
class HTMLPurifier_ConfigSchema_Validator_Alnum extends HTMLPurifier_ConfigSchema_Validator
|
|
{
|
|
|
|
protected $index;
|
|
|
|
public function __construct($index) {
|
|
$this->index = $index;
|
|
}
|
|
|
|
public function validate(&$arr, $interchange) {
|
|
if (!ctype_alnum($arr[$this->index])) {
|
|
throw new HTMLPurifier_ConfigSchema_Exception($arr[$this->index] . ' in '. $this->index .' must be alphanumeric');
|
|
}
|
|
}
|
|
|
|
}
|