Make WordPress Core

Ticket #17923: 17923.patch

File 17923.patch, 1.2 KB (added by kurtpayne, 12 years ago)

Optionally encode parameters to add_query_arg

  • wordpress/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                        foreach ( $kayvees as $k => $v )
     1483                                $kayvees[$k] = rawurlencode( $v );
    14801484                $qs = array_merge( $qs, $kayvees );
    14811485        } else {
    1482                 $qs[func_get_arg( 0 )] = func_get_arg( 1 );
     1486                if ( true === @func_get_arg( 3 ) )
     1487                        $qs[func_get_arg( 0 )] = rawurlencode( func_get_arg( 1 ) );
     1488                else
     1489                        $qs[func_get_arg( 0 )] = func_get_arg( 1 );
    14831490        }
    14841491
    14851492        foreach ( (array) $qs as $k => $v ) {