Changeset 2247

Show
Ignore:
Timestamp:
02/11/05 00:57:46 (4 years ago)
Author:
saxmatt
Message:

Keep working with 4.1 - http://mosquito.wordpress.org/view.php?id=808

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/functions-compat.php

    r1776 r2247  
    4848} 
    4949 
     50if (!defined('CASE_LOWER')) { 
     51    define('CASE_LOWER', 0); 
     52} 
     53 
     54if (!defined('CASE_UPPER')) { 
     55    define('CASE_UPPER', 1); 
     56} 
     57 
     58 
     59/** 
     60 * Replace array_change_key_case() 
     61 * 
     62 * @category    PHP 
     63 * @package     PHP_Compat 
     64 * @link        http://php.net/function.array_change_key_case 
     65 * @author      Stephan Schmidt <schst@php.net> 
     66 * @author      Aidan Lister <aidan@php.net> 
     67 * @version     $Revision$ 
     68 * @since       PHP 4.2.0 
     69 * @require     PHP 4.0.0 (user_error) 
     70 */ 
     71if (!function_exists('array_change_key_case')) { 
     72    function array_change_key_case($input, $case = CASE_LOWER) 
     73    { 
     74        if (!is_array($input)) { 
     75            user_error('array_change_key_case(): The argument should be an array', 
     76                E_USER_WARNING); 
     77            return false; 
     78        } 
     79 
     80        $output   = array (); 
     81        $keys     = array_keys($input); 
     82        $casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper'; 
     83 
     84        foreach ($keys as $key) { 
     85            $output[$casefunc($key)] = $input[$key]; 
     86        } 
     87 
     88        return $output; 
     89    } 
     90} 
     91 
    5092?>