Use new code style

This commit is contained in:
David Stone
2025-02-07 19:02:33 -07:00
parent 0181024ae1
commit 8433379d90
672 changed files with 37107 additions and 45249 deletions
.phpcs.xml.distcomposer.jsonconstants.php
inc
admin-pages
class-about-admin-page.phpclass-base-admin-page.phpclass-base-customer-facing-admin-page.phpclass-broadcast-edit-admin-page.phpclass-broadcast-list-admin-page.phpclass-checkout-form-edit-admin-page.phpclass-checkout-form-list-admin-page.phpclass-customer-edit-admin-page.phpclass-customer-list-admin-page.phpclass-customizer-admin-page.phpclass-dashboard-admin-page.phpclass-discount-code-edit-admin-page.phpclass-discount-code-list-admin-page.phpclass-domain-edit-admin-page.phpclass-domain-list-admin-page.phpclass-edit-admin-page.phpclass-email-edit-admin-page.phpclass-email-list-admin-page.phpclass-email-template-customize-admin-page.phpclass-event-list-admin-page.phpclass-event-view-admin-page.phpclass-hosting-integration-wizard-admin-page.phpclass-invoice-template-customize-admin-page.phpclass-jobs-list-admin-page.phpclass-list-admin-page.phpclass-membership-edit-admin-page.phpclass-membership-list-admin-page.phpclass-migration-alert-admin-page.phpclass-payment-edit-admin-page.phpclass-payment-list-admin-page.phpclass-placeholders-admin-page.phpclass-product-edit-admin-page.phpclass-product-list-admin-page.phpclass-settings-admin-page.phpclass-setup-wizard-admin-page.phpclass-shortcodes-admin-page.phpclass-site-edit-admin-page.phpclass-site-list-admin-page.phpclass-system-info-admin-page.phpclass-tax-rates-admin-page.phpclass-template-previewer-customize-admin-page.phpclass-top-admin-nav-menu.phpclass-view-logs-admin-page.phpclass-webhook-edit-admin-page.phpclass-webhook-list-admin-page.phpclass-wizard-admin-page.php
customer-panel
debug
api
builders
checkout
class-cart.phpclass-checkout-pages.phpclass-checkout.phpclass-legacy-checkout.phpclass-line-item.php
signup-fields
class-admin-notices.phpclass-admin-themes-compatibility.phpclass-ajax.phpclass-api.phpclass-async-calls.phpclass-autoloader.phpclass-cron.phpclass-current.phpclass-dashboard-statistics.phpclass-dashboard-widgets.phpclass-documentation.phpclass-domain-mapping.phpclass-faker.phpclass-geolocation.phpclass-helper.phpclass-hooks.phpclass-license.phpclass-light-ajax.phpclass-logger.phpclass-maintenance-mode.phpclass-newsletter.phpclass-requirements.phpclass-scripts.phpclass-session-cookie.phpclass-settings.phpclass-sunrise.phpclass-user-switching.phpclass-views.phpclass-whitelabel.phpclass-wp-ultimo.php
compat
contracts
country
database
debug
deprecated
development
domain-mapping
duplication
exception
functions
gateways
helpers
installers
integrations
internal
invoices
limitations
limits
list-tables
loaders
managers
models
objects
site-templates
sso
tax
traits
ui
updater
sunrise.php
tests
uninstall.php
views
about.phpadmin-notices.php
admin-pages
base
broadcast
checkout
customers
dashboard-statistics
dashboard-widgets
domain
dynamic-styles
emails
events
invoice
legacy
limitations
memberships
payments
settings
shortcodes
sites
system-info
taxes
ui
wizards
wp-multisite-waas.php

@@ -33,8 +33,7 @@ class Site_Template_Limits {
public function init() {
add_action('plugins_loaded', array($this, 'setup'));
} // end init;
}
/**
* Sets up the hooks and checks.
@@ -49,8 +48,7 @@ class Site_Template_Limits {
add_filter('wu_checkout_template_id', array($this, 'maybe_force_template_selection'), 10, 2);
add_filter('wu_cart_get_extra_params', array($this, 'maybe_force_template_selection_on_cart'), 10, 2);
} // end setup;
}
/**
* Maybe filter the template selection options on the template selection field.
@@ -68,8 +66,7 @@ class Site_Template_Limits {
$products = array_filter($products);
if (!empty($products)) {
if ( ! empty($products)) {
$limits = new \WP_Ultimo\Objects\Limitations();
list($plan, $additional_products) = wu_segregate_products($products);
@@ -77,35 +74,25 @@ class Site_Template_Limits {
$products = array_merge(array($plan), $additional_products);
foreach ($products as $product) {
$limits = $limits->merge($product->get_limitations());
} // end foreach;
}
if ($limits->site_templates->get_mode() === 'default') {
$attributes['sites'] = wu_get_isset($attributes, 'sites', explode(',', ($attributes['template_selection_sites'] ?? '')));
return $attributes;
} elseif ($limits->site_templates->get_mode() === 'assign_template') {
$attributes['should_display'] = false;
} else {
$site_list = wu_get_isset($attributes, 'sites', explode(',', ($attributes['template_selection_sites'] ?? '')));
$available_templates = $limits->site_templates->get_available_site_templates();
$attributes['sites'] = array_intersect($site_list, $available_templates);
} // end if;
} // end if;
}
}
return $attributes;
} // end maybe_filter_template_selection_options;
}
/**
* Decides if we need to force the selection of a given template during the site creation.
@@ -119,14 +106,11 @@ class Site_Template_Limits {
public function maybe_force_template_selection($template_id, $membership) {
if ($membership && $membership->get_limitations()->site_templates->get_mode() === 'assign_template') {
$template_id = $membership->get_limitations()->site_templates->get_pre_selected_site_template();
} // end if;
}
return $template_id;
} // end maybe_force_template_selection;
}
/**
* Pre-selects a given template on the checkout screen depending on permissions.
@@ -150,26 +134,19 @@ class Site_Template_Limits {
$products = array_filter($products);
foreach ($products as $product) {
$limits = $limits->merge($product->get_limitations());
} // end foreach;
}
if ($limits->site_templates->get_mode() === 'assign_template') {
$extra['template_id'] = $limits->site_templates->get_pre_selected_site_template();
} elseif ($limits->site_templates->get_mode() === 'choose_available_templates') {
$template_id = Checkout::get_instance()->request_or_session('template_id');
$extra['template_id'] = $this->is_template_available($products, $template_id) ? $template_id : false;
} // end if;
}
return $extra;
} // end maybe_force_template_selection_on_cart;
}
/**
* Check if site template is available in current limits
@@ -182,8 +159,7 @@ class Site_Template_Limits {
$template_id = (int) $template_id;
if (!empty($products)) {
if ( ! empty($products)) {
$limits = new \WP_Ultimo\Objects\Limitations();
list($plan, $additional_products) = wu_segregate_products($products);
@@ -191,27 +167,18 @@ class Site_Template_Limits {
$products = array_merge(array($plan), $additional_products);
foreach ($products as $product) {
$limits = $limits->merge($product->get_limitations());
} // end foreach;
}
if ($limits->site_templates->get_mode() === 'assign_template') {
return $limits->site_templates->get_pre_selected_site_template() === $template_id;
} else {
$available_templates = $limits->site_templates->get_available_site_templates();
return in_array($template_id, $available_templates, true);
} // end if;
} // end if;
}
}
return true;
} // end is_template_available;
} // end class Site_Template_Limits;
}
}