2008-03-02 04:39:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2008-03-04 05:21:04 +00:00
|
|
|
* Validates that a field is alphanumeric in the array. Expects $index
|
|
|
|
* to exist.
|
2008-03-02 04:39:14 +00:00
|
|
|
*/
|
|
|
|
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])) {
|
2008-03-04 04:13:07 +00:00
|
|
|
$this->error($arr[$this->index] . ' in '. $this->index .' must be alphanumeric');
|
2008-03-02 04:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|