Ticket #23089: 23089.2.patch
File 23089.2.patch, 2.8 KB (added by , 12 years ago) |
---|
-
wp-includes/default-widgets.php
558 558 ob_start(); 559 559 extract($args); 560 560 561 $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base); 562 if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) 563 $number = 10; 561 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Posts' ) : $instance['title'], $instance, $this->id_base ); 562 $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 10; 564 563 $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; 565 564 566 565 $r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) ); … … 609 608 610 609 function form( $instance ) { 611 610 $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 612 $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;611 $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 5; 613 612 $show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false; 614 613 ?> 615 614 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> … … 674 673 675 674 extract($args, EXTR_SKIP); 676 675 $output = ''; 677 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title'], $instance, $this->id_base ); 676 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title'], $instance, $this->id_base ); 677 $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 5; 678 678 679 if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )680 $number = 5;681 682 679 $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); 683 680 $output .= $before_widget; 684 681 if ( $title ) … … 716 713 } 717 714 718 715 function form( $instance ) { 719 $title = isset( $instance['title']) ? esc_attr($instance['title']) : '';720 $number = isset($instance['number']) ? absint($instance['number']) : 5;716 $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 717 $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 5; 721 718 ?> 722 719 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> 723 720 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>