Ticket #15523: 15523.diff
File 15523.diff, 2.3 KB (added by , 14 years ago) |
---|
-
wp-includes/post-template.php
754 754 * @param array|string $args Optional. Override default arguments. 755 755 * @return string HTML content, if not displaying. 756 756 */ 757 function wp_dropdown_pages( $args = '') {757 function wp_dropdown_pages( $args = '' ) { 758 758 $defaults = array( 759 'depth' => 0, 'child_of' => 0, 760 'selected' => 0, 'echo' => 1, 761 'name' => 'page_id', 'id' => '', 762 'show_option_none' => '', 'show_option_no_change' => '', 763 'option_none_value' => '' 759 'child_of' => 0, 760 'depth' => 0, 761 'echo' => 1, 762 'id' => '', 763 'multiple' => '', 764 'name' => 'page_id', 765 'option_none_value' => '', 766 'selected' => 0, 767 'show_option_no_change' => '', 768 'show_option_none' => '', 769 'size' => '' 764 770 ); 765 771 766 772 $r = wp_parse_args( $args, $defaults ); 767 773 extract( $r, EXTR_SKIP ); 768 774 769 $pages = get_pages( $r);775 $pages = get_pages( $r ); 770 776 $output = ''; 771 $name = esc_attr( $name);777 $name = esc_attr( $name ); 772 778 // Back-compat with old system where both id and name were based on $name argument 773 if ( empty( $id) )779 if ( empty( $id ) ) 774 780 $id = $name; 775 781 776 if ( ! empty($pages) ) { 777 $output = "<select name=\"$name\" id=\"$id\">\n"; 782 if ( 'multiple' == $multiple ) 783 $multiple = ' multiple="multiple"'; 784 785 if ( is_int( $size ) || ctype_digit( $size ) ) 786 $size = " size=\"$size\""; 787 788 if ( ! empty( $pages ) ) { 789 $output = "<select name=\"$name\" id=\"$id\"$multiple$size>\n"; 778 790 if ( $show_option_no_change ) 779 791 $output .= "\t<option value=\"-1\">$show_option_no_change</option>"; 780 792 if ( $show_option_none ) 781 $output .= "\t<option value=\"" . esc_attr( $option_none_value) . "\">$show_option_none</option>\n";782 $output .= walk_page_dropdown_tree( $pages, $depth, $r);793 $output .= "\t<option value=\"" . esc_attr( $option_none_value ) . "\">$show_option_none</option>\n"; 794 $output .= walk_page_dropdown_tree( $pages, $depth, $r ); 783 795 $output .= "</select>\n"; 784 796 } 785 797 786 $output = apply_filters( 'wp_dropdown_pages', $output);798 $output = apply_filters( 'wp_dropdown_pages', $output ); 787 799 788 800 if ( $echo ) 789 801 echo $output;