Ticket #16625: 16625.diff
| File 16625.diff, 3.3 KB (added by , 15 years ago) |
|---|
-
wp-includes/user.php
980 980 'include' => '', 'exclude' => '', 'multi' => 0, 981 981 'show' => 'display_name', 'echo' => 1, 982 982 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', 983 'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false 983 'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false, 984 'option_none_value' => -1 984 985 ); 985 986 986 987 $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; … … 1006 1007 $output .= "\t<option value='0'>$show_option_all</option>\n"; 1007 1008 1008 1009 if ( $show_option_none ) { 1009 $_selected = selected( -1, $selected, false );1010 $_selected = selected( $option_none_value, $selected, false ); 1010 1011 $output .= "\t<option value='-1'$_selected>$show_option_none</option>\n"; 1011 1012 } 1012 1013 -
wp-includes/category-template.php
309 309 'name' => 'cat', 'id' => '', 310 310 'class' => 'postform', 'depth' => 0, 311 311 'tab_index' => 0, 'taxonomy' => 'category', 312 'hide_if_empty' => false 312 'hide_if_empty' => false, 'option_none_value' => -1 313 313 ); 314 314 315 315 $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; … … 338 338 $class = esc_attr( $class ); 339 339 $id = $id ? esc_attr( $id ) : $name; 340 340 341 if ( ! $ r['hide_if_empty']|| ! empty($categories) )341 if ( ! $hide_if_empty || ! empty($categories) ) 342 342 $output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n"; 343 343 else 344 344 $output = ''; 345 345 346 if ( empty($categories) && ! $ r['hide_if_empty']&& !empty($show_option_none) ) {346 if ( empty($categories) && ! $hide_if_empty && !empty($show_option_none) ) { 347 347 $show_option_none = apply_filters( 'list_cats', $show_option_none ); 348 $output .= "\t<option value=' -1' selected='selected'>$show_option_none</option>\n";348 $output .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n"; 349 349 } 350 350 351 351 if ( ! empty( $categories ) ) { 352 352 353 353 if ( $show_option_all ) { 354 354 $show_option_all = apply_filters( 'list_cats', $show_option_all ); 355 $ selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : '';356 $output .= "\t<option value='0'$ selected>$show_option_all</option>\n";355 $_selected = selected( 0, $selected, false); 356 $output .= "\t<option value='0'$_selected>$show_option_all</option>\n"; 357 357 } 358 358 359 359 if ( $show_option_none ) { 360 360 $show_option_none = apply_filters( 'list_cats', $show_option_none ); 361 $ selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : '';362 $output .= "\t<option value=' -1'$selected>$show_option_none</option>\n";361 $_selected = selected( $option_none_value, $selected, false ); 362 $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n"; 363 363 } 364 364 365 365 if ( $hierarchical ) … … 369 369 370 370 $output .= walk_category_dropdown_tree( $categories, $depth, $r ); 371 371 } 372 if ( ! $ r['hide_if_empty']|| ! empty($categories) )372 if ( ! $hide_if_empty || ! empty($categories) ) 373 373 $output .= "</select>\n"; 374 374 375 375