2008-03-04 04:13:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validates that this ID does not exist already in the interchange object.
|
2008-03-04 05:21:04 +00:00
|
|
|
* Expects ID to exist.
|
|
|
|
*
|
2008-03-04 04:13:07 +00:00
|
|
|
* @note
|
|
|
|
* Although this tests both possible values, in practice the ID
|
|
|
|
* will only be in one or the other. We do this to keep things simple.
|
|
|
|
*/
|
2008-03-04 04:20:55 +00:00
|
|
|
class HTMLPurifier_ConfigSchema_Validator_Unique extends HTMLPurifier_ConfigSchema_Validator
|
2008-03-04 04:13:07 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public function validate(&$arr, $interchange) {
|
|
|
|
if (isset($interchange->namespaces[$arr['ID']])) {
|
|
|
|
$this->error('Cannot redefine namespace');
|
|
|
|
}
|
|
|
|
if (isset($interchange->directives[$arr['ID']])) {
|
|
|
|
$this->error('Cannot redefine directive');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|