Use PHP 7.4 featers and PHP 8 polyfills

This commit is contained in:
David Stone
2025-02-08 13:57:32 -07:00
parent 8bea6067cd
commit b41dc2b2eb
550 changed files with 15270 additions and 14627 deletions

View File

@ -27,11 +27,11 @@ if ( ! defined('ABSPATH')) {
<?php
$prices = array(
$prices = [
1 => __('Monthly', 'wp-ultimo'),
3 => __('Quarterly', 'wp-ultimo'),
12 => __('Yearly', 'wp-ultimo'),
);
];
$first = true;

View File

@ -30,7 +30,7 @@ if ( ! defined('ABSPATH')) {
*/
$plan_attrs = '';
foreach (array(1, 3, 12) as $type) {
foreach ([1, 3, 12] as $type) {
$price = $plan->free ? __('Free!', 'wp-ultimo') : str_replace(wu_get_currency_symbol(), '', wu_format_currency((((float) $plan->{'price_' . $type}) / $type)));
$plan_attrs .= " data-price-$type='$price'";
} // end foreach;
@ -65,7 +65,7 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
<?php else : ?>
<h5>
<?php $symbol_left = in_array(wu_get_setting('currency_position', '%s%v'), array('%s%v', '%s %v')); ?>
<?php $symbol_left = in_array(wu_get_setting('currency_position', '%s%v'), ['%s%v', '%s %v']); ?>
<?php
if ($symbol_left) :
?>
@ -88,10 +88,10 @@ $plan_attrs = apply_filters('wu_pricing_table_plan', $plan_attrs, $plan);
*
* Display quarterly and Annually plans, to be hidden
*/
$prices_total = array(
$prices_total = [
3 => __('every 3 months', 'wp-ultimo'),
12 => __('yearly', 'wp-ultimo'),
);
];
foreach ($prices_total as $freq => $string) {
$text = sprintf(__('%1$s, billed %2$s', 'wp-ultimo'), wu_format_currency($plan->{"price_$freq"}), $string);

View File

@ -96,12 +96,12 @@ if (empty($plans)) {
foreach ($plans as $plan) {
wu_get_template(
'legacy/signup/pricing-table/plan',
array(
[
'plan' => $plan,
'count' => $count,
'columns' => $columns,
'current_plan' => $current_plan,
)
]
);
} // end foreach;

View File

@ -23,23 +23,23 @@ require_once ABSPATH . 'wp-admin/includes/class-wp-screen.php';
require_once ABSPATH . 'wp-admin/includes/screen.php';
// Load the admin actions removed in WordPress 6.0
$admin_actions = array(
'admin_print_scripts' => array(
$admin_actions = [
'admin_print_scripts' => [
'print_head_scripts' => 20,
),
'admin_print_styles' => array(
],
'admin_print_styles' => [
'print_admin_styles' => 20,
),
'admin_head' => array(
],
'admin_head' => [
'wp_color_scheme_settings' => 10,
'wp_admin_canonical_url' => 10,
'wp_site_icon' => 10,
'wp_admin_viewport_meta' => 10,
),
'admin_print_footer_scripts' => array(
],
'admin_print_footer_scripts' => [
'_wp_footer_scripts' => 10,
),
);
],
];
foreach ($admin_actions as $action => $handlers) {
foreach ($handlers as $handler => $priority) {
@ -109,7 +109,7 @@ do_action('wu_checkout_scripts');
?>
<div class="wu-setup-content wu-content-<?php echo wu_request('step', isset($signup->step) ? $signup->step : 'default'); ?>">
<div class="wu-setup-content wu-content-<?php echo wu_request('step', $signup->step ?? 'default'); ?>">
<div name="loginform" id="loginform">
@ -131,7 +131,7 @@ do_action('wu_checkout_scripts');
/**
* Nav Links
*/
wu_get_template('legacy/signup/signup-nav-links', array('signup' => $signup));
wu_get_template('legacy/signup/signup-nav-links', ['signup' => $signup]);
?>
</div> <!-- /login -->
@ -140,7 +140,7 @@ do_action('wu_checkout_scripts');
/**
* Navigation Steps
*/
wu_get_template('legacy/signup/signup-steps-navigation', array('signup' => $signup));
wu_get_template('legacy/signup/signup-steps-navigation', ['signup' => $signup]);
?>
<?php

View File

@ -30,10 +30,10 @@ if ( ! defined('ABSPATH')) {
*/
$nav_links = apply_filters(
'wu_signup_form_nav_links',
array(
[
home_url() => __('Return to Home', 'wp-ultimo'),
wp_login_url() => sprintf('<strong>%s</strong>', __('Log In', 'wp-ultimo')),
)
]
);
if ( ! isset($signup->step)) {

View File

@ -31,7 +31,7 @@ if ( ! defined('ABSPATH')) {
*/
$dynamic_part = '<strong id="wu-your-site" v-html="site_url ? site_url : \'yoursite\'">';
// This is used on the yoursite.network.com during sign-up
$dynamic_part .= isset($signup->results['blogname']) ? $signup->results['blogname'] : __('yoursite', 'wp-ultimo');
$dynamic_part .= $signup->results['blogname'] ?? __('yoursite', 'wp-ultimo');
$dynamic_part .= '</strong>';
$site_url = preg_replace('#^https?://#', '', WU_Signup()->get_site_url_for_previewer());

View File

@ -21,24 +21,24 @@ if ( ! defined('ABSPATH')) {
// Get all available plans
$plans = wu_get_products(
array(
[
'type' => 'plan',
)
]
);
// Render the selector
wu_get_template(
'legacy/signup/pricing-table/pricing-table',
array(
[
'plans' => $plans,
'signup' => $signup,
'current_plan' => false,
'is_shortcode' => false,
'atts' => array(
'atts' => [
'primary_color' => '#00a1ff', // wu_get_setting('primary-color', '#00a1ff'),
'accent_color' => '#78b336', // wu_get_setting('accent-color', '#78b336'),
'default_pricing_option' => 1, // wu_get_setting('default_pricing_option', 1),
'show_selector' => true,
),
)
],
]
);