wp_get_archives() cleanup.

git-svn-id: http://svn.automattic.com/wordpress/trunk@3878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-06-15 20:28:47 +00:00
parent 6c68ddb70e
commit ab541ae071
2 changed files with 15 additions and 19 deletions

View File

@ -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);
}
?>

View File

@ -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 = '–';