From 486a81bf12e608549bd1141f888208c4d4d6589c Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Fri, 17 Feb 2017 16:10:15 -0200 Subject: [PATCH] Fixed coding standards --- i18n/locale-info.php | 8 ++++---- includes/abstracts/abstract-wc-payment-token.php | 2 +- includes/api/v1/class-wc-rest-customers-controller.php | 2 +- includes/api/v1/class-wc-rest-products-controller.php | 2 +- includes/class-wc-checkout.php | 2 +- includes/class-wc-geolocation.php | 2 +- .../data-stores/class-wc-customer-download-data-store.php | 4 ++-- includes/emails/class-wc-email-cancelled-order.php | 2 +- .../emails/class-wc-email-customer-completed-order.php | 2 +- includes/emails/class-wc-email-customer-invoice.php | 2 +- includes/emails/class-wc-email-customer-on-hold-order.php | 2 +- .../emails/class-wc-email-customer-processing-order.php | 2 +- includes/emails/class-wc-email-failed-order.php | 2 +- includes/emails/class-wc-email-new-order.php | 2 +- templates/single-product/product-attributes.php | 6 ------ tests/unit-tests/api/product-reviews.php | 2 +- tests/unit-tests/util/deprecated-hooks.php | 2 +- 17 files changed, 20 insertions(+), 26 deletions(-) diff --git a/i18n/locale-info.php b/i18n/locale-info.php index 7f17495e74d..adb7b732dad 100644 --- a/i18n/locale-info.php +++ b/i18n/locale-info.php @@ -269,10 +269,10 @@ return array( 'state' => '', 'rate' => '24.0000', 'name' => 'ALV', - 'shipping' => true - ) - ) - ) + 'shipping' => true, + ), + ), + ), ), 'FR' => array( 'currency_code' => 'EUR', diff --git a/includes/abstracts/abstract-wc-payment-token.php b/includes/abstracts/abstract-wc-payment-token.php index f5023c7b67a..550462c69fd 100644 --- a/includes/abstracts/abstract-wc-payment-token.php +++ b/includes/abstracts/abstract-wc-payment-token.php @@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php' ); +include_once( WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php' ); /** * WooCommerce Payment Token. diff --git a/includes/api/v1/class-wc-rest-customers-controller.php b/includes/api/v1/class-wc-rest-customers-controller.php index ac8f350434b..daf0bc4f5b6 100644 --- a/includes/api/v1/class-wc-rest-customers-controller.php +++ b/includes/api/v1/class-wc-rest-customers-controller.php @@ -533,7 +533,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { 'username' => $_data['username'], 'last_order' => array( 'id' => is_object( $last_order ) ? $last_order->get_id() : null, - 'date' => is_object( $last_order ) ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $last_order->get_date_created() ) ) ) : null + 'date' => is_object( $last_order ) ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $last_order->get_date_created() ) ) ) : null, ), 'orders_count' => $customer->get_order_count(), 'total_spent' => $customer->get_total_spent(), diff --git a/includes/api/v1/class-wc-rest-products-controller.php b/includes/api/v1/class-wc-rest-products-controller.php index e913a00da6f..f2e1a8481cd 100644 --- a/includes/api/v1/class-wc-rest-products-controller.php +++ b/includes/api/v1/class-wc-rest-products-controller.php @@ -199,7 +199,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { $args['meta_query'][] = array( 'key' => '_sku', 'value' => $request['sku'], - 'compare' => '=' + 'compare' => '=', ); } diff --git a/includes/class-wc-checkout.php b/includes/class-wc-checkout.php index 5fe53ac7c5c..f8e60d6f5df 100644 --- a/includes/class-wc-checkout.php +++ b/includes/class-wc-checkout.php @@ -972,7 +972,7 @@ class WC_Checkout { $value = apply_filters( 'woocommerce_checkout_get_value', null, $input ); - if ( $value !== null ) { + if ( null !== $value ) { return $value; } diff --git a/includes/class-wc-geolocation.php b/includes/class-wc-geolocation.php index edef1c886c1..062799815ff 100644 --- a/includes/class-wc-geolocation.php +++ b/includes/class-wc-geolocation.php @@ -227,7 +227,7 @@ class WC_Geolocation { */ private static function geolocate_via_db( $ip_address ) { if ( ! class_exists( 'WC_Geo_IP', false ) ) { - include_once( WC_ABSPATH . 'includes/class-wc-geo-ip.php' ); + include_once( WC_ABSPATH . 'includes/class-wc-geo-ip.php' ); } $gi = new WC_Geo_IP(); diff --git a/includes/data-stores/class-wc-customer-download-data-store.php b/includes/data-stores/class-wc-customer-download-data-store.php index f3336602727..f81eab879ca 100644 --- a/includes/data-stores/class-wc-customer-download-data-store.php +++ b/includes/data-stores/class-wc-customer-download-data-store.php @@ -30,7 +30,7 @@ class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store 'downloads_remaining' => $download->get_downloads_remaining(), 'access_granted' => date( 'Y-m-d', $download->get_access_granted() ), 'download_count' => $download->get_download_count(), - 'access_expires' => $download->get_access_expires() ? date( 'Y-m-d', $download->get_access_expires() ) : NULL, + 'access_expires' => $download->get_access_expires() ? date( 'Y-m-d', $download->get_access_expires() ) : null, ); $format = array( @@ -96,7 +96,7 @@ class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store 'downloads_remaining' => $download->get_downloads_remaining(), 'access_granted' => date( 'Y-m-d', $download->get_access_granted() ), 'download_count' => $download->get_download_count(), - 'access_expires' => $download->get_access_expires() ? date( 'Y-m-d', $download->get_access_expires() ) : NULL, + 'access_expires' => $download->get_access_expires() ? date( 'Y-m-d', $download->get_access_expires() ) : null, ); $format = array( diff --git a/includes/emails/class-wc-email-cancelled-order.php b/includes/emails/class-wc-email-cancelled-order.php index 1b4a62ade3c..a00b77e63dd 100644 --- a/includes/emails/class-wc-email-cancelled-order.php +++ b/includes/emails/class-wc-email-cancelled-order.php @@ -49,7 +49,7 @@ class WC_Email_Cancelled_Order extends WC_Email { * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = false ) { - if ( $order_id && ! is_a( $order, 'WC_Order' ) ){ + if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } diff --git a/includes/emails/class-wc-email-customer-completed-order.php b/includes/emails/class-wc-email-customer-completed-order.php index 79f23d9ad43..555447c9122 100644 --- a/includes/emails/class-wc-email-customer-completed-order.php +++ b/includes/emails/class-wc-email-customer-completed-order.php @@ -53,7 +53,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email { * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = false ) { - if ( $order_id && ! is_a( $order, 'WC_Order' ) ){ + if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } diff --git a/includes/emails/class-wc-email-customer-invoice.php b/includes/emails/class-wc-email-customer-invoice.php index 99bc70a4088..d70ecc2786c 100644 --- a/includes/emails/class-wc-email-customer-invoice.php +++ b/includes/emails/class-wc-email-customer-invoice.php @@ -67,7 +67,7 @@ class WC_Email_Customer_Invoice extends WC_Email { * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = false ) { - if ( $order_id && ! is_a( $order, 'WC_Order' ) ){ + if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } diff --git a/includes/emails/class-wc-email-customer-on-hold-order.php b/includes/emails/class-wc-email-customer-on-hold-order.php index f485ded0c16..97039b36ddb 100644 --- a/includes/emails/class-wc-email-customer-on-hold-order.php +++ b/includes/emails/class-wc-email-customer-on-hold-order.php @@ -47,7 +47,7 @@ class WC_Email_Customer_On_Hold_Order extends WC_Email { * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = false ) { - if ( $order_id && ! is_a( $order, 'WC_Order' ) ){ + if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } diff --git a/includes/emails/class-wc-email-customer-processing-order.php b/includes/emails/class-wc-email-customer-processing-order.php index 998be97e40e..f60aa53b9b1 100644 --- a/includes/emails/class-wc-email-customer-processing-order.php +++ b/includes/emails/class-wc-email-customer-processing-order.php @@ -47,7 +47,7 @@ class WC_Email_Customer_Processing_Order extends WC_Email { * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = false ) { - if ( $order_id && ! is_a( $order, 'WC_Order' ) ){ + if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } diff --git a/includes/emails/class-wc-email-failed-order.php b/includes/emails/class-wc-email-failed-order.php index 4e5cd462f82..4d0a263de52 100644 --- a/includes/emails/class-wc-email-failed-order.php +++ b/includes/emails/class-wc-email-failed-order.php @@ -49,7 +49,7 @@ class WC_Email_Failed_Order extends WC_Email { * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = false ) { - if ( $order_id && ! is_a( $order, 'WC_Order' ) ){ + if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } diff --git a/includes/emails/class-wc-email-new-order.php b/includes/emails/class-wc-email-new-order.php index ff589c9e447..c44bd51b672 100644 --- a/includes/emails/class-wc-email-new-order.php +++ b/includes/emails/class-wc-email-new-order.php @@ -53,7 +53,7 @@ class WC_Email_New_Order extends WC_Email { * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = false ) { - if ( $order_id && ! is_a( $order, 'WC_Order' ) ){ + if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } diff --git a/templates/single-product/product-attributes.php b/templates/single-product/product-attributes.php index 1b545e1ae86..e249d3e304f 100644 --- a/templates/single-product/product-attributes.php +++ b/templates/single-product/product-attributes.php @@ -44,12 +44,10 @@ if ( ! defined( 'ABSPATH' ) ) { $values = array(); if ( $attribute->is_taxonomy() ) { - $attribute_taxonomy = $attribute->get_taxonomy_object(); $attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) ); foreach ( $attribute_values as $attribute_value ) { - $value_name = esc_html( $attribute_value->name ); if ( $attribute_taxonomy->attribute_public ) { @@ -57,17 +55,13 @@ if ( ! defined( 'ABSPATH' ) ) { } else { $values[] = $value_name; } - } - } else { - $values = $attribute->get_options(); foreach ( $values as &$value ) { $value = esc_html( $value ); } - } echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values ); diff --git a/tests/unit-tests/api/product-reviews.php b/tests/unit-tests/api/product-reviews.php index 486ae6aaf96..fcc060c2244 100644 --- a/tests/unit-tests/api/product-reviews.php +++ b/tests/unit-tests/api/product-reviews.php @@ -368,7 +368,7 @@ class Product_Reviews extends WC_REST_Unit_Test_Case { ), 'delete' => array( $review_2_id, - $review_3_id + $review_3_id, ), 'create' => array( array( diff --git a/tests/unit-tests/util/deprecated-hooks.php b/tests/unit-tests/util/deprecated-hooks.php index b52bd6764ba..934a14a0699 100644 --- a/tests/unit-tests/util/deprecated-hooks.php +++ b/tests/unit-tests/util/deprecated-hooks.php @@ -105,7 +105,7 @@ class WC_Tests_Deprecated_Hooks extends WC_Unit_Test_Case { $new_hook = 'wc_new_hook'; $old_hook = 'wc_old_hook'; $test_value = false; - $args = array( &$test_value ); + $args = array( &$test_value ); $return = -1; add_filter( $old_hook, array( $this, 'toggle_value_by_ref' ) );