mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-24 09:11:52 +00:00
c0b5bc3eea
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1599 48356398-32a2-884e-a903-53898d9a118a
24 lines
686 B
PHP
24 lines
686 B
PHP
<?php
|
|
|
|
/**
|
|
* Validates that this ID does not exist already in the interchange object.
|
|
* Expects ID to exist.
|
|
*
|
|
* @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_Unique 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');
|
|
}
|
|
}
|
|
|
|
}
|