mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-14 01:08:41 +00:00
c0b5bc3eea
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1599 48356398-32a2-884e-a903-53898d9a118a
23 lines
526 B
PHP
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');
|
|
}
|
|
}
|
|
|
|
}
|