From b8534eee284770cf3d63e114bfd005b8a6346567 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 21 Mar 2018 00:06:47 -0300 Subject: [PATCH] Fixed includes/class-wc-install.php PHPCS violations --- includes/class-wc-install.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index e9e059463b5..212579cf82c 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -2,13 +2,11 @@ /** * Installation related functions and actions. * - * @package WooCommerce/Classes - * @version 3.0.0 + * @package WooCommerce/Classes + * @version 3.0.0 */ -if ( ! defined( 'ABSPATH' ) ) { - exit; -} +defined( 'ABSPATH' ) || exit; /** * WC_Install Class. @@ -151,11 +149,11 @@ class WC_Install { * This function is hooked into admin_init to affect admin only. */ public static function install_actions() { - if ( ! empty( $_GET['do_update_woocommerce'] ) ) { + if ( ! empty( $_GET['do_update_woocommerce'] ) ) { // WPCS: input var ok, CSRF ok. self::update(); WC_Admin_Notices::add_notice( 'update' ); } - if ( ! empty( $_GET['force_update_woocommerce'] ) ) { + if ( ! empty( $_GET['force_update_woocommerce'] ) ) { // WPCS: input var ok, CSRF ok. do_action( 'wp_' . get_current_blog_id() . '_wc_updater_cron' ); wp_safe_redirect( admin_url( 'admin.php?page=wc-settings' ) ); exit; @@ -358,7 +356,7 @@ class WC_Install { $held_duration = get_option( 'woocommerce_hold_stock_minutes', '60' ); - if ( '' != $held_duration ) { + if ( '' !== $held_duration ) { wp_schedule_single_event( time() + ( absint( $held_duration ) * 60 ), 'woocommerce_cancel_unpaid_orders' ); } @@ -1009,10 +1007,10 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta ( foreach ( $files as $file ) { if ( wp_mkdir_p( $file['base'] ) && ! file_exists( trailingslashit( $file['base'] ) . $file['file'] ) ) { - $file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); + $file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen if ( $file_handle ) { - fwrite( $file_handle, $file['content'] ); - fclose( $file_handle ); + fwrite( $file_handle, $file['content'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite + fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose } } } @@ -1040,7 +1038,7 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta ( * @return array */ public static function plugin_row_meta( $links, $file ) { - if ( WC_PLUGIN_BASENAME == $file ) { + if ( WC_PLUGIN_BASENAME === $file ) { $row_meta = array( 'docs' => '' . esc_html__( 'Docs', 'woocommerce' ) . '', 'apidocs' => '' . esc_html__( 'API docs', 'woocommerce' ) . '', @@ -1060,8 +1058,8 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta ( * @param string $key Plugin relative path. Example: woocommerce/woocommerce.php. */ private static function associate_plugin_slug( $plugins, $key ) { - $slug = explode( '/', $key ); - $slug = explode( '.', end( $slug ) ); + $slug = explode( '/', $key ); + $slug = explode( '.', end( $slug ) ); $plugins[ $slug[0] ] = $key; return $plugins; }