From ab541ae0711a1af100b78fc64170d3ab00fe2bdc Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 15 Jun 2006 20:28:47 +0000 Subject: [PATCH] wp_get_archives() cleanup. git-svn-id: http://svn.automattic.com/wordpress/trunk@3878 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/deprecated.php | 5 +++++ wp-includes/general-template.php | 29 ++++++++++------------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index a7a3044f4f..23668d8e9f 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -470,4 +470,9 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array( return wp_set_post_categories($post_ID, $post_categories); } +function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { + $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); + return wp_get_archives($args); +} + ?> diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 4a80d8b4c5..31111f95ed 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -275,27 +275,17 @@ function get_archives_link($url, $text, $format = 'html', $before = '', $after = function wp_get_archives($args = '') { - parse_str($args, $r); - if ( !isset($r['type']) ) - $r['type'] = ''; - if ( !isset($r['limit']) ) - $r['limit'] = ''; - if ( !isset($r['format']) ) - $r['format'] = 'html'; - if ( !isset($r['before']) ) - $r['before'] = ''; - if ( !isset($r['after']) ) - $r['after'] = ''; - if ( !isset($r['show_post_count']) ) - $r['show_post_count'] = false; - - get_archives($r['type'], $r['limit'], $r['format'], $r['before'], $r['after'], $r['show_post_count']); -} - - -function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { global $wp_locale, $wpdb; + if ( is_array($args) ) + $r = &$args; + else + parse_str($args, $r); + + $defaults = array('type' => 'monthly', 'limit' => '', 'format' => 'html', 'before' => '', 'after' => '', 'show_post_count' => false); + $r = array_merge($defaults, $r); + extract($r); + if ( '' == $type ) $type = 'monthly'; @@ -303,6 +293,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after $limit = (int) $limit; $limit = ' LIMIT '.$limit; } + // this is what will separate dates on weekly archive links $archive_week_separator = '–';