Changeset 28432
- Timestamp:
- 05/15/2014 03:47:43 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/category-template.php
r28359 r28432 345 345 $r = wp_parse_args( $args, $defaults ); 346 346 347 if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {347 if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) { 348 348 $r['pad_counts'] = true; 349 349 } 350 350 351 extract( $r );351 $tab_index = $r['tab_index']; 352 352 353 353 $tab_index_attribute = ''; 354 if ( (int) $tab_index > 0 ) 354 if ( (int) $tab_index > 0 ) { 355 355 $tab_index_attribute = " tabindex=\"$tab_index\""; 356 357 $categories = get_terms( $ taxonomy, $r );358 $name = esc_attr( $ name);359 $class = esc_attr( $ class);360 $id = $ id ? esc_attr( $id) : $name;361 362 if ( ! $r['hide_if_empty'] || ! empty( $categories) )356 } 357 $categories = get_terms( $r['taxonomy'], $r ); 358 $name = esc_attr( $r['name'] ); 359 $class = esc_attr( $r['class'] ); 360 $id = $r['id'] ? esc_attr( $r['id'] ) : $name; 361 362 if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) { 363 363 $output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n"; 364 else364 } else { 365 365 $output = ''; 366 367 if ( empty( $categories) && ! $r['hide_if_empty'] && !empty($show_option_none) ) {366 } 367 if ( empty( $categories ) && ! $r['hide_if_empty'] && ! empty( $r['show_option_none'] ) ) { 368 368 369 369 /** … … 381 381 * @param string $element Taxonomy element to list. 382 382 */ 383 $show_option_none = apply_filters( 'list_cats', $ show_option_none);383 $show_option_none = apply_filters( 'list_cats', $r['show_option_none'] ); 384 384 $output .= "\t<option value='-1' selected='selected'>$show_option_none</option>\n"; 385 385 } … … 387 387 if ( ! empty( $categories ) ) { 388 388 389 if ( $ show_option_all) {389 if ( $r['show_option_all'] ) { 390 390 391 391 /** This filter is documented in wp-includes/category-template.php */ 392 $show_option_all = apply_filters( 'list_cats', $ show_option_all);392 $show_option_all = apply_filters( 'list_cats', $r['show_option_all'] ); 393 393 $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : ''; 394 394 $output .= "\t<option value='0'$selected>$show_option_all</option>\n"; 395 395 } 396 396 397 if ( $ show_option_none) {397 if ( $r['show_option_none'] ) { 398 398 399 399 /** This filter is documented in wp-includes/category-template.php */ 400 $show_option_none = apply_filters( 'list_cats', $ show_option_none);400 $show_option_none = apply_filters( 'list_cats', $r['show_option_none'] ); 401 401 $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : ''; 402 402 $output .= "\t<option value='-1'$selected>$show_option_none</option>\n"; 403 403 } 404 404 405 if ( $ hierarchical )405 if ( $r['hierarchical'] ) { 406 406 $depth = $r['depth']; // Walk the full depth. 407 else407 } else { 408 408 $depth = -1; // Flat. 409 409 } 410 410 $output .= walk_category_dropdown_tree( $categories, $depth, $r ); 411 411 } 412 412 413 if ( ! $r['hide_if_empty'] || ! empty( $categories) )413 if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) { 414 414 $output .= "</select>\n"; 415 415 } 416 416 /** 417 417 * Filter the taxonomy drop-down output. … … 424 424 $output = apply_filters( 'wp_dropdown_cats', $output, $r ); 425 425 426 if ( $ echo )426 if ( $r['echo'] ) { 427 427 echo $output; 428 428 } 429 429 return $output; 430 430 }
Note: See TracChangeset
for help on using the changeset viewer.