mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-04 05:07:55 +02:00
- Rename Duplicate to Unique, as the name of validator indicates what we want the input to be
- Enable flush to work when includes are renamed git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1597 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
21
library/HTMLPurifier/ConfigSchema/Validator/Unique.php
Normal file
21
library/HTMLPurifier/ConfigSchema/Validator/Unique.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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_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');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user