mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-14 01:08:41 +00:00
22 lines
478 B
PHP
22 lines
478 B
PHP
|
<?php
|
||
|
|
||
|
/**
|
||
|
* Validates that an field exists in the array
|
||
|
*/
|
||
|
class HTMLPurifier_ConfigSchema_Validator_Exists extends HTMLPurifier_ConfigSchema_Validator
|
||
|
{
|
||
|
|
||
|
protected $index;
|
||
|
|
||
|
public function __construct($index) {
|
||
|
$this->index = $index;
|
||
|
}
|
||
|
|
||
|
public function validate(&$arr, $interchange) {
|
||
|
if (empty($arr[$this->index])) {
|
||
|
throw new HTMLPurifier_ConfigSchema_Exception($this->index . ' must exist');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|