WordPress.org

Make WordPress Core

Ticket #23089: 23089.patch

File 23089.patch, 1.7 KB (added by SergeyBiryukov, 5 years ago)
  • wp-includes/default-widgets.php

     
    558558                ob_start();
    559559                extract($args);
    560560
    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    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 10;
    564563                $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
    565564
    566565                $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 ) ) );
     
    674673
    675674                extract($args, EXTR_SKIP);
    676675                $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 = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
    678678
    679                 if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
    680                         $number = 5;
    681 
    682679                $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) );
    683680                $output .= $before_widget;
    684681                if ( $title )