Make WordPress Core


Ignore:
Timestamp:
04/05/2011 05:13:04 PM (15 years ago)
Author:
ryan
Message:

Take out unnecessary compat functions from compat.php. Props hakre, ptahdunbar. see #16918

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r17555 r17603  
    13691369function build_query( $data ) {
    13701370        return _http_build_query( $data, null, '&', '', false );
     1371}
     1372
     1373// from php.net (modified by Mark Jaquith to behave like the native PHP5 function)
     1374function _http_build_query($data, $prefix=null, $sep=null, $key='', $urlencode=true) {
     1375        $ret = array();
     1376
     1377        foreach ( (array) $data as $k => $v ) {
     1378                if ( $urlencode)
     1379                        $k = urlencode($k);
     1380                if ( is_int($k) && $prefix != null )
     1381                        $k = $prefix.$k;
     1382                if ( !empty($key) )
     1383                        $k = $key . '%5B' . $k . '%5D';
     1384                if ( $v === NULL )
     1385                        continue;
     1386                elseif ( $v === FALSE )
     1387                        $v = '0';
     1388
     1389                if ( is_array($v) || is_object($v) )
     1390                        array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
     1391                elseif ( $urlencode )
     1392                        array_push($ret, $k.'='.urlencode($v));
     1393                else
     1394                        array_push($ret, $k.'='.$v);
     1395        }
     1396
     1397        if ( NULL === $sep )
     1398                $sep = ini_get('arg_separator.output');
     1399
     1400        return implode($sep, $ret);
    13711401}
    13721402
Note: See TracChangeset for help on using the changeset viewer.