mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-24 09:11:52 +00:00
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');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|