Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
* @param string $label The field label.
|
||||
*/
|
||||
|
||||
$products_to_reduce = array_merge(array(false), $products);
|
||||
$products_to_reduce = array_merge([false], $products);
|
||||
|
||||
$first_recurring_product = array_reduce(
|
||||
$products_to_reduce,
|
||||
@ -195,7 +195,7 @@ if ($first_recurring_product !== null) {
|
||||
* Price display.
|
||||
*/
|
||||
|
||||
$symbol_left = in_array(wu_get_setting('currency_position', '%s%v'), array('%s%v', '%s %v'));
|
||||
$symbol_left = in_array(wu_get_setting('currency_position', '%s%v'), ['%s%v', '%s %v']);
|
||||
|
||||
?>
|
||||
|
||||
@ -222,7 +222,7 @@ if ($first_recurring_product !== null) {
|
||||
</span>
|
||||
|
||||
<?php
|
||||
foreach (array(3, 12) as $freq) :
|
||||
foreach ([3, 12] as $freq) :
|
||||
$price_variation = $product->get_price_variation($freq, 'month');
|
||||
|
||||
if ( ! $price_variation) {
|
||||
@ -303,10 +303,10 @@ if ($first_recurring_product !== null) {
|
||||
*
|
||||
* 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) {
|
||||
$price_variation = $product->get_price_variation($freq, 'month');
|
||||
|
@ -25,13 +25,13 @@ if (isset($should_display) && ! $should_display) {
|
||||
return;
|
||||
} // end if;
|
||||
|
||||
$sites = array_map('wu_get_site', isset($sites) ? $sites : array());
|
||||
$sites = array_map('wu_get_site', $sites ?? []);
|
||||
|
||||
$categories = isset($categories) ? $categories : array();
|
||||
$categories ??= [];
|
||||
|
||||
$customer_sites_category = __('Your Sites', 'wp_ultimo');
|
||||
|
||||
$customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites) : array();
|
||||
$customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites) : [];
|
||||
|
||||
?>
|
||||
|
||||
@ -82,7 +82,7 @@ $customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites)
|
||||
|
||||
</ul>
|
||||
|
||||
<div id="wu-site-template-container-grid" class="wu-grid wu-grid-cols-1 sm:wu-grid-cols-2 md:wu-grid-cols-<?php echo isset($cols) ? $cols : '3'; ?> wu-gap-4">
|
||||
<div id="wu-site-template-container-grid" class="wu-grid wu-grid-cols-1 sm:wu-grid-cols-2 md:wu-grid-cols-<?php echo $cols ?? '3'; ?> wu-gap-4">
|
||||
|
||||
<?php foreach ($sites as $site_template) : ?>
|
||||
|
||||
@ -93,7 +93,7 @@ $customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites)
|
||||
|
||||
<?php $is_template = $site_template->get_type() === 'site_template'; ?>
|
||||
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? array($customer_sites_category) : array()); ?>
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
|
||||
<div
|
||||
id="wu-site-template-<?php echo esc_attr($site_template->get_id()); ?>"
|
||||
|
@ -22,13 +22,13 @@ if ( ! $should_display) {
|
||||
return;
|
||||
} // end if;
|
||||
|
||||
$sites = array_map('wu_get_site', isset($sites) ? $sites : array());
|
||||
$sites = array_map('wu_get_site', $sites ?? []);
|
||||
|
||||
$categories = isset($categories) ? $categories : array();
|
||||
$categories ??= [];
|
||||
|
||||
$customer_sites_category = __('Your Sites', 'wp_ultimo');
|
||||
|
||||
$customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites) : array();
|
||||
$customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites) : [];
|
||||
|
||||
?>
|
||||
|
||||
@ -181,7 +181,7 @@ $customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites)
|
||||
|
||||
<?php $is_template = $site->get_type() === 'site_template'; ?>
|
||||
|
||||
<?php $categories = array_merge($site->get_categories(), ! $is_template ? array($customer_sites_category) : array()); ?>
|
||||
<?php $categories = array_merge($site->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
|
||||
<div
|
||||
class="theme"
|
||||
|
@ -22,13 +22,13 @@ if ( ! $should_display) {
|
||||
return;
|
||||
} // end if;
|
||||
|
||||
$sites = array_map('wu_get_site', isset($sites) ? $sites : array());
|
||||
$sites = array_map('wu_get_site', $sites ?? []);
|
||||
|
||||
$categories = isset($categories) ? $categories : array();
|
||||
$categories ??= [];
|
||||
|
||||
$customer_sites_category = __('Your Sites', 'wp_ultimo');
|
||||
|
||||
$customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites) : array();
|
||||
$customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites) : [];
|
||||
|
||||
?>
|
||||
<div id="wu-site-template-container">
|
||||
@ -89,7 +89,7 @@ $customer_sites = isset($customer_sites) ? array_map('intval', $customer_sites)
|
||||
|
||||
<?php $is_template = $site_template->get_type() === 'site_template'; ?>
|
||||
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? array($customer_sites_category) : array()); ?>
|
||||
<?php $categories = array_merge($site_template->get_categories(), ! $is_template ? [$customer_sites_category] : []); ?>
|
||||
|
||||
<div
|
||||
id="wu-site-template-<?php echo esc_attr($site_template->get_id()); ?>"
|
||||
|
Reference in New Issue
Block a user