Make WordPress Core


Ignore:
Timestamp:
06/14/2007 10:46:59 PM (17 years ago)
Author:
ryan
Message:

wp_parse_str() from mdawaffe. see #4467

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r5708 r5709  
    969969}
    970970
    971 function paginate_links( $arg = '' ) {
    972     if ( is_array($arg) )
    973         $a = &$arg;
    974     else
    975         parse_str($arg, $a);
    976 
    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
    990 
    991     extract($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    );
     986
     987    $args = wp_parse_args( $args, $defaults );
     988    extract($args, EXTR_SKIP);
    992989
    993990    // Who knows what else people pass in $args
Note: See TracChangeset for help on using the changeset viewer.