| 5 | | |
| 6 | | /* Added in PHP 4.2.0 */ |
| 7 | | |
| 8 | | if (!function_exists('floatval')) { |
| 9 | | function floatval($string) { |
| 10 | | return ((float) $string); |
| 11 | | } |
| 12 | | } |
| 13 | | |
| 14 | | if (!function_exists('is_a')) { |
| 15 | | function is_a($object, $class) { |
| 16 | | // by Aidan Lister <aidan@php.net> |
| 17 | | if (get_class($object) == strtolower($class)) { |
| 18 | | return true; |
| 19 | | } else { |
| 20 | | return is_subclass_of($object, $class); |
| 21 | | } |
| 22 | | } |
| 23 | | } |
| 24 | | |
| 25 | | if (!function_exists('ob_clean')) { |
| 26 | | function ob_clean() { |
| 27 | | // by Aidan Lister <aidan@php.net> |
| 28 | | if (@ob_end_clean()) { |
| 29 | | return ob_start(); |
| 30 | | } |
| 31 | | return false; |
| 32 | | } |
| 33 | | } |
| 34 | | |
| 35 | | |
| 67 | | |
| 68 | | /** |
| 69 | | * Replace array_change_key_case() |
| 70 | | * |
| 71 | | * @category PHP |
| 72 | | * @package PHP_Compat |
| 73 | | * @link http://php.net/function.array_change_key_case |
| 74 | | * @author Stephan Schmidt <schst@php.net> |
| 75 | | * @author Aidan Lister <aidan@php.net> |
| 76 | | * @version $Revision$ |
| 77 | | * @since PHP 4.2.0 |
| 78 | | * @require PHP 4.0.0 (user_error) |
| 79 | | */ |
| 80 | | if (!function_exists('array_change_key_case')) { |
| 81 | | function array_change_key_case($input, $case = CASE_LOWER) |
| 82 | | { |
| 83 | | if (!is_array($input)) { |
| 84 | | user_error('array_change_key_case(): The argument should be an array', |
| 85 | | E_USER_WARNING); |
| 86 | | return false; |
| 87 | | } |
| 88 | | |
| 89 | | $output = array (); |
| 90 | | $keys = array_keys($input); |
| 91 | | $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; |
| 92 | | |
| 93 | | foreach ($keys as $key) { |
| 94 | | $output[$casefunc($key)] = $input[$key]; |
| 95 | | } |
| 96 | | |
| 97 | | return $output; |
| 98 | | } |
| 99 | | } |
| 100 | | |