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-includes/post.php

    r43535 r43571  
    2020function create_initial_post_types() {
    2121        register_post_type(
    22                 'post', array(
     22                'post',
     23                array(
    2324                        'labels'                => array(
    2425                                'name_admin_bar' => _x( 'Post', 'add new from admin bar' ),
    … …  
    4243
    4344        register_post_type(
    44                 'page', array(
     45                'page',
     46                array(
    4547                        'labels'                => array(
    4648                                'name_admin_bar' => _x( 'Page', 'add new from admin bar' ),
    … …  
    6567
    6668        register_post_type(
    67                 'attachment', array(
     69                'attachment',
     70                array(
    6871                        'labels'                => array(
    6972                                'name'           => _x( 'Media', 'post type general name' ),
    … …  
    98101
    99102        register_post_type(
    100                 'revision', array(
     103                'revision',
     104                array(
    101105                        'labels'           => array(
    102106                                'name'          => __( 'Revisions' ),
    … …  
    118122
    119123        register_post_type(
    120                 'nav_menu_item', array(
     124                'nav_menu_item',
     125                array(
    121126                        'labels'           => array(
    122127                                'name'          => __( 'Navigation Menu Items' ),
    … …  
    133138
    134139        register_post_type(
    135                 'custom_css', array(
     140                'custom_css',
     141                array(
    136142                        'labels'           => array(
    137143                                'name'          => __( 'Custom CSS' ),
    … …  
    164170
    165171        register_post_type(
    166                 'customize_changeset', array(
     172                'customize_changeset',
     173                array(
    167174                        'labels'           => array(
    168175                                'name'               => _x( 'Changesets', 'post type general name' ),
    … …  
    211218
    212219        register_post_type(
    213                 'oembed_cache', array(
     220                'oembed_cache',
     221                array(
    214222                        'labels'           => array(
    215223                                'name'          => __( 'oEmbed Responses' ),
    … …  
    228236
    229237        register_post_type(
    230                 'user_request', array(
     238                'user_request',
     239                array(
    231240                        'labels'           => array(
    232241                                'name'          => __( 'User Requests' ),
    … …  
    245254
    246255        register_post_status(
    247                 'publish', array(
     256                'publish',
     257                array(
    248258                        'label'       => _x( 'Published', 'post status' ),
    249259                        'public'      => true,
    … …  
    254264
    255265        register_post_status(
    256                 'future', array(
     266                'future',
     267                array(
    257268                        'label'       => _x( 'Scheduled', 'post status' ),
    258269                        'protected'   => true,
    … …  
    263274
    264275        register_post_status(
    265                 'draft', array(
     276                'draft',
     277                array(
    266278                        'label'       => _x( 'Draft', 'post status' ),
    267279                        'protected'   => true,
    … …  
    272284
    273285        register_post_status(
    274                 'pending', array(
     286                'pending',
     287                array(
    275288                        'label'       => _x( 'Pending', 'post status' ),
    276289                        'protected'   => true,
    … …  
    281294
    282295        register_post_status(
    283                 'private', array(
     296                'private',
     297                array(
    284298                        'label'       => _x( 'Private', 'post status' ),
    285299                        'private'     => true,
    … …  
    290304
    291305        register_post_status(
    292                 'trash', array(
     306                'trash',
     307                array(
    293308                        'label'                     => _x( 'Trash', 'post status' ),
    294309                        'internal'                  => true,
    … …  
    300315
    301316        register_post_status(
    302                 'auto-draft', array(
     317                'auto-draft',
     318                array(
    303319                        'label'    => 'auto-draft',
    304320                        'internal' => true,
    … …  
    308324
    309325        register_post_status(
    310                 'inherit', array(
     326                'inherit',
     327                array(
    311328                        'label'               => 'inherit',
    312329                        'internal'            => true,
    … …  
    317334
    318335        register_post_status(
    319                 'request-pending', array(
     336                'request-pending',
     337                array(
    320338                        'label'               => _x( 'Pending', 'request status' ),
    321339                        'internal'            => true,
    … …  
    326344
    327345        register_post_status(
    328                 'request-confirmed', array(
     346                'request-confirmed',
     347                array(
    329348                        'label'               => _x( 'Confirmed', 'request status' ),
    330349                        'internal'            => true,
    … …  
    335354
    336355        register_post_status(
    337                 'request-failed', array(
     356                'request-failed',
     357                array(
    338358                        'label'               => _x( 'Failed', 'request status' ),
    339359                        'internal'            => true,
    … …  
    344364
    345365        register_post_status(
    346                 'request-completed', array(
     366                'request-completed',
     367                array(
    347368                        'label'               => _x( 'Completed', 'request status' ),
    348369                        'internal'            => true,
    … …  
    47024723                        WHERE post_title = %s
    47034724                        AND post_type IN ($post_type_in_string)
    4704                 ", $page_title
     4725                ",
     4726                        $page_title
    47054727                );
    47064728        } else {
    … …  
    47114733                        WHERE post_title = %s
    47124734                        AND post_type = %s
    4713                 ", $page_title, $post_type
     4735                ",
     4736                        $page_title,
     4737                        $post_type
    47144738                );
    47154739        }
    … …  
    59035927function wp_check_for_changed_dates( $post_id, $post, $post_before ) {
    59045928        $previous_date = date( 'Y-m-d', strtotime( $post_before->post_date ) );
    5905         $new_date = date( 'Y-m-d', strtotime( $post->post_date ) );
     5929        $new_date      = date( 'Y-m-d', strtotime( $post->post_date ) );
    59065930        // Don't bother if it hasn't changed.
    59075931        if ( $new_date == $previous_date ) {
Note: See TracChangeset for help on using the changeset viewer.