0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-20 11:15:18 +00:00
htmlpurifier/library/HTMLPurifier/ConfigSchema/Validator/Alnum.php
2008-03-04 04:13:07 +00:00

23 lines
528 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])) {
$this->error($arr[$this->index] . ' in '. $this->index .' must be alphanumeric');
}
}
}