mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-10 15:48:42 +00:00
22 lines
661 B
PHP
22 lines
661 B
PHP
|
<?php
|
||
|
|
||
|
/**
|
||
|
* Validates that this ID does not exist already in the interchange object.
|
||
|
* @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.
|
||
|
*/
|
||
|
class HTMLPurifier_ConfigSchema_Validator_Duplicate extends HTMLPurifier_ConfigSchema_Validator
|
||
|
{
|
||
|
|
||
|
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');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|