0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 17:01:51 +00:00
htmlpurifier/library/HTMLPurifier/ConfigSchema/Validator/Alnum.php
2008-03-04 05:21:04 +00:00

23 lines
526 B
PHP

<?php
/**
* Validates that a field is alphanumeric in the array. Expects $index
* to exist.
*/
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');
}
}
}