mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -27,7 +27,9 @@ class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control {
|
||||
*/
|
||||
public function __construct( $manager ) {
|
||||
parent::__construct(
|
||||
$manager, 'background_image', array(
|
||||
$manager,
|
||||
'background_image',
|
||||
array(
|
||||
'label' => __( 'Background Image' ),
|
||||
'section' => 'background_image',
|
||||
)
|
||||
@@ -44,7 +46,9 @@ class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control {
|
||||
|
||||
$custom_background = get_theme_support( 'custom-background' );
|
||||
wp_localize_script(
|
||||
'customize-controls', '_wpCustomizeBackground', array(
|
||||
'customize-controls',
|
||||
'_wpCustomizeBackground',
|
||||
array(
|
||||
'defaults' => ! empty( $custom_background[0] ) ? $custom_background[0] : array(),
|
||||
'nonces' => array(
|
||||
'add' => wp_create_nonce( 'background-add' ),
|
||||
|
||||
@@ -181,7 +181,8 @@ final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting {
|
||||
}
|
||||
|
||||
$r = wp_update_custom_css_post(
|
||||
$css, array(
|
||||
$css,
|
||||
array(
|
||||
'stylesheet' => $this->stylesheet,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -28,7 +28,9 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
|
||||
*/
|
||||
public function __construct( $manager ) {
|
||||
parent::__construct(
|
||||
$manager, 'header_image', array(
|
||||
$manager,
|
||||
'header_image',
|
||||
array(
|
||||
'label' => __( 'Header Image' ),
|
||||
'settings' => array(
|
||||
'default' => 'header_image',
|
||||
@@ -51,7 +53,9 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
|
||||
$this->prepare_control();
|
||||
|
||||
wp_localize_script(
|
||||
'customize-views', '_wpCustomizeHeader', array(
|
||||
'customize-views',
|
||||
'_wpCustomizeHeader',
|
||||
array(
|
||||
'data' => array(
|
||||
'width' => absint( get_theme_support( 'custom-header', 'width' ) ),
|
||||
'height' => absint( get_theme_support( 'custom-header', 'height' ) ),
|
||||
|
||||
@@ -353,7 +353,9 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
|
||||
|
||||
if ( ! isset( $this->value['nav_menu_term_id'] ) && $this->post_id > 0 ) {
|
||||
$menus = wp_get_post_terms(
|
||||
$this->post_id, WP_Customize_Nav_Menu_Setting::TAXONOMY, array(
|
||||
$this->post_id,
|
||||
WP_Customize_Nav_Menu_Setting::TAXONOMY,
|
||||
array(
|
||||
'fields' => 'ids',
|
||||
)
|
||||
);
|
||||
@@ -557,7 +559,8 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
|
||||
|
||||
if ( ARRAY_A === $args['output'] ) {
|
||||
$items = wp_list_sort(
|
||||
$items, array(
|
||||
$items,
|
||||
array(
|
||||
$args['output_key'] => 'ASC',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -269,7 +269,8 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
|
||||
'term_group' => 0,
|
||||
'taxonomy' => self::TAXONOMY,
|
||||
'filter' => 'raw',
|
||||
), $setting_value
|
||||
),
|
||||
$setting_value
|
||||
);
|
||||
|
||||
array_splice( $menus, $index, ( -1 === $index ? 0 : 1 ), array( $menu_obj ) );
|
||||
@@ -278,7 +279,8 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
|
||||
// Make sure the menu objects get re-sorted after an update/insert.
|
||||
if ( ! $is_delete && ! empty( $args['orderby'] ) ) {
|
||||
$menus = wp_list_sort(
|
||||
$menus, array(
|
||||
$menus,
|
||||
array(
|
||||
$args['orderby'] => 'ASC',
|
||||
)
|
||||
);
|
||||
@@ -366,7 +368,8 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
|
||||
'term_group' => 0,
|
||||
'taxonomy' => self::TAXONOMY,
|
||||
'filter' => 'raw',
|
||||
), $setting_value
|
||||
),
|
||||
$setting_value
|
||||
);
|
||||
|
||||
return $menu_obj;
|
||||
|
||||
@@ -96,6 +96,6 @@ class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel {
|
||||
// NOTE: The following is a workaround for an inability to treat (and thus label) a list of sections as a whole.
|
||||
?>
|
||||
<li class="customize-control-title customize-section-title-nav_menus-heading"><?php _e( 'Menus' ); ?></li>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,6 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user