Ticket #23089: 23089.3.patch
File 23089.3.patch, 3.1 KB (added by , 12 years ago) |
---|
-
wp-includes/default-widgets.php
559 559 ob_start(); 560 560 extract($args); 561 561 562 $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base); 563 if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) 562 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' ); 563 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 564 $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 10; 565 if ( ! $number ) 564 566 $number = 10; 565 567 $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; 566 568 … … 675 677 676 678 extract($args, EXTR_SKIP); 677 679 $output = ''; 678 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title'], $instance, $this->id_base );679 680 680 if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) 681 $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); 682 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 683 $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; 684 if ( ! $number ) 681 685 $number = 5; 682 686 683 687 $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); … … 717 721 } 718 722 719 723 function form( $instance ) { 720 $title = isset($instance['title']) ? esc_attr($instance['title']) : '';721 $number = isset( $instance['number']) ? absint($instance['number']) : 5;724 $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 725 $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; 722 726 ?> 723 <p><label for="<?php echo $this->get_field_id( 'title'); ?>"><?php _e('Title:'); ?></label>724 <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>727 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 728 <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> 725 729 726 <p><label for="<?php echo $this->get_field_id( 'number'); ?>"><?php _e('Number of comments to show:'); ?></label>727 <input id="<?php echo $this->get_field_id( 'number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>730 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of comments to show:' ); ?></label> 731 <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p> 728 732 <?php 729 733 } 730 734 }