mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
Refactor unit tests so that abstract test cases are now called Harnesses and AttrDef tests use their harness's assertDef() function, which enforces type much better. Also fixed a few bugs.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@161 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -12,9 +12,9 @@ require_once 'HTMLPurifier/IDAccumulator.php';
|
||||
class HTMLPurifier_AttrDef_ID extends HTMLPurifier_AttrDef
|
||||
{
|
||||
|
||||
function validate($old_id, $config, &$accumulator) {
|
||||
function validate($id, $config, &$accumulator) {
|
||||
|
||||
$id = trim($old_id); // trim it first
|
||||
$id = trim($id); // trim it first
|
||||
|
||||
if ($id === '') return false;
|
||||
if (isset($accumulator->ids[$id])) return false;
|
||||
@@ -37,7 +37,7 @@ class HTMLPurifier_AttrDef_ID extends HTMLPurifier_AttrDef
|
||||
// if no change was made to the ID, return the result
|
||||
// else, return the new id if stripping whitespace made it
|
||||
// valid, or return false.
|
||||
return ($id == $old_id) ? $result : ($result ? $id : false);
|
||||
return $result ? $id : false;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user