Changeset 4495 for trunk/wp-includes/compat.php
- Timestamp:
- 11/19/2006 07:56:05 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/compat.php
r3901 r4495 37 37 38 38 function printr($var, $do_not_echo = false) { 39 // from php.net/print_r user contributed notes 39 // from php.net/print_r user contributed notes 40 40 ob_start(); 41 41 print_r($var); … … 43 43 ob_clean(); 44 44 if (!$do_not_echo) { 45 45 echo "<pre>$code</pre>"; 46 46 } 47 47 ob_end_clean(); … … 58 58 59 59 if (!defined('CASE_LOWER')) { 60 60 define('CASE_LOWER', 0); 61 61 } 62 62 63 63 if (!defined('CASE_UPPER')) { 64 64 define('CASE_UPPER', 1); 65 65 } 66 66 … … 79 79 */ 80 80 if (!function_exists('array_change_key_case')) { 81 82 83 84 85 86 87 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 88 89 90 91 89 $output = array (); 90 $keys = array_keys($input); 91 $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; 92 92 93 94 95 93 foreach ($keys as $key) { 94 $output[$casefunc($key)] = $input[$key]; 95 } 96 96 97 98 97 return $output; 98 } 99 99 } 100 100 101 101 // From php.net 102 102 if(!function_exists('http_build_query')) { 103 104 105 106 107 108 109 110 111 112 103 function http_build_query( $formdata, $numeric_prefix = null, $key = null ) { 104 $res = array(); 105 foreach ((array)$formdata as $k=>$v) { 106 $tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k); 107 if ($key) $tmp_key = $key.'['.$tmp_key.']'; 108 $res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) ); 109 } 110 $separator = ini_get('arg_separator.output'); 111 return implode($separator, $res); 112 } 113 113 } 114 114
Note: See TracChangeset
for help on using the changeset viewer.