WordPress.org

Make WordPress Core

Ticket #17923: 17923.3.patch

File 17923.3.patch, 1.1 KB (added by Viper007Bond, 2 years ago)

This is what I meant, although whether it's better or not is debatable

  • wp-includes/functions.php

     
    14281428 * @param mixed $param1 Either newkey or an associative_array 
    14291429 * @param mixed $param2 Either newvalue or oldquery or uri 
    14301430 * @param mixed $param3 Optional. Old query or uri 
     1431 * @param bool $encode Optional.  If true, values will be rawurlencode()'d 
    14311432 * @return string New URL query string. 
    14321433 */ 
    14331434function add_query_arg() { 
     
    14771478        $qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string 
    14781479        if ( is_array( func_get_arg( 0 ) ) ) { 
    14791480                $kayvees = func_get_arg( 0 ); 
     1481                if ( true === @func_get_arg( 3 ) ) 
     1482                        $kayvees = array_map( 'rawurlencode', $kayvees ); 
    14801483                $qs = array_merge( $qs, $kayvees ); 
    14811484        } else { 
    14821485                $qs[func_get_arg( 0 )] = func_get_arg( 1 ); 
     1486                if ( true === @func_get_arg( 3 ) ) 
     1487                        $qs[func_get_arg( 0 )] = rawurlencode( $qs[func_get_arg( 0 )] ); 
    14831488        } 
    14841489 
    14851490        foreach ( (array) $qs as $k => $v ) {