Changeset 5713

Show
Ignore:
Timestamp:
06/15/07 17:35:56 (1 year ago)
Author:
ryan
Message:

wp_parse_str() from mdawaffe. fixes #4467

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.2/wp-includes/formatting.php

    r5262 r5713  
    11191119} 
    11201120 
     1121function wp_parse_str( $string, &$array ) { 
     1122    parse_str( $string, $array ); 
     1123    if ( get_magic_quotes_gpc() ) 
     1124        $array = stripslashes_deep( $array ); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str 
     1125    $array = apply_filters( 'wp_parse_str', $array ); 
     1126} 
     1127 
    11211128?> 
  • branches/2.2/wp-includes/functions.php

    r5706 r5713  
    802802    } 
    803803 
    804     parse_str($query, $qs); 
    805     if ( get_magic_quotes_gpc() ) 
    806         $qs = stripslashes_deep($qs); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str 
     804    wp_parse_str($query, $qs); 
    807805    $qs = urlencode_deep($qs); 
    808806    if ( is_array(func_get_arg(0)) ) { 
     
    14821480 
    14831481function wp_parse_args( $args, $defaults = '' ) { 
    1484     if ( is_array($args) ) : 
     1482    if ( is_array( $args ) ) 
    14851483        $r =& $args; 
    1486     else : 
    1487         parse_str( $args, $r ); 
    1488         if ( get_magic_quotes_gpc() ) 
    1489             $r = stripslashes_deep( $r ); 
    1490     endif; 
    1491  
    1492     if ( is_array($defaults) ) : 
    1493         extract($defaults); 
    1494         extract($r); 
    1495         return compact(array_keys($defaults)); // only those options defined in $defaults 
    1496     else : 
     1484    else 
     1485        wp_parse_str( $args, $r ); 
     1486 
     1487    if ( is_array( $defaults ) ) 
     1488        return array_merge( $defaults, $r ); 
     1489    else 
    14971490        return $r; 
    1498     endif; 
    14991491} 
    15001492 
  • branches/2.2/wp-includes/general-template.php

    r5625 r5713  
    958958} 
    959959 
    960 function paginate_links( $arg = '' ) { 
    961     if ( is_array($arg) ) 
    962         $a = &$arg; 
    963     else 
    964         parse_str($arg, $a); 
    965  
    966     // Defaults 
    967     $base = '%_%'; // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 
    968     $format = '?page=%#%'; // ?page=%#% : %#% is replaced by the page number 
    969     $total = 1; 
    970     $current = 0; 
    971     $show_all = false; 
    972     $prev_next = true; 
    973     $prev_text = __('« Previous'); 
    974     $next_text = __('Next »'); 
    975     $end_size = 1; // How many numbers on either end including the end 
    976     $mid_size = 2; // How many numbers to either side of current not including current 
    977     $type = 'plain'; 
    978     $add_args = false; // array of query args to aadd 
    979  
    980     extract($a); 
     960function paginate_links( $args = '' ) { 
     961    $defaults = array(  
     962        'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 
     963        'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number 
     964        'total' => 1, 
     965        'current' => 0, 
     966        'show_all' => false, 
     967        'prev_next' => true, 
     968        'prev_text' => __('« Previous'), 
     969        'next_text' => __('Next »'), 
     970        'end_size' => 1, // How many numbers on either end including the end 
     971        'mid_size' => 2, // How many numbers to either side of current not including current 
     972        'type' => 'plain', 
     973        'add_args' => false // array of query args to aadd 
     974    ); 
     975 
     976    $args = wp_parse_args( $args, $defaults ); 
     977    extract($args, EXTR_SKIP); 
    981978 
    982979    // Who knows what else people pass in $args