Make WordPress Core


Ignore:
Timestamp:
08/17/2018 01:50:26 AM (8 years ago)
Author:
pento
Message:

Coding Standards: Upgrade WPCS to 1.0.0

WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:

  • Multiline function calls must now put each parameter on a new line.
  • Auto-formatting files is now part of the grunt precommit script.
  • Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-media-list-table.php

    r43063 r43571  
    172172                        return;
    173173                }
    174 ?>
     174                ?>
    175175                <div class="actions">
    176 <?php
    177 if ( ! is_singular() ) {
    178         if ( ! $this->is_trash ) {
    179                 $this->months_dropdown( 'attachment' );
    180         }
    181 
    182         /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
    183         do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
    184 
    185         submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
    186 }
    187 
    188 if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
    189         submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
    190 }
     176                <?php
     177                if ( ! is_singular() ) {
     178                        if ( ! $this->is_trash ) {
     179                                $this->months_dropdown( 'attachment' );
     180                        }
     181
     182                        /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
     183                        do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
     184
     185                        submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
     186                }
     187
     188                if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
     189                        submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
     190                }
    191191                ?>
    192192                </div>
    193 <?php
     193                <?php
    194194        }
    195195
    … …  
    237237
    238238                $this->screen->render_screen_reader_content( 'heading_views' );
    239 ?>
     239                ?>
    240240<div class="wp-filter">
    241241        <div class="filter-items">
    … …  
    253253                </select>
    254254
    255 <?php
     255                <?php
    256256                $this->extra_tablenav( 'bar' );
    257257
    … …  
    260260
    261261                // Back compat for pre-4.0 view links.
    262 if ( ! empty( $views ) ) {
    263         echo '<ul class="filter-links">';
    264         foreach ( $views as $class => $view ) {
    265                 echo "<li class='$class'>$view</li>";
    266         }
    267         echo '</ul>';
    268 }
    269 ?>
     262                if ( ! empty( $views ) ) {
     263                        echo '<ul class="filter-links">';
     264                        foreach ( $views as $class => $view ) {
     265                                echo "<li class='$class'>$view</li>";
     266                        }
     267                        echo '</ul>';
     268                }
     269                ?>
    270270        </div>
    271271
    … …  
    274274                <input type="search" placeholder="<?php esc_attr_e( 'Search media items...' ); ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div>
    275275        </div>
    276         <?php
     276                <?php
    277277        }
    278278
    … …  
    355355        public function column_cb( $post ) {
    356356                if ( current_user_can( 'edit_post', $post->ID ) ) {
    357                 ?>
     357                        ?>
    358358                        <label class="screen-reader-text" for="cb-select-<?php echo $post->ID; ?>">
    359359                                                                                                                                                <?php
    360360                                                                                                                                                echo sprintf( __( 'Select %s' ), _draft_or_post_title() );
    361                         ?>
     361                                                                                                                                                ?>
    362362                        </label>
    363363                        <input type="checkbox" name="media[]" id="cb-select-<?php echo $post->ID; ?>" value="<?php echo $post->ID; ?>" />
    364                 <?php
     364                        <?php
    365365                }
    366366        }
    … …  
    396396                        echo $link_start;
    397397                        if ( $thumb ) :
    398                         ?>
     398                                ?>
    399399                                <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span>
    400                         <?php
     400                                <?php
    401401                        endif;
    402402                        echo $title . $link_end;
    … …  
    488488
    489489                        if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
    490 ?>
     490                                ?>
    491491                                <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
    492492                                        <?php echo $title; ?></a></strong>
    493493                                                                <?php
    494494                        } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) {
    495 ?>
     495                                ?>
    496496                                <strong><?php echo $title; ?></strong>
    497497                                                                        <?php
    … …  
    506506                                                'media[]'        => $post->ID,
    507507                                                '_wpnonce'       => wp_create_nonce( 'bulk-' . $this->_args['plural'] ),
    508                                         ), 'upload.php'
     508                                        ),
     509                                        'upload.php'
    509510                                );
    510511                                printf(
    … …  
    632633                        }
    633634                        $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';
    634                 ?>
     635                        ?>
    635636                        <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
    636637                                <?php $this->single_row_columns( $post ); ?>
    637638                        </tr>
    638                 <?php
     639                        <?php
    639640                endwhile;
    640641        }
Note: See TracChangeset for help on using the changeset viewer.