wp_parse_str() from mdawaffe. see #4467

git-svn-id: https://develop.svn.wordpress.org/trunk@5709 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-06-14 22:46:59 +00:00
parent 09da00f7fe
commit 6b7bc3b1b6
3 changed files with 31 additions and 34 deletions

View File

@@ -968,27 +968,24 @@ function language_attributes() {
echo $output;
}
function paginate_links( $arg = '' ) {
if ( is_array($arg) )
$a = &$arg;
else
parse_str($arg, $a);
function paginate_links( $args = '' ) {
$defaults = array(
'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
'total' => 1,
'current' => 0,
'show_all' => false,
'prev_next' => true,
'prev_text' => __('« Previous'),
'next_text' => __('Next »'),
'end_size' => 1, // How many numbers on either end including the end
'mid_size' => 2, // How many numbers to either side of current not including current
'type' => 'plain',
'add_args' => false // array of query args to aadd
);
// Defaults
$base = '%_%'; // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
$format = '?page=%#%'; // ?page=%#% : %#% is replaced by the page number
$total = 1;
$current = 0;
$show_all = false;
$prev_next = true;
$prev_text = __('« Previous');
$next_text = __('Next »');
$end_size = 1; // How many numbers on either end including the end
$mid_size = 2; // How many numbers to either side of current not including current
$type = 'plain';
$add_args = false; // array of query args to aadd
extract($a);
$args = wp_parse_args( $args, $defaults );
extract($args, EXTR_SKIP);
// Who knows what else people pass in $args
$total = (int) $total;