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

@ -20,7 +20,7 @@
* @since 1.8.2
*/
foreach ($page->get_title_links() as $action_link) :
$action_classes = isset($action_link['classes']) ? $action_link['classes'] : '';
$action_classes = $action_link['classes'] ?? '';
?>

View File

@ -86,10 +86,10 @@
<?php
echo wu_get_form_url(
'add_new_form_field',
array(
[
'checkout_form' => $checkout_form,
'step' => '',
)
]
);
?>
=' + step_name + '&field=' + field.id"

View File

@ -47,9 +47,9 @@
<?php
echo wu_get_form_url(
'add_new_form_step',
array(
[
'checkout_form' => $checkout_form,
)
]
);
?>
"
@ -173,10 +173,10 @@
<?php
echo wu_get_form_url(
'add_new_form_step',
array(
[
'checkout_form' => $checkout_form,
'step' => '',
)
]
);
?>
=' + step.id"
@ -195,11 +195,11 @@
<?php
echo wu_get_form_url(
'add_new_form_field',
array(
[
'checkout_form' => $checkout_form,
'width' => 600,
'step' => '',
)
]
);
?>
=' + step.id"
@ -313,9 +313,9 @@
<?php
echo wu_get_form_url(
'add_new_form_step',
array(
[
'checkout_form' => $checkout_form,
)
]
);
?>
"

View File

@ -15,10 +15,10 @@
<?php
echo get_avatar_url(
$item->get_user_id(),
array(
[
'default' => 'identicon',
'size' => 320,
)
]
);
?>
)"
@ -33,10 +33,10 @@
92,
'identicon',
'',
array(
[
'force_display' => true,
'class' => 'wu-rounded-full wu-border wu-border-solid wu-border-gray-300 wu-bg-white',
)
]
);
?>
</div>
@ -101,7 +101,7 @@
<?php
if ( ! empty($item->get_memberships())) {
?>
<a href="<?php echo wu_network_admin_url('wp-ultimo-memberships', array('customer_id' => $item->get_id())); ?>">
<a href="<?php echo wu_network_admin_url('wp-ultimo-memberships', ['customer_id' => $item->get_id()]); ?>">
<?php _e('View', 'wp-ultimo'); ?>
</a>
<?php
@ -124,9 +124,9 @@
$url_switch_to = sprintf('<a title="%s" class="%s" href="%s">%s</a>', __('Switch To', 'wp-ultimo'), $is_modal_switch_to, \WP_Ultimo\User_Switching::get_instance()->render($item->get_user_id()), __('Switch To', 'wp-ultimo'));
$actions = array(
$actions = [
'switch-to' => $item->get_user_id() !== get_current_user_id() ? $url_switch_to : __('None', 'wp-ultimo'),
);
];
echo implode('<br />', $actions);
@ -144,7 +144,7 @@
<?php _e('Select Customer', 'wp-ultimo'); ?>
</label>
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-customer', array('id' => $item->get_id())); ?>" class="button button-primary">
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-customer', ['id' => $item->get_id()]); ?>" class="button button-primary">
<?php _e('Manage', 'wp-ultimo'); ?>
</a>
</div>

View File

@ -18,7 +18,7 @@
* @since 1.8.2
*/
foreach ($page->get_title_links() as $action_link) :
$action_classes = isset($action_link['classes']) ? $action_link['classes'] : '';
$action_classes = $action_link['classes'] ?? '';
?>

View File

@ -18,9 +18,9 @@
* @since 1.8.2
*/
foreach ($page->get_title_links() as $action_link) :
$action_classes = isset($action_link['classes']) ? $action_link['classes'] : '';
$action_classes = $action_link['classes'] ?? '';
$attrs = isset($action_link['attrs']) ? $action_link['attrs'] : '';
$attrs = $action_link['attrs'] ?? '';
?>
@ -133,9 +133,9 @@
wp_editor(
html_entity_decode($content),
'content',
array(
[
'height' => 500,
)
]
);
?>

View File

@ -10,12 +10,12 @@
<?php
echo wu_render_empty_state(
array(
[
'message' => __('No notes yet.', 'wp-ultimo'),
'sub_message' => __('Use the "Add new Note" to create the first one.', 'wp-ultimo'),
'link_url' => false,
'display_background_image' => false,
)
]
);
?>
@ -44,10 +44,10 @@
20,
'identicon',
'',
array(
[
'force_display' => true,
'class' => 'wu-rounded-full wu-mr-2',
)
]
)
);
?>
@ -66,12 +66,12 @@
<?php if (current_user_can('delete_notes')) : ?>
<?php
$modal_atts = array(
$modal_atts = [
'object_id' => wu_request('id'),
'model' => $model,
'note_id' => $note->note_id,
'height' => 306,
);
];
?>
<span class="wu-ml-2">

View File

@ -7,7 +7,7 @@
?>
<div
class="wu-flex wu-justify-center wu-items-center wu-text-center wu-bg-contain wu-bg-no-repeat wu--mb-12 wu-pb-12"
style="background-image: url(<?php echo $display_background_image ? wu_get_asset('empty-state-bg.png', 'img') : ''; ?>); <?php echo $display_background_image ? 'height: calc(100vh - 300px); background-position: center -30px;' : ''; ?>"
style="background-image: url(<?php echo $display_background_image ? wu_get_asset('empty-state-bg.webp', 'img') : ''; ?>); <?php echo $display_background_image ? 'height: calc(100vh - 300px); background-position: center -30px;' : ''; ?>"
>
<div class="wu-block wu-p-4 md:wu-pt-12 wu-self-center">

View File

@ -75,7 +75,7 @@
<input
name='s' id="s"
value="<?php echo esc_attr(isset($_REQUEST['s']) ? $_REQUEST['s'] : ''); ?>"
value="<?php echo esc_attr($_REQUEST['s'] ?? ''); ?>"
placeholder="<?php echo esc_attr($search_label); ?>"
type="search"
aria-describedby="live-search-desc"

View File

@ -18,7 +18,7 @@
* @since 1.8.2
*/
foreach ($page->get_title_links() as $action_link) :
$action_classes = isset($action_link['classes']) ? $action_link['classes'] : '';
$action_classes = $action_link['classes'] ?? '';
?>

View File

@ -64,7 +64,7 @@
<?php _e('Select Site', 'wp-ultimo'); ?>
</label> -->
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-product', array('id' => $item->get_id())); ?>" class="button button-primary">
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-product', ['id' => $item->get_id()]); ?>" class="button button-primary">
<?php _e('Read More', 'wp-ultimo'); ?>
</a>

View File

@ -18,7 +18,7 @@
* @since 1.8.2
*/
foreach ($page->get_title_links() as $action_link) :
$action_classes = isset($action_link['classes']) ? $action_link['classes'] : '';
$action_classes = $action_link['classes'] ?? '';
?>
@ -103,7 +103,7 @@
/**
* Holds add-on menus
*/
$addons = array();
$addons = [];
?>

View File

@ -52,7 +52,7 @@
<?php _e('Select Site', 'wp-ultimo'); ?>
</label>
<a title="<?php echo esc_attr(__('Publish pending site', 'wp-ultimo')); ?>" href="<?php echo wu_get_form_url('publish_pending_site', array('membership_id' => $item->get_membership_id())); ?>" class="wubox button button-primary">
<a title="<?php echo esc_attr(__('Publish pending site', 'wp-ultimo')); ?>" href="<?php echo wu_get_form_url('publish_pending_site', ['membership_id' => $item->get_membership_id()]); ?>" class="wubox button button-primary">
<?php _e('Publish Site', 'wp-ultimo'); ?>
</a>
@ -63,7 +63,7 @@
<?php _e('Select Site', 'wp-ultimo'); ?>
</label>
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-site', array('id' => $item->get_id())); ?>" class="button button-primary">
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-site', ['id' => $item->get_id()]); ?>" class="button button-primary">
<?php _e('Manage', 'wp-ultimo'); ?>
</a>
@ -73,7 +73,7 @@
<span>&nbsp;</span>
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-site', array('id' => $item->get_id())); ?>" class="button button-primary">
<a href="<?php echo wu_network_admin_url('wp-ultimo-edit-site', ['id' => $item->get_id()]); ?>" class="button button-primary">
<?php _e('See Main Site', 'wp-ultimo'); ?>
</a>