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

@ -35,6 +35,7 @@
<exclude name="WordPress.WhiteSpace.CastStructureSpacing.NoSpaceBeforeOpenParenthesis" /> <exclude name="WordPress.WhiteSpace.CastStructureSpacing.NoSpaceBeforeOpenParenthesis" />
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" /> <exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
<exclude name="Universal.Arrays.DisallowShortArraySyntax" /> <exclude name="Universal.Arrays.DisallowShortArraySyntax" />
<exclude name="Universal.Operators.DisallowShortTernary" />
</rule> </rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"> <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties> <properties>

View File

@ -23,6 +23,8 @@ defined('ABSPATH') || exit;
abstract class Base_Admin_Page { abstract class Base_Admin_Page {
/** /**
* In Edit mode
*
* @var bool * @var bool
*/ */
protected $edit; protected $edit;
@ -240,7 +242,7 @@ abstract class Base_Admin_Page {
global $submenu; global $submenu;
if ($this->get_submenu_title() && 'menu' === $this->type && isset($submenu[ $this->id ]) && $submenu[ $this->id ][0][3] === $this->get_title()) { if ($this->get_submenu_title() && 'menu' === $this->type && isset($submenu[ $this->id ]) && $this->get_title() === $submenu[ $this->id ][0][3]) {
$submenu[ $this->id ][0][0] = $this->get_submenu_title(); $submenu[ $this->id ][0][0] = $this->get_submenu_title();
} }
} }
@ -256,7 +258,7 @@ abstract class Base_Admin_Page {
global $plugin_page; global $plugin_page;
if ($this->highlight_menu_slug && isset($_GET['page']) && $_GET['page'] === $this->get_id()) { if ($this->highlight_menu_slug && isset($_GET['page']) && $this->get_id() === $_GET['page']) {
$plugin_page = $this->highlight_menu_slug; $plugin_page = $this->highlight_menu_slug;
$file = $this->highlight_menu_slug; $file = $this->highlight_menu_slug;
@ -624,7 +626,7 @@ abstract class Base_Admin_Page {
if (wu_get_documentation_url($this->get_id(), false)) { if (wu_get_documentation_url($this->get_id(), false)) {
$this->action_links[] = [ $this->action_links[] = [
'url' => wu_get_documentation_url($this->get_id()), 'url' => wu_get_documentation_url($this->get_id()),
'label' => __('Documentation'), 'label' => __('Documentation', 'wp-ultimo'),
'icon' => 'wu-open-book', 'icon' => 'wu-open-book',
]; ];
} }

View File

@ -200,9 +200,11 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
$this->save_page_settings($settings_to_save); $this->save_page_settings($settings_to_save);
$referer = isset($_SERVER['HTTP_REFERER']) ? sanitize_url(wp_unslash($_SERVER['HTTP_REFERER'])) : '';
wp_send_json_success( wp_send_json_success(
[ [
'redirect_url' => add_query_arg('updated', 1, $_SERVER['HTTP_REFERER']), 'redirect_url' => add_query_arg('updated', 1, $referer),
] ]
); );
} }

View File

@ -1182,7 +1182,7 @@ class Checkout_Form_Edit_Admin_Page extends Edit_Admin_Page {
$new_fields = []; $new_fields = [];
foreach ($fields as $index => $field) { foreach ($fields as $index => $field) {
if ($field['type'] === 'header') { if ('header' === $field['type']) {
continue; continue;
} }
@ -1491,7 +1491,7 @@ class Checkout_Form_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function get_object() { public function get_object() {
if ($this->object !== null) { if (null !== $this->object) {
return $this->object; return $this->object;
} }

View File

@ -451,11 +451,11 @@ class Customer_Edit_Admin_Page extends Edit_Admin_Page {
'value' => wu_get_customer_meta($this->get_object()->get_id(), $key), 'value' => wu_get_customer_meta($this->get_object()->get_id(), $key),
]; ];
if ($field_data['type'] === 'hidden') { if ('hidden' === $field_data['type']) {
$field_data['type'] = 'text'; $field_data['type'] = 'text';
} }
if ($field_data['type'] === 'image') { if ('image' === $field_data['type']) {
$image_attributes = wp_get_attachment_image_src((int) $field_data['value'], 'full'); $image_attributes = wp_get_attachment_image_src((int) $field_data['value'], 'full');
$field_data['img'] = $image_attributes ? $image_attributes[0] : ''; $field_data['img'] = $image_attributes ? $image_attributes[0] : '';
} }
@ -1071,7 +1071,7 @@ class Customer_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function get_object() { public function get_object() {
if ($this->object !== null) { if (null !== $this->object) {
return $this->object; return $this->object;
} }
@ -1108,7 +1108,7 @@ class Customer_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function handle_save(): void { public function handle_save(): void {
if ($_POST['submit_button'] === 'send_verification') { if ('send_verification' === $_POST['submit_button']) {
$customer = $this->get_object(); $customer = $this->get_object();
$customer->send_verification_email(); $customer->send_verification_email();

View File

@ -134,7 +134,7 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
return; return;
} }
if ($page->id === 'wp-ultimo') { if ('wp-ultimo' === $page->id) {
$preset_options = [ $preset_options = [
'last_7_days' => [ 'last_7_days' => [
'label' => __('Last 7 days', 'wp-ultimo'), 'label' => __('Last 7 days', 'wp-ultimo'),

View File

@ -599,7 +599,7 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function get_object() { public function get_object() {
if ($this->object !== null) { if (null !== $this->object) {
return $this->object; return $this->object;
} }

View File

@ -493,7 +493,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function get_object() { public function get_object() {
if ($this->object !== null) { if (null !== $this->object) {
return $this->object; return $this->object;
} }

View File

@ -62,7 +62,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
*/ */
public function get_errors() { public function get_errors() {
if ($this->errors === null) { if (null === $this->errors) {
$this->errors = new \WP_Error(); $this->errors = new \WP_Error();
} }
@ -850,7 +850,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
'updated' => 1, 'updated' => 1,
]; ];
if ($this->edit === false) { if (false === $this->edit) {
$array_params['id'] = $object->get_id(); $array_params['id'] = $object->get_id();
$array_params['wu-new-model'] = true; $array_params['wu-new-model'] = true;

View File

@ -1073,7 +1073,7 @@ class Membership_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function get_object() { public function get_object() {
if ($this->object !== null) { if (null !== $this->object) {
return $this->object; return $this->object;
} }
@ -1156,7 +1156,7 @@ class Membership_Edit_Admin_Page extends Edit_Admin_Page {
'updated' => 1, 'updated' => 1,
]; ];
if ($this->edit === false) { if (false === $this->edit) {
$array_params['id'] = $object->get_id(); $array_params['id'] = $object->get_id();
} }

View File

@ -1026,7 +1026,7 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function get_object() { public function get_object() {
if ($this->object !== null) { if (null !== $this->object) {
return $this->object; return $this->object;
} }

View File

@ -192,7 +192,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
*/ */
public function is_migration() { public function is_migration() {
if ($this->is_migration === null) { if (null === $this->is_migration) {
$this->is_migration = Migrator::is_legacy_network(); $this->is_migration = Migrator::is_legacy_network();
} }
@ -785,7 +785,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
*/ */
public function handle_configuration(): void { public function handle_configuration(): void {
if ($_POST['submit'] === '1') { if ('1' === $_POST['submit']) {
$this->integration->setup_constants($_POST); $this->integration->setup_constants($_POST);
$redirect_url = $this->get_next_section_link(); $redirect_url = $this->get_next_section_link();

View File

@ -150,7 +150,7 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
foreach ($elements as $element) { foreach ($elements as $element) {
$defaults = $element->defaults(); $defaults = $element->defaults();
$params = array_filter($element->fields(), fn($el) => $el['type'] !== 'note' && $el['type'] !== 'header'); $params = array_filter($element->fields(), fn($el) => 'note' !== $el['type'] && 'header' !== $el['type']);
foreach ($params as $key => $value) { foreach ($params as $key => $value) {
$params[ $key ]['default'] = wu_get_isset($defaults, $key, ''); $params[ $key ]['default'] = wu_get_isset($defaults, $key, '');

View File

@ -720,7 +720,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
*/ */
public function get_object() { public function get_object() {
if ($this->object !== null) { if (null !== $this->object) {
return $this->object; return $this->object;
} }

View File

@ -401,7 +401,7 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
'updated' => 1, 'updated' => 1,
]; ];
if ($this->edit === false) { if (false === $this->edit) {
$array_params['id'] = $object->get_id(); $array_params['id'] = $object->get_id();
} }

View File

@ -159,7 +159,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
*/ */
public function force_screen_options(): void { public function force_screen_options(): void {
if (get_current_screen()->id !== 'toplevel_page_sites') { if ('toplevel_page_sites' !== get_current_screen()->id) {
return; return;
} }

View File

@ -147,7 +147,7 @@ class Block_Editor_Widget_Manager {
* Deal with the group type. * Deal with the group type.
* On those, we need to loop the sub-fields. * On those, we need to loop the sub-fields.
*/ */
if ($field['type'] === 'group') { if ('group' === $field['type']) {
foreach ($field['fields'] as &$sub_field) { foreach ($field['fields'] as &$sub_field) {
foreach ($sub_field as $sub_item => &$sub_value) { foreach ($sub_field as $sub_item => &$sub_value) {
if (in_array($sub_item, $callable_keys, true) && is_callable($sub_value)) { if (in_array($sub_item, $callable_keys, true) && is_callable($sub_value)) {
@ -213,11 +213,11 @@ class Block_Editor_Widget_Manager {
foreach ($fields as $field_id => $field) { foreach ($fields as $field_id => $field) {
$type = 'string'; $type = 'string';
if ($field['type'] === 'toggle') { if ('toggle' === $field['type']) {
$type = 'boolean'; $type = 'boolean';
} }
if ($field['type'] === 'number') { if ('number' === $field['type']) {
$type = 'integer'; $type = 'integer';
} }

View File

@ -626,7 +626,7 @@ class Cart implements \JsonSerializable {
$product = $line_item->get_product(); $product = $line_item->get_product();
if ($product) { if ($product) {
if ($product->is_recurring() && ($this->duration_unit !== $product->get_duration_unit() || $this->duration !== $product->get_duration())) { if ($product->is_recurring() && ($product->get_duration_unit() !== $this->duration_unit || $product->get_duration() !== $this->duration)) {
$product_variation = $product->get_as_variation($this->duration, $this->duration_unit); $product_variation = $product->get_as_variation($this->duration, $this->duration_unit);
/* /*
@ -876,7 +876,7 @@ class Cart implements \JsonSerializable {
*/ */
$is_plan_change = false; $is_plan_change = false;
if ($membership->get_plan_id() !== $this->plan_id || $this->duration_unit !== $membership->get_duration_unit() || $this->duration !== $membership->get_duration()) { if ($membership->get_plan_id() !== $this->plan_id || $membership->get_duration_unit() !== $this->duration_unit || $membership->get_duration() !== $this->duration) {
$is_plan_change = true; $is_plan_change = true;
} }
@ -934,7 +934,7 @@ class Cart implements \JsonSerializable {
* We'll probably never enter in this if, but we * We'll probably never enter in this if, but we
* hev it here to prevent bugs. * hev it here to prevent bugs.
*/ */
if ( ! $is_plan_change || ($this->get_plan_id() === $membership->get_plan_id() && $this->duration_unit === $membership->get_duration_unit() && $this->duration === $membership->get_duration())) { if ( ! $is_plan_change || ($this->get_plan_id() === $membership->get_plan_id() && $membership->get_duration_unit() === $this->duration_unit && $membership->get_duration() === $this->duration)) {
$this->products = []; $this->products = [];
$this->line_items = []; $this->line_items = [];
@ -969,7 +969,7 @@ class Cart implements \JsonSerializable {
$old_price_per_day = $days_in_old_cycle > 0 ? $membership->get_amount() / $days_in_old_cycle : $membership->get_amount(); $old_price_per_day = $days_in_old_cycle > 0 ? $membership->get_amount() / $days_in_old_cycle : $membership->get_amount();
$new_price_per_day = $days_in_new_cycle > 0 ? $this->get_recurring_total() / $days_in_new_cycle : $this->get_recurring_total(); $new_price_per_day = $days_in_new_cycle > 0 ? $this->get_recurring_total() / $days_in_new_cycle : $this->get_recurring_total();
$is_same_product = $this->plan_id === $membership->get_plan_id(); $is_same_product = $membership->get_plan_id() === $this->plan_id;
/** /**
* Here we search for variations of the plans * Here we search for variations of the plans
@ -1088,7 +1088,7 @@ class Cart implements \JsonSerializable {
]; ];
} }
if ($this->duration_unit && $this->duration && ($this->duration_unit !== $plan_b->get_duration_unit() || $this->duration !== $plan_b->get_duration())) { if ($this->duration_unit && $this->duration && ($plan_b->get_duration_unit() !== $this->duration_unit || $plan_b->get_duration() !== $this->duration)) {
$plan_a_variation = $plan_a->get_as_variation($this->duration, $this->duration_unit); $plan_a_variation = $plan_a->get_as_variation($this->duration, $this->duration_unit);
if ( ! $plan_a_variation) { if ( ! $plan_a_variation) {
@ -1511,7 +1511,7 @@ class Cart implements \JsonSerializable {
} }
// Here we check if the product is recurring and if so, get the correct variation // Here we check if the product is recurring and if so, get the correct variation
if ($product->is_recurring() && ! empty($this->duration) && ($this->duration !== $product->get_duration() || $this->duration_unit !== $product->get_duration_unit())) { if ($product->is_recurring() && ! empty($this->duration) && ($product->get_duration() !== $this->duration || $product->get_duration_unit() !== $this->duration_unit)) {
$product = $product->get_as_variation($this->duration, $this->duration_unit); $product = $product->get_as_variation($this->duration, $this->duration_unit);
if ( ! $product) { if ( ! $product) {
@ -1576,7 +1576,7 @@ class Cart implements \JsonSerializable {
* the cart. * the cart.
*/ */
if ($product->is_free() === false) { if ($product->is_free() === false) {
if (absint($this->duration) !== $product->get_duration() || $this->duration_unit !== $product->get_duration_unit()) { if (absint($this->duration) !== $product->get_duration() || $product->get_duration_unit() !== $this->duration_unit) {
$price_variation = $product->get_price_variation($this->duration, $this->duration_unit); $price_variation = $product->get_price_variation($this->duration, $this->duration_unit);
if ($price_variation) { if ($price_variation) {
@ -2614,7 +2614,7 @@ class Cart implements \JsonSerializable {
*/ */
public function should_auto_renew() { public function should_auto_renew() {
return $this->auto_renew === 'yes' || $this->auto_renew === true; return 'yes' === $this->auto_renew || true === $this->auto_renew;
} }
/** /**

View File

@ -437,7 +437,7 @@ class Checkout_Pages {
return; return;
} }
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ('POST' === $_SERVER['REQUEST_METHOD']) {
return; return;
} }

View File

@ -367,7 +367,7 @@ class Checkout {
$this->checkout_form = wu_get_checkout_form_by_slug($checkout_form_slug); $this->checkout_form = wu_get_checkout_form_by_slug($checkout_form_slug);
if ($this->session === null) { if (null === $this->session) {
$this->session = wu_get_session('signup'); $this->session = wu_get_session('signup');
} }
@ -1434,7 +1434,7 @@ class Checkout {
* to handle the status here as the payment is not * to handle the status here as the payment is not
* passed to process_checkout method in this case. * passed to process_checkout method in this case.
*/ */
if ( ! $this->order->should_collect_payment() && $this->type === 'downgrade') { if ( ! $this->order->should_collect_payment() && 'downgrade' === $this->type) {
$payment_data['status'] = Payment_Status::COMPLETED; $payment_data['status'] = Payment_Status::COMPLETED;
} }
@ -1570,7 +1570,7 @@ class Checkout {
if (empty($duration) && $this->steps) { if (empty($duration) && $this->steps) {
foreach ($this->steps as $step) { foreach ($this->steps as $step) {
foreach ($step['fields'] as $field) { foreach ($step['fields'] as $field) {
if ($field['type'] === 'period_selection') { if ('period_selection' === $field['type']) {
$duration = $field['period_options'][0]['duration']; $duration = $field['period_options'][0]['duration'];
$duration_unit = $field['period_options'][0]['duration_unit']; $duration_unit = $field['period_options'][0]['duration_unit'];
@ -1723,7 +1723,7 @@ class Checkout {
/* /*
* Add rules for site when creating a new account. * Add rules for site when creating a new account.
*/ */
if ($this->type === 'new') { if ('new' === $this->type) {
// char limit according https://datatracker.ietf.org/doc/html/rfc1034#section-3.1 // char limit according https://datatracker.ietf.org/doc/html/rfc1034#section-3.1
$rules['site_title'] = 'min:4'; $rules['site_title'] = 'min:4';
@ -2293,7 +2293,7 @@ class Checkout {
$value = $default; $value = $default;
if ($this->session !== null) { if (null !== $this->session) {
$session = $this->session->get('signup'); $session = $this->session->get('signup');
if (isset($session[ $key ])) { if (isset($session[ $key ])) {
@ -2348,7 +2348,7 @@ class Checkout {
return true; return true;
} }
return $this->step_name === array_shift($step_names); return array_shift($step_names) === $this->step_name;
} }
/** /**
@ -2386,7 +2386,7 @@ class Checkout {
return true; return true;
} }
return $this->step_name === array_pop($step_names); return array_pop($step_names) === $this->step_name;
} }
/** /**

View File

@ -247,7 +247,7 @@ class Legacy_Checkout {
wp_add_inline_style('legacy-signup', $this->get_legacy_dynamic_styles()); wp_add_inline_style('legacy-signup', $this->get_legacy_dynamic_styles());
// Do not get the login if the first step // Do not get the login if the first step
if ($this->step != 'plan') { if ('plan' != $this->step) {
wp_enqueue_style('login'); wp_enqueue_style('login');
@ -577,7 +577,7 @@ class Legacy_Checkout {
/** /**
* Set the errors * Set the errors
*/ */
if ($this->results === null) { if (null === $this->results) {
$this->results = ['errors' => new \WP_Error()]; $this->results = ['errors' => new \WP_Error()];
} }
@ -979,7 +979,7 @@ class Legacy_Checkout {
$params['customized'] = $_REQUEST['customized']; $params['customized'] = $_REQUEST['customized'];
} }
if (isset($_REQUEST['skip_plan']) && $_REQUEST['skip_plan'] == 1) { if (isset($_REQUEST['skip_plan']) && 1 == $_REQUEST['skip_plan']) {
unset($this->steps['plan']); unset($this->steps['plan']);
unset($params['skip_plan']); unset($params['skip_plan']);
} }

View File

@ -387,7 +387,7 @@ class Line_Item implements \JsonSerializable {
return false; return false;
} }
if ($product->is_recurring() && ($this->duration_unit !== $product->get_duration_unit() || $this->duration !== $product->get_duration())) { if ($product->is_recurring() && ($product->get_duration_unit() !== $this->duration_unit || $product->get_duration() !== $this->duration)) {
$product_variation = $product->get_as_variation($this->duration, $this->duration_unit); $product_variation = $product->get_as_variation($this->duration, $this->duration_unit);
/* /*

View File

@ -215,7 +215,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
/* /*
* Backwards compatibility with previous betas * Backwards compatibility with previous betas
*/ */
if ($attributes['order_summary_template'] === 'simple') { if ('simple' === $attributes['order_summary_template']) {
$attributes['order_summary_template'] = 'clean'; $attributes['order_summary_template'] = 'clean';
} }

View File

@ -138,7 +138,7 @@ class Ajax {
/* /*
* Deal with site * Deal with site
*/ */
if ($args['model'] === 'site') { if ('site' === $args['model']) {
if (wu_get_isset($query, 'id__in')) { if (wu_get_isset($query, 'id__in')) {
$query['blog_id__in'] = $query['id__in']; $query['blog_id__in'] = $query['id__in'];
@ -154,9 +154,9 @@ class Ajax {
$results = []; $results = [];
if ($args['model'] === 'user') { if ('user' === $args['model']) {
$results = $this->search_wordpress_users($query); $results = $this->search_wordpress_users($query);
} elseif ($args['model'] === 'page') { } elseif ('page' === $args['model']) {
$results = get_posts( $results = get_posts(
[ [
'post_type' => 'page', 'post_type' => 'page',
@ -165,7 +165,7 @@ class Ajax {
'exclude' => $query['id__not_in'] ?? '', 'exclude' => $query['id__not_in'] ?? '',
] ]
); );
} elseif ($args['model'] === 'setting') { } elseif ('setting' === $args['model']) {
$results = $this->search_wp_ultimo_setting($query); $results = $this->search_wp_ultimo_setting($query);
} else { } else {
$model_func = 'wu_get_' . strtolower((string) $args['model']) . 's'; $model_func = 'wu_get_' . strtolower((string) $args['model']) . 's';

View File

@ -33,22 +33,23 @@ class Async_Calls {
* *
* @var array * @var array
*/ */
static $registry = []; public static $registry = [];
/** /**
* Registers a new listener. * Registers a new listener.
* *
* @param string $id The id of the listener.
* @param callable $callback A callback to be run.
* @param mixed ...$args Arguments to be passed to the callback.
*
* @return void
*@since 2.0.7 *@since 2.0.7
* *
* @param string $id The id of the listener.
* @param callable $callable A callback to be run.
* @param mixed ...$args Arguments to be passed to the callback.
* @return void
*/ */
public static function register_listener($id, $callable, ...$args): void { public static function register_listener($id, $callback, ...$args): void {
self::$registry[ $id ] = [ self::$registry[ $id ] = [
'callable' => $callable, 'callable' => $callback,
'args' => $args, 'args' => $args,
]; ];
} }

View File

@ -51,7 +51,6 @@ class Autoloader {
* @return boolean * @return boolean
*/ */
public static function is_debug() { public static function is_debug() {
return false;
return false; // return wu_is_debug();
} }
} }

View File

@ -75,7 +75,7 @@ class Domain_Mapping {
/* /*
* Don't run during installation... * Don't run during installation...
*/ */
if (defined('WP_INSTALLING') && $_SERVER['SCRIPT_NAME'] !== '/wp-activate.php') { if (defined('WP_INSTALLING') && '/wp-activate.php' !== $_SERVER['SCRIPT_NAME']) {
return; return;
} }

View File

@ -51,7 +51,7 @@ class Session_Cookie implements Session {
public function __construct($realm_name) { public function __construct($realm_name) {
$this->realm_name = $realm_name; $this->realm_name = $realm_name;
if ($this->loaded === true) { if (true === $this->loaded) {
return; return;
} }

View File

@ -153,7 +153,7 @@ class Settings {
$this->settings = wu_get_option(self::KEY); $this->settings = wu_get_option(self::KEY);
} }
if ($this->settings === false || empty($this->settings)) { if (false === $this->settings || empty($this->settings)) {
if ( ! $this->saving) { if ( ! $this->saving) {
$this->saving = true; $this->saving = true;
$this->settings = $this->save_settings([], true); $this->settings = $this->save_settings([], true);
@ -249,7 +249,7 @@ class Settings {
/** /**
* For the current tab, we need to assume toggle fields. * For the current tab, we need to assume toggle fields.
*/ */
if (wu_request('tab', 'general') === $section_slug && $field->type === 'toggle' && ! isset($settings_to_save[ $field_slug ])) { if (wu_request('tab', 'general') === $section_slug && 'toggle' === $field->type && ! isset($settings_to_save[ $field_slug ])) {
$new_value = false; $new_value = false;
} }
@ -503,7 +503,7 @@ class Settings {
/* /*
* Makes sure we install the default value if it is not set yet. * Makes sure we install the default value if it is not set yet.
*/ */
if (isset($atts['default']) && $atts['default'] !== null && ! isset($settings[ $field_slug ])) { if (isset($atts['default']) && null !== $atts['default'] && ! isset($settings[ $field_slug ])) {
$this->save_setting($field_slug, $atts['default']); $this->save_setting($field_slug, $atts['default']);
} }
} }

View File

@ -120,7 +120,7 @@ class Whitelabel {
*/ */
public function replace_text($translation, $text, $domain) { public function replace_text($translation, $text, $domain) {
if ($this->allowed_domains === null) { if (null === $this->allowed_domains) {
$this->allowed_domains = apply_filters( $this->allowed_domains = apply_filters(
'wu_replace_text_allowed_domains', 'wu_replace_text_allowed_domains',
[ [
@ -148,7 +148,7 @@ class Whitelabel {
return $translation; return $translation;
} }
if ($this->init === false) { if (false === $this->init) {
$search_and_replace = []; $search_and_replace = [];
$site_plural = wu_get_setting('rename_site_plural'); $site_plural = wu_get_setting('rename_site_plural');
@ -343,7 +343,7 @@ class Whitelabel {
$index = ''; $index = '';
foreach ($menu as $i => $menu_item) { foreach ($menu as $i => $menu_item) {
if ($menu_item[2] === 'sites.php') { if ('sites.php' === $menu_item[2]) {
$index = $i; $index = $i;
continue; continue;

View File

@ -314,7 +314,7 @@ class Legacy_Shortcodes {
/** /**
* In the case of the legacy layout, we need to load extra styles. * In the case of the legacy layout, we need to load extra styles.
*/ */
if ($atts['layout'] === 'legacy') { if ('legacy' === $atts['layout']) {
wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css')); wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css'));
wp_add_inline_style('legacy-signup', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles()); wp_add_inline_style('legacy-signup', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
@ -324,7 +324,7 @@ class Legacy_Shortcodes {
do_action('wu_setup_checkout'); do_action('wu_setup_checkout');
$atts['plan_id'] = is_string($atts['plan_id']) && $atts['plan_id'] !== 'all' ? explode(',', $atts['plan_id']) : false; $atts['plan_id'] = is_string($atts['plan_id']) && 'all' !== $atts['plan_id'] ? explode(',', $atts['plan_id']) : false;
$checkout_form = new \WP_Ultimo\Models\Checkout_Form(); $checkout_form = new \WP_Ultimo\Models\Checkout_Form();
@ -504,7 +504,7 @@ class Legacy_Shortcodes {
/** /**
* In the case of the legacy layout, we need to load extra styles. * In the case of the legacy layout, we need to load extra styles.
*/ */
if ($atts['layout'] === 'legacy') { if ('legacy' === $atts['layout']) {
wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css')); wp_enqueue_style('legacy-signup', wu_get_asset('legacy-signup.css', 'css'));
wp_add_inline_style('legacy-signup', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles()); wp_add_inline_style('legacy-signup', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());

View File

@ -62,7 +62,7 @@ abstract class Table extends \BerlinDB\Database\Table {
*/ */
public function exists() { public function exists() {
if ($this->_exists === null) { if (null === $this->_exists) {
$this->_exists = parent::exists(); $this->_exists = parent::exists();
} }

View File

@ -99,7 +99,7 @@ class Primary_Domain {
$primary_domain = $domains[0]; $primary_domain = $domains[0];
if ($_SERVER['HTTP_HOST'] !== $primary_domain->get_domain() && $primary_domain->is_active()) { if ($primary_domain->get_domain() !== $_SERVER['HTTP_HOST'] && $primary_domain->is_active()) {
$url = wu_get_current_url(); $url = wu_get_current_url();
$new_url = Domain_Mapping::get_instance()->replace_url($url, $primary_domain); $new_url = Domain_Mapping::get_instance()->replace_url($url, $primary_domain);
@ -118,7 +118,7 @@ class Primary_Domain {
*/ */
public function maybe_redirect_to_mapped_or_network_domain(): void { public function maybe_redirect_to_mapped_or_network_domain(): void {
if ($_SERVER['REQUEST_METHOD'] !== 'GET' || wp_doing_ajax()) { if ('GET' !== $_SERVER['REQUEST_METHOD'] || wp_doing_ajax()) {
return; return;
} }

View File

@ -443,7 +443,7 @@ if ( ! class_exists('MUCD_Data') ) {
MUCD_Duplicate::write_log('Result :' . var_export($results, true)); MUCD_Duplicate::write_log('Result :' . var_export($results, true));
} }
if ($wpdb->last_error != '') { if ('' != $wpdb->last_error) {
self::sql_error($sql_query, $wpdb->last_error); self::sql_error($sql_query, $wpdb->last_error);
} }

View File

@ -208,7 +208,7 @@ if ( ! class_exists('MUCD_Duplicate') ) {
*/ */
public static function init_log($data): void { public static function init_log($data): void {
// INIT LOG AND SAVE OPTION // INIT LOG AND SAVE OPTION
if (isset($data['log']) && $data['log'] == 'yes' ) { if (isset($data['log']) && 'yes' == $data['log'] ) {
if (isset($data['log-path']) && ! empty($data['log-path'])) { if (isset($data['log-path']) && ! empty($data['log-path'])) {
$log_name = @date('Y_m_d_His') . '-' . $data['domain'] . '.log'; $log_name = @date('Y_m_d_His') . '-' . $data['domain'] . '.log';
if (! str_ends_with((string) $data['log-path'], '/')) { if (! str_ends_with((string) $data['log-path'], '/')) {

View File

@ -139,7 +139,7 @@ if ( ! class_exists('MUCD_Log') ) {
* @return boolean True on success, False on failure * @return boolean True on success, False on failure
*/ */
public function write_log($message): bool { public function write_log($message): bool {
if ($this->mod !== false && $this->can_write() ) { if (false !== $this->mod && $this->can_write() ) {
$time = @date('[d/M/Y:H:i:s]'); $time = @date('[d/M/Y:H:i:s]');
fwrite($this->fp, "$time $message" . "\r\n"); fwrite($this->fp, "$time $message" . "\r\n");
return true; return true;

View File

@ -185,11 +185,11 @@ function wu_is_form_field_pre_selected($field_slug) {
*/ */
function wu_form_field_request_arg($field) { function wu_form_field_request_arg($field) {
if ($field['type'] === 'template_selection') { if ('template_selection' === $field['type']) {
return 'template_id'; return 'template_id';
} }
if ($field['type'] === 'pricing_table') { if ('pricing_table' === $field['type']) {
return 'products'; return 'products';
} }

View File

@ -189,7 +189,7 @@ function wu_path_join(...$parts): string {
return ''; return '';
} }
$prefix = ($parts[0] === DIRECTORY_SEPARATOR) ? DIRECTORY_SEPARATOR : ''; $prefix = (DIRECTORY_SEPARATOR === $parts[0]) ? DIRECTORY_SEPARATOR : '';
$processed = array_filter(array_map(fn($part) => rtrim((string) $part, DIRECTORY_SEPARATOR), $parts), fn($part) => ! empty($part)); $processed = array_filter(array_map(fn($part) => rtrim((string) $part, DIRECTORY_SEPARATOR), $parts), fn($part) => ! empty($part));

View File

@ -30,7 +30,7 @@ function wu_guess_registration_page() {
$maybe_register_page = get_page_by_path('register'); $maybe_register_page = get_page_by_path('register');
if ($maybe_register_page && has_shortcode($maybe_register_page->post_content, 'wu_checkout') && $maybe_register_page->post_status === 'publish') { if ($maybe_register_page && has_shortcode($maybe_register_page->post_content, 'wu_checkout') && 'publish' === $maybe_register_page->post_status) {
wu_save_setting('default_registration_page', $maybe_register_page->ID); wu_save_setting('default_registration_page', $maybe_register_page->ID);
function_exists('flush_rewrite_rules') && flush_rewrite_rules(true); function_exists('flush_rewrite_rules') && flush_rewrite_rules(true);

View File

@ -190,7 +190,7 @@ function wu_segregate_products($products) {
} }
} }
if ($product->get_type() === 'plan' && $results[0] === false) { if ($product->get_type() === 'plan' && false === $results[0]) {
$results[0] = $product; $results[0] = $product;
} else { } else {
$results[1][] = $product; $results[1][] = $product;

View File

@ -608,7 +608,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
* If already exists, checks for status * If already exists, checks for status
*/ */
if ($existing_webhook) { if ($existing_webhook) {
if ($existing_webhook->status === 'disabled') { if ('disabled' === $existing_webhook->status) {
$status = Stripe\WebhookEndpoint::update( $status = Stripe\WebhookEndpoint::update(
$existing_webhook->id, $existing_webhook->id,
[ [
@ -1779,7 +1779,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
try { try {
$subscription = Stripe\Subscription::retrieve($subscription_id); $subscription = Stripe\Subscription::retrieve($subscription_id);
if ($subscription->status !== 'canceled') { if ('canceled' !== $subscription->status) {
$subscription->cancel(); $subscription->cancel();
} }
} catch (\Exception $e) { } catch (\Exception $e) {
@ -2054,7 +2054,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
* *
* First, we'll start customer subscription created. * First, we'll start customer subscription created.
*/ */
if ($event->type === 'customer.subscription.created') { if ('customer.subscription.created' === $event->type) {
do_action('wu_webhook_recurring_payment_profile_created', $membership, $this); do_action('wu_webhook_recurring_payment_profile_created', $membership, $this);
} }
@ -2064,7 +2064,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
* On Stripe Checkout, we rely entirely on * On Stripe Checkout, we rely entirely on
* the webhook call to change the status of things. * the webhook call to change the status of things.
*/ */
if ($event->type === 'checkout.session.completed') { if ('checkout.session.completed' === $event->type) {
$membership->set_gateway_customer_id($payment_event->customer); $membership->set_gateway_customer_id($payment_event->customer);
$membership->set_gateway_subscription_id($payment_event->subscription); $membership->set_gateway_subscription_id($payment_event->subscription);
@ -2079,7 +2079,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
/* /*
* Next, let's deal with charges that went through! * Next, let's deal with charges that went through!
*/ */
if ($event->type === 'charge.succeeded' || $event->type === 'invoice.payment_succeeded') { if ('charge.succeeded' === $event->type || 'invoice.payment_succeeded' === $event->type) {
/** /**
* Here we need to handle invoice.payment_succeeded * Here we need to handle invoice.payment_succeeded
* events due subscriptions with trials and we need * events due subscriptions with trials and we need
@ -2092,7 +2092,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
'gateway' => $this->get_id(), 'gateway' => $this->get_id(),
]; ];
if ($event->type === 'charge.succeeded') { if ('charge.succeeded' === $event->type) {
/* /*
* Successful one-time payment * Successful one-time payment
*/ */
@ -2178,7 +2178,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
$pending_payment->attributes($payment_data); $pending_payment->attributes($payment_data);
$payment = $pending_payment; $payment = $pending_payment;
} elseif ($event->type === 'charge.succeeded') { } elseif ('charge.succeeded' === $event->type) {
/** /**
* These must be retrieved after the status * These must be retrieved after the status
* is set to active in order for upgrades to work properly * is set to active in order for upgrades to work properly
@ -2248,7 +2248,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
$this->payment = $payment; $this->payment = $payment;
if ($payment_event->object === 'charge' && ! $subscription && $this->get_id() === 'stripe') { if ('charge' === $payment_event->object && ! $subscription && $this->get_id() === 'stripe') {
$cart = $payment->get_meta('wu_original_cart'); $cart = $payment->get_meta('wu_original_cart');
$payment_intent_id = (string) $payment->get_meta('stripe_payment_intent_id'); $payment_intent_id = (string) $payment->get_meta('stripe_payment_intent_id');
@ -2316,7 +2316,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
/* /*
* Next, let's deal with charges that went through! * Next, let's deal with charges that went through!
*/ */
if ($event->type === 'charge.refunded') { if ('charge.refunded' === $event->type) {
$payment_data = [ $payment_data = [
'gateway' => 'stripe', 'gateway' => 'stripe',
]; ];
@ -2352,11 +2352,11 @@ class Base_Stripe_Gateway extends Base_Gateway {
/* /*
* Failed payments. * Failed payments.
*/ */
if ($event->type === 'invoice.payment_failed') { if ('invoice.payment_failed' === $event->type) {
$this->webhook_event_id = $event->id; $this->webhook_event_id = $event->id;
// Make sure this invoice is tied to a subscription and is the user's current subscription. // Make sure this invoice is tied to a subscription and is the user's current subscription.
if ( ! empty($event->data->object->subscription) && $event->data->object->subscription === $membership->get_gateway_subscription_id()) { if ( ! empty($event->data->object->subscription) && $membership->get_gateway_subscription_id() === $event->data->object->subscription) {
do_action('wu_recurring_payment_failed', $membership, $this); do_action('wu_recurring_payment_failed', $membership, $this);
} }
@ -2368,10 +2368,10 @@ class Base_Stripe_Gateway extends Base_Gateway {
/* /*
* Cancelled / failed subscription. * Cancelled / failed subscription.
*/ */
if ($event->type === 'customer.subscription.deleted') { if ('customer.subscription.deleted' === $event->type) {
wu_log_add('stripe', 'Processing Stripe customer.subscription.deleted webhook.'); wu_log_add('stripe', 'Processing Stripe customer.subscription.deleted webhook.');
if ($payment_event->id === $membership->get_gateway_subscription_id()) { if ($membership->get_gateway_subscription_id() === $payment_event->id) {
/* /*
* If this is a completed payment plan, * If this is a completed payment plan,
* we can skip any cancellation actions. * we can skip any cancellation actions.

View File

@ -41,18 +41,19 @@ class Arr {
/** /**
* Filter an array by property or key. * Filter an array by property or key.
* *
* @since 2.0.11 * @param array $array_to_filter The array to filter.
*
* @param array $array The array to filter.
* @param string $property The property to filter by. Dot notation is supported. * @param string $property The property to filter by. Dot notation is supported.
* @param mixed $expected_value The expected value to filter by. * @param mixed $expected_value The expected value to filter by.
* @param integer $flag The flag determining the return type. * @param integer $flag The flag determining the return type.
*
* @return mixed * @return mixed
*@since 2.0.11
*
*/ */
public static function filter_by_property($array, $property, $expected_value, $flag = 0) { public static function filter_by_property($array_to_filter, $property, $expected_value, $flag = 0) {
$result = self::filter( $result = self::filter(
$array, $array_to_filter,
function ($value) use ($property, $expected_value) { function ($value) use ($property, $expected_value) {
return Arr::get($value, $property, null) == $expected_value; // phpcs:ignore return Arr::get($value, $property, null) == $expected_value; // phpcs:ignore
@ -69,18 +70,19 @@ class Arr {
/** /**
* Filters an array using a callback. * Filters an array using a callback.
* *
* @param array $array_to_search The array to search inside.
* @param callable $closure The closure function to call.
*
* @return array
*@since 2.0.11 *@since 2.0.11
* *
* @param array $array The array to search inside.
* @param callable $closure The closure function to call.
* @return array
*/ */
public static function filter($array, $closure) { public static function filter($array_to_search, $closure) {
if ($closure) { if ($closure) {
$result = []; $result = [];
foreach ($array as $key => $value) { foreach ($array_to_search as $key => $value) {
if (call_user_func($closure, $value, $key)) { if (call_user_func($closure, $value, $key)) {
$result[] = $value; $result[] = $value;
} }
@ -89,71 +91,74 @@ class Arr {
return $result; return $result;
} }
return array_filter($array); return array_filter($array_to_search);
} }
/** /**
* Get a nested value inside an array. Dot notation is supported. * Get a nested value inside an array. Dot notation is supported.
* *
* @since 2.0.11 * @param array $array_target The array to get the value from.
*
* @param array $array The array to get the value from.
* @param string $key The array key to get. Supports dot notation. * @param string $key The array key to get. Supports dot notation.
* @param mixed $default The value to return ibn the case the key does not exist. * @param mixed $default The value to return ibn the case the key does not exist.
*
* @return mixed * @return mixed
*@since 2.0.11
*
*/ */
public static function get($array, $key, $default = null) { public static function get($array_target, $key, $default = null) {
if (is_null($key)) { if (is_null($key)) {
return $array; return $array_target;
} }
if (isset($array[ $key ])) { if (isset($array_target[ $key ])) {
return $array[ $key ]; return $array_target[ $key ];
} }
foreach (explode('.', $key) as $segment) { foreach (explode('.', $key) as $segment) {
if ( ! is_array($array) || ! array_key_exists($segment, $array)) { if ( ! is_array($array_target) || ! array_key_exists($segment, $array_target)) {
return $default; return $default;
} }
$array = $array[ $segment ]; $array_target = $array_target[ $segment ];
} }
return $array; return $array_target;
} }
/** /**
* Set a nested value inside an array. Dot notation is supported. * Set a nested value inside an array. Dot notation is supported.
* *
* @since 2.0.11 * @param array $array_to_modify The array to modify.
*
* @param array $array The array to modify.
* @param string $key The array key to set. Supports dot notation. * @param string $key The array key to set. Supports dot notation.
* @param mixed $value The value to set. * @param mixed $value The value to set.
*
* @return array * @return array
*@since 2.0.11
*
*/ */
public static function set(&$array, $key, $value) { public static function set(&$array_to_modify, $key, $value) {
if (is_null($key)) { if (is_null($key)) {
return $array = $value; // phpcs:ignore return $array_to_modify = $value; // phpcs:ignore
} }
$keys = explode('.', $key); $keys = explode('.', $key);
$keys_count = count($keys);
while (count($keys) > 1) { while ($keys_count > 1) {
$key = array_shift($keys); $key = array_shift($keys);
if ( ! isset($array[ $key ]) || ! is_array($array[ $key ])) { if ( ! isset($array_to_modify[ $key ]) || ! is_array($array_to_modify[ $key ])) {
$array[ $key ] = []; $array_to_modify[ $key ] = [];
} }
$array =& $array[ $key ]; $array_to_modify =& $array_to_modify[ $key ];
} }
$array[ array_shift($keys) ] = $value; $array_to_modify[ array_shift($keys) ] = $value;
return $array; return $array_to_modify;
} }
/** /**

View File

@ -50,7 +50,7 @@ class Base_Installer {
$all_done = true; $all_done = true;
foreach ($this->get_steps() as $step) { foreach ($this->get_steps() as $step) {
if ($step['done'] === false) { if (false === $step['done']) {
$all_done = false; $all_done = false;
} }
} }

View File

@ -706,7 +706,7 @@ class Migrator extends Base_Installer {
global $wpdb; global $wpdb;
if ($this->settings !== null) { if (null !== $this->settings) {
return $this->settings; return $this->settings;
} }
@ -1662,7 +1662,7 @@ class Migrator extends Base_Installer {
if ($subscription->gateway) { if ($subscription->gateway) {
$membership_data['gateway'] = $subscription->gateway; $membership_data['gateway'] = $subscription->gateway;
if ($subscription->gateway === 'stripe') { if ('stripe' === $subscription->gateway) {
/** /**
* Case Stripe. * Case Stripe.
@ -1672,7 +1672,7 @@ class Migrator extends Base_Installer {
*/ */
$membership_data['gateway_customer_id'] = $subscription->integration_key; $membership_data['gateway_customer_id'] = $subscription->integration_key;
$membership_data['gateway_subscription_id'] = $v1_subscription_meta->subscription_id; $membership_data['gateway_subscription_id'] = $v1_subscription_meta->subscription_id;
} elseif ($subscription->gateway === 'paypal') { } elseif ('paypal' === $subscription->gateway) {
/** /**
* Case PayPal. * Case PayPal.

View File

@ -241,7 +241,7 @@ class CPanel_Host_Provider extends Base_Host_Provider {
*/ */
public function load_api() { public function load_api() {
if ($this->api === null) { if (null === $this->api) {
$username = defined('WU_CPANEL_USERNAME') ? WU_CPANEL_USERNAME : ''; $username = defined('WU_CPANEL_USERNAME') ? WU_CPANEL_USERNAME : '';
$password = defined('WU_CPANEL_PASSWORD') ? WU_CPANEL_PASSWORD : ''; $password = defined('WU_CPANEL_PASSWORD') ? WU_CPANEL_PASSWORD : '';
$host = defined('WU_CPANEL_HOST') ? WU_CPANEL_HOST : ''; $host = defined('WU_CPANEL_HOST') ? WU_CPANEL_HOST : '';

View File

@ -243,7 +243,7 @@ class CPanel_API {
$reply = json_decode((string) $reply, true); $reply = json_decode((string) $reply, true);
if (isset($reply['status']) && $reply['status'] == 1) { // phpcs:ignore if (isset($reply['status']) && 1 == $reply['status']) { // phpcs:ignore
$this->cpsess = $reply['security_token']; $this->cpsess = $reply['security_token'];
$this->homepage = $this->get_base_url() . $reply['redirect']; $this->homepage = $this->get_base_url() . $reply['redirect'];

View File

@ -99,7 +99,7 @@ class Memory_Trap {
$message = sprintf(__('Your server\'s PHP and WordPress memory limits are too low to perform this check. You might need to contact your host provider and ask the PHP memory limit in particular to be raised.', 'wp-ultimo')); $message = sprintf(__('Your server\'s PHP and WordPress memory limits are too low to perform this check. You might need to contact your host provider and ask the PHP memory limit in particular to be raised.', 'wp-ultimo'));
if ($this->return_type === 'json') { if ('json' === $this->return_type) {
wp_send_json_error( wp_send_json_error(
[ [
'message' => $message, 'message' => $message,

View File

@ -71,6 +71,6 @@ class Limit_Customer_User_Role extends Limit {
$default_value = wu_get_setting('default_role', 'administrator'); $default_value = wu_get_setting('default_role', 'administrator');
return empty($this->limit) || $this->limit === 'default' ? $default_value : $this->limit; return empty($this->limit) || 'default' === $this->limit ? $default_value : $this->limit;
} }
} }

View File

@ -45,13 +45,13 @@ class Limit_Plugins extends Limit {
$plugin = (object) $this->{$value_to_check}; $plugin = (object) $this->{$value_to_check};
$types = [ $types = [
'visible' => $plugin->visibility === 'visible', 'visible' => 'visible' === $plugin->visibility,
'hidden' => $plugin->visibility === 'hidden', 'hidden' => 'hidden' === $plugin->visibility,
'default' => $plugin->behavior === 'default', 'default' => 'default' === $plugin->behavior,
'force_active' => $plugin->behavior === 'force_active', 'force_active' => 'force_active' === $plugin->behavior,
'force_inactive' => $plugin->behavior === 'force_inactive', 'force_inactive' => 'force_inactive' === $plugin->behavior,
'force_active_locked' => $plugin->behavior === 'force_active_locked', 'force_active_locked' => 'force_active_locked' === $plugin->behavior,
'force_inactive_locked' => $plugin->behavior === 'force_inactive_locked', 'force_inactive_locked' => 'force_inactive_locked' === $plugin->behavior,
]; ];
return wu_get_isset($types, $type, false); return wu_get_isset($types, $type, false);

View File

@ -87,9 +87,9 @@ class Limit_Site_Templates extends Limit {
$template = (object) $this->{$value_to_check}; $template = (object) $this->{$value_to_check};
$types = [ $types = [
'available' => $template->behavior === 'available', 'available' => 'available' === $template->behavior,
'not_available' => $template->behavior === 'not_available', 'not_available' => 'not_available' === $template->behavior,
'pre_selected' => $template->behavior === 'pre_selected', 'pre_selected' => 'pre_selected' === $template->behavior,
]; ];
return wu_get_isset($types, $type, true); return wu_get_isset($types, $type, true);
@ -178,7 +178,7 @@ class Limit_Site_Templates extends Limit {
foreach ($limits as $site_id => $site_settings) { foreach ($limits as $site_id => $site_settings) {
$site_settings = (object) $site_settings; $site_settings = (object) $site_settings;
if ($site_settings->behavior === 'available' || $site_settings->behavior === 'pre_selected' || $this->mode === 'default') { if ('available' === $site_settings->behavior || 'pre_selected' === $site_settings->behavior || 'default' === $this->mode) {
$available[] = $site_id; $available[] = $site_id;
} }
} }
@ -205,7 +205,7 @@ class Limit_Site_Templates extends Limit {
foreach ($limits as $site_id => $site_settings) { foreach ($limits as $site_id => $site_settings) {
$site_settings = (object) $site_settings; $site_settings = (object) $site_settings;
if ($site_settings->behavior === 'pre_selected') { if ('pre_selected' === $site_settings->behavior) {
$pre_selected_site_template = $site_id; $pre_selected_site_template = $site_id;
} }
} }

View File

@ -53,10 +53,10 @@ class Limit_Themes extends Limit {
$theme = (object) $this->{$value_to_check}; $theme = (object) $this->{$value_to_check};
$types = [ $types = [
'visible' => $theme->visibility === 'visible', 'visible' => 'visible' === $theme->visibility,
'hidden' => $theme->visibility === 'hidden', 'hidden' => 'hidden' === $theme->visibility,
'available' => $theme->behavior === 'available', 'available' => 'available' === $theme->behavior,
'not_available' => $theme->behavior === 'not_available', 'not_available' => 'not_available' === $theme->behavior,
]; ];
return wu_get_isset($types, $type, false); return wu_get_isset($types, $type, false);
@ -136,7 +136,7 @@ class Limit_Themes extends Limit {
foreach ($limits as $theme_slug => $theme_settings) { foreach ($limits as $theme_slug => $theme_settings) {
$theme_settings = (object) $theme_settings; $theme_settings = (object) $theme_settings;
if ($theme_settings->behavior === 'available') { if ('available' === $theme_settings->behavior) {
$available[] = $theme_slug; $available[] = $theme_slug;
} }
} }
@ -160,14 +160,14 @@ class Limit_Themes extends Limit {
return $active_theme; return $active_theme;
} }
if ($this->forced_active_theme !== null) { if (null !== $this->forced_active_theme) {
return $this->forced_active_theme; return $this->forced_active_theme;
} }
foreach ($limits as $theme_slug => $theme_settings) { foreach ($limits as $theme_slug => $theme_settings) {
$theme_settings = (object) $theme_settings; $theme_settings = (object) $theme_settings;
if ($theme_settings->behavior === 'force_active') { if ('force_active' === $theme_settings->behavior) {
$active_theme = $theme_slug; $active_theme = $theme_slug;
} }
} }

View File

@ -54,7 +54,7 @@ class Customer_User_Role_Limits {
$screen = get_current_screen(); $screen = get_current_screen();
if ( ! $screen || $screen->id !== 'user') { if ( ! $screen || 'user' !== $screen->id) {
return; return;
} }

View File

@ -112,7 +112,7 @@ class Post_Type_Limits {
*/ */
public function limit_restoring(): void { public function limit_restoring(): void {
if (isset($_REQUEST['action']) && $_REQUEST['action'] === 'untrash') { if (isset($_REQUEST['action']) && 'untrash' === $_REQUEST['action']) {
$this->limit_posts(); $this->limit_posts();
} }
} }
@ -170,7 +170,7 @@ class Post_Type_Limits {
} }
if (isset($data['post_status']) && $data['post_status'] !== 'publish') { if (isset($data['post_status']) && 'publish' !== $data['post_status']) {
return $data; return $data;
} }
@ -208,10 +208,10 @@ class Post_Type_Limits {
$quota = wu_get_current_site()->get_limitations()->post_types->attachment->number; $quota = wu_get_current_site()->get_limitations()->post_types->attachment->number;
// This bit is for the flash uploader // This bit is for the flash uploader
if ($file['type'] === 'application/octet-stream' && isset($file['tmp_name'])) { if ('application/octet-stream' === $file['type'] && isset($file['tmp_name'])) {
$file_size = getimagesize($file['tmp_name']); $file_size = getimagesize($file['tmp_name']);
if (isset($file_size['error']) && $file_size['error'] !== 0) { if (isset($file_size['error']) && 0 !== $file_size['error']) {
$file['error'] = "Unexpected Error: {$file_size['error']}"; $file['error'] = "Unexpected Error: {$file_size['error']}";
return $file; return $file;

View File

@ -330,7 +330,7 @@ class Theme_Limits {
*/ */
protected function get_forced_theme_stylesheet() { protected function get_forced_theme_stylesheet() {
if ($this->forced_theme_stylesheet === null) { if (null === $this->forced_theme_stylesheet) {
$this->forced_theme_stylesheet = wu_get_current_site()->get_limitations()->themes->get_forced_active_theme(); $this->forced_theme_stylesheet = wu_get_current_site()->get_limitations()->themes->get_forced_active_theme();
} }
@ -346,7 +346,7 @@ class Theme_Limits {
*/ */
protected function get_forced_theme_template() { protected function get_forced_theme_template() {
if ($this->forced_theme_template === null) { if (null === $this->forced_theme_template) {
$stylesheet = $this->get_forced_theme_stylesheet(); $stylesheet = $this->get_forced_theme_stylesheet();
$this->forced_theme_template = $stylesheet ? wp_get_theme($stylesheet)->get_template() : false; $this->forced_theme_template = $stylesheet ? wp_get_theme($stylesheet)->get_template() : false;

View File

@ -168,7 +168,7 @@ class Base_List_Table extends \WP_List_Table {
*/ */
protected function extra_tablenav($which) { protected function extra_tablenav($which) {
if ($this->current_mode === 'grid') { if ('grid' === $this->current_mode) {
printf( printf(
'<button id="cb-select-all-grid" v-on:click.prevent="select_all" class="button">%s</button>', '<button id="cb-select-all-grid" v-on:click.prevent="select_all" class="button">%s</button>',
__('Select All', 'wp-ultimo') __('Select All', 'wp-ultimo')
@ -184,7 +184,7 @@ class Base_List_Table extends \WP_List_Table {
*/ */
public function set_list_mode(): void { public function set_list_mode(): void {
if ($this->context !== 'page') { if ('page' !== $this->context) {
$this->current_mode = 'list'; $this->current_mode = 'list';
return; return;
@ -501,7 +501,7 @@ class Base_List_Table extends \WP_List_Table {
/* /*
* Any items at all? * Any items at all?
*/ */
if ( ! $this->has_items() && $this->context === 'page') { if ( ! $this->has_items() && 'page' === $this->context) {
echo wu_render_empty_state( echo wu_render_empty_state(
[ [
'message' => sprintf(__("You don't have any %s yet.", 'wp-ultimo'), $this->labels['plural']), 'message' => sprintf(__("You don't have any %s yet.", 'wp-ultimo'), $this->labels['plural']),
@ -1355,7 +1355,7 @@ class Base_List_Table extends \WP_List_Table {
continue; continue;
} }
if (isset($_REQUEST[ $field_name ]['before']) && isset($_REQUEST[ $field_name ]['after']) && $_REQUEST[ $field_name ]['before'] === '' && $_REQUEST[ $field_name ]['after'] === '') { if (isset($_REQUEST[ $field_name ]['before']) && isset($_REQUEST[ $field_name ]['after']) && '' === $_REQUEST[ $field_name ]['before'] && '' === $_REQUEST[ $field_name ]['after']) {
continue; continue;
} }

View File

@ -293,7 +293,7 @@ class Customer_List_Table extends Base_List_Table {
$filter_type = 'text'; $filter_type = 'text';
$rule = 'is'; $rule = 'is';
if ($item->date_query === true) { if (true === $item->date_query) {
$filter_type = 'date'; $filter_type = 'date';
$rule = 'is_after'; $rule = 'is_after';
} elseif (in_array(strtolower((string) $item->name), ['smallint'], true)) { } elseif (in_array(strtolower((string) $item->name), ['smallint'], true)) {

View File

@ -158,7 +158,7 @@ class Broadcast_Manager extends Base_Manager {
); );
} }
if ($args['type'] === 'broadcast_email') { if ('broadcast_email' === $args['type']) {
$to = []; $to = [];
$bcc = []; $bcc = [];
@ -272,7 +272,7 @@ class Broadcast_Manager extends Base_Manager {
$broadcast = new Broadcast($broadcast_data); $broadcast = new Broadcast($broadcast_data);
if ($args['type'] === 'broadcast_notice') { if ('broadcast_notice' === $args['type']) {
$broadcast->set_notice_type($args['notice_type']); $broadcast->set_notice_type($args['notice_type']);
} }

View File

@ -236,7 +236,7 @@ class Event_Manager extends Base_Manager {
'hidden' => false, 'hidden' => false,
]; ];
$types = array_filter($types, fn($item) => $item['hidden'] === false); $types = array_filter($types, fn($item) => false === $item['hidden']);
return $types; return $types;
} }

View File

@ -257,7 +257,7 @@ class Field_Templates_Manager extends Base_Manager {
$holder_name = "instantiated_{$field_type}_templates"; $holder_name = "instantiated_{$field_type}_templates";
if ( ! isset($this->holders[ $holder_name ]) || $this->holders[ $holder_name ] === null) { if ( ! isset($this->holders[ $holder_name ]) || null === $this->holders[ $holder_name ]) {
$this->holders[ $holder_name ] = array_map([$this, 'instantiate_field_template'], $this->get_templates($field_type)); $this->holders[ $holder_name ] = array_map([$this, 'instantiate_field_template'], $this->get_templates($field_type));
} }

View File

@ -377,7 +377,7 @@ class Gateway_Manager extends Base_Manager {
$gateways = $this->get_registered_gateways(); $gateways = $this->get_registered_gateways();
$gateways = array_filter($gateways, fn($item) => $item['hidden'] === false); $gateways = array_filter($gateways, fn($item) => false === $item['hidden']);
return $gateways; return $gateways;
} }

View File

@ -313,7 +313,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['visits']['fields']['modules_visits_overwrite'] = $this->override_notice($object->get_limitations(false)->visits->has_own_enabled()); $sections['visits']['fields']['modules_visits_overwrite'] = $this->override_notice($object->get_limitations(false)->visits->has_own_enabled());
} }
@ -332,7 +332,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['visits']['fields']['allowed_visits_overwrite'] = $this->override_notice($object->get_limitations(false)->visits->has_own_limit(), ['limit_visits']); $sections['visits']['fields']['allowed_visits_overwrite'] = $this->override_notice($object->get_limitations(false)->visits->has_own_limit(), ['limit_visits']);
} }
@ -374,7 +374,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['users']['fields']['modules_user_overwrite'] = $this->override_notice($object->get_limitations(false)->users->has_own_enabled()); $sections['users']['fields']['modules_user_overwrite'] = $this->override_notice($object->get_limitations(false)->users->has_own_enabled());
} }
@ -401,7 +401,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['post_types']['fields']['post_quota_overwrite'] = $this->override_notice($object->get_limitations(false)->post_types->has_own_enabled()); $sections['post_types']['fields']['post_quota_overwrite'] = $this->override_notice($object->get_limitations(false)->post_types->has_own_enabled());
} }
@ -437,7 +437,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['limit_disk_space']['fields']['disk_space_modules_overwrite'] = $this->override_notice($object->get_limitations(false)->disk_space->has_own_enabled()); $sections['limit_disk_space']['fields']['disk_space_modules_overwrite'] = $this->override_notice($object->get_limitations(false)->disk_space->has_own_enabled());
} }
@ -454,7 +454,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['limit_disk_space']['fields']['disk_space_override'] = $this->override_notice($object->get_limitations(false)->disk_space->has_own_limit(), ['limit_disk_space']); $sections['limit_disk_space']['fields']['disk_space_override'] = $this->override_notice($object->get_limitations(false)->disk_space->has_own_limit(), ['limit_disk_space']);
} }
@ -482,7 +482,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['custom_domain']['fields']['custom_domain_override'] = $this->override_notice($object->get_limitations(false)->domain_mapping->has_own_enabled(), ['allow_domain_mapping']); $sections['custom_domain']['fields']['custom_domain_override'] = $this->override_notice($object->get_limitations(false)->domain_mapping->has_own_enabled(), ['allow_domain_mapping']);
} }
@ -620,7 +620,7 @@ class Limitation_Manager {
/* /*
* Add override notice. * Add override notice.
*/ */
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['users']['fields'][ "override_{$user_role_slug}" ] = $this->override_notice($object->get_limitations(false)->users->exists($user_role_slug), ['limit_users']); $sections['users']['fields'][ "override_{$user_role_slug}" ] = $this->override_notice($object->get_limitations(false)->users->exists($user_role_slug), ['limit_users']);
} }
} }
@ -678,7 +678,7 @@ class Limitation_Manager {
/* /*
* Add override notice. * Add override notice.
*/ */
if ($object->model !== 'product') { if ('product' !== $object->model) {
$sections['post_types']['fields'][ "override_{$post_type_slug}" ] = $this->override_notice( $sections['post_types']['fields'][ "override_{$post_type_slug}" ] = $this->override_notice(
$object->get_limitations(false)->post_types->exists($post_type_slug), $object->get_limitations(false)->post_types->exists($post_type_slug),
[ [
@ -711,7 +711,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$fields['sites_overwrite'] = $this->override_notice($object->get_limitations(false)->sites->has_own_enabled()); $fields['sites_overwrite'] = $this->override_notice($object->get_limitations(false)->sites->has_own_enabled());
} }
@ -741,7 +741,7 @@ class Limitation_Manager {
], ],
]; ];
if ($object->model !== 'product') { if ('product' !== $object->model) {
$fields['sites_overwrite_2'] = $this->override_notice($object->get_limitations(false)->sites->has_own_limit(), ["get_state_value('product_type', 'none') !== 'service' && limit_sites"]); $fields['sites_overwrite_2'] = $this->override_notice($object->get_limitations(false)->sites->has_own_limit(), ["get_state_value('product_type', 'none') !== 'service' && limit_sites"]);
} }

View File

@ -113,7 +113,7 @@ class Signup_Fields_Manager extends Base_Manager {
*/ */
public function get_instantiated_field_types() { public function get_instantiated_field_types() {
if ($this->instantiated_field_types === null) { if (null === $this->instantiated_field_types) {
$this->instantiated_field_types = array_map([$this, 'instantiate_field_type'], $this->get_field_types()); $this->instantiated_field_types = array_map([$this, 'instantiate_field_type'], $this->get_field_types());
} }

View File

@ -240,7 +240,7 @@ abstract class Base_Model implements \JsonSerializable {
/* /*
* Keeps the original. * Keeps the original.
*/ */
if ($this->_original === null) { if (null === $this->_original) {
$original = get_object_vars($this); $original = get_object_vars($this);
unset($original['_original']); unset($original['_original']);

View File

@ -125,7 +125,7 @@ class Broadcast extends Post_Base_Model {
*/ */
public function get_migrated_from_id() { public function get_migrated_from_id() {
if ($this->migrated_from_id === null) { if (null === $this->migrated_from_id) {
$this->migrated_from_id = $this->get_meta('migrated_from_id', 0); $this->migrated_from_id = $this->get_meta('migrated_from_id', 0);
} }
@ -176,7 +176,7 @@ class Broadcast extends Post_Base_Model {
*/ */
public function get_notice_type() { public function get_notice_type() {
if ($this->notice_type === null) { if (null === $this->notice_type) {
$this->notice_type = $this->get_meta('notice_type', 'success'); $this->notice_type = $this->get_meta('notice_type', 'success');
} }

View File

@ -1089,7 +1089,7 @@ class Checkout_Form extends Base_Model {
*/ */
public function get_thank_you_page_id() { public function get_thank_you_page_id() {
if ($this->thank_you_page_id === null) { if (null === $this->thank_you_page_id) {
$this->thank_you_page_id = $this->get_meta('wu_thank_you_page_id', ''); $this->thank_you_page_id = $this->get_meta('wu_thank_you_page_id', '');
} }
@ -1118,7 +1118,7 @@ class Checkout_Form extends Base_Model {
*/ */
public function get_conversion_snippets() { public function get_conversion_snippets() {
if ($this->conversion_snippets === null) { if (null === $this->conversion_snippets) {
$this->conversion_snippets = $this->get_meta('wu_conversion_snippets', ''); $this->conversion_snippets = $this->get_meta('wu_conversion_snippets', '');
} }

View File

@ -547,7 +547,7 @@ class Customer extends Base_Model {
*/ */
public function get_extra_information() { public function get_extra_information() {
if ($this->extra_information === null) { if (null === $this->extra_information) {
$extra_information = (array) $this->get_meta('wu_customer_extra_information'); $extra_information = (array) $this->get_meta('wu_customer_extra_information');
$this->extra_information = array_filter($extra_information); $this->extra_information = array_filter($extra_information);

View File

@ -709,7 +709,7 @@ class Discount_Code extends Base_Model {
*/ */
public function get_allowed_products() { public function get_allowed_products() {
if ($this->allowed_products === null) { if (null === $this->allowed_products) {
$this->allowed_products = $this->get_meta('wu_allowed_products', []); $this->allowed_products = $this->get_meta('wu_allowed_products', []);
} }
@ -738,7 +738,7 @@ class Discount_Code extends Base_Model {
*/ */
public function get_limit_products() { public function get_limit_products() {
if ($this->limit_products === null) { if (null === $this->limit_products) {
$this->limit_products = $this->get_meta('wu_limit_products', false); $this->limit_products = $this->get_meta('wu_limit_products', false);
} }

View File

@ -170,7 +170,7 @@ class Email extends Post_Base_Model {
*/ */
public function get_event() { public function get_event() {
if ($this->event === null) { if (null === $this->event) {
$this->event = $this->get_meta('wu_system_email_event'); $this->event = $this->get_meta('wu_system_email_event');
} }
@ -209,7 +209,7 @@ class Email extends Post_Base_Model {
$this->style = $this->get_meta('wu_style', 'html'); $this->style = $this->get_meta('wu_style', 'html');
if ($this->style === 'use_default') { if ('use_default' === $this->style) {
$this->style = wu_get_setting('email_template_type', 'html'); $this->style = wu_get_setting('email_template_type', 'html');
} }
@ -249,7 +249,7 @@ class Email extends Post_Base_Model {
*/ */
public function has_schedule() { public function has_schedule() {
if ($this->schedule === null) { if (null === $this->schedule) {
$this->schedule = $this->get_meta('wu_schedule', false); $this->schedule = $this->get_meta('wu_schedule', false);
} }
@ -532,7 +532,7 @@ class Email extends Post_Base_Model {
*/ */
public function get_target() { public function get_target() {
if ($this->target === null) { if (null === $this->target) {
$this->target = $this->get_meta('wu_target', 'admin'); $this->target = $this->get_meta('wu_target', 'admin');
} }
@ -633,7 +633,7 @@ class Email extends Post_Base_Model {
*/ */
public function get_send_copy_to_admin() { public function get_send_copy_to_admin() {
if ($this->send_copy_to_admin === null) { if (null === $this->send_copy_to_admin) {
$this->send_copy_to_admin = $this->get_meta('wu_send_copy_to_admin', false); $this->send_copy_to_admin = $this->get_meta('wu_send_copy_to_admin', false);
} }
@ -662,7 +662,7 @@ class Email extends Post_Base_Model {
*/ */
public function is_active() { public function is_active() {
if ($this->active === null) { if (null === $this->active) {
$this->active = $this->get_meta('wu_active', true); $this->active = $this->get_meta('wu_active', true);
} }
@ -691,7 +691,7 @@ class Email extends Post_Base_Model {
*/ */
public function is_legacy() { public function is_legacy() {
if ($this->legacy === null) { if (null === $this->legacy) {
$this->legacy = $this->get_meta('wu_legacy', false); $this->legacy = $this->get_meta('wu_legacy', false);
} }

View File

@ -482,7 +482,7 @@ class Membership extends Base_Model {
if ($plan && ($plan->get_duration() !== $this->get_duration() || $plan->get_duration_unit() !== $this->get_duration_unit())) { if ($plan && ($plan->get_duration() !== $this->get_duration() || $plan->get_duration_unit() !== $this->get_duration_unit())) {
$variation = $plan->get_as_variation($this->get_duration(), $this->get_duration_unit()); $variation = $plan->get_as_variation($this->get_duration(), $this->get_duration_unit());
$plan = ($variation ? $variation : null) ?? $plan; $plan = ($variation ?: null) ?? $plan;
} }
return $plan; return $plan;
@ -1342,7 +1342,7 @@ class Membership extends Base_Model {
*/ */
public function get_discount_code() { public function get_discount_code() {
if ($this->discount_code === null) { if (null === $this->discount_code) {
$this->discount_code = $this->get_meta('discount_code'); $this->discount_code = $this->get_meta('discount_code');
} }

View File

@ -597,7 +597,7 @@ class Payment extends Base_Model {
*/ */
public function get_line_items(): array { public function get_line_items(): array {
if ($this->line_items === null) { if (null === $this->line_items) {
$line_items = (array) $this->get_meta('wu_line_items'); $line_items = (array) $this->get_meta('wu_line_items');
$this->line_items = array_filter($line_items); $this->line_items = array_filter($line_items);
@ -877,7 +877,7 @@ class Payment extends Base_Model {
*/ */
public function get_saved_invoice_number() { public function get_saved_invoice_number() {
if ($this->invoice_number === null) { if (null === $this->invoice_number) {
$this->invoice_number = $this->get_meta('wu_invoice_number', ''); $this->invoice_number = $this->get_meta('wu_invoice_number', '');
} }
@ -898,11 +898,11 @@ class Payment extends Base_Model {
$provisional = false; $provisional = false;
if ($this->invoice_number === null) { if (null === $this->invoice_number) {
$this->invoice_number = $this->get_meta('wu_invoice_number'); $this->invoice_number = $this->get_meta('wu_invoice_number');
} }
if ($this->invoice_number === false) { if (false === $this->invoice_number) {
$provisional = true; $provisional = true;
$this->invoice_number = wu_get_setting('next_invoice_number'); $this->invoice_number = wu_get_setting('next_invoice_number');
@ -981,7 +981,7 @@ class Payment extends Base_Model {
*/ */
public function should_cancel_membership_on_refund() { public function should_cancel_membership_on_refund() {
if ($this->cancel_membership_on_refund === null) { if (null === $this->cancel_membership_on_refund) {
$this->cancel_membership_on_refund = $this->get_meta('wu_cancel_membership_on_refund', false); $this->cancel_membership_on_refund = $this->get_meta('wu_cancel_membership_on_refund', false);
} }

View File

@ -334,7 +334,7 @@ class Product extends Base_Model {
*/ */
public function get_featured_image_id() { public function get_featured_image_id() {
if ($this->featured_image_id === null) { if (null === $this->featured_image_id) {
$this->featured_image_id = $this->get_meta('wu_featured_image_id'); $this->featured_image_id = $this->get_meta('wu_featured_image_id');
} }
@ -1055,7 +1055,7 @@ class Product extends Base_Model {
*/ */
public function get_tax_category() { public function get_tax_category() {
if ($this->tax_category === null) { if (null === $this->tax_category) {
$this->tax_category = $this->get_meta('tax_category', 'default'); $this->tax_category = $this->get_meta('tax_category', 'default');
} }
@ -1085,7 +1085,7 @@ class Product extends Base_Model {
*/ */
public function get_contact_us_label() { public function get_contact_us_label() {
if ($this->contact_us_label === null) { if (null === $this->contact_us_label) {
$this->contact_us_label = $this->get_meta('wu_contact_us_label', ''); $this->contact_us_label = $this->get_meta('wu_contact_us_label', '');
} }
@ -1114,7 +1114,7 @@ class Product extends Base_Model {
*/ */
public function get_contact_us_link() { public function get_contact_us_link() {
if ($this->contact_us_link === null) { if (null === $this->contact_us_link) {
$this->contact_us_link = $this->get_meta('wu_contact_us_link', ''); $this->contact_us_link = $this->get_meta('wu_contact_us_link', '');
} }
@ -1143,7 +1143,7 @@ class Product extends Base_Model {
*/ */
public function get_feature_list() { public function get_feature_list() {
if ($this->feature_list === null) { if (null === $this->feature_list) {
$this->feature_list = $this->get_meta('feature_list'); $this->feature_list = $this->get_meta('feature_list');
} }
@ -1172,7 +1172,7 @@ class Product extends Base_Model {
*/ */
public function get_customer_role() { public function get_customer_role() {
if ($this->customer_role === null) { if (null === $this->customer_role) {
$this->customer_role = $this->get_limitations()->customer_user_role->get_limit(); $this->customer_role = $this->get_limitations()->customer_user_role->get_limit();
} }
@ -1239,7 +1239,7 @@ class Product extends Base_Model {
*/ */
public function get_price_variations() { public function get_price_variations() {
if ($this->price_variations === null) { if (null === $this->price_variations) {
$this->price_variations = array_map( $this->price_variations = array_map(
function ($price_variation) { function ($price_variation) {
/** /**
@ -1372,7 +1372,7 @@ class Product extends Base_Model {
*/ */
public function get_available_addons() { public function get_available_addons() {
if ($this->available_addons === null) { if (null === $this->available_addons) {
$this->available_addons = $this->get_meta('wu_available_addons', []); $this->available_addons = $this->get_meta('wu_available_addons', []);
if (is_string($this->available_addons)) { if (is_string($this->available_addons)) {
@ -1440,7 +1440,7 @@ class Product extends Base_Model {
*/ */
public function get_legacy_options() { public function get_legacy_options() {
if ($this->legacy_options === null) { if (null === $this->legacy_options) {
$this->legacy_options = $this->get_meta('legacy_options', false); $this->legacy_options = $this->get_meta('legacy_options', false);
} }

View File

@ -343,7 +343,7 @@ class Site extends Base_Model {
*/ */
public function get_categories() { public function get_categories() {
if ($this->categories === null) { if (null === $this->categories) {
$this->categories = $this->get_meta('wu_categories', []); $this->categories = $this->get_meta('wu_categories', []);
} }
@ -362,7 +362,7 @@ class Site extends Base_Model {
*/ */
public function get_featured_image_id() { public function get_featured_image_id() {
if ($this->featured_image_id === null) { if (null === $this->featured_image_id) {
return $this->get_meta('wu_featured_image_id'); return $this->get_meta('wu_featured_image_id');
} }
@ -718,7 +718,7 @@ class Site extends Base_Model {
*/ */
public function is_active() { public function is_active() {
if ($this->active === null) { if (null === $this->active) {
$this->active = $this->get_meta('wu_active', true); $this->active = $this->get_meta('wu_active', true);
} }
@ -885,7 +885,7 @@ class Site extends Base_Model {
*/ */
public function get_customer_id() { public function get_customer_id() {
if ($this->customer_id === null) { if (null === $this->customer_id) {
$this->customer_id = $this->get_meta('wu_customer_id'); $this->customer_id = $this->get_meta('wu_customer_id');
} }
@ -950,7 +950,7 @@ class Site extends Base_Model {
*/ */
public function get_membership_id() { public function get_membership_id() {
if ($this->membership_id === null) { if (null === $this->membership_id) {
$this->membership_id = $this->get_meta('wu_membership_id'); $this->membership_id = $this->get_meta('wu_membership_id');
} }
@ -1001,7 +1001,7 @@ class Site extends Base_Model {
*/ */
public function get_membership() { public function get_membership() {
if ($this->_membership !== null) { if (null !== $this->_membership) {
return $this->_membership; return $this->_membership;
} }
@ -1057,7 +1057,7 @@ class Site extends Base_Model {
*/ */
public function get_template_id() { public function get_template_id() {
if ($this->template_id === null) { if (null === $this->template_id) {
$this->template_id = $this->get_meta('wu_template_id'); $this->template_id = $this->get_meta('wu_template_id');
} }
@ -1152,7 +1152,7 @@ class Site extends Base_Model {
return 'main'; return 'main';
} }
if ($this->type === null) { if (null === $this->type) {
$type = $this->get_meta('wu_type'); $type = $this->get_meta('wu_type');
$this->type = $type ?: 'default'; $this->type = $type ?: 'default';
@ -1267,7 +1267,7 @@ class Site extends Base_Model {
$details = get_blog_details($this->get_blog_id()); $details = get_blog_details($this->get_blog_id());
if ($details && $this->title === null) { if ($details && null === $this->title) {
$this->set_title($details->blogname); $this->set_title($details->blogname);
} }
@ -1289,7 +1289,7 @@ class Site extends Base_Model {
*/ */
public function get_transient() { public function get_transient() {
if ($this->transient === null) { if (null === $this->transient) {
$this->transient = $this->get_meta('wu_transient'); $this->transient = $this->get_meta('wu_transient');
} }

View File

@ -43,7 +43,7 @@ trait Billable {
*/ */
public function get_billing_address() { public function get_billing_address() {
if ($this->billing_address === null) { if (null === $this->billing_address) {
$billing_address = $this->get_meta('wu_billing_address'); $billing_address = $this->get_meta('wu_billing_address');
$this->billing_address = is_a($billing_address, '\WP_Ultimo\Objects\Billing_Address') ? $billing_address : $this->get_default_billing_address(); $this->billing_address = is_a($billing_address, '\WP_Ultimo\Objects\Billing_Address') ? $billing_address : $this->get_default_billing_address();

View File

@ -159,9 +159,9 @@ trait Limitable {
$sites = []; $sites = [];
if ($this->model === 'site') { if ('site' === $this->model) {
$sites[] = $this; $sites[] = $this;
} elseif ($this->model === 'membership') { } elseif ('membership' === $this->model) {
$sites = $this->get_sites(); $sites = $this->get_sites();
} }
@ -242,12 +242,12 @@ trait Limitable {
} }
} }
if ($this->model !== 'product') { if ('product' !== $this->model) {
/* /*
* Set the new permissions, based on the diff. * Set the new permissions, based on the diff.
*/ */
$limitations = wu_array_recursive_diff($modules_to_save, $current_limitations->to_array()); $limitations = wu_array_recursive_diff($modules_to_save, $current_limitations->to_array());
} elseif ($this->model === 'product' && $this->get_type() !== 'plan') { } elseif ('product' === $this->model && $this->get_type() !== 'plan') {
$limitations = wu_array_recursive_diff($modules_to_save, Limitations::get_empty()->to_array()); $limitations = wu_array_recursive_diff($modules_to_save, Limitations::get_empty()->to_array());
} else { } else {
$limitations = $modules_to_save; $limitations = $modules_to_save;
@ -264,15 +264,15 @@ trait Limitable {
*/ */
public function get_applicable_product_slugs() { public function get_applicable_product_slugs() {
if ($this->model === 'product') { if ('product' === $this->model) {
return [$this->get_slug()]; return [$this->get_slug()];
} }
$slugs = []; $slugs = [];
if ($this->model === 'membership') { if ('membership' === $this->model) {
$membership = $this; $membership = $this;
} elseif ($this->model === 'site') { } elseif ('site' === $this->model) {
$membership = $this->get_membership(); $membership = $this->get_membership();
} }

View File

@ -32,7 +32,7 @@ trait Notable {
*/ */
public function get_notes() { public function get_notes() {
if ($this->notes === null) { if (null === $this->notes) {
$this->notes = get_metadata($this->get_meta_data_table_name(), $this->get_id(), 'wu_note', false); $this->notes = get_metadata($this->get_meta_data_table_name(), $this->get_id(), 'wu_note', false);
} }

View File

@ -93,7 +93,7 @@ trait WP_Ultimo_Plan_Deprecated {
*/ */
public function is_featured_plan() { public function is_featured_plan() {
if ($this->featured_plan === null) { if (null === $this->featured_plan) {
$this->featured_plan = $this->get_meta('featured_plan', false); $this->featured_plan = $this->get_meta('featured_plan', false);
} }

View File

@ -284,7 +284,7 @@ abstract class Base_Element {
$should_load = false; $should_load = false;
if ($block['blockName'] === $this->get_id()) { if ($this->get_id() === $block['blockName']) {
$should_load = true; $should_load = true;
} }
@ -386,7 +386,7 @@ abstract class Base_Element {
*/ */
public function setup_for_admin(): void { public function setup_for_admin(): void {
if ($this->loaded === true) { if (true === $this->loaded) {
return; return;
} }
@ -548,7 +548,7 @@ abstract class Base_Element {
$block_content = parse_blocks($content); $block_content = parse_blocks($content);
foreach ($block_content as $block) { foreach ($block_content as $block) {
if ($block['blockName'] === $this->get_id()) { if ($this->get_id() === $block['blockName']) {
return $block['attrs']; return $block['attrs'];
} }
} }
@ -613,7 +613,7 @@ abstract class Base_Element {
*/ */
public function get_pre_loaded_attribute($name, $default = false) { public function get_pre_loaded_attribute($name, $default = false) {
if ($this->pre_loaded_attributes === false || ! is_array($this->pre_loaded_attributes)) { if (false === $this->pre_loaded_attributes || ! is_array($this->pre_loaded_attributes)) {
return false; return false;
} }
@ -682,7 +682,7 @@ abstract class Base_Element {
$state = []; $state = [];
foreach ($fields as $field_slug => &$field) { foreach ($fields as $field_slug => &$field) {
if ($field['type'] === 'header' || $field['type'] === 'note') { if ('header' === $field['type'] || 'note' === $field['type']) {
unset($fields[ $field_slug ]); unset($fields[ $field_slug ]);
continue; continue;
@ -697,7 +697,7 @@ abstract class Base_Element {
*/ */
$additional_state = []; $additional_state = [];
if ($field['type'] === 'group') { if ('group' === $field['type']) {
foreach ($field['fields'] as $sub_field_slug => &$sub_field) { foreach ($field['fields'] as $sub_field_slug => &$sub_field) {
$sub_field['html_attr'] = [ $sub_field['html_attr'] = [
'v-model.lazy' => "attributes.{$sub_field_slug}", 'v-model.lazy' => "attributes.{$sub_field_slug}",
@ -810,7 +810,7 @@ abstract class Base_Element {
$state = array_merge($defaults, $saved_settings); $state = array_merge($defaults, $saved_settings);
foreach ($fields as $field_slug => &$field) { foreach ($fields as $field_slug => &$field) {
if ($field['type'] === 'header') { if ('header' === $field['type']) {
unset($fields[ $field_slug ]); unset($fields[ $field_slug ]);
continue; continue;
@ -886,7 +886,7 @@ abstract class Base_Element {
foreach ($fields as $field_slug => $field) { foreach ($fields as $field_slug => $field) {
$setting = wu_request($field_slug, false); $setting = wu_request($field_slug, false);
if (false !== $setting || $field['type'] === 'toggle') { if (false !== $setting || 'toggle' === $field['type']) {
$settings[ $field_slug ] = $setting; $settings[ $field_slug ] = $setting;
} }
} }

View File

@ -178,7 +178,7 @@ class Field implements \JsonSerializable {
/* /*
* Back Compat for Select2 Fields * Back Compat for Select2 Fields
*/ */
if ($this->type === 'select2') { if ('select2' === $this->type) {
$this->atts['html_attr']['data-selectize'] = 1; $this->atts['html_attr']['data-selectize'] = 1;
$this->atts['html_attr']['multiple'] = 1; $this->atts['html_attr']['multiple'] = 1;
} }
@ -247,11 +247,11 @@ class Field implements \JsonSerializable {
$this->atts['wrapper_classes'] .= ' wu-requires-other'; $this->atts['wrapper_classes'] .= ' wu-requires-other';
} }
if ('type' === $att && $this->atts[ $att ] === 'submit') { if ('type' === $att && 'submit' === $this->atts[ $att ]) {
$this->atts['wrapper_classes'] .= ' wu-submit-field'; $this->atts['wrapper_classes'] .= ' wu-submit-field';
} }
if ('type' === $att && $this->atts[ $att ] === 'tab-select') { if ('type' === $att && 'tab-select' === $this->atts[ $att ]) {
$this->atts['wrapper_classes'] .= ' wu-tab-field'; $this->atts['wrapper_classes'] .= ' wu-tab-field';
} }
@ -402,12 +402,12 @@ class Field implements \JsonSerializable {
unset($this->atts['html_attr']['class']); unset($this->atts['html_attr']['class']);
if ($this->type === 'number') { if ('number' === $this->type) {
if ($this->min !== false) { if (false !== $this->min) {
$attributes['min'] = $this->min; $attributes['min'] = $this->min;
} }
if ($this->max !== false) { if (false !== $this->max) {
$attributes['max'] = $this->max; $attributes['max'] = $this->max;
} }
} }
@ -415,7 +415,7 @@ class Field implements \JsonSerializable {
/* /*
* Adds money formatting and masking * Adds money formatting and masking
*/ */
if ($this->money !== false) { if (false !== $this->money) {
$attributes['v-bind'] = 'money_settings'; $attributes['v-bind'] = 'money_settings';
} }

View File

@ -213,12 +213,12 @@ class Form implements \JsonSerializable {
unset($this->atts['html_attr']['class']); unset($this->atts['html_attr']['class']);
if ($this->type === 'number') { if ('number' === $this->type) {
if ($this->min !== false) { if (false !== $this->min) {
$attributes['min'] = $this->min; $attributes['min'] = $this->min;
} }
if ($this->max !== false) { if (false !== $this->max) {
$attributes['max'] = $this->max; $attributes['max'] = $this->max;
} }
} }

View File

@ -423,7 +423,7 @@ class Login_Form_Element extends Base_Element {
/* /*
* Handles maintenance mode on Elementor. * Handles maintenance mode on Elementor.
*/ */
if ($post && $post->ID === absint(wu_get_setting('default_login_page', 0))) { if ($post && absint(wu_get_setting('default_login_page', 0)) === $post->ID) {
add_filter('elementor/maintenance_mode/is_login_page', '__return_true'); add_filter('elementor/maintenance_mode/is_login_page', '__return_true');
} }
} }
@ -749,9 +749,9 @@ class Login_Form_Element extends Base_Element {
if (isset($_GET['redirect_to'])) { if (isset($_GET['redirect_to'])) {
$atts['redirect_type'] = 'query_redirect'; $atts['redirect_type'] = 'query_redirect';
$fields['redirect_to']['value'] = $_GET['redirect_to']; $fields['redirect_to']['value'] = $_GET['redirect_to'];
} elseif ($atts['redirect_type'] === 'customer_site') { } elseif ('customer_site' === $atts['redirect_type']) {
$fields['redirect_to']['value'] = $atts['customer_redirect_path']; $fields['redirect_to']['value'] = $atts['customer_redirect_path'];
} elseif ($atts['redirect_type'] === 'main_site') { } elseif ('main_site' === $atts['redirect_type']) {
$fields['redirect_to']['value'] = $atts['main_redirect_path']; $fields['redirect_to']['value'] = $atts['main_redirect_path'];
} }

View File

@ -367,7 +367,7 @@ class My_Sites_Element extends Base_Element {
$user_sites = array_reduce( $user_sites = array_reduce(
$wp_user_sites, $wp_user_sites,
function ($user_sites, $wp_site) use ($customer_sites) { function ($user_sites, $wp_site) use ($customer_sites) {
if ( ! array_key_exists($wp_site->userblog_id, $customer_sites ?? []) && $wp_site->userblog_id !== get_main_site_id()) { if ( ! array_key_exists($wp_site->userblog_id, $customer_sites ?? []) && get_main_site_id() !== $wp_site->userblog_id) {
$wu_site = wu_get_site($wp_site->userblog_id); $wu_site = wu_get_site($wp_site->userblog_id);
$wu_site->set_membership_id(0); $wu_site->set_membership_id(0);
$user_sites[ $wp_site->userblog_id ] = $wu_site; $user_sites[ $wp_site->userblog_id ] = $wu_site;

View File

@ -34,7 +34,15 @@ final class YodaConditionsRector extends AbstractRector
public function refactor(Node $node): ?Node public function refactor(Node $node): ?Node
{ {
// Ensure the left operand is not a constant // Ensure the left operand is not a constant
if ($node->left instanceof Node\Expr\Variable && (! $node->right instanceof Node\Expr\Variable)) { if ((
$node->left instanceof Node\Expr\Variable ||
$node->left instanceof Node\Expr\PropertyFetch ||
$node->left instanceof Node\Expr\ArrayDimFetch) && (
$node->right instanceof Scalar ||
$node->right instanceof ConstFetch ||
$node->right instanceof Node\Expr\FuncCall ||
$node->right instanceof Node\Expr\MethodCall
)) {
// Swap the left and right operands // Swap the left and right operands
$this->mirrorComments($node->right, $node->left); $this->mirrorComments($node->right, $node->left);
[$node->left, $node->right] = [$node->right, $node->left]; [$node->left, $node->right] = [$node->right, $node->left];

View File

@ -2,6 +2,8 @@
namespace Rector\Tests\TypeDeclaration\Rector\YodaConditionsRector\Fixture; namespace Rector\Tests\TypeDeclaration\Rector\YodaConditionsRector\Fixture;
const A_CONST = 'x'; const A_CONST = 'x';
$arr = array('x'=>1);
$obj = (object) $arr;
$a = 'x'; $a = 'x';
if ($a === 'x') { if ($a === 'x') {
$a = 'xx'; $a = 'xx';
@ -21,12 +23,20 @@ if (strlen($a) === 1) {
if ($a === 0 || $a === rand()) { if ($a === 0 || $a === rand()) {
return $a; return $a;
} }
if ($obj->x === 1) {
echo $obj->x;
}
if ($arr['x'] === 1) {
echo $arr['x'];
}
?> ?>
----- -----
<?php <?php
namespace Rector\Tests\TypeDeclaration\Rector\YodaConditionsRector\Fixture; namespace Rector\Tests\TypeDeclaration\Rector\YodaConditionsRector\Fixture;
const A_CONST = 'x'; const A_CONST = 'x';
$arr = array('x'=>1);
$obj = (object) $arr;
$a = 'x'; $a = 'x';
if ('x' === $a) { if ('x' === $a) {
$a = 'xx'; $a = 'xx';
@ -46,4 +56,10 @@ if (strlen($a) === 1) {
if (0 === $a || rand() === $a) { if (0 === $a || rand() === $a) {
return $a; return $a;
} }
if (1 === $obj->x) {
echo $obj->x;
}
if (1 === $arr['x']) {
echo $arr['x'];
}
?> ?>

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@
<div class="wu-toggle"> <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> <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()); ?>"> <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(); ?> <?php echo $option->get_name(); ?>

View File

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

View File

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

View File

@ -7,7 +7,7 @@
?> ?>
<?php <?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']); $coupon = wu_get_coupon($_GET['coupon']);
?> ?>

View File

@ -115,7 +115,7 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
<?php <?php
$button_attrubutes = apply_filters('wu_plan_select_button_attributes', '', $plan, $current_plan); $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); $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"> <p id="nav">

View File

@ -63,8 +63,8 @@
</h3> </h3>
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][visibility]" class="wu-w-full"> <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('visible' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> 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('hidden' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
</select> </select>
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600"> <h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
@ -74,11 +74,11 @@
</h3> </h3>
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][behavior]" class="wu-w-full"> <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 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($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('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($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_inactive'); ?> value="force_inactive"><?php _e('Force Inactivate', '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($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('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($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('force_inactive_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive_locked"><?php _e('Force Inactivate & Lock', 'wp-ultimo'); ?></option>
</select> </select>
</div> </div>
@ -87,7 +87,7 @@
</div> </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"> <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'); ?> <?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]" name="modules[site_templates][limit][<?php echo esc_attr($site_template->get_id()); ?>][behavior]"
class="wu-w-full" class="wu-w-full"
> >
<option <?php selected($template_settings->behavior === 'available'); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option> <option <?php selected('available' === $template_settings->behavior); ?> 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 <?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($template_settings->behavior === 'pre_selected'); ?> value="pre_selected"><?php _e('Pre-Selected', '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> </select>
</div> </div>

View File

@ -10,7 +10,7 @@
$theme_settings = $object->get_limitations()->themes->{$theme_path}; $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; $section['state']['force_active_theme'] = $theme_path;
} // end if; } // end if;
@ -65,8 +65,8 @@
</h3> </h3>
<select name="modules[themes][limit][<?php echo esc_attr($theme_path); ?>][visibility]" class="wu-w-full"> <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('visible' === $theme_settings->visibility); ?> 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('hidden' === $theme_settings->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
</select> </select>
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600"> <h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
@ -76,16 +76,16 @@
</h3> </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"> <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('available' === $theme_settings->behavior); ?> 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 <?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($theme_settings->behavior === 'force_active'); ?> value="force_active"><?php _e('Force Activate', '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> </select>
</div> </div>
</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"> <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'); ?> <?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> </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> <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> <td class='wu-px-4 wu-py-2'> <?php echo $text_no; ?> </td>