diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-06 23:59:37 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-06 23:59:37 +0200 |
commit | eda33d5ece128fcc11f6b46df38b3bfd76eb74ad (patch) | |
tree | 0b5e72e236bde4ebd59c246e3cfd458baccb529e /system/core/Common.php | |
parent | 05fa61144667c85b0463f7e8baa6af00aa195dc6 (diff) | |
parent | a6a7ef10a755a718008fbee4b01b80a682b89c39 (diff) |
Made Environment Support optional. Comment out or delete the constant to stop environment checks.
Diffstat (limited to 'system/core/Common.php')
-rw-r--r-- | system/core/Common.php | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/system/core/Common.php b/system/core/Common.php index d7054ebe6..1aca809ab 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -476,28 +476,26 @@ * @param string * @return string */ - function remove_invisible_characters($str) + function remove_invisible_characters($str, $url_encoded = TRUE) { - static $non_displayables; - - if ( ! isset($non_displayables)) + $non_displayables = array(); + + // every control character except newline (dec 10) + // carriage return (dec 13), and horizontal tab (dec 09) + + if ($url_encoded) { - // every control character except newline (dec 10), carriage return (dec 13), and horizontal tab (dec 09), - $non_displayables = array( - '/%0[0-8bcef]/', // url encoded 00-08, 11, 12, 14, 15 - '/%1[0-9a-f]/', // url encoded 16-31 - '/[\x00-\x08]/', // 00-08 - '/\x0b/', '/\x0c/', // 11, 12 - '/[\x0e-\x1f]/' // 14-31 - ); + $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 + $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 } + + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 do { - $cleaned = $str; - $str = preg_replace($non_displayables, '', $str); + $str = preg_replace($non_displayables, '', $str, -1, $count); } - while ($cleaned != $str); + while ($count); return $str; } |