Ticket #4467: 4467.diff

File 4467.diff, 3.3 KB (added by mdawaffe, 5 years ago)
  • wp-includes/formatting.php

     
    11881188        return $value; 
    11891189} 
    11901190 
     1191function wp_parse_str( $string, &$array ) { 
     1192        parse_str( $string, $array ) 
     1193        if ( get_magic_quotes_gpc() ) 
     1194                $array = stripslashes_deep( $array ); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str 
     1195        $array = apply_filters( 'wp_parse_str', $array ); 
     1196} 
     1197 
    11911198?> 
  • wp-includes/general-template.php

     
    968968        echo $output; 
    969969} 
    970970 
    971 function paginate_links( $arg = '' ) { 
    972         if ( is_array($arg) ) 
    973                 $a = &$arg; 
    974         else 
    975                 parse_str($arg, $a); 
     971function paginate_links( $args = '' ) { 
     972        $defaults = array(  
     973                'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 
     974                'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number 
     975                'total' => 1, 
     976                'current' => 0, 
     977                'show_all' => false, 
     978                'prev_next' => true, 
     979                'prev_text' => __('« Previous'), 
     980                'next_text' => __('Next »'), 
     981                'end_size' => 1, // How many numbers on either end including the end 
     982                'mid_size' => 2, // How many numbers to either side of current not including current 
     983                'type' => 'plain', 
     984                'add_args' => false // array of query args to aadd 
     985        ); 
    976986 
    977         // Defaults 
    978         $base = '%_%'; // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 
    979         $format = '?page=%#%'; // ?page=%#% : %#% is replaced by the page number 
    980         $total = 1; 
    981         $current = 0; 
    982         $show_all = false; 
    983         $prev_next = true; 
    984         $prev_text = __('« Previous'); 
    985         $next_text = __('Next »'); 
    986         $end_size = 1; // How many numbers on either end including the end 
    987         $mid_size = 2; // How many numbers to either side of current not including current 
    988         $type = 'plain'; 
    989         $add_args = false; // array of query args to aadd 
     987        $args = wp_parse_args( $args, $defaults ); 
     988        extract($args, EXTR_SKIP); 
    990989 
    991         extract($a); 
    992  
    993990        // Who knows what else people pass in $args 
    994991        $total    = (int) $total; 
    995992        if ( $total < 2 ) 
  • wp-includes/functions.php

     
    603603                $query = $uri; 
    604604        } 
    605605 
    606         parse_str($query, $qs); 
    607         if ( get_magic_quotes_gpc() ) 
    608                 $qs = stripslashes_deep($qs); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str 
     606        wp_parse_str($query, $qs); 
    609607        $qs = urlencode_deep($qs); 
    610608        if ( is_array(func_get_arg(0)) ) { 
    611609                $kayvees = func_get_arg(0); 
     
    12871285} 
    12881286 
    12891287function wp_parse_args( $args, $defaults = '' ) { 
    1290         if ( is_array( $args ) ) { 
     1288        if ( is_array( $args ) ) 
    12911289                $r =& $args; 
    1292         } else { 
    1293                 parse_str( $args, $r ); 
    1294                 if ( get_magic_quotes_gpc() ) { 
    1295                         $r = stripslashes_deep( $r ); 
    1296                 } 
    1297         } 
     1290        else 
     1291                wp_parse_str( $args, $r ); 
    12981292         
    1299         if ( is_array( $defaults ) ) { 
     1293        if ( is_array( $defaults ) ) 
    13001294                return array_merge( $defaults, $r ); 
    1301         } else { 
     1295        else 
    13021296                return $r; 
    1303         } 
    13041297} 
    13051298 
    13061299function wp_maybe_load_widgets() { 
     
    13231316        while ( @ob_end_flush() ); 
    13241317} 
    13251318 
    1326 ?> 
    1327  No newline at end of file 
     1319?>