Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/lxbarth/simplepie
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Nov 28, 2009
2 parents 06c96a7 + 4cbbfd8 commit 498e270
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions simplepie.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11873,34 +11873,11 @@ class SimplePie_IRI
// If we have a % character
if ($string[$position] === '%')
{
// If we have a pct-encoded section
// If we have a pct-encoded section normalise the pct-encoded to uppercase
if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2)
{
// Get the the represented character
$chr = chr(hexdec(substr($string, $position + 1, 2)));

// If the character is valid, replace the pct-encoded with the actual character while normalising case
if (strpos($valid_chars, $chr) !== false)
{
if ($case & SIMPLEPIE_LOWERCASE)
{
$chr = strtolower($chr);
}
elseif ($case & SIMPLEPIE_UPPERCASE)
{
$chr = strtoupper($chr);
}
$string = substr_replace($string, $chr, $position, 3);
$strlen -= 2;
$position++;
}

// Otherwise just normalise the pct-encoded to uppercase
else
{
$string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2);
$position += 3;
}
$string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2);
$position += 3;
}
// If we don't have a pct-encoded section, just replace the % with its own esccaped form
else
Expand Down Expand Up @@ -14944,7 +14921,7 @@ class SimplePie_Sanitize
$data = SimplePie_Misc::absolutize_url($data, $base);
}

if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
if ($type & (SIMPLEPIE_CONSTRUCT_TEXT))
{
$data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
}
Expand Down

0 comments on commit 498e270

Please sign in to comment.