Make WordPress Core

Changeset 3605


Ignore:
Timestamp:
03/03/2006 09:38:36 PM (21 years ago)
Author:
ryan
Message:

Normalize argument names.

Location:
trunk/wp-includes
Files:
3 edited

Legend:

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

    r3591 r3605  
    412412}
    413413
     414function wp_list_cats($args = '') {
     415        if ( is_array($args) )
     416                $r = &$args;
     417        else
     418                parse_str($args, $r);
     419
     420        // Map to new names.
     421        if ( isset($r['optionall']) && isset($r['all']))
     422                $r['show_option_all'] = $r['all'];
     423        if ( isset($r['sort_column']) )
     424                $r['orderby'] = $r['sort_column'];
     425        if ( isset($r['sort_order']) )
     426                $r['order'] = $r['sort_order'];
     427        if ( isset($r['optiondates']) )
     428                $r['show_last_update'] = $r['optiondates'];
     429        if ( isset($r['optioncount']) )
     430                $r['show_count'] = $r['optioncount'];
     431        if ( !empty($r['list']) )
     432                $r['style'] = 'break';
     433
     434        return wp_list_categories($r); 
     435}
     436
    414437function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
    415                 $show_last_update = 0, $show_counts = 0, $hide_empty = 1, $optionnone = FALSE,
     438                $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = FALSE,
    416439                $selected = 0, $exclude = 0) {
    417440
    … …  
    425448
    426449        $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
    427                                         'show_last_update', 'show_counts', 'hide_empty', 'selected', 'exclude');
     450                                        'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
    428451        $query = add_query_arg($vars, '');
    429452        return wp_dropdown_categories($query);
  • trunk/wp-includes/template-functions-bookmarks.php

    r3595 r3605  
    248248}
    249249
     250function wp_list_bookmarks($args = '') {
     251        if ( is_array($args) )
     252                $r = &$args;
     253        else
     254                parse_str($args, $r);
     255
     256        $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => 0, 'category' => 0,
     257                'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' =>1,
     258                'categorize' => 1, 'title_li' => __('Bookmarks'));
     259        $r = array_merge($defaults, $r);
     260        extract($r);
     261       
     262        // TODO: The rest of it.
     263        // If $categorize, group links by category with the category name being the
     264        // title of each li, otherwise just list them with title_li as the li title.
     265        // If $categorize and $category or $category_name, list links for the given category
     266        // with the category name as the title li.  If not $categorize, use title_li.
     267        // When using each category's name as a title li, use before and after args for specifying
     268        // any markup.  We don't want to hardcode h2.
     269}
     270
    250271function get_bookmarks($args = '') {
    251272        global $wpdb;
  • trunk/wp-includes/template-functions-category.php

    r3595 r3605  
    157157
    158158        $defaults = array('show_option_all' => '', 'show_option_none' => '', 'orderby' => 'ID',
    159                 'order' => 'ASC', 'show_last_update' => 0, 'show_counts' => 0,
     159                'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0,
    160160                'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1,
    161161                'selected' => 0, 'hierarchical' => 0, 'name' => 'cat',
    … …  
    207207        $output .= '>';
    208208        $output .= $cat_name;
    209         if ( $args['show_counts'] )
     209        if ( $args['show_count'] )
    210210                $output .= '  ('. $category->category_count .')';
    211211        if ( $args['show_last_update'] ) {
    … …  
    218218}
    219219
    220 function wp_list_cats($args = '') {
    221         return wp_list_categories($args);       
    222 }
    223 
    224220function wp_list_categories($args = '') {
    225221        if ( is_array($args) )
    … …  
    228224                parse_str($args, $r);
    229225
    230         $defaults = array('optionall' => 0, 'all' => 'All', 'sort_column' => 'ID',
    231                 'sort_order' => 'asc', 'list' => true, 'optiondates' => 0,
    232                 'optioncount' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1,
     226        $defaults = array('show_option_all' => '', 'orderby' => 'ID',
     227                'order' => 'asc', 'style' => 'list', 'show_last_update' => 0,
     228                'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1,
    233229                'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '',
    234230                'hierarchical' => false, 'title_li' => '');
    235231        $r = array_merge($defaults, $r);
    236         if ( ! isset($r['orderby']) )
    237                 $r['orderby'] = $r['sort_column'];
    238         if ( ! isset($r['order']) )
    239                 $r['order'] = $r['sort_order'];
    240         $r['include_last_update_time'] = $r['optiondates'];
     232        $r['include_last_update_time'] = $r['show_date'];
    241233        extract($r);
    242234
    … …  
    270262
    271263function _category_list_level_start($output, $depth, $cat, $args) {
    272         if (! $args['list'])
     264        if ( 'list' != $args['style'] )
    273265                return $output;
    274266
    … …  
    279271
    280272function _category_list_level_end($output, $depth, $cat, $args) {
    281         if (! $args['list'])
     273        if ( 'list' != $args['style'] )
    282274                return $output;
    283275
    … …  
    324316        }
    325317
    326         if ( intval($optioncount) == 1 )
     318        if ( $show_count )
    327319                $link .= ' ('.intval($category->category_count).')';
    328320
    329         if ( $optiondates ) {
    330                 if ( $optiondates == 1 )
    331                         $optiondates = 'Y-m-d';
    332                 $link .= ' ' . gmdate($optiondates,$category->last_update_timestamp);
    333         }
    334 
    335         if ( $list ) {
     321        if ( $show_date ) {
     322                $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
     323        }
     324
     325        if ( 'list' == $args['style'] ) {
    336326                $output .= "\t<li";
    337327                if ( ($category->cat_ID == $current_category) && is_category() )
    … …  
    346336
    347337function _category_list_element_end($output, $category, $depth, $cat, $args) {
    348         if (! $args['list'])
     338        if ( 'list' != $args['style'] )
    349339                return $output;
    350340
Note: See TracChangeset for help on using the changeset viewer.