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
This commit is contained in:
parent
4d86d8a6ad
commit
f8f70f294a
|
@ -64,8 +64,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ( wc_tax_enabled() && WC()->cart->tax_display_cart == 'excl' ) : ?>
|
||||
<?php if ( get_option( 'woocommerce_tax_total_display' ) == 'itemized' ) : ?>
|
||||
<?php if ( wc_tax_enabled() && 'excl' === WC()->cart->tax_display_cart ) : ?>
|
||||
<?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
|
||||
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
|
||||
<tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
|
||||
<th><?php echo esc_html( $tax->label ); ?></th>
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
?>
|
||||
<div class="woocommerce-shipping-fields">
|
||||
<?php if ( WC()->cart->needs_shipping_address() === true ) : ?>
|
||||
<?php if ( true === WC()->cart->needs_shipping_address() ) : ?>
|
||||
|
||||
<?php
|
||||
if ( empty( $_POST ) ) {
|
||||
|
|
|
@ -83,8 +83,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ( wc_tax_enabled() && WC()->cart->tax_display_cart === 'excl' ) : ?>
|
||||
<?php if ( get_option( 'woocommerce_tax_total_display' ) === 'itemized' ) : ?>
|
||||
<?php if ( wc_tax_enabled() && 'excl' === WC()->cart->tax_display_cart ) : ?>
|
||||
<?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
|
||||
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
|
||||
<tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
|
||||
<th><?php echo esc_html( $tax->label ); ?></th>
|
||||
|
|
|
@ -42,8 +42,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
|
|||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<td class="td" colspan="2" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px !important;'; ?>"><?php echo $total['label']; ?></td>
|
||||
<td class="td" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px !important;'; ?>"><?php echo $total['value']; ?></td>
|
||||
<td class="td" colspan="2" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px !important;'; ?>"><?php echo $total['label']; ?></td>
|
||||
<td class="td" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px !important;'; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
<p><?php printf( __( "Thanks for creating an account on %s. Your username is <strong>%s</strong>.", 'woocommerce' ), esc_html( $blogname ), esc_html( $user_login ) ); ?></p>
|
||||
|
||||
<?php if ( get_option( 'woocommerce_registration_generate_password' ) == 'yes' && $password_generated ) : ?>
|
||||
<?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
|
||||
|
||||
<p><?php printf( __( "Your password has been automatically generated: <strong>%s</strong>", 'woocommerce' ), esc_html( $user_pass ) ); ?></p>
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i === 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( 1 === $i ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( 1 === $i ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:left; <?php if ( 1 === $i ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:left; <?php if ( 1 === $i ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ echo "= " . $email_heading . " =\n\n";
|
|||
|
||||
echo sprintf( __( "Thanks for creating an account on %s. Your username is <strong>%s</strong>.", '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 <strong>%s</strong>.", '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";
|
||||
|
|
Loading…
Reference in New Issue