Normalize argument names.
git-svn-id: http://svn.automattic.com/wordpress/trunk@3605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eaea1c6e70
commit
150bb1dcee
|
@ -411,8 +411,31 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
|||
return wp_list_cats($query);
|
||||
}
|
||||
|
||||
function wp_list_cats($args = '') {
|
||||
if ( is_array($args) )
|
||||
$r = &$args;
|
||||
else
|
||||
parse_str($args, $r);
|
||||
|
||||
// Map to new names.
|
||||
if ( isset($r['optionall']) && isset($r['all']))
|
||||
$r['show_option_all'] = $r['all'];
|
||||
if ( isset($r['sort_column']) )
|
||||
$r['orderby'] = $r['sort_column'];
|
||||
if ( isset($r['sort_order']) )
|
||||
$r['order'] = $r['sort_order'];
|
||||
if ( isset($r['optiondates']) )
|
||||
$r['show_last_update'] = $r['optiondates'];
|
||||
if ( isset($r['optioncount']) )
|
||||
$r['show_count'] = $r['optioncount'];
|
||||
if ( !empty($r['list']) )
|
||||
$r['style'] = 'break';
|
||||
|
||||
return wp_list_categories($r);
|
||||
}
|
||||
|
||||
function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
|
||||
$show_last_update = 0, $show_counts = 0, $hide_empty = 1, $optionnone = FALSE,
|
||||
$show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = FALSE,
|
||||
$selected = 0, $exclude = 0) {
|
||||
|
||||
$show_option_all = '';
|
||||
|
@ -424,7 +447,7 @@ function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = '
|
|||
$show_option_none = __('None');
|
||||
|
||||
$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
|
||||
'show_last_update', 'show_counts', 'hide_empty', 'selected', 'exclude');
|
||||
'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
|
||||
$query = add_query_arg($vars, '');
|
||||
return wp_dropdown_categories($query);
|
||||
}
|
||||
|
|
|
@ -247,6 +247,27 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
|
|||
}
|
||||
}
|
||||
|
||||
function wp_list_bookmarks($args = '') {
|
||||
if ( is_array($args) )
|
||||
$r = &$args;
|
||||
else
|
||||
parse_str($args, $r);
|
||||
|
||||
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => 0, 'category' => 0,
|
||||
'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' =>1,
|
||||
'categorize' => 1, 'title_li' => __('Bookmarks'));
|
||||
$r = array_merge($defaults, $r);
|
||||
extract($r);
|
||||
|
||||
// TODO: The rest of it.
|
||||
// If $categorize, group links by category with the category name being the
|
||||
// title of each li, otherwise just list them with title_li as the li title.
|
||||
// If $categorize and $category or $category_name, list links for the given category
|
||||
// with the category name as the title li. If not $categorize, use title_li.
|
||||
// When using each category's name as a title li, use before and after args for specifying
|
||||
// any markup. We don't want to hardcode h2.
|
||||
}
|
||||
|
||||
function get_bookmarks($args = '') {
|
||||
global $wpdb;
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ function wp_dropdown_categories($args = '') {
|
|||
parse_str($args, $r);
|
||||
|
||||
$defaults = array('show_option_all' => '', 'show_option_none' => '', 'orderby' => 'ID',
|
||||
'order' => 'ASC', 'show_last_update' => 0, 'show_counts' => 0,
|
||||
'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');
|
||||
|
@ -206,7 +206,7 @@ function _category_dropdown_element($output, $category, $depth, $selected, $args
|
|||
$output .= ' selected="selected"';
|
||||
$output .= '>';
|
||||
$output .= $cat_name;
|
||||
if ( $args['show_counts'] )
|
||||
if ( $args['show_count'] )
|
||||
$output .= ' ('. $category->category_count .')';
|
||||
if ( $args['show_last_update'] ) {
|
||||
$format = 'Y-m-d';
|
||||
|
@ -217,27 +217,19 @@ function _category_dropdown_element($output, $category, $depth, $selected, $args
|
|||
return $output;
|
||||
}
|
||||
|
||||
function wp_list_cats($args = '') {
|
||||
return wp_list_categories($args);
|
||||
}
|
||||
|
||||
function wp_list_categories($args = '') {
|
||||
if ( is_array($args) )
|
||||
$r = &$args;
|
||||
else
|
||||
parse_str($args, $r);
|
||||
|
||||
$defaults = array('optionall' => 0, 'all' => 'All', 'sort_column' => 'ID',
|
||||
'sort_order' => 'asc', 'list' => true, 'optiondates' => 0,
|
||||
'optioncount' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1,
|
||||
$defaults = array('show_option_all' => '', 'orderby' => 'ID',
|
||||
'order' => 'asc', 'style' => 'list', 'show_last_update' => 0,
|
||||
'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1,
|
||||
'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '',
|
||||
'hierarchical' => false, 'title_li' => '');
|
||||
$r = array_merge($defaults, $r);
|
||||
if ( ! isset($r['orderby']) )
|
||||
$r['orderby'] = $r['sort_column'];
|
||||
if ( ! isset($r['order']) )
|
||||
$r['order'] = $r['sort_order'];
|
||||
$r['include_last_update_time'] = $r['optiondates'];
|
||||
$r['include_last_update_time'] = $r['show_date'];
|
||||
extract($r);
|
||||
|
||||
$categories = get_categories($r);
|
||||
|
@ -269,7 +261,7 @@ function wp_list_categories($args = '') {
|
|||
}
|
||||
|
||||
function _category_list_level_start($output, $depth, $cat, $args) {
|
||||
if (! $args['list'])
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
$indent = str_repeat("\t", $depth);
|
||||
|
@ -278,7 +270,7 @@ function _category_list_level_start($output, $depth, $cat, $args) {
|
|||
}
|
||||
|
||||
function _category_list_level_end($output, $depth, $cat, $args) {
|
||||
if (! $args['list'])
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
$indent = str_repeat("\t", $depth);
|
||||
|
@ -323,16 +315,14 @@ function _category_list_element_start($output, $category, $depth, $current_categ
|
|||
$link .= ')';
|
||||
}
|
||||
|
||||
if ( intval($optioncount) == 1 )
|
||||
if ( $show_count )
|
||||
$link .= ' ('.intval($category->category_count).')';
|
||||
|
||||
if ( $optiondates ) {
|
||||
if ( $optiondates == 1 )
|
||||
$optiondates = 'Y-m-d';
|
||||
$link .= ' ' . gmdate($optiondates,$category->last_update_timestamp);
|
||||
if ( $show_date ) {
|
||||
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
|
||||
}
|
||||
|
||||
if ( $list ) {
|
||||
if ( 'list' == $args['style'] ) {
|
||||
$output .= "\t<li";
|
||||
if ( ($category->cat_ID == $current_category) && is_category() )
|
||||
$output .= ' class="current-cat"';
|
||||
|
@ -345,7 +335,7 @@ function _category_list_element_start($output, $category, $depth, $current_categ
|
|||
}
|
||||
|
||||
function _category_list_element_end($output, $category, $depth, $cat, $args) {
|
||||
if (! $args['list'])
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
$output .= "</li>\n";
|
||||
|
|
Loading…
Reference in New Issue