0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-19 18:55:19 +00:00

Fix typos in AttrDef/Lang.php involving lowercasing uppercased language strings.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@618 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-12-26 03:56:53 +00:00
parent ceb1b9ccdb
commit 688b1833f5
3 changed files with 7 additions and 3 deletions

1
NEWS
View File

@ -20,6 +20,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
! Added enduser-youtube.html, explains how to embed YouTube videos. See ! Added enduser-youtube.html, explains how to embed YouTube videos. See
also corresponding smoketest preserveYouTube.php. also corresponding smoketest preserveYouTube.php.
! Added purifyArray(), which takes a list of HTML and purifies it all ! Added purifyArray(), which takes a list of HTML and purifies it all
- Fixed fatal error thrown by upper-cased language attributes
- printDefinition.php: added labels, added better clarification - printDefinition.php: added labels, added better clarification
. HTMLPurifier_Config::create() added, takes mixed variable and converts into . HTMLPurifier_Config::create() added, takes mixed variable and converts into
a HTMLPurifier_Config object. a HTMLPurifier_Config object.

View File

@ -49,7 +49,7 @@ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
if ($length == 0 || $length == 1 || $length > 8 || !ctype_alnum($subtags[1])) { if ($length == 0 || $length == 1 || $length > 8 || !ctype_alnum($subtags[1])) {
return $new_string; return $new_string;
} }
if (!ctype_lower($subtags[1])) $subtags[1] = strotolower($subtags[1]); if (!ctype_lower($subtags[1])) $subtags[1] = strtolower($subtags[1]);
$new_string .= '-' . $subtags[1]; $new_string .= '-' . $subtags[1];
if ($num_subtags == 2) return $new_string; if ($num_subtags == 2) return $new_string;
@ -61,7 +61,7 @@ class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
return $new_string; return $new_string;
} }
if (!ctype_lower($subtags[$i])) { if (!ctype_lower($subtags[$i])) {
$subtags[$i] = strotolower($subtags[$i]); $subtags[$i] = strtolower($subtags[$i]);
} }
$new_string .= '-' . $subtags[$i]; $new_string .= '-' . $subtags[$i];
} }

View File

@ -17,6 +17,9 @@ class HTMLPurifier_AttrDef_LangTest extends HTMLPurifier_AttrDefHarness
$this->assertDef(' en ', 'en'); // trim $this->assertDef(' en ', 'en'); // trim
$this->assertDef('EN', 'en'); // case insensitivity $this->assertDef('EN', 'en'); // case insensitivity
// (thanks Eugen Pankratz for noticing the typos!)
$this->assertDef('En-Us-Edison', 'en-us-edison'); // complex ci
$this->assertDef('fr en', false); // multiple languages $this->assertDef('fr en', false); // multiple languages
$this->assertDef('%', false); // bad character $this->assertDef('%', false); // bad character
@ -26,7 +29,7 @@ class HTMLPurifier_AttrDef_LangTest extends HTMLPurifier_AttrDefHarness
// primary subtag rules // primary subtag rules
// I'm somewhat hesitant to allow x and i as primary language codes, // I'm somewhat hesitant to allow x and i as primary language codes,
// because they usually are never used in real life. However, // because they usually are never used in real life. However,
// theoretically speaking, having them alone is permissble, so // theoretically speaking, having them alone is permissable, so
// I'll be lenient. No XML parser is going to complain anyway. // I'll be lenient. No XML parser is going to complain anyway.
$this->assertDef('x'); $this->assertDef('x');
$this->assertDef('i'); $this->assertDef('i');