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

@ -77,7 +77,7 @@ if (is_array($field->values)) {
foreach ($field->values as $key => $value) {
$field_id = esc_attr($field->id);
$field_id .= $position !== $field_len - 1 ? $key : '';
$field_id .= $field_len - 1 !== $position ? $key : '';
++$position;
?>
<li id="<?php echo esc_attr($field_id); ?>-line"

View File

@ -29,7 +29,7 @@
<?php foreach ($field->options as $option_value => $option_label) : ?>
<option <?php selected($option_value === $field->value || (is_array($field->value) && in_array($option_value, $field->value))); ?> value="<?php echo esc_attr($option_value); ?>">
<option <?php selected($field->value === $option_value || (is_array($field->value) && in_array($option_value, $field->value))); ?> value="<?php echo esc_attr($option_value); ?>">
<?php echo $option_label; ?>

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;

View File

@ -83,7 +83,7 @@ $page->render_csv_button(
<?php
foreach ($state_list as $state => $state_count) :
$_state_count = $_state_count + $state_count;
$_state_count += $state_count;
?>
<tr>

View File

@ -72,7 +72,7 @@
<?php if ($display_image) : ?>
<div class="wu-mb-4 md:wu-mb-0 <?php echo $screenshot_position === 'right' ? 'wu-order-12 md:wu-ml-6' : 'md:wu-mr-6'; ?>">
<div class="wu-mb-4 md:wu-mb-0 <?php echo 'right' === $screenshot_position ? 'wu-order-12 md:wu-ml-6' : 'md:wu-mr-6'; ?>">
<img
style="max-width: <?php echo esc_attr($screenshot_size); ?>px;"

View File

@ -115,7 +115,7 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
<?php
$button_attrubutes = apply_filters('wu_plan_select_button_attributes', '', $plan, $current_plan);
$button_label = $current_plan != null && $current_plan->id == $plan->get_id() ? __('This is your current plan', 'wp-ultimo') : __('Select Plan', 'wp-ultimo');
$button_label = null != $current_plan && $current_plan->id == $plan->get_id() ? __('This is your current plan', 'wp-ultimo') : __('Select Plan', 'wp-ultimo');
$button_label = apply_filters('wu_plan_select_button_label', $button_label, $plan, $current_plan);
?>

View File

@ -91,7 +91,7 @@ if (empty($plans)) {
*/
$count = count($plans);
$columns = $count == 5 ? '2-4' : 12 / $count;
$columns = 5 == $count ? '2-4' : 12 / $count;
foreach ($plans as $plan) {
wu_get_template(

View File

@ -48,7 +48,7 @@ $percent = 100 / $count;
*/
$class = '';
if ($step_key === $signup->step) {
if ($signup->step === $step_key) {
$class = 'active';
} elseif (array_search($signup->step, array_keys($signup->steps)) > array_search($step_key, array_keys($signup->steps))) {
$class = 'done';

View File

@ -14,7 +14,7 @@
// Check if it was selected
$settings = wu_get_setting($field_slug);
if ($settings === false) {
if (false === $settings) {
$settings = $field['default'] ?? false;
}