diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-06-21 16:41:02 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-06-21 16:41:02 +0000 |
commit | a5fe68e002632c190ffbd85167671ed4d4961135 (patch) | |
tree | ae57f94603111507c50cb3c212a03bedf8f7dc5a /wp-includes/category-template.php | |
parent | 4e38776b5b68c61a4593a84340f4654200f7568e (diff) | |
download | wordpress-mu-a5fe68e002632c190ffbd85167671ed4d4961135.tar.gz wordpress-mu-a5fe68e002632c190ffbd85167671ed4d4961135.tar.xz wordpress-mu-a5fe68e002632c190ffbd85167671ed4d4961135.zip |
WP Merge to WP 2.2.1
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1005 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/category-template.php')
-rw-r--r-- | wp-includes/category-template.php | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index d4c521e..5eaabfb 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -86,6 +86,15 @@ function _get_the_category_usort($a, $b) { return strcmp($a->category_name, $b->category_name); } +function _get_the_category_usort_by_ID($a, $b) { + if ( $a->cat_ID > $b->cat_ID ) + return 1; + elseif ( $a->cat_ID < $b->cat_ID ) + return -1; + else + return 0; +} + function get_the_category_by_ID($cat_ID) { $cat_ID = (int) $cat_ID; $category = &get_category($cat_ID); @@ -172,21 +181,20 @@ function category_description($category = 0) { } function wp_dropdown_categories($args = '') { - $defaults = array( - 'show_option_all' => '', 'show_option_none' => '', - 'orderby' => 'ID', 'order' => 'ASC', - 'show_last_update' => 0, 'show_count' => 0, - 'hide_empty' => 1, 'child_of' => 0, - 'exclude' => '', 'echo' => 1, - 'selected' => 0, 'hierarchical' => 0, - 'name' => 'cat', 'class' => 'postform' - ); - + if ( is_array($args) ) + $r = &$args; + else + parse_str($args, $r); + + $defaults = array('show_option_all' => '', 'show_option_none' => '', 'orderby' => 'ID', + 'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0, + 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, + 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', + 'class' => 'postform'); $defaults['selected'] = ( is_category() ) ? get_query_var('cat') : 0; - - $r = wp_parse_args( $args, $defaults ); + $r = array_merge($defaults, $r); $r['include_last_update_time'] = $r['show_last_update']; - extract( $r ); + extract($r, EXTR_SKIP); $categories = get_categories($r); @@ -222,28 +230,23 @@ function wp_dropdown_categories($args = '') { } function wp_list_categories($args = '') { - $defaults = array( - 'show_option_all' => '', 'orderby' => 'name', - 'order' => 'ASC', 'show_last_update' => 0, - 'style' => 'list', 'show_count' => 0, - 'hide_empty' => 1, 'use_desc_for_title' => 1, - 'child_of' => 0, 'feed' => '', - 'feed_image' => '', 'exclude' => '', - 'hierarchical' => true, 'title_li' => __('Categories') - ); - - $r = wp_parse_args( $args, $defaults ); - - if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) { + if ( is_array($args) ) + $r = &$args; + else + parse_str($args, $r); + + $defaults = array('show_option_all' => '', 'orderby' => 'name', + 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', + 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, + 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '', + 'hierarchical' => true, 'title_li' => __('Categories')); + $r = array_merge($defaults, $r); + if ( !isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical'] ) $r['pad_counts'] = true; - } - - if ( isset( $r['show_date'] ) ) { + if ( isset($r['show_date']) ) $r['include_last_update_time'] = $r['show_date']; - } - - extract( $r ); - + extract($r, EXTR_SKIP); + $categories = get_categories($r); $output = ''; |