Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-recent-posts.php

    r41890 r42343  
    2424    public function __construct() {
    2525        $widget_ops = array(
    26             'classname' => 'widget_recent_entries',
    27             'description' => __( 'Your site’s most recent Posts.' ),
     26            'classname'                   => 'widget_recent_entries',
     27            'description'                 => __( 'Your site’s most recent Posts.' ),
    2828            'customize_selective_refresh' => true,
    2929        );
     
    6868         * @param array $instance Array of settings for the current widget.
    6969         */
    70         $r = new WP_Query( apply_filters( 'widget_posts_args', array(
    71             'posts_per_page'      => $number,
    72             'no_found_rows'       => true,
    73             'post_status'         => 'publish',
    74             'ignore_sticky_posts' => true,
    75         ), $instance ) );
     70        $r = new WP_Query(
     71            apply_filters(
     72                'widget_posts_args', array(
     73                    'posts_per_page'      => $number,
     74                    'no_found_rows'       => true,
     75                    'post_status'         => 'publish',
     76                    'ignore_sticky_posts' => true,
     77                ), $instance
     78            )
     79        );
    7680
    7781        if ( ! $r->have_posts() ) {
     
    9296                ?>
    9397                <li>
    94                     <a href="<?php the_permalink( $recent_post->ID ); ?>"><?php echo $title ; ?></a>
     98                    <a href="<?php the_permalink( $recent_post->ID ); ?>"><?php echo $title; ?></a>
    9599                    <?php if ( $show_date ) : ?>
    96100                        <span class="post-date"><?php echo get_the_date( '', $recent_post->ID ); ?></span>
     
    114118     */
    115119    public function update( $new_instance, $old_instance ) {
    116         $instance = $old_instance;
    117         $instance['title'] = sanitize_text_field( $new_instance['title'] );
    118         $instance['number'] = (int) $new_instance['number'];
     120        $instance              = $old_instance;
     121        $instance['title']     = sanitize_text_field( $new_instance['title'] );
     122        $instance['number']    = (int) $new_instance['number'];
    119123        $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
    120124        return $instance;
Note: See TracChangeset for help on using the changeset viewer.