More yoda conditions
This commit is contained in:
@ -35,6 +35,7 @@
|
||||
<exclude name="WordPress.WhiteSpace.CastStructureSpacing.NoSpaceBeforeOpenParenthesis" />
|
||||
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
|
||||
<exclude name="Universal.Arrays.DisallowShortArraySyntax" />
|
||||
<exclude name="Universal.Operators.DisallowShortTernary" />
|
||||
</rule>
|
||||
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
|
||||
<properties>
|
||||
|
@ -23,6 +23,8 @@ defined('ABSPATH') || exit;
|
||||
abstract class Base_Admin_Page {
|
||||
|
||||
/**
|
||||
* In Edit mode
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $edit;
|
||||
@ -240,7 +242,7 @@ abstract class Base_Admin_Page {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -256,7 +258,7 @@ abstract class Base_Admin_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;
|
||||
|
||||
$file = $this->highlight_menu_slug;
|
||||
@ -624,7 +626,7 @@ abstract class Base_Admin_Page {
|
||||
if (wu_get_documentation_url($this->get_id(), false)) {
|
||||
$this->action_links[] = [
|
||||
'url' => wu_get_documentation_url($this->get_id()),
|
||||
'label' => __('Documentation'),
|
||||
'label' => __('Documentation', 'wp-ultimo'),
|
||||
'icon' => 'wu-open-book',
|
||||
];
|
||||
}
|
||||
|
@ -200,9 +200,11 @@ abstract class Base_Customer_Facing_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
$this->save_page_settings($settings_to_save);
|
||||
|
||||
$referer = isset($_SERVER['HTTP_REFERER']) ? sanitize_url(wp_unslash($_SERVER['HTTP_REFERER'])) : '';
|
||||
|
||||
wp_send_json_success(
|
||||
[
|
||||
'redirect_url' => add_query_arg('updated', 1, $_SERVER['HTTP_REFERER']),
|
||||
'redirect_url' => add_query_arg('updated', 1, $referer),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1182,7 +1182,7 @@ class Checkout_Form_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
$new_fields = [];
|
||||
|
||||
foreach ($fields as $index => $field) {
|
||||
if ($field['type'] === 'header') {
|
||||
if ('header' === $field['type']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1491,7 +1491,7 @@ class Checkout_Form_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_object() {
|
||||
|
||||
if ($this->object !== null) {
|
||||
if (null !== $this->object) {
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
|
@ -451,11 +451,11 @@ class Customer_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'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';
|
||||
}
|
||||
|
||||
if ($field_data['type'] === 'image') {
|
||||
if ('image' === $field_data['type']) {
|
||||
$image_attributes = wp_get_attachment_image_src((int) $field_data['value'], 'full');
|
||||
$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() {
|
||||
|
||||
if ($this->object !== null) {
|
||||
if (null !== $this->object) {
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
@ -1108,7 +1108,7 @@ class Customer_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function handle_save(): void {
|
||||
|
||||
if ($_POST['submit_button'] === 'send_verification') {
|
||||
if ('send_verification' === $_POST['submit_button']) {
|
||||
$customer = $this->get_object();
|
||||
|
||||
$customer->send_verification_email();
|
||||
|
@ -134,7 +134,7 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($page->id === 'wp-ultimo') {
|
||||
if ('wp-ultimo' === $page->id) {
|
||||
$preset_options = [
|
||||
'last_7_days' => [
|
||||
'label' => __('Last 7 days', 'wp-ultimo'),
|
||||
|
@ -599,7 +599,7 @@ class Discount_Code_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_object() {
|
||||
|
||||
if ($this->object !== null) {
|
||||
if (null !== $this->object) {
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ class Domain_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_object() {
|
||||
|
||||
if ($this->object !== null) {
|
||||
if (null !== $this->object) {
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_errors() {
|
||||
|
||||
if ($this->errors === null) {
|
||||
if (null === $this->errors) {
|
||||
$this->errors = new \WP_Error();
|
||||
}
|
||||
|
||||
@ -850,7 +850,7 @@ abstract class Edit_Admin_Page extends Base_Admin_Page {
|
||||
'updated' => 1,
|
||||
];
|
||||
|
||||
if ($this->edit === false) {
|
||||
if (false === $this->edit) {
|
||||
$array_params['id'] = $object->get_id();
|
||||
|
||||
$array_params['wu-new-model'] = true;
|
||||
|
@ -1073,7 +1073,7 @@ class Membership_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_object() {
|
||||
|
||||
if ($this->object !== null) {
|
||||
if (null !== $this->object) {
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
@ -1156,7 +1156,7 @@ class Membership_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'updated' => 1,
|
||||
];
|
||||
|
||||
if ($this->edit === false) {
|
||||
if (false === $this->edit) {
|
||||
$array_params['id'] = $object->get_id();
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ class Product_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_object() {
|
||||
|
||||
if ($this->object !== null) {
|
||||
if (null !== $this->object) {
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ class Setup_Wizard_Admin_Page extends Wizard_Admin_Page {
|
||||
*/
|
||||
public function is_migration() {
|
||||
|
||||
if ($this->is_migration === null) {
|
||||
if (null === $this->is_migration) {
|
||||
$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 {
|
||||
|
||||
if ($_POST['submit'] === '1') {
|
||||
if ('1' === $_POST['submit']) {
|
||||
$this->integration->setup_constants($_POST);
|
||||
|
||||
$redirect_url = $this->get_next_section_link();
|
||||
|
@ -150,7 +150,7 @@ class Shortcodes_Admin_Page extends Base_Admin_Page {
|
||||
foreach ($elements as $element) {
|
||||
$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) {
|
||||
$params[ $key ]['default'] = wu_get_isset($defaults, $key, '');
|
||||
|
@ -720,7 +720,7 @@ class Site_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
*/
|
||||
public function get_object() {
|
||||
|
||||
if ($this->object !== null) {
|
||||
if (null !== $this->object) {
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ class Webhook_Edit_Admin_Page extends Edit_Admin_Page {
|
||||
'updated' => 1,
|
||||
];
|
||||
|
||||
if ($this->edit === false) {
|
||||
if (false === $this->edit) {
|
||||
$array_params['id'] = $object->get_id();
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ class Add_New_Site_Admin_Page extends Base_Customer_Facing_Admin_Page {
|
||||
*/
|
||||
public function force_screen_options(): void {
|
||||
|
||||
if (get_current_screen()->id !== 'toplevel_page_sites') {
|
||||
if ('toplevel_page_sites' !== get_current_screen()->id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ class Block_Editor_Widget_Manager {
|
||||
* Deal with the group type.
|
||||
* On those, we need to loop the sub-fields.
|
||||
*/
|
||||
if ($field['type'] === 'group') {
|
||||
if ('group' === $field['type']) {
|
||||
foreach ($field['fields'] as &$sub_field) {
|
||||
foreach ($sub_field as $sub_item => &$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) {
|
||||
$type = 'string';
|
||||
|
||||
if ($field['type'] === 'toggle') {
|
||||
if ('toggle' === $field['type']) {
|
||||
$type = 'boolean';
|
||||
}
|
||||
|
||||
if ($field['type'] === 'number') {
|
||||
if ('number' === $field['type']) {
|
||||
$type = 'integer';
|
||||
}
|
||||
|
||||
|
@ -626,7 +626,7 @@ class Cart implements \JsonSerializable {
|
||||
$product = $line_item->get_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);
|
||||
|
||||
/*
|
||||
@ -876,7 +876,7 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
@ -934,7 +934,7 @@ class Cart implements \JsonSerializable {
|
||||
* We'll probably never enter in this if, but we
|
||||
* 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->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();
|
||||
$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
|
||||
@ -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);
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
if ( ! $product) {
|
||||
@ -1576,7 +1576,7 @@ class Cart implements \JsonSerializable {
|
||||
* the cart.
|
||||
*/
|
||||
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);
|
||||
|
||||
if ($price_variation) {
|
||||
@ -2614,7 +2614,7 @@ class Cart implements \JsonSerializable {
|
||||
*/
|
||||
public function should_auto_renew() {
|
||||
|
||||
return $this->auto_renew === 'yes' || $this->auto_renew === true;
|
||||
return 'yes' === $this->auto_renew || true === $this->auto_renew;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -437,7 +437,7 @@ class Checkout_Pages {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ('POST' === $_SERVER['REQUEST_METHOD']) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ class Checkout {
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
@ -1434,7 +1434,7 @@ class Checkout {
|
||||
* to handle the status here as the payment is not
|
||||
* 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;
|
||||
}
|
||||
|
||||
@ -1570,7 +1570,7 @@ class Checkout {
|
||||
if (empty($duration) && $this->steps) {
|
||||
foreach ($this->steps as $step) {
|
||||
foreach ($step['fields'] as $field) {
|
||||
if ($field['type'] === 'period_selection') {
|
||||
if ('period_selection' === $field['type']) {
|
||||
$duration = $field['period_options'][0]['duration'];
|
||||
$duration_unit = $field['period_options'][0]['duration_unit'];
|
||||
|
||||
@ -1723,7 +1723,7 @@ class Checkout {
|
||||
/*
|
||||
* 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
|
||||
$rules['site_title'] = 'min:4';
|
||||
@ -2293,7 +2293,7 @@ class Checkout {
|
||||
|
||||
$value = $default;
|
||||
|
||||
if ($this->session !== null) {
|
||||
if (null !== $this->session) {
|
||||
$session = $this->session->get('signup');
|
||||
|
||||
if (isset($session[ $key ])) {
|
||||
@ -2348,7 +2348,7 @@ class Checkout {
|
||||
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 $this->step_name === array_pop($step_names);
|
||||
return array_pop($step_names) === $this->step_name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +247,7 @@ class Legacy_Checkout {
|
||||
wp_add_inline_style('legacy-signup', $this->get_legacy_dynamic_styles());
|
||||
|
||||
// Do not get the login if the first step
|
||||
if ($this->step != 'plan') {
|
||||
if ('plan' != $this->step) {
|
||||
|
||||
wp_enqueue_style('login');
|
||||
|
||||
@ -577,7 +577,7 @@ class Legacy_Checkout {
|
||||
/**
|
||||
* Set the errors
|
||||
*/
|
||||
if ($this->results === null) {
|
||||
if (null === $this->results) {
|
||||
$this->results = ['errors' => new \WP_Error()];
|
||||
}
|
||||
|
||||
@ -979,7 +979,7 @@ class Legacy_Checkout {
|
||||
$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($params['skip_plan']);
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ class Line_Item implements \JsonSerializable {
|
||||
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);
|
||||
|
||||
/*
|
||||
|
@ -215,7 +215,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
/*
|
||||
* Backwards compatibility with previous betas
|
||||
*/
|
||||
if ($attributes['order_summary_template'] === 'simple') {
|
||||
if ('simple' === $attributes['order_summary_template']) {
|
||||
$attributes['order_summary_template'] = 'clean';
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Ajax {
|
||||
/*
|
||||
* Deal with site
|
||||
*/
|
||||
if ($args['model'] === 'site') {
|
||||
if ('site' === $args['model']) {
|
||||
if (wu_get_isset($query, 'id__in')) {
|
||||
$query['blog_id__in'] = $query['id__in'];
|
||||
|
||||
@ -154,9 +154,9 @@ class Ajax {
|
||||
|
||||
$results = [];
|
||||
|
||||
if ($args['model'] === 'user') {
|
||||
if ('user' === $args['model']) {
|
||||
$results = $this->search_wordpress_users($query);
|
||||
} elseif ($args['model'] === 'page') {
|
||||
} elseif ('page' === $args['model']) {
|
||||
$results = get_posts(
|
||||
[
|
||||
'post_type' => 'page',
|
||||
@ -165,7 +165,7 @@ class Ajax {
|
||||
'exclude' => $query['id__not_in'] ?? '',
|
||||
]
|
||||
);
|
||||
} elseif ($args['model'] === 'setting') {
|
||||
} elseif ('setting' === $args['model']) {
|
||||
$results = $this->search_wp_ultimo_setting($query);
|
||||
} else {
|
||||
$model_func = 'wu_get_' . strtolower((string) $args['model']) . 's';
|
||||
|
@ -33,22 +33,23 @@ class Async_Calls {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
static $registry = [];
|
||||
public static $registry = [];
|
||||
|
||||
/**
|
||||
* Registers a new listener.
|
||||
*
|
||||
* @since 2.0.7
|
||||
*
|
||||
* @param string $id The id of the listener.
|
||||
* @param callable $callable A callback to be run.
|
||||
* @param callable $callback A callback to be run.
|
||||
* @param mixed ...$args Arguments to be passed to the callback.
|
||||
*
|
||||
* @return void
|
||||
*@since 2.0.7
|
||||
*
|
||||
*/
|
||||
public static function register_listener($id, $callable, ...$args): void {
|
||||
public static function register_listener($id, $callback, ...$args): void {
|
||||
|
||||
self::$registry[ $id ] = [
|
||||
'callable' => $callable,
|
||||
'callable' => $callback,
|
||||
'args' => $args,
|
||||
];
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ class Autoloader {
|
||||
* @return boolean
|
||||
*/
|
||||
public static function is_debug() {
|
||||
|
||||
return false; // return wu_is_debug();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class Domain_Mapping {
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class Session_Cookie implements Session {
|
||||
public function __construct($realm_name) {
|
||||
|
||||
$this->realm_name = $realm_name;
|
||||
if ($this->loaded === true) {
|
||||
if (true === $this->loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ class Settings {
|
||||
$this->settings = wu_get_option(self::KEY);
|
||||
}
|
||||
|
||||
if ($this->settings === false || empty($this->settings)) {
|
||||
if (false === $this->settings || empty($this->settings)) {
|
||||
if ( ! $this->saving) {
|
||||
$this->saving = true;
|
||||
$this->settings = $this->save_settings([], true);
|
||||
@ -249,7 +249,7 @@ class Settings {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ class Settings {
|
||||
/*
|
||||
* 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']);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class Whitelabel {
|
||||
*/
|
||||
public function replace_text($translation, $text, $domain) {
|
||||
|
||||
if ($this->allowed_domains === null) {
|
||||
if (null === $this->allowed_domains) {
|
||||
$this->allowed_domains = apply_filters(
|
||||
'wu_replace_text_allowed_domains',
|
||||
[
|
||||
@ -148,7 +148,7 @@ class Whitelabel {
|
||||
return $translation;
|
||||
}
|
||||
|
||||
if ($this->init === false) {
|
||||
if (false === $this->init) {
|
||||
$search_and_replace = [];
|
||||
|
||||
$site_plural = wu_get_setting('rename_site_plural');
|
||||
@ -343,7 +343,7 @@ class Whitelabel {
|
||||
$index = '';
|
||||
|
||||
foreach ($menu as $i => $menu_item) {
|
||||
if ($menu_item[2] === 'sites.php') {
|
||||
if ('sites.php' === $menu_item[2]) {
|
||||
$index = $i;
|
||||
|
||||
continue;
|
||||
|
@ -314,7 +314,7 @@ class Legacy_Shortcodes {
|
||||
/**
|
||||
* 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_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');
|
||||
|
||||
$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();
|
||||
|
||||
@ -504,7 +504,7 @@ class Legacy_Shortcodes {
|
||||
/**
|
||||
* 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_add_inline_style('legacy-signup', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
|
||||
|
@ -62,7 +62,7 @@ abstract class Table extends \BerlinDB\Database\Table {
|
||||
*/
|
||||
public function exists() {
|
||||
|
||||
if ($this->_exists === null) {
|
||||
if (null === $this->_exists) {
|
||||
$this->_exists = parent::exists();
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Primary_Domain {
|
||||
|
||||
$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();
|
||||
|
||||
$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 {
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'GET' || wp_doing_ajax()) {
|
||||
if ('GET' !== $_SERVER['REQUEST_METHOD'] || wp_doing_ajax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ if ( ! class_exists('MUCD_Data') ) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ if ( ! class_exists('MUCD_Duplicate') ) {
|
||||
*/
|
||||
public static function init_log($data): void {
|
||||
// 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'])) {
|
||||
$log_name = @date('Y_m_d_His') . '-' . $data['domain'] . '.log';
|
||||
if (! str_ends_with((string) $data['log-path'], '/')) {
|
||||
|
@ -139,7 +139,7 @@ if ( ! class_exists('MUCD_Log') ) {
|
||||
* @return boolean True on success, False on failure
|
||||
*/
|
||||
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]');
|
||||
fwrite($this->fp, "$time $message" . "\r\n");
|
||||
return true;
|
||||
|
@ -185,11 +185,11 @@ function wu_is_form_field_pre_selected($field_slug) {
|
||||
*/
|
||||
function wu_form_field_request_arg($field) {
|
||||
|
||||
if ($field['type'] === 'template_selection') {
|
||||
if ('template_selection' === $field['type']) {
|
||||
return 'template_id';
|
||||
}
|
||||
|
||||
if ($field['type'] === 'pricing_table') {
|
||||
if ('pricing_table' === $field['type']) {
|
||||
return 'products';
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ function wu_path_join(...$parts): string {
|
||||
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));
|
||||
|
||||
|
@ -30,7 +30,7 @@ function wu_guess_registration_page() {
|
||||
|
||||
$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);
|
||||
|
||||
function_exists('flush_rewrite_rules') && flush_rewrite_rules(true);
|
||||
|
@ -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;
|
||||
} else {
|
||||
$results[1][] = $product;
|
||||
|
@ -608,7 +608,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
* If already exists, checks for status
|
||||
*/
|
||||
if ($existing_webhook) {
|
||||
if ($existing_webhook->status === 'disabled') {
|
||||
if ('disabled' === $existing_webhook->status) {
|
||||
$status = Stripe\WebhookEndpoint::update(
|
||||
$existing_webhook->id,
|
||||
[
|
||||
@ -1779,7 +1779,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
try {
|
||||
$subscription = Stripe\Subscription::retrieve($subscription_id);
|
||||
|
||||
if ($subscription->status !== 'canceled') {
|
||||
if ('canceled' !== $subscription->status) {
|
||||
$subscription->cancel();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@ -2054,7 +2054,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
|
||||
@ -2064,7 +2064,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
* On Stripe Checkout, we rely entirely on
|
||||
* 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_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!
|
||||
*/
|
||||
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
|
||||
* events due subscriptions with trials and we need
|
||||
@ -2092,7 +2092,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
'gateway' => $this->get_id(),
|
||||
];
|
||||
|
||||
if ($event->type === 'charge.succeeded') {
|
||||
if ('charge.succeeded' === $event->type) {
|
||||
/*
|
||||
* Successful one-time payment
|
||||
*/
|
||||
@ -2178,7 +2178,7 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
$pending_payment->attributes($payment_data);
|
||||
|
||||
$payment = $pending_payment;
|
||||
} elseif ($event->type === 'charge.succeeded') {
|
||||
} elseif ('charge.succeeded' === $event->type) {
|
||||
/**
|
||||
* These must be retrieved after the status
|
||||
* 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;
|
||||
|
||||
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');
|
||||
|
||||
$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!
|
||||
*/
|
||||
if ($event->type === 'charge.refunded') {
|
||||
if ('charge.refunded' === $event->type) {
|
||||
$payment_data = [
|
||||
'gateway' => 'stripe',
|
||||
];
|
||||
@ -2352,11 +2352,11 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
/*
|
||||
* Failed payments.
|
||||
*/
|
||||
if ($event->type === 'invoice.payment_failed') {
|
||||
if ('invoice.payment_failed' === $event->type) {
|
||||
$this->webhook_event_id = $event->id;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -2368,10 +2368,10 @@ class Base_Stripe_Gateway extends Base_Gateway {
|
||||
/*
|
||||
* 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.');
|
||||
|
||||
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,
|
||||
* we can skip any cancellation actions.
|
||||
|
@ -41,18 +41,19 @@ class Arr {
|
||||
/**
|
||||
* Filter an array by property or key.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*
|
||||
* @param array $array The array to filter.
|
||||
* @param array $array_to_filter The array to filter.
|
||||
* @param string $property The property to filter by. Dot notation is supported.
|
||||
* @param mixed $expected_value The expected value to filter by.
|
||||
* @param integer $flag The flag determining the return type.
|
||||
*
|
||||
* @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(
|
||||
$array,
|
||||
$array_to_filter,
|
||||
function ($value) use ($property, $expected_value) {
|
||||
|
||||
return Arr::get($value, $property, null) == $expected_value; // phpcs:ignore
|
||||
@ -69,18 +70,19 @@ class Arr {
|
||||
/**
|
||||
* Filters an array using a callback.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*
|
||||
* @param array $array The array to search inside.
|
||||
* @param array $array_to_search The array to search inside.
|
||||
* @param callable $closure The closure function to call.
|
||||
*
|
||||
* @return array
|
||||
*@since 2.0.11
|
||||
*
|
||||
*/
|
||||
public static function filter($array, $closure) {
|
||||
public static function filter($array_to_search, $closure) {
|
||||
|
||||
if ($closure) {
|
||||
$result = [];
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
foreach ($array_to_search as $key => $value) {
|
||||
if (call_user_func($closure, $value, $key)) {
|
||||
$result[] = $value;
|
||||
}
|
||||
@ -89,71 +91,74 @@ class Arr {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return array_filter($array);
|
||||
return array_filter($array_to_search);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a nested value inside an array. Dot notation is supported.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*
|
||||
* @param array $array The array to get the value from.
|
||||
* @param array $array_target The array to get the value from.
|
||||
* @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.
|
||||
*
|
||||
* @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)) {
|
||||
return $array;
|
||||
return $array_target;
|
||||
}
|
||||
|
||||
if (isset($array[ $key ])) {
|
||||
return $array[ $key ];
|
||||
if (isset($array_target[ $key ])) {
|
||||
return $array_target[ $key ];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$array = $array[ $segment ];
|
||||
$array_target = $array_target[ $segment ];
|
||||
}
|
||||
|
||||
return $array;
|
||||
return $array_target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a nested value inside an array. Dot notation is supported.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*
|
||||
* @param array $array The array to modify.
|
||||
* @param array $array_to_modify The array to modify.
|
||||
* @param string $key The array key to set. Supports dot notation.
|
||||
* @param mixed $value The value to set.
|
||||
*
|
||||
* @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)) {
|
||||
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);
|
||||
|
||||
if ( ! isset($array[ $key ]) || ! is_array($array[ $key ])) {
|
||||
$array[ $key ] = [];
|
||||
if ( ! isset($array_to_modify[ $key ]) || ! is_array($array_to_modify[ $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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ class Base_Installer {
|
||||
$all_done = true;
|
||||
|
||||
foreach ($this->get_steps() as $step) {
|
||||
if ($step['done'] === false) {
|
||||
if (false === $step['done']) {
|
||||
$all_done = false;
|
||||
}
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ class Migrator extends Base_Installer {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
if ($this->settings !== null) {
|
||||
if (null !== $this->settings) {
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
@ -1662,7 +1662,7 @@ class Migrator extends Base_Installer {
|
||||
if ($subscription->gateway) {
|
||||
$membership_data['gateway'] = $subscription->gateway;
|
||||
|
||||
if ($subscription->gateway === 'stripe') {
|
||||
if ('stripe' === $subscription->gateway) {
|
||||
|
||||
/**
|
||||
* Case Stripe.
|
||||
@ -1672,7 +1672,7 @@ class Migrator extends Base_Installer {
|
||||
*/
|
||||
$membership_data['gateway_customer_id'] = $subscription->integration_key;
|
||||
$membership_data['gateway_subscription_id'] = $v1_subscription_meta->subscription_id;
|
||||
} elseif ($subscription->gateway === 'paypal') {
|
||||
} elseif ('paypal' === $subscription->gateway) {
|
||||
|
||||
/**
|
||||
* Case PayPal.
|
||||
|
@ -241,7 +241,7 @@ class CPanel_Host_Provider extends Base_Host_Provider {
|
||||
*/
|
||||
public function load_api() {
|
||||
|
||||
if ($this->api === null) {
|
||||
if (null === $this->api) {
|
||||
$username = defined('WU_CPANEL_USERNAME') ? WU_CPANEL_USERNAME : '';
|
||||
$password = defined('WU_CPANEL_PASSWORD') ? WU_CPANEL_PASSWORD : '';
|
||||
$host = defined('WU_CPANEL_HOST') ? WU_CPANEL_HOST : '';
|
||||
|
@ -243,7 +243,7 @@ class CPanel_API {
|
||||
|
||||
$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->homepage = $this->get_base_url() . $reply['redirect'];
|
||||
|
@ -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'));
|
||||
|
||||
if ($this->return_type === 'json') {
|
||||
if ('json' === $this->return_type) {
|
||||
wp_send_json_error(
|
||||
[
|
||||
'message' => $message,
|
||||
|
@ -71,6 +71,6 @@ class Limit_Customer_User_Role extends Limit {
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
@ -45,13 +45,13 @@ class Limit_Plugins extends Limit {
|
||||
$plugin = (object) $this->{$value_to_check};
|
||||
|
||||
$types = [
|
||||
'visible' => $plugin->visibility === 'visible',
|
||||
'hidden' => $plugin->visibility === 'hidden',
|
||||
'default' => $plugin->behavior === 'default',
|
||||
'force_active' => $plugin->behavior === 'force_active',
|
||||
'force_inactive' => $plugin->behavior === 'force_inactive',
|
||||
'force_active_locked' => $plugin->behavior === 'force_active_locked',
|
||||
'force_inactive_locked' => $plugin->behavior === 'force_inactive_locked',
|
||||
'visible' => 'visible' === $plugin->visibility,
|
||||
'hidden' => 'hidden' === $plugin->visibility,
|
||||
'default' => 'default' === $plugin->behavior,
|
||||
'force_active' => 'force_active' === $plugin->behavior,
|
||||
'force_inactive' => 'force_inactive' === $plugin->behavior,
|
||||
'force_active_locked' => 'force_active_locked' === $plugin->behavior,
|
||||
'force_inactive_locked' => 'force_inactive_locked' === $plugin->behavior,
|
||||
];
|
||||
|
||||
return wu_get_isset($types, $type, false);
|
||||
|
@ -87,9 +87,9 @@ class Limit_Site_Templates extends Limit {
|
||||
$template = (object) $this->{$value_to_check};
|
||||
|
||||
$types = [
|
||||
'available' => $template->behavior === 'available',
|
||||
'not_available' => $template->behavior === 'not_available',
|
||||
'pre_selected' => $template->behavior === 'pre_selected',
|
||||
'available' => 'available' === $template->behavior,
|
||||
'not_available' => 'not_available' === $template->behavior,
|
||||
'pre_selected' => 'pre_selected' === $template->behavior,
|
||||
];
|
||||
|
||||
return wu_get_isset($types, $type, true);
|
||||
@ -178,7 +178,7 @@ class Limit_Site_Templates extends Limit {
|
||||
foreach ($limits as $site_id => $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;
|
||||
}
|
||||
}
|
||||
@ -205,7 +205,7 @@ class Limit_Site_Templates extends Limit {
|
||||
foreach ($limits as $site_id => $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;
|
||||
}
|
||||
}
|
||||
|
@ -53,10 +53,10 @@ class Limit_Themes extends Limit {
|
||||
$theme = (object) $this->{$value_to_check};
|
||||
|
||||
$types = [
|
||||
'visible' => $theme->visibility === 'visible',
|
||||
'hidden' => $theme->visibility === 'hidden',
|
||||
'available' => $theme->behavior === 'available',
|
||||
'not_available' => $theme->behavior === 'not_available',
|
||||
'visible' => 'visible' === $theme->visibility,
|
||||
'hidden' => 'hidden' === $theme->visibility,
|
||||
'available' => 'available' === $theme->behavior,
|
||||
'not_available' => 'not_available' === $theme->behavior,
|
||||
];
|
||||
|
||||
return wu_get_isset($types, $type, false);
|
||||
@ -136,7 +136,7 @@ class Limit_Themes extends Limit {
|
||||
foreach ($limits as $theme_slug => $theme_settings) {
|
||||
$theme_settings = (object) $theme_settings;
|
||||
|
||||
if ($theme_settings->behavior === 'available') {
|
||||
if ('available' === $theme_settings->behavior) {
|
||||
$available[] = $theme_slug;
|
||||
}
|
||||
}
|
||||
@ -160,14 +160,14 @@ class Limit_Themes extends Limit {
|
||||
return $active_theme;
|
||||
}
|
||||
|
||||
if ($this->forced_active_theme !== null) {
|
||||
if (null !== $this->forced_active_theme) {
|
||||
return $this->forced_active_theme;
|
||||
}
|
||||
|
||||
foreach ($limits as $theme_slug => $theme_settings) {
|
||||
$theme_settings = (object) $theme_settings;
|
||||
|
||||
if ($theme_settings->behavior === 'force_active') {
|
||||
if ('force_active' === $theme_settings->behavior) {
|
||||
$active_theme = $theme_slug;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class Customer_User_Role_Limits {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( ! $screen || $screen->id !== 'user') {
|
||||
if ( ! $screen || 'user' !== $screen->id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ class Post_Type_Limits {
|
||||
*/
|
||||
public function limit_restoring(): void {
|
||||
|
||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] === 'untrash') {
|
||||
if (isset($_REQUEST['action']) && 'untrash' === $_REQUEST['action']) {
|
||||
$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;
|
||||
}
|
||||
|
||||
@ -208,10 +208,10 @@ class Post_Type_Limits {
|
||||
$quota = wu_get_current_site()->get_limitations()->post_types->attachment->number;
|
||||
|
||||
// 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']);
|
||||
|
||||
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']}";
|
||||
|
||||
return $file;
|
||||
|
@ -330,7 +330,7 @@ class Theme_Limits {
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ class Theme_Limits {
|
||||
*/
|
||||
protected function get_forced_theme_template() {
|
||||
|
||||
if ($this->forced_theme_template === null) {
|
||||
if (null === $this->forced_theme_template) {
|
||||
$stylesheet = $this->get_forced_theme_stylesheet();
|
||||
|
||||
$this->forced_theme_template = $stylesheet ? wp_get_theme($stylesheet)->get_template() : false;
|
||||
|
@ -168,7 +168,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
protected function extra_tablenav($which) {
|
||||
|
||||
if ($this->current_mode === 'grid') {
|
||||
if ('grid' === $this->current_mode) {
|
||||
printf(
|
||||
'<button id="cb-select-all-grid" v-on:click.prevent="select_all" class="button">%s</button>',
|
||||
__('Select All', 'wp-ultimo')
|
||||
@ -184,7 +184,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function set_list_mode(): void {
|
||||
|
||||
if ($this->context !== 'page') {
|
||||
if ('page' !== $this->context) {
|
||||
$this->current_mode = 'list';
|
||||
|
||||
return;
|
||||
@ -501,7 +501,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
/*
|
||||
* Any items at all?
|
||||
*/
|
||||
if ( ! $this->has_items() && $this->context === 'page') {
|
||||
if ( ! $this->has_items() && 'page' === $this->context) {
|
||||
echo wu_render_empty_state(
|
||||
[
|
||||
'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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
$filter_type = 'text';
|
||||
$rule = 'is';
|
||||
|
||||
if ($item->date_query === true) {
|
||||
if (true === $item->date_query) {
|
||||
$filter_type = 'date';
|
||||
$rule = 'is_after';
|
||||
} elseif (in_array(strtolower((string) $item->name), ['smallint'], true)) {
|
||||
|
@ -158,7 +158,7 @@ class Broadcast_Manager extends Base_Manager {
|
||||
);
|
||||
}
|
||||
|
||||
if ($args['type'] === 'broadcast_email') {
|
||||
if ('broadcast_email' === $args['type']) {
|
||||
$to = [];
|
||||
|
||||
$bcc = [];
|
||||
@ -272,7 +272,7 @@ class Broadcast_Manager extends Base_Manager {
|
||||
|
||||
$broadcast = new Broadcast($broadcast_data);
|
||||
|
||||
if ($args['type'] === 'broadcast_notice') {
|
||||
if ('broadcast_notice' === $args['type']) {
|
||||
$broadcast->set_notice_type($args['notice_type']);
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ class Event_Manager extends Base_Manager {
|
||||
'hidden' => false,
|
||||
];
|
||||
|
||||
$types = array_filter($types, fn($item) => $item['hidden'] === false);
|
||||
$types = array_filter($types, fn($item) => false === $item['hidden']);
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ class Field_Templates_Manager extends Base_Manager {
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ class Gateway_Manager extends Base_Manager {
|
||||
|
||||
$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;
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
}
|
||||
|
||||
@ -620,7 +620,7 @@ class Limitation_Manager {
|
||||
/*
|
||||
* 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']);
|
||||
}
|
||||
}
|
||||
@ -678,7 +678,7 @@ class Limitation_Manager {
|
||||
/*
|
||||
* Add override notice.
|
||||
*/
|
||||
if ($object->model !== 'product') {
|
||||
if ('product' !== $object->model) {
|
||||
$sections['post_types']['fields'][ "override_{$post_type_slug}" ] = $this->override_notice(
|
||||
$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());
|
||||
}
|
||||
|
||||
@ -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"]);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class Signup_Fields_Manager extends Base_Manager {
|
||||
*/
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ abstract class Base_Model implements \JsonSerializable {
|
||||
/*
|
||||
* Keeps the original.
|
||||
*/
|
||||
if ($this->_original === null) {
|
||||
if (null === $this->_original) {
|
||||
$original = get_object_vars($this);
|
||||
|
||||
unset($original['_original']);
|
||||
|
@ -125,7 +125,7 @@ class Broadcast extends Post_Base_Model {
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ class Broadcast extends Post_Base_Model {
|
||||
*/
|
||||
public function get_notice_type() {
|
||||
|
||||
if ($this->notice_type === null) {
|
||||
if (null === $this->notice_type) {
|
||||
$this->notice_type = $this->get_meta('notice_type', 'success');
|
||||
}
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ class Checkout_Form extends Base_Model {
|
||||
*/
|
||||
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', '');
|
||||
}
|
||||
|
||||
@ -1118,7 +1118,7 @@ class Checkout_Form extends Base_Model {
|
||||
*/
|
||||
public function get_conversion_snippets() {
|
||||
|
||||
if ($this->conversion_snippets === null) {
|
||||
if (null === $this->conversion_snippets) {
|
||||
$this->conversion_snippets = $this->get_meta('wu_conversion_snippets', '');
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ class Customer extends Base_Model {
|
||||
*/
|
||||
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');
|
||||
|
||||
$this->extra_information = array_filter($extra_information);
|
||||
|
@ -709,7 +709,7 @@ class Discount_Code extends Base_Model {
|
||||
*/
|
||||
public function get_allowed_products() {
|
||||
|
||||
if ($this->allowed_products === null) {
|
||||
if (null === $this->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() {
|
||||
|
||||
if ($this->limit_products === null) {
|
||||
if (null === $this->limit_products) {
|
||||
$this->limit_products = $this->get_meta('wu_limit_products', false);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ class Email extends Post_Base_Model {
|
||||
*/
|
||||
public function get_event() {
|
||||
|
||||
if ($this->event === null) {
|
||||
if (null === $this->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');
|
||||
|
||||
if ($this->style === 'use_default') {
|
||||
if ('use_default' === $this->style) {
|
||||
$this->style = wu_get_setting('email_template_type', 'html');
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ class Email extends Post_Base_Model {
|
||||
*/
|
||||
public function has_schedule() {
|
||||
|
||||
if ($this->schedule === null) {
|
||||
if (null === $this->schedule) {
|
||||
$this->schedule = $this->get_meta('wu_schedule', false);
|
||||
}
|
||||
|
||||
@ -532,7 +532,7 @@ class Email extends Post_Base_Model {
|
||||
*/
|
||||
public function get_target() {
|
||||
|
||||
if ($this->target === null) {
|
||||
if (null === $this->target) {
|
||||
$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() {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -662,7 +662,7 @@ class Email extends Post_Base_Model {
|
||||
*/
|
||||
public function is_active() {
|
||||
|
||||
if ($this->active === null) {
|
||||
if (null === $this->active) {
|
||||
$this->active = $this->get_meta('wu_active', true);
|
||||
}
|
||||
|
||||
@ -691,7 +691,7 @@ class Email extends Post_Base_Model {
|
||||
*/
|
||||
public function is_legacy() {
|
||||
|
||||
if ($this->legacy === null) {
|
||||
if (null === $this->legacy) {
|
||||
$this->legacy = $this->get_meta('wu_legacy', false);
|
||||
}
|
||||
|
||||
|
@ -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())) {
|
||||
$variation = $plan->get_as_variation($this->get_duration(), $this->get_duration_unit());
|
||||
|
||||
$plan = ($variation ? $variation : null) ?? $plan;
|
||||
$plan = ($variation ?: null) ?? $plan;
|
||||
}
|
||||
|
||||
return $plan;
|
||||
@ -1342,7 +1342,7 @@ class Membership extends Base_Model {
|
||||
*/
|
||||
public function get_discount_code() {
|
||||
|
||||
if ($this->discount_code === null) {
|
||||
if (null === $this->discount_code) {
|
||||
$this->discount_code = $this->get_meta('discount_code');
|
||||
}
|
||||
|
||||
|
@ -597,7 +597,7 @@ class Payment extends Base_Model {
|
||||
*/
|
||||
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');
|
||||
|
||||
$this->line_items = array_filter($line_items);
|
||||
@ -877,7 +877,7 @@ class Payment extends Base_Model {
|
||||
*/
|
||||
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', '');
|
||||
}
|
||||
|
||||
@ -898,11 +898,11 @@ class Payment extends Base_Model {
|
||||
|
||||
$provisional = false;
|
||||
|
||||
if ($this->invoice_number === null) {
|
||||
if (null === $this->invoice_number) {
|
||||
$this->invoice_number = $this->get_meta('wu_invoice_number');
|
||||
}
|
||||
|
||||
if ($this->invoice_number === false) {
|
||||
if (false === $this->invoice_number) {
|
||||
$provisional = true;
|
||||
|
||||
$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() {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
@ -1055,7 +1055,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
public function get_tax_category() {
|
||||
|
||||
if ($this->tax_category === null) {
|
||||
if (null === $this->tax_category) {
|
||||
$this->tax_category = $this->get_meta('tax_category', 'default');
|
||||
}
|
||||
|
||||
@ -1085,7 +1085,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
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', '');
|
||||
}
|
||||
|
||||
@ -1114,7 +1114,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
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', '');
|
||||
}
|
||||
|
||||
@ -1143,7 +1143,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
public function get_feature_list() {
|
||||
|
||||
if ($this->feature_list === null) {
|
||||
if (null === $this->feature_list) {
|
||||
$this->feature_list = $this->get_meta('feature_list');
|
||||
}
|
||||
|
||||
@ -1172,7 +1172,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
@ -1239,7 +1239,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
public function get_price_variations() {
|
||||
|
||||
if ($this->price_variations === null) {
|
||||
if (null === $this->price_variations) {
|
||||
$this->price_variations = array_map(
|
||||
function ($price_variation) {
|
||||
/**
|
||||
@ -1372,7 +1372,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
public function get_available_addons() {
|
||||
|
||||
if ($this->available_addons === null) {
|
||||
if (null === $this->available_addons) {
|
||||
$this->available_addons = $this->get_meta('wu_available_addons', []);
|
||||
|
||||
if (is_string($this->available_addons)) {
|
||||
@ -1440,7 +1440,7 @@ class Product extends Base_Model {
|
||||
*/
|
||||
public function get_legacy_options() {
|
||||
|
||||
if ($this->legacy_options === null) {
|
||||
if (null === $this->legacy_options) {
|
||||
$this->legacy_options = $this->get_meta('legacy_options', false);
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ class Site extends Base_Model {
|
||||
*/
|
||||
public function get_categories() {
|
||||
|
||||
if ($this->categories === null) {
|
||||
if (null === $this->categories) {
|
||||
$this->categories = $this->get_meta('wu_categories', []);
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ class Site extends Base_Model {
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
@ -718,7 +718,7 @@ class Site extends Base_Model {
|
||||
*/
|
||||
public function is_active() {
|
||||
|
||||
if ($this->active === null) {
|
||||
if (null === $this->active) {
|
||||
$this->active = $this->get_meta('wu_active', true);
|
||||
}
|
||||
|
||||
@ -885,7 +885,7 @@ class Site extends Base_Model {
|
||||
*/
|
||||
public function get_customer_id() {
|
||||
|
||||
if ($this->customer_id === null) {
|
||||
if (null === $this->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() {
|
||||
|
||||
if ($this->membership_id === null) {
|
||||
if (null === $this->membership_id) {
|
||||
$this->membership_id = $this->get_meta('wu_membership_id');
|
||||
}
|
||||
|
||||
@ -1001,7 +1001,7 @@ class Site extends Base_Model {
|
||||
*/
|
||||
public function get_membership() {
|
||||
|
||||
if ($this->_membership !== null) {
|
||||
if (null !== $this->_membership) {
|
||||
return $this->_membership;
|
||||
}
|
||||
|
||||
@ -1057,7 +1057,7 @@ class Site extends Base_Model {
|
||||
*/
|
||||
public function get_template_id() {
|
||||
|
||||
if ($this->template_id === null) {
|
||||
if (null === $this->template_id) {
|
||||
$this->template_id = $this->get_meta('wu_template_id');
|
||||
}
|
||||
|
||||
@ -1152,7 +1152,7 @@ class Site extends Base_Model {
|
||||
return 'main';
|
||||
}
|
||||
|
||||
if ($this->type === null) {
|
||||
if (null === $this->type) {
|
||||
$type = $this->get_meta('wu_type');
|
||||
|
||||
$this->type = $type ?: 'default';
|
||||
@ -1267,7 +1267,7 @@ class Site extends Base_Model {
|
||||
|
||||
$details = get_blog_details($this->get_blog_id());
|
||||
|
||||
if ($details && $this->title === null) {
|
||||
if ($details && null === $this->title) {
|
||||
$this->set_title($details->blogname);
|
||||
}
|
||||
|
||||
@ -1289,7 +1289,7 @@ class Site extends Base_Model {
|
||||
*/
|
||||
public function get_transient() {
|
||||
|
||||
if ($this->transient === null) {
|
||||
if (null === $this->transient) {
|
||||
$this->transient = $this->get_meta('wu_transient');
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ trait Billable {
|
||||
*/
|
||||
public function get_billing_address() {
|
||||
|
||||
if ($this->billing_address === null) {
|
||||
if (null === $this->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();
|
||||
|
@ -159,9 +159,9 @@ trait Limitable {
|
||||
|
||||
$sites = [];
|
||||
|
||||
if ($this->model === 'site') {
|
||||
if ('site' === $this->model) {
|
||||
$sites[] = $this;
|
||||
} elseif ($this->model === 'membership') {
|
||||
} elseif ('membership' === $this->model) {
|
||||
$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.
|
||||
*/
|
||||
$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());
|
||||
} else {
|
||||
$limitations = $modules_to_save;
|
||||
@ -264,15 +264,15 @@ trait Limitable {
|
||||
*/
|
||||
public function get_applicable_product_slugs() {
|
||||
|
||||
if ($this->model === 'product') {
|
||||
if ('product' === $this->model) {
|
||||
return [$this->get_slug()];
|
||||
}
|
||||
|
||||
$slugs = [];
|
||||
|
||||
if ($this->model === 'membership') {
|
||||
if ('membership' === $this->model) {
|
||||
$membership = $this;
|
||||
} elseif ($this->model === 'site') {
|
||||
} elseif ('site' === $this->model) {
|
||||
$membership = $this->get_membership();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ trait Notable {
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ trait WP_Ultimo_Plan_Deprecated {
|
||||
*/
|
||||
public function is_featured_plan() {
|
||||
|
||||
if ($this->featured_plan === null) {
|
||||
if (null === $this->featured_plan) {
|
||||
$this->featured_plan = $this->get_meta('featured_plan', false);
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ abstract class Base_Element {
|
||||
|
||||
$should_load = false;
|
||||
|
||||
if ($block['blockName'] === $this->get_id()) {
|
||||
if ($this->get_id() === $block['blockName']) {
|
||||
$should_load = true;
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ abstract class Base_Element {
|
||||
*/
|
||||
public function setup_for_admin(): void {
|
||||
|
||||
if ($this->loaded === true) {
|
||||
if (true === $this->loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ abstract class Base_Element {
|
||||
$block_content = parse_blocks($content);
|
||||
|
||||
foreach ($block_content as $block) {
|
||||
if ($block['blockName'] === $this->get_id()) {
|
||||
if ($this->get_id() === $block['blockName']) {
|
||||
return $block['attrs'];
|
||||
}
|
||||
}
|
||||
@ -613,7 +613,7 @@ abstract class Base_Element {
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -682,7 +682,7 @@ abstract class Base_Element {
|
||||
$state = [];
|
||||
|
||||
foreach ($fields as $field_slug => &$field) {
|
||||
if ($field['type'] === 'header' || $field['type'] === 'note') {
|
||||
if ('header' === $field['type'] || 'note' === $field['type']) {
|
||||
unset($fields[ $field_slug ]);
|
||||
|
||||
continue;
|
||||
@ -697,7 +697,7 @@ abstract class Base_Element {
|
||||
*/
|
||||
$additional_state = [];
|
||||
|
||||
if ($field['type'] === 'group') {
|
||||
if ('group' === $field['type']) {
|
||||
foreach ($field['fields'] as $sub_field_slug => &$sub_field) {
|
||||
$sub_field['html_attr'] = [
|
||||
'v-model.lazy' => "attributes.{$sub_field_slug}",
|
||||
@ -810,7 +810,7 @@ abstract class Base_Element {
|
||||
$state = array_merge($defaults, $saved_settings);
|
||||
|
||||
foreach ($fields as $field_slug => &$field) {
|
||||
if ($field['type'] === 'header') {
|
||||
if ('header' === $field['type']) {
|
||||
unset($fields[ $field_slug ]);
|
||||
|
||||
continue;
|
||||
@ -886,7 +886,7 @@ abstract class Base_Element {
|
||||
foreach ($fields as $field_slug => $field) {
|
||||
$setting = wu_request($field_slug, false);
|
||||
|
||||
if (false !== $setting || $field['type'] === 'toggle') {
|
||||
if (false !== $setting || 'toggle' === $field['type']) {
|
||||
$settings[ $field_slug ] = $setting;
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class Field implements \JsonSerializable {
|
||||
/*
|
||||
* Back Compat for Select2 Fields
|
||||
*/
|
||||
if ($this->type === 'select2') {
|
||||
if ('select2' === $this->type) {
|
||||
$this->atts['html_attr']['data-selectize'] = 1;
|
||||
$this->atts['html_attr']['multiple'] = 1;
|
||||
}
|
||||
@ -247,11 +247,11 @@ class Field implements \JsonSerializable {
|
||||
$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';
|
||||
}
|
||||
|
||||
if ('type' === $att && $this->atts[ $att ] === 'tab-select') {
|
||||
if ('type' === $att && 'tab-select' === $this->atts[ $att ]) {
|
||||
$this->atts['wrapper_classes'] .= ' wu-tab-field';
|
||||
}
|
||||
|
||||
@ -402,12 +402,12 @@ class Field implements \JsonSerializable {
|
||||
|
||||
unset($this->atts['html_attr']['class']);
|
||||
|
||||
if ($this->type === 'number') {
|
||||
if ($this->min !== false) {
|
||||
if ('number' === $this->type) {
|
||||
if (false !== $this->min) {
|
||||
$attributes['min'] = $this->min;
|
||||
}
|
||||
|
||||
if ($this->max !== false) {
|
||||
if (false !== $this->max) {
|
||||
$attributes['max'] = $this->max;
|
||||
}
|
||||
}
|
||||
@ -415,7 +415,7 @@ class Field implements \JsonSerializable {
|
||||
/*
|
||||
* Adds money formatting and masking
|
||||
*/
|
||||
if ($this->money !== false) {
|
||||
if (false !== $this->money) {
|
||||
$attributes['v-bind'] = 'money_settings';
|
||||
}
|
||||
|
||||
|
@ -213,12 +213,12 @@ class Form implements \JsonSerializable {
|
||||
|
||||
unset($this->atts['html_attr']['class']);
|
||||
|
||||
if ($this->type === 'number') {
|
||||
if ($this->min !== false) {
|
||||
if ('number' === $this->type) {
|
||||
if (false !== $this->min) {
|
||||
$attributes['min'] = $this->min;
|
||||
}
|
||||
|
||||
if ($this->max !== false) {
|
||||
if (false !== $this->max) {
|
||||
$attributes['max'] = $this->max;
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ class Login_Form_Element extends Base_Element {
|
||||
/*
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
@ -749,9 +749,9 @@ class Login_Form_Element extends Base_Element {
|
||||
if (isset($_GET['redirect_to'])) {
|
||||
$atts['redirect_type'] = 'query_redirect';
|
||||
$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'];
|
||||
} elseif ($atts['redirect_type'] === 'main_site') {
|
||||
} elseif ('main_site' === $atts['redirect_type']) {
|
||||
$fields['redirect_to']['value'] = $atts['main_redirect_path'];
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ class My_Sites_Element extends Base_Element {
|
||||
$user_sites = array_reduce(
|
||||
$wp_user_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->set_membership_id(0);
|
||||
$user_sites[ $wp_site->userblog_id ] = $wu_site;
|
||||
|
@ -34,7 +34,15 @@ final class YodaConditionsRector extends AbstractRector
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
// 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
|
||||
$this->mirrorComments($node->right, $node->left);
|
||||
[$node->left, $node->right] = [$node->right, $node->left];
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Rector\Tests\TypeDeclaration\Rector\YodaConditionsRector\Fixture;
|
||||
const A_CONST = 'x';
|
||||
$arr = array('x'=>1);
|
||||
$obj = (object) $arr;
|
||||
$a = 'x';
|
||||
if ($a === 'x') {
|
||||
$a = 'xx';
|
||||
@ -21,12 +23,20 @@ if (strlen($a) === 1) {
|
||||
if ($a === 0 || $a === rand()) {
|
||||
return $a;
|
||||
}
|
||||
if ($obj->x === 1) {
|
||||
echo $obj->x;
|
||||
}
|
||||
if ($arr['x'] === 1) {
|
||||
echo $arr['x'];
|
||||
}
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\TypeDeclaration\Rector\YodaConditionsRector\Fixture;
|
||||
const A_CONST = 'x';
|
||||
$arr = array('x'=>1);
|
||||
$obj = (object) $arr;
|
||||
$a = 'x';
|
||||
if ('x' === $a) {
|
||||
$a = 'xx';
|
||||
@ -46,4 +56,10 @@ if (strlen($a) === 1) {
|
||||
if (0 === $a || rand() === $a) {
|
||||
return $a;
|
||||
}
|
||||
if (1 === $obj->x) {
|
||||
echo $obj->x;
|
||||
}
|
||||
if (1 === $arr['x']) {
|
||||
echo $arr['x'];
|
||||
}
|
||||
?>
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($field->type === 'date' || $field->date === true) : ?>
|
||||
<?php if ('date' === $field->type || true === $field->date) : ?>
|
||||
|
||||
<?php
|
||||
|
||||
|
@ -25,12 +25,12 @@
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($field->type === 'date' || $field->date === true) : ?>
|
||||
<?php if ('date' === $field->type || true === $field->date) : ?>
|
||||
|
||||
<?php
|
||||
|
||||
if (wu_validate_date($field->value)) {
|
||||
if ($field->display_value == false) {
|
||||
if (false == $field->display_value) {
|
||||
echo __('No date', 'wp-ultimo');
|
||||
} else {
|
||||
$date = $field->value;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($field->type === 'model') : ?>
|
||||
<?php if ('model' === $field->type) : ?>
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
<div class="wu-toggle">
|
||||
|
||||
<input class="wu-tgl wu-tgl-ios" value="1" <?php checked($field->value == 1); ?> id="wu-tg-<?php echo esc_attr($field->id); ?>" type="checkbox" name="<?php echo esc_attr($field_slug); ?>" <?php echo $field->get_html_attributes(); ?> />
|
||||
<input class="wu-tgl wu-tgl-ios" value="1" <?php checked(1 == $field->value); ?> id="wu-tg-<?php echo esc_attr($field->id); ?>" type="checkbox" name="<?php echo esc_attr($field_slug); ?>" <?php echo $field->get_html_attributes(); ?> />
|
||||
|
||||
<label class="wu-tgl-btn wp-ui-highlight wu-bg-blue-500" for="wu-tg-<?php echo esc_attr($field->id); ?>"></label>
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
<label class="wu-block" for="field-<?php echo esc_attr($field->id); ?>-<?php echo esc_attr($option->get_id()); ?>">
|
||||
|
||||
<input id="field-products-<?php echo esc_attr($option->get_id()); ?>" type="checkbox" name="products[]" value="<?php echo esc_attr($option->get_id()); ?>" <?php echo $field->get_html_attributes(); ?> <?php checked($field->value == $option->get_id()); ?> v-model="products">
|
||||
<input id="field-products-<?php echo esc_attr($option->get_id()); ?>" type="checkbox" name="products[]" value="<?php echo esc_attr($option->get_id()); ?>" <?php echo $field->get_html_attributes(); ?> <?php checked($option->get_id() == $field->value); ?> v-model="products">
|
||||
|
||||
<?php echo $option->get_name(); ?>
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
<div class="wu-block wu-pt-2">
|
||||
|
||||
<?php if ($user->ID !== get_current_user_id()) : ?>
|
||||
<?php if (get_current_user_id() !== $user->ID) : ?>
|
||||
|
||||
<a
|
||||
href="<?php echo \WP_Ultimo\User_Switching::get_instance()->render($user->ID); ?>"
|
||||
|
@ -62,7 +62,7 @@ $page->render_csv_button(
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $form->signup_form; ?>
|
||||
<?php if ($form->signup_form === 'by-admin') : ?>
|
||||
<?php if ('by-admin' === $form->signup_form) : ?>
|
||||
<?php echo wu_tooltip(__('Customers created via the admin panel, by super admins.', 'wp-ultimo')); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
@ -7,7 +7,7 @@
|
||||
?>
|
||||
<?php
|
||||
|
||||
if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset($_GET['step']) && $_GET['step'] == 'plan') :
|
||||
if (isset($_GET['coupon']) && wu_get_coupon($_GET['coupon']) !== false && isset($_GET['step']) && 'plan' == $_GET['step']) :
|
||||
$coupon = wu_get_coupon($_GET['coupon']);
|
||||
|
||||
?>
|
||||
|
@ -115,7 +115,7 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
|
||||
|
||||
<?php
|
||||
$button_attrubutes = apply_filters('wu_plan_select_button_attributes', '', $plan, $current_plan);
|
||||
$button_label = null != $current_plan && $current_plan->id == $plan->get_id() ? __('This is your current plan', 'wp-ultimo') : __('Select Plan', 'wp-ultimo');
|
||||
$button_label = null != $current_plan && $plan->get_id() == $current_plan->id ? __('This is your current plan', 'wp-ultimo') : __('Select Plan', 'wp-ultimo');
|
||||
$button_label = apply_filters('wu_plan_select_button_label', $button_label, $plan, $current_plan);
|
||||
?>
|
||||
|
||||
|
@ -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">
|
||||
|
||||
|
@ -63,8 +63,8 @@
|
||||
</h3>
|
||||
|
||||
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][visibility]" class="wu-w-full">
|
||||
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->visibility === 'visible'); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->visibility === 'hidden'); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('visible' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('hidden' === $object->get_limitations()->plugins->{$plugin_path}->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
|
||||
</select>
|
||||
|
||||
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
|
||||
@ -74,11 +74,11 @@
|
||||
</h3>
|
||||
|
||||
<select name="modules[plugins][limit][<?php echo esc_attr($plugin_path); ?>][behavior]" class="wu-w-full">
|
||||
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'default'); ?> value="default"><?php _e('Default', 'wp-ultimo'); ?></option>
|
||||
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_active'); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
|
||||
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_inactive'); ?> value="force_inactive"><?php _e('Force Inactivate', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_active_locked'); ?> value="force_active_locked"><?php _e('Force Activate & Lock', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected($object->get_limitations()->plugins->{$plugin_path}->behavior === 'force_inactive_locked'); ?> value="force_inactive_locked"><?php _e('Force Inactivate & Lock', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('default' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="default"><?php _e('Default', 'wp-ultimo'); ?></option>
|
||||
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_active' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
|
||||
<option <?php disabled(is_plugin_active_for_network($plugin_path)); ?> <?php selected('force_inactive' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive"><?php _e('Force Inactivate', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('force_active_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_active_locked"><?php _e('Force Activate & Lock', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('force_inactive_locked' === $object->get_limitations()->plugins->{$plugin_path}->behavior); ?> value="force_inactive_locked"><?php _e('Force Inactivate & Lock', 'wp-ultimo'); ?></option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
@ -87,7 +87,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($object->model !== 'product' && $object->get_limitations(false)->plugins->exists($plugin_path)) : ?>
|
||||
<?php if ('product' !== $object->model && $object->get_limitations(false)->plugins->exists($plugin_path)) : ?>
|
||||
|
||||
<p class="wu-m-0 wu-mt-4 wu-p-2 wu-bg-blue-100 wu-text-blue-600 wu-rounded">
|
||||
<?php _e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-ultimo'); ?>
|
||||
|
@ -61,9 +61,9 @@
|
||||
name="modules[site_templates][limit][<?php echo esc_attr($site_template->get_id()); ?>][behavior]"
|
||||
class="wu-w-full"
|
||||
>
|
||||
<option <?php selected($template_settings->behavior === 'available'); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected($template_settings->behavior === 'not_available'); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
|
||||
<option :disabled="pre_selected_template !== '' && pre_selected_template !== false && pre_selected_template != '<?php echo esc_attr($site_template->get_id()); ?>'" <?php selected($template_settings->behavior === 'pre_selected'); ?> value="pre_selected"><?php _e('Pre-Selected', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('available' === $template_settings->behavior); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('not_available' === $template_settings->behavior); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
|
||||
<option :disabled="pre_selected_template !== '' && pre_selected_template !== false && pre_selected_template != '<?php echo esc_attr($site_template->get_id()); ?>'" <?php selected('pre_selected' === $template_settings->behavior); ?> value="pre_selected"><?php _e('Pre-Selected', 'wp-ultimo'); ?></option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
$theme_settings = $object->get_limitations()->themes->{$theme_path};
|
||||
|
||||
if ($theme_settings->behavior === 'force_active') {
|
||||
if ('force_active' === $theme_settings->behavior) {
|
||||
$section['state']['force_active_theme'] = $theme_path;
|
||||
} // end if;
|
||||
|
||||
@ -65,8 +65,8 @@
|
||||
</h3>
|
||||
|
||||
<select name="modules[themes][limit][<?php echo esc_attr($theme_path); ?>][visibility]" class="wu-w-full">
|
||||
<option <?php selected($theme_settings->visibility === 'visible'); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected($theme_settings->visibility === 'hidden'); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('visible' === $theme_settings->visibility); ?> value="visible"><?php _e('Visible', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('hidden' === $theme_settings->visibility); ?> value="hidden"><?php _e('Hidden', 'wp-ultimo'); ?></option>
|
||||
</select>
|
||||
|
||||
<h3 class="wu-my-1 wu-mt-4 wu-text-2xs wu-uppercase wu-text-gray-600">
|
||||
@ -76,16 +76,16 @@
|
||||
</h3>
|
||||
|
||||
<select v-on:change="force_active_theme = ($event.target.value === 'force_active' ? '<?php echo esc_attr($theme_path); ?>' : '')" name="modules[themes][limit][<?php echo esc_attr($theme_path); ?>][behavior]" class="wu-w-full">
|
||||
<option <?php selected($theme_settings->behavior === 'available'); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected($theme_settings->behavior === 'not_available'); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
|
||||
<option :disabled="force_active_theme !== '' && force_active_theme != '<?php echo esc_attr($theme_path); ?>'" <?php selected($theme_settings->behavior === 'force_active'); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('available' === $theme_settings->behavior); ?> value="available"><?php _e('Available', 'wp-ultimo'); ?></option>
|
||||
<option <?php selected('not_available' === $theme_settings->behavior); ?> value="not_available"><?php _e('Not Available', 'wp-ultimo'); ?></option>
|
||||
<option :disabled="force_active_theme !== '' && force_active_theme != '<?php echo esc_attr($theme_path); ?>'" <?php selected('force_active' === $theme_settings->behavior); ?> value="force_active"><?php _e('Force Activate', 'wp-ultimo'); ?></option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($object->model !== 'product' && $object->get_limitations(false)->themes->exists($theme_path)) : ?>
|
||||
<?php if ('product' !== $object->model && $object->get_limitations(false)->themes->exists($theme_path)) : ?>
|
||||
|
||||
<p class="wu-m-0 wu-mt-4 wu-p-2 wu-bg-blue-100 wu-text-blue-600 wu-rounded">
|
||||
<?php _e('This value is being applied only to this entity. Changes made to the membership or product permissions will not affect this particular value.', 'wp-ultimo'); ?>
|
||||
|
@ -33,11 +33,11 @@ $text_no = '<span class="dashicons dashicons-no-alt wu-text-red-600"></span>';
|
||||
|
||||
</td>
|
||||
|
||||
<?php if ($value['value'] === 'Yes' || $value['value'] === 'Enabled') : ?>
|
||||
<?php if ('Yes' === $value['value'] || 'Enabled' === $value['value']) : ?>
|
||||
|
||||
<td class='wu-px-4 wu-py-2'> <?php echo $text_yes; ?> </td>
|
||||
|
||||
<?php elseif ($value['value'] === 'No' || $value['value'] === 'Disabled') : ?>
|
||||
<?php elseif ('No' === $value['value'] || 'Disabled' === $value['value']) : ?>
|
||||
|
||||
<td class='wu-px-4 wu-py-2'> <?php echo $text_no; ?> </td>
|
||||
|
||||
|
Reference in New Issue
Block a user