More yoda conditions

This commit is contained in:
David Stone
2025-02-09 12:30:02 -07:00
parent d9122a410d
commit 0a4c81c105
97 changed files with 323 additions and 289 deletions

View File

@ -25,7 +25,7 @@
?>
<?php if ($field->type === 'date' || $field->date === true) : ?>
<?php if ('date' === $field->type || true === $field->date) : ?>
<?php

View File

@ -25,12 +25,12 @@
?>
<?php if ($field->type === 'date' || $field->date === true) : ?>
<?php if ('date' === $field->type || true === $field->date) : ?>
<?php
if (wu_validate_date($field->value)) {
if ($field->display_value == false) {
if (false == $field->display_value) {
echo __('No date', 'wp-ultimo');
} else {
$date = $field->value;

View File

@ -25,7 +25,7 @@
?>
<?php if ($field->type === 'model') : ?>
<?php if ('model' === $field->type) : ?>
<div class="wu-flex">

View File

@ -37,7 +37,7 @@
<div class="wu-toggle">
<input class="wu-tgl wu-tgl-ios" value="1" <?php checked($field->value == 1); ?> id="wu-tg-<?php echo esc_attr($field->id); ?>" type="checkbox" name="<?php echo esc_attr($field_slug); ?>" <?php echo $field->get_html_attributes(); ?> />
<input class="wu-tgl wu-tgl-ios" value="1" <?php checked(1 == $field->value); ?> id="wu-tg-<?php echo esc_attr($field->id); ?>" type="checkbox" name="<?php echo esc_attr($field_slug); ?>" <?php echo $field->get_html_attributes(); ?> />
<label class="wu-tgl-btn wp-ui-highlight wu-bg-blue-500" for="wu-tg-<?php echo esc_attr($field->id); ?>"></label>

View File

@ -27,7 +27,7 @@
<label class="wu-block" for="field-<?php echo esc_attr($field->id); ?>-<?php echo esc_attr($option->get_id()); ?>">
<input id="field-products-<?php echo esc_attr($option->get_id()); ?>" type="checkbox" name="products[]" value="<?php echo esc_attr($option->get_id()); ?>" <?php echo $field->get_html_attributes(); ?> <?php checked($field->value == $option->get_id()); ?> v-model="products">
<input id="field-products-<?php echo esc_attr($option->get_id()); ?>" type="checkbox" name="products[]" value="<?php echo esc_attr($option->get_id()); ?>" <?php echo $field->get_html_attributes(); ?> <?php checked($option->get_id() == $field->value); ?> v-model="products">
<?php echo $option->get_name(); ?>

View File

@ -57,7 +57,7 @@
<div class="wu-block wu-pt-2">
<?php if ($user->ID !== get_current_user_id()) : ?>
<?php if (get_current_user_id() !== $user->ID) : ?>
<a
href="<?php echo \WP_Ultimo\User_Switching::get_instance()->render($user->ID); ?>"

View File

@ -62,7 +62,7 @@ $page->render_csv_button(
<tr>
<td>
<?php echo $form->signup_form; ?>
<?php if ($form->signup_form === 'by-admin') : ?>
<?php if ('by-admin' === $form->signup_form) : ?>
<?php echo wu_tooltip(__('Customers created via the admin panel, by super admins.', 'wp-ultimo')); ?>
<?php endif; ?>
</td>

View File

@ -7,7 +7,7 @@
?>
<?php
if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset($_GET['step']) && $_GET['step'] == 'plan') :
if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset($_GET['step']) && 'plan' == $_GET['step']) :
$coupon = wu_get_coupon($_GET['coupon']);
?>

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 = null != $current_plan && $current_plan->id == $plan->get_id() ? __('This is your current plan', 'wp-ultimo') : __('Select Plan', 'wp-ultimo');
$button_label = null != $current_plan && $plan->get_id() == $current_plan->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

@ -42,7 +42,7 @@ if ( ! isset($signup->step)) {
?>
<?php if ($signup->step != 'plan' && $signup->step != 'template') : ?>
<?php if ('plan' != $signup->step && 'template' != $signup->step) : ?>
<p id="nav">

View File

@ -63,8 +63,8 @@
</h3>
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][visibility]" class="wu-w-full">
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->visibility === 'visible'); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->visibility === 'hidden'); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
<option <?php selected('visible' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
<option <?php selected('hidden' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
</select>
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
@ -74,11 +74,11 @@
</h3>
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][behavior]" class="wu-w-full">
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'default'); ?> value="default"><?php _e('Default', 'wp-ultimo'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_active'); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_inactive'); ?> value="force_inactive"><?php _e('Force Inactivate', 'wp-ultimo'); ?></option>
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_active_locked'); ?> value="force_active_locked"><?php _e('Force Activate & Lock', 'wp-ultimo'); ?></option>
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_inactive_locked'); ?> value="force_inactive_locked"><?php _e('Force Inactivate & Lock', 'wp-ultimo'); ?></option>
<option <?php selected('default' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="default"><?php _e('Default', 'wp-ultimo'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_active' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_inactive' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive"><?php _e('Force Inactivate', 'wp-ultimo'); ?></option>
<option <?php selected('force_active_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active_locked"><?php _e('Force Activate & Lock', 'wp-ultimo'); ?></option>
<option <?php selected('force_inactive_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive_locked"><?php _e('Force Inactivate & Lock', 'wp-ultimo'); ?></option>
</select>
</div>
@ -87,7 +87,7 @@
</div>
<?php if ($object->model !== 'product' && $object->get_limitations(false)->plugins->exists($plugin_path)) : ?>
<?php if ('product' !== $object->model && $object->get_limitations(false)->plugins->exists($plugin_path)) : ?>
<p class="wu-m-0 wu-mt-4 wu-p-2 wu-bg-blue-100 wu-text-blue-600 wu-rounded">
<?php _e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-ultimo'); ?>

View File

@ -61,9 +61,9 @@
name="modules[site_templates][limit][<?php echo esc_attr($site_template->get_id()); ?>][behavior]"
class="wu-w-full"
>
<option <?php selected($template_settings->behavior === 'available'); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
<option <?php selected($template_settings->behavior === 'not_available'); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
<option :disabled="pre_selected_template !== '' && pre_selected_template !== false && pre_selected_template != '<?php echo esc_attr($site_template->get_id()); ?>'" <?php selected($template_settings->behavior === 'pre_selected'); ?> value="pre_selected"><?php _e('Pre-Selected', 'wp-ultimo'); ?></option>
<option <?php selected('available' === $template_settings->behavior); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
<option <?php selected('not_available' === $template_settings->behavior); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
<option :disabled="pre_selected_template !== '' && pre_selected_template !== false && pre_selected_template != '<?php echo esc_attr($site_template->get_id()); ?>'" <?php selected('pre_selected' === $template_settings->behavior); ?> value="pre_selected"><?php _e('Pre-Selected', 'wp-ultimo'); ?></option>
</select>
</div>

View File

@ -10,7 +10,7 @@
$theme_settings = $object->get_limitations()->themes->{$theme_path};
if ($theme_settings->behavior === 'force_active') {
if ('force_active' === $theme_settings->behavior) {
$section['state']['force_active_theme'] = $theme_path;
} // end if;
@ -65,8 +65,8 @@
</h3>
<select name="modules[themes][limit][<?php echo esc_attr($theme_path); ?>][visibility]" class="wu-w-full">
<option <?php selected($theme_settings->visibility === 'visible'); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
<option <?php selected($theme_settings->visibility === 'hidden'); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
<option <?php selected('visible' === $theme_settings->visibility); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
<option <?php selected('hidden' === $theme_settings->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
</select>
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
@ -76,16 +76,16 @@
</h3>
<select v-on:change="force_active_theme = ($event.target.value === 'force_active' ? '<?php echo esc_attr($theme_path); ?>' : '')" name="modules[themes][limit][<?php echo esc_attr($theme_path); ?>][behavior]" class="wu-w-full">
<option <?php selected($theme_settings->behavior === 'available'); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
<option <?php selected($theme_settings->behavior === 'not_available'); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
<option :disabled="force_active_theme !== '' && force_active_theme != '<?php echo esc_attr($theme_path); ?>'" <?php selected($theme_settings->behavior === 'force_active'); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
<option <?php selected('available' === $theme_settings->behavior); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
<option <?php selected('not_available' === $theme_settings->behavior); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
<option :disabled="force_active_theme !== '' && force_active_theme != '<?php echo esc_attr($theme_path); ?>'" <?php selected('force_active' === $theme_settings->behavior); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
</select>
</div>
</div>
<?php if ($object->model !== 'product' && $object->get_limitations(false)->themes->exists($theme_path)) : ?>
<?php if ('product' !== $object->model && $object->get_limitations(false)->themes->exists($theme_path)) : ?>
<p class="wu-m-0 wu-mt-4 wu-p-2 wu-bg-blue-100 wu-text-blue-600 wu-rounded">
<?php _e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-ultimo'); ?>

View File

@ -33,11 +33,11 @@ $text_no = '<span class="dashicons dashicons-no-alt wu-text-red-600"></span>';
</td>
<?php if ($value['value'] === 'Yes' || $value['value'] === 'Enabled') : ?>
<?php if ('Yes' === $value['value'] || 'Enabled' === $value['value']) : ?>
<td class='wu-px-4 wu-py-2'> <?php echo $text_yes; ?> </td>
<?php elseif ($value['value'] === 'No' || $value['value'] === 'Disabled') : ?>
<?php elseif ('No' === $value['value'] || 'Disabled' === $value['value']) : ?>
<td class='wu-px-4 wu-py-2'> <?php echo $text_no; ?> </td>