mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-10 07:38:41 +00:00
4c798bd17e
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1596 48356398-32a2-884e-a903-53898d9a118a
23 lines
528 B
PHP
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');
|
|
}
|
|
}
|
|
|
|
}
|