mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-02 12:21:09 +02:00
[2.1.4] [MFH] Case-insensitive CSS from r1461
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/php4@1712 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
1
NEWS
1
NEWS
@@ -11,6 +11,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
|
|
||||||
2.1.4, unknown release date
|
2.1.4, unknown release date
|
||||||
! DefinitionCacheFactory now can register new implementations
|
! DefinitionCacheFactory now can register new implementations
|
||||||
|
! CSS properties are now case-insensitive
|
||||||
- Colors missing # but in hex form will be corrected
|
- Colors missing # but in hex form will be corrected
|
||||||
- CSS Number algorithm improved
|
- CSS Number algorithm improved
|
||||||
|
|
||||||
|
@@ -38,7 +38,20 @@ class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
|
|||||||
list($property, $value) = explode(':', $declaration, 2);
|
list($property, $value) = explode(':', $declaration, 2);
|
||||||
$property = trim($property);
|
$property = trim($property);
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
if (!isset($definition->info[$property])) continue;
|
$ok = false;
|
||||||
|
do {
|
||||||
|
if (isset($definition->info[$property])) {
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ctype_lower($property)) break;
|
||||||
|
$property = strtolower($property);
|
||||||
|
if (isset($definition->info[$property])) {
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(0);
|
||||||
|
if (!$ok) continue;
|
||||||
// inefficient call, since the validator will do this again
|
// inefficient call, since the validator will do this again
|
||||||
if (strtolower(trim($value)) !== 'inherit') {
|
if (strtolower(trim($value)) !== 'inherit') {
|
||||||
// inherit works for everything (but only on the base property)
|
// inherit works for everything (but only on the base property)
|
||||||
|
@@ -107,6 +107,9 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
|||||||
$this->assertDef(' font-weight : bold; color : #ff0000',
|
$this->assertDef(' font-weight : bold; color : #ff0000',
|
||||||
'font-weight:bold;color:#ff0000;');
|
'font-weight:bold;color:#ff0000;');
|
||||||
|
|
||||||
|
// case-insensitivity
|
||||||
|
$this->assertDef('FLOAT:LEFT;', 'float:left;');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user