Make WordPress Core


Ignore:
Timestamp:
08/17/2018 01:50:26 AM (6 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/class-wp-customize-nav-menus.php

    r43480 r43571  
    181181
    182182            $posts = array_merge(
    183                 $posts, get_posts(
     183                $posts,
     184                get_posts(
    184185                    array(
    185186                        'numberposts' => 10,
     
    210211        } elseif ( 'taxonomy' === $type ) {
    211212            $terms = get_terms(
    212                 $object, array(
     213                $object,
     214                array(
    213215                    'child_of'     => 0,
    214216                    'exclude'      => '',
     
    364366        $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
    365367        $terms      = get_terms(
    366             $taxonomies, array(
     368            $taxonomies,
     369            array(
    367370                'name__like' => $args['s'],
    368371                'number'     => 20,
     
    388391        // Add "Home" link if search term matches. Treat as a page, but switch to custom on add.
    389392        if ( isset( $args['s'] ) ) {
    390             $title = _x( 'Home', 'nav menu home label' );
     393            $title   = _x( 'Home', 'nav menu home label' );
    391394            $matches = function_exists( 'mb_stripos' ) ? false !== mb_stripos( $title, $args['s'] ) : false !== stripos( $title, $args['s'] );
    392395            if ( $matches ) {
     
    595598        $this->manager->add_panel(
    596599            new WP_Customize_Nav_Menus_Panel(
    597                 $this->manager, 'nav_menus', array(
     600                $this->manager,
     601                'nav_menus',
     602                array(
    598603                    'title'       => __( 'Menus' ),
    599604                    'description' => $description,
     
    621626
    622627        $this->manager->add_section(
    623             'menu_locations', array(
     628            'menu_locations',
     629            array(
    624630                'title'       => 1 === $num_locations ? _x( 'View Location', 'menu locations' ) : _x( 'View All Locations', 'menu locations' ),
    625631                'panel'       => 'nav_menus',
     
    657663            } else {
    658664                $this->manager->add_setting(
    659                     $setting_id, array(
     665                    $setting_id,
     666                    array(
    660667                        'sanitize_callback' => array( $this, 'intval_base10' ),
    661668                        'theme_supports'    => 'menus',
     
    674681            $this->manager->add_control(
    675682                new WP_Customize_Nav_Menu_Location_Control(
    676                     $this->manager, $setting_id, array(
     683                    $this->manager,
     684                    $setting_id,
     685                    array(
    677686                        'label'       => $description,
    678687                        'location_id' => $location,
     
    692701            $this->manager->add_section(
    693702                new WP_Customize_Nav_Menu_Section(
    694                     $this->manager, $section_id, array(
     703                    $this->manager,
     704                    $section_id,
     705                    array(
    695706                        'title'    => html_entity_decode( $menu->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
    696707                        'priority' => 10,
     
    703714            $this->manager->add_setting(
    704715                new WP_Customize_Nav_Menu_Setting(
    705                     $this->manager, $nav_menu_setting_id, array(
     716                    $this->manager,
     717                    $nav_menu_setting_id,
     718                    array(
    706719                        'transport' => 'postMessage',
    707720                    )
     
    725738                $this->manager->add_setting(
    726739                    new WP_Customize_Nav_Menu_Item_Setting(
    727                         $this->manager, $menu_item_setting_id, array(
     740                        $this->manager,
     741                        $menu_item_setting_id,
     742                        array(
    728743                            'value'     => $value,
    729744                            'transport' => 'postMessage',
     
    735750                $this->manager->add_control(
    736751                    new WP_Customize_Nav_Menu_Item_Control(
    737                         $this->manager, $menu_item_setting_id, array(
     752                        $this->manager,
     753                        $menu_item_setting_id,
     754                        array(
    738755                            'label'    => $item->title,
    739756                            'section'  => $section_id,
     
    749766        // Add the add-new-menu section and controls.
    750767        $this->manager->add_section(
    751             'add_menu', array(
     768            'add_menu',
     769            array(
    752770                'type'     => 'new_menu',
    753771                'title'    => __( 'New Menu' ),
     
    759777        $this->manager->add_setting(
    760778            new WP_Customize_Filter_Setting(
    761                 $this->manager, 'nav_menus_created_posts', array(
     779                $this->manager,
     780                'nav_menus_created_posts',
     781                array(
    762782                    'transport'         => 'postMessage',
    763783                    'type'              => 'option', // To prevent theme prefix in changeset.
     
    10371057            </h3>
    10381058        </script>
    1039     <?php
     1059        <?php
    10401060    }
    10411061
     
    10951115            ?>
    10961116        </div><!-- #available-menu-items -->
    1097     <?php
     1117        <?php
    10981118    }
    10991119
     
    11211141                        /* translators: %s: Title of a section with menu items */
    11221142                        printf( __( 'Toggle section: %s' ), esc_html( $available_item_type['title'] ) );
    1123                         ?>
     1143                    ?>
    11241144                        </span>
    11251145                    <span class="toggle-indicator" aria-hidden="true"></span>
Note: See TracChangeset for help on using the changeset viewer.