mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
Implement simple attribute transformations and roll them out.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@152 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -14,11 +14,16 @@ class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
|
||||
$this->case_sensitive = $case_sensitive;
|
||||
}
|
||||
|
||||
function validate($string) {
|
||||
function validate($raw_string) {
|
||||
$string = trim($raw_string);
|
||||
if (!$this->case_sensitive) {
|
||||
$string = ctype_lower($string) ? $string : strtolower($string);
|
||||
}
|
||||
return isset($this->valid_values[$string]);
|
||||
$result = isset($this->valid_values[$string]);
|
||||
|
||||
// if strings equal, return result, otherwise, return
|
||||
// the new string on a good result and false on a bad one
|
||||
return ($string == $raw_string) ? $result : $result ? $string : false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user