From f8f70f294a89d27e5b7a55236c0c4e0ec3f15c9f Mon Sep 17 00:00:00 2001 From: mitogh Date: Sat, 14 Nov 2015 20:35:29 -0600 Subject: [PATCH] Update strict comparission and update to Yoda condition In order to follow one of the best practices from the Wordpress handbook: - https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#yoda-conditions --- templates/cart/cart-totals.php | 4 ++-- templates/cart/cross-sells.php | 2 +- templates/cart/shipping-calculator.php | 2 +- templates/checkout/form-shipping.php | 2 +- templates/checkout/review-order.php | 4 ++-- templates/emails/admin-cancelled-order.php | 4 ++-- templates/emails/customer-completed-order.php | 4 ++-- templates/emails/customer-invoice.php | 4 ++-- templates/emails/customer-new-account.php | 2 +- templates/emails/customer-note.php | 4 ++-- templates/emails/customer-processing-order.php | 4 ++-- templates/emails/customer-refunded-order.php | 4 ++-- templates/emails/plain/customer-new-account.php | 2 +- 13 files changed, 21 insertions(+), 21 deletions(-) diff --git a/templates/cart/cart-totals.php b/templates/cart/cart-totals.php index 6e29e948a23..bfe5e74e516 100644 --- a/templates/cart/cart-totals.php +++ b/templates/cart/cart-totals.php @@ -64,8 +64,8 @@ if ( ! defined( 'ABSPATH' ) ) { - cart->tax_display_cart == 'excl' ) : ?> - + cart->tax_display_cart ) : ?> + cart->get_tax_totals() as $code => $tax ) : ?> label ); ?> diff --git a/templates/cart/cross-sells.php b/templates/cart/cross-sells.php index e867150f989..05438fccb80 100644 --- a/templates/cart/cross-sells.php +++ b/templates/cart/cross-sells.php @@ -23,7 +23,7 @@ global $product, $woocommerce_loop; $crosssells = WC()->cart->get_cross_sells(); -if ( sizeof( $crosssells ) == 0 ) return; +if ( 0 === sizeof( $crosssells ) ) return; $meta_query = WC()->query->get_meta_query(); diff --git a/templates/cart/shipping-calculator.php b/templates/cart/shipping-calculator.php index d0075620b21..43415c8c7fd 100644 --- a/templates/cart/shipping-calculator.php +++ b/templates/cart/shipping-calculator.php @@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } -if ( get_option( 'woocommerce_enable_shipping_calc' ) === 'no' || ! WC()->cart->needs_shipping() ) { +if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart->needs_shipping() ) { return; } diff --git a/templates/checkout/form-shipping.php b/templates/checkout/form-shipping.php index c14adc46af9..a9c4b2269fa 100644 --- a/templates/checkout/form-shipping.php +++ b/templates/checkout/form-shipping.php @@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) { ?>
- cart->needs_shipping_address() === true ) : ?> + cart->needs_shipping_address() ) : ?> - cart->tax_display_cart === 'excl' ) : ?> - + cart->tax_display_cart ) : ?> + cart->get_tax_totals() as $code => $tax ) : ?> label ); ?> diff --git a/templates/emails/admin-cancelled-order.php b/templates/emails/admin-cancelled-order.php index 1ce2d42d035..74274c8b604 100644 --- a/templates/emails/admin-cancelled-order.php +++ b/templates/emails/admin-cancelled-order.php @@ -42,8 +42,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> foreach ( $totals as $total ) { $i++; ?> - - + + - - + + - - + + %s.", 'woocommerce' ), esc_html( $blogname ), esc_html( $user_login ) ); ?>

- +

%s", 'woocommerce' ), esc_html( $user_pass ) ); ?>

diff --git a/templates/emails/customer-note.php b/templates/emails/customer-note.php index a020ef8fa78..0eda1fed873 100644 --- a/templates/emails/customer-note.php +++ b/templates/emails/customer-note.php @@ -51,8 +51,8 @@ if ( ! defined( 'ABSPATH' ) ) { foreach ( $totals as $total ) { $i++; ?> - - + + - - + + - - + + %s.", 'woocommerce' ), $blogname, $user_login ) . "\n\n"; -if ( get_option( 'woocommerce_registration_generate_password' ) === 'yes' && $password_generated ) +if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) echo sprintf( __( "Your password is %s.", 'woocommerce' ), $user_pass ) . "\n\n"; echo sprintf( __( 'You can access your account area to view your orders and change your password here: %s.', 'woocommerce' ), wc_get_page_permalink( 'myaccount' ) ) . "\n\n";