Everywhere yoda conditions are
This commit is contained in:
@ -249,7 +249,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
foreach ($extra_query_args as $extra_query_arg) {
|
||||
$query = wu_request($extra_query_arg, 'all');
|
||||
|
||||
if ($query !== 'all') {
|
||||
if ('all' !== $query) {
|
||||
$query_args[ $extra_query_arg ] = $query;
|
||||
}
|
||||
}
|
||||
@ -403,7 +403,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
'wu_list_table',
|
||||
[
|
||||
'base_url' => wu_get_form_url('bulk_actions'),
|
||||
'model' => strchr($this->get_table_id(), '_', true),
|
||||
'model' => strstr($this->get_table_id(), '_', true),
|
||||
'i18n' => [
|
||||
'confirm' => __('Confirm Action', 'wp-ultimo'),
|
||||
],
|
||||
@ -647,9 +647,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
|
||||
$model = wu_request('model');
|
||||
|
||||
if ($model === 'checkout') {
|
||||
if ('checkout' === $model) {
|
||||
$model = 'checkout_form';
|
||||
} elseif ($model === 'discount') {
|
||||
} elseif ('discount' === $model) {
|
||||
$model = 'discount_code';
|
||||
}
|
||||
|
||||
|
@ -78,28 +78,29 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
|
||||
$class = 'wu-bg-gray-200';
|
||||
|
||||
if ($type === 'broadcast_email') {
|
||||
if ('broadcast_email' === $type) {
|
||||
$label = __('Email', 'wp-ultimo');
|
||||
}
|
||||
|
||||
if ($type === 'broadcast_notice') {
|
||||
if ('broadcast_notice' === $type) {
|
||||
$status = $item->get_notice_type();
|
||||
|
||||
$label = __('Notice', 'wp-ultimo');
|
||||
|
||||
if ($status === 'info') {
|
||||
if ('info' === $status) {
|
||||
$class = 'wu-bg-blue-200';
|
||||
} elseif ($status === 'success') {
|
||||
} elseif ('success' === $status) {
|
||||
$class = 'wu-bg-green-200';
|
||||
} elseif ($status === 'warning') {
|
||||
} elseif ('warning' === $status) {
|
||||
$class = 'wu-bg-orange-200';
|
||||
} elseif ($status === 'error') {
|
||||
} elseif ('error' === $status) {
|
||||
$class = 'wu-bg-red-200';
|
||||
}
|
||||
}
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 $class wu-rounded-sm wu-text-gray-700 wu-text-xs wu-font-mono'>{$label}</span>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the name of the broadcast.
|
||||
*
|
||||
@ -428,6 +429,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
|
@ -46,6 +46,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the product column.
|
||||
*
|
||||
@ -97,6 +98,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-text-gray-700 wu-py-1 wu-px-2 wu-rounded-sm wu-text-xs wu-font-mono'>{$slug}</span>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the number pof steps and fields.
|
||||
*
|
||||
@ -108,6 +110,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
|
||||
return sprintf(__('%1$d Step(s) and %2$d Field(s)', 'wp-ultimo'), $item->get_step_count(), $item->get_field_count());
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the form shortcode.
|
||||
*
|
||||
@ -138,7 +141,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
if ($bulk_action === 'duplicate') {
|
||||
if ('duplicate' === $bulk_action) {
|
||||
$checkout_form_id = wu_request('id');
|
||||
|
||||
$checkout_form = wu_get_checkout_form($checkout_form_id);
|
||||
@ -199,6 +202,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
|
@ -102,6 +102,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
|
||||
return $_filter_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -202,6 +203,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of memberships owned by this customer.
|
||||
*
|
||||
|
@ -46,6 +46,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -195,6 +196,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
|
@ -66,6 +66,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
|
||||
return $_filter_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the domain column.
|
||||
*
|
||||
@ -169,6 +170,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
|
@ -73,7 +73,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
|
||||
$target = wu_request('target');
|
||||
|
||||
if ($target && $target !== 'all') {
|
||||
if ($target && 'all' !== $target) {
|
||||
$query['meta_query'] = [
|
||||
'type' => [
|
||||
'key' => 'wu_target',
|
||||
@ -86,6 +86,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
|
||||
return wu_get_emails($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the title of the email.
|
||||
*
|
||||
@ -212,7 +213,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
if ($bulk_action === 'duplicate') {
|
||||
if ('duplicate' === $bulk_action) {
|
||||
$email_id = wu_request('id');
|
||||
|
||||
$email = wu_get_email($email_id);
|
||||
@ -280,6 +281,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
|
@ -78,7 +78,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
|
||||
$object_label_tooltip = substr($object_severity_label, 0, 1);
|
||||
|
||||
if ($object_initiator === 'system') {
|
||||
if ('system' === $object_initiator) {
|
||||
$avatar = '<span class="dashicons-wu-tools wu-text-gray-700 wu-text-xl"></span>';
|
||||
|
||||
$system_text = ucfirst($object_initiator);
|
||||
@ -97,7 +97,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
</div>
|
||||
</div>";
|
||||
// phpcs:enable
|
||||
} elseif ($object_initiator === 'manual') {
|
||||
} elseif ('manual' === $object_initiator) {
|
||||
$avatar = get_avatar(
|
||||
$item->get_author_id(),
|
||||
32,
|
||||
@ -164,6 +164,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 wu-bg-gray-200 wu-rounded-sm wu-text-gray-700 wu-text-xs wu-font-mono'>{$object_slug}</span>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the markup for the message column.
|
||||
*
|
||||
@ -216,6 +217,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
|
||||
return apply_filters('wu_events_list_table_get_columns', $columns, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
|
@ -59,9 +59,9 @@ class Inside_Events_List_Table extends Event_List_Table {
|
||||
|
||||
$object_initiator = $item->get_initiator();
|
||||
|
||||
if ($object_initiator === 'system') {
|
||||
if ('system' === $object_initiator) {
|
||||
$value = sprintf('<span class="dashicons-wu-wp-ultimo wu-align-middle wu-mr-1 wu-text-lg"></span><span class="wu-text-gray-600">%s</span>', __('Automatically processed by WP Multisite WaaS', 'wp-ultimo'));
|
||||
} elseif ($object_initiator === 'manual') {
|
||||
} elseif ('manual' === $object_initiator) {
|
||||
$avatar = get_avatar(
|
||||
$item->get_author_id(),
|
||||
16,
|
||||
|
@ -112,6 +112,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
return $_filter_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the membership reference code.
|
||||
*
|
||||
@ -269,6 +270,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the parent method to include the custom ajax functionality for WP Multisite WaaS.
|
||||
*
|
||||
|
@ -198,7 +198,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
|
||||
$date = $item->get_date_expiration();
|
||||
|
||||
if (empty($date) || $date === '0000-00-00 00:00:00') {
|
||||
if (empty($date) || '0000-00-00 00:00:00' === $date) {
|
||||
return sprintf('<span>%s</span><br><small>%s</small>', __('Lifetime', 'wp-ultimo'), __('It never expires', 'wp-ultimo'));
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the payment reference code.
|
||||
*
|
||||
@ -193,6 +194,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the column for the total amount of the payment.
|
||||
*
|
||||
|
@ -195,7 +195,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
if ($bulk_action === 'duplicate') {
|
||||
if ('duplicate' === $bulk_action) {
|
||||
$product = wu_request('id');
|
||||
|
||||
$product = wu_get_product($product);
|
||||
|
@ -66,7 +66,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
$type = wu_request('type');
|
||||
|
||||
if ($type === 'pending') {
|
||||
if ('pending' === $type) {
|
||||
$pending_sites = \WP_Ultimo\Models\Site::get_all_by_type('pending');
|
||||
|
||||
return $count ? count($pending_sites) : $pending_sites;
|
||||
@ -79,7 +79,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
'search' => wu_request('s'),
|
||||
];
|
||||
|
||||
if ($type && $type !== 'all') {
|
||||
if ($type && 'all' !== $type) {
|
||||
$query['meta_query'] = [
|
||||
'type' => [
|
||||
'key' => 'wu_type',
|
||||
@ -92,6 +92,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
return wu_get_sites($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the bulk edit checkbox.
|
||||
*
|
||||
@ -105,6 +106,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
return sprintf('<input type="checkbox" name="bulk-delete[]" value="%s" />', $item->get_id());
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -185,6 +187,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
return $title . sprintf('<span class="wu-block">%s</span>', make_clickable($item->get_active_site_url())) . $this->row_actions($actions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date of the customer registration.
|
||||
*
|
||||
@ -228,6 +231,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
return "<span class='wu-bg-gray-200 wu-py-1 wu-px-2 wu-leading-none wu-rounded-sm wu-text-xs wu-font-mono $class'>{$label}</span>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Column for the domains associated with this site.
|
||||
*
|
||||
@ -295,6 +299,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
@ -387,7 +392,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
$action = $this->current_action();
|
||||
|
||||
if ($action === 'duplicate') {
|
||||
if ('duplicate' === $action) {
|
||||
$site_id = wu_request('id');
|
||||
|
||||
$site = wu_get_site($site_id);
|
||||
|
@ -46,6 +46,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the name column.
|
||||
*
|
||||
@ -115,6 +116,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
|
||||
return "<span class='wu-py-1 wu-px-2 wu-bg-gray-200 wu-rounded-sm wu-text-gray-700 wu-text-xs wu-font-mono'>{$event}</span>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the count column.
|
||||
*
|
||||
@ -132,6 +134,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
|
||||
return $count . $this->row_actions($actions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content of the integration column.
|
||||
*
|
||||
@ -178,6 +181,7 @@ class Webhook_List_Table extends Base_List_Table {
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filters for this page.
|
||||
*
|
||||
|
Reference in New Issue
Block a user