Everywhere yoda conditions are

This commit is contained in:
David Stone
2025-02-09 00:20:10 -07:00
parent d74f6d1a53
commit be0ab98895
213 changed files with 691 additions and 412 deletions

View File

@ -12,7 +12,7 @@ $product = wu_get_product($product['id']);
$product_variation = $product->get_as_variation($duration, $duration_unit);
if ($product_variation !== false) {
if (false !== $product_variation) {
$product = $product_variation;
} // end if;

View File

@ -25,7 +25,7 @@
<?php _e('Description', 'wp-ultimo'); ?>
</th>
<?php if ($table_columns === 'simple') : ?>
<?php if ('simple' === $table_columns) : ?>
<th class="col-total-gross">
<?php _e('Subtotal', 'wp-ultimo'); ?>
@ -59,7 +59,7 @@
<tr v-if="order.line_items.length === 0">
<td class="" colspan="<?php echo esc_attr($table_columns === 'simple') ? 2 : 5; ?>" class="col-description">
<td class="" colspan="<?php echo esc_attr('simple' === $table_columns) ? 2 : 5; ?>" class="col-description">
<?php _e('No products in shopping cart.', 'wp-ultimo'); ?>
@ -101,7 +101,7 @@
</td>
<?php if ($table_columns === 'simple') : ?>
<?php if ('simple' === $table_columns) : ?>
<td v-show="line_item.recurring" class="wu-py-2 col-total-net">
@ -161,7 +161,7 @@
<tfoot class="">
<?php if ($table_columns === 'simple') : ?>
<?php if ('simple' === $table_columns) : ?>
<tr>
@ -199,7 +199,7 @@
<tr>
<td class="" colspan="<?php echo esc_attr($table_columns === 'simple') ? 1 : 4; ?>">
<td class="" colspan="<?php echo esc_attr('simple' === $table_columns) ? 1 : 4; ?>">
<strong><?php _e("Today's Grand Total", 'wp-ultimo'); ?></strong>
@ -221,7 +221,7 @@
<tr v-if="order.has_trial">
<td class="" colspan="<?php echo esc_attr($table_columns === 'simple') ? 1 : 4; ?>">
<td class="" colspan="<?php echo esc_attr('simple' === $table_columns) ? 1 : 4; ?>">
<small>
<?php printf(__('Total in %1$s - end of trial period.', 'wp-ultimo'), '{{ $moment.unix(order.dates.date_trial_end).format(`LL`) }}'); ?>

View File

@ -25,7 +25,7 @@ defined('ABSPATH') || exit;
<li class="wu-mx-2">
<a
:class="(duration == <?php echo $period_option['duration']; ?> && duration_unit == '<?php echo $period_option['duration_unit']; ?>') || (<?php echo json_encode($index === 0); ?> && duration === '') ? 'wu-font-semibold active' : ''"
:class="(duration == <?php echo $period_option['duration']; ?> && duration_unit == '<?php echo $period_option['duration_unit']; ?>') || (<?php echo json_encode(0 === $index); ?> && duration === '') ? 'wu-font-semibold active' : ''"
v-on:click.prevent="duration = <?php echo $period_option['duration']; ?>; duration_unit = '<?php echo $period_option['duration_unit']; ?>'"
href="#"
>

View File

@ -27,7 +27,7 @@ defined('ABSPATH') || exit;
<?php foreach ($period_options as $index => $period_option) : ?>
<li>
<a class="wu-text-center" :class="(duration == <?php echo $period_option['duration']; ?> && duration_unit == '<?php echo $period_option['duration_unit']; ?>') || (<?php echo json_encode($index === 0); ?> && duration === '') ? 'active' : ''" v-on:click.prevent="duration = <?php echo $period_option['duration']; ?>; duration_unit = '<?php echo $period_option['duration_unit']; ?>'" href="#">
<a class="wu-text-center" :class="(duration == <?php echo $period_option['duration']; ?> && duration_unit == '<?php echo $period_option['duration_unit']; ?>') || (<?php echo json_encode(0 === $index); ?> && duration === '') ? 'active' : ''" v-on:click.prevent="duration = <?php echo $period_option['duration']; ?>; duration_unit = '<?php echo $period_option['duration_unit']; ?>'" href="#">
<?php echo $period_option['label']; ?>
</a>
</li>

View File

@ -19,7 +19,7 @@ $first_recurring_product = array_reduce(
$products_to_reduce,
function ($chosen_product, $product) {
if ($product && $product->is_recurring() && $chosen_product == false) {
if ($product && $product->is_recurring() && false == $chosen_product) {
$chosen_product = $product;
} // end if;
@ -58,7 +58,7 @@ wp_add_inline_script(
'after'
);
if ($first_recurring_product !== null) {
if (null !== $first_recurring_product) {
wp_add_inline_script(
'wu-checkout',
sprintf(
@ -318,7 +318,7 @@ if ($first_recurring_product !== null) {
$extra_check_for_annual = '';
if ($freq === 12) {
if (12 === $freq) {
$extra_check_for_annual = ' || (duration == "1" && duration_unit == "year")';
} // end if;

View File

@ -13,7 +13,7 @@ foreach ($products as $index => &$_product) {
$product_variation = $_product->get_as_variation($duration, $duration_unit);
if ($product_variation === false && ! $force_different_durations) {
if (false === $product_variation && ! $force_different_durations) {
unset($products[ $index ]);
$_product = $product_variation;