Make WordPress Core

Changeset 3878


Ignore:
Timestamp:
06/15/2006 08:28:47 PM (19 years ago)
Author:
ryan
Message:

wp_get_archives() cleanup.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/deprecated.php

    r3849 r3878  
    471471}
    472472
     473function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
     474    $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
     475    return wp_get_archives($args);
     476}
     477
    473478?>
  • trunk/wp-includes/general-template.php

    r3862 r3878  
    276276
    277277function wp_get_archives($args = '') {
    278     parse_str($args, $r);
    279     if ( !isset($r['type']) )
    280         $r['type'] = '';
    281     if ( !isset($r['limit']) )
    282         $r['limit'] = '';
    283     if ( !isset($r['format']) )
    284         $r['format'] = 'html';
    285     if ( !isset($r['before']) )
    286         $r['before'] = '';
    287     if ( !isset($r['after']) )
    288         $r['after'] = '';
    289     if ( !isset($r['show_post_count']) )
    290         $r['show_post_count'] = false;
    291 
    292     get_archives($r['type'], $r['limit'], $r['format'], $r['before'], $r['after'], $r['show_post_count']);
    293 }
    294 
    295 
    296 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
    297278    global $wp_locale, $wpdb;
     279
     280    if ( is_array($args) )
     281        $r = &$args;
     282    else
     283        parse_str($args, $r);
     284
     285    $defaults = array('type' => 'monthly', 'limit' => '', 'format' => 'html', 'before' => '', 'after' => '', 'show_post_count' => false);
     286    $r = array_merge($defaults, $r);
     287    extract($r);
    298288
    299289    if ( '' == $type )
     
    304294        $limit = ' LIMIT '.$limit;
    305295    }
     296
    306297    // this is what will separate dates on weekly archive links
    307298    $archive_week_separator = '–';
Note: See TracChangeset for help on using the changeset viewer.