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,9 +27,9 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
*/
public function get_columns() {
$columns = array(
$columns = [
'responsive' => '',
);
];
return $columns;
}
@ -42,45 +42,45 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
* @param object $item The item being rendered.
* @return void
*/
public function column_responsive($item) {
public function column_responsive($item): void {
$product = $item->get_product();
$first_row = array(
'quantity' => array(
$first_row = [
'quantity' => [
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
'label' => __('Quantity', 'wp-ultimo'),
'value' => sprintf(__('x%d', 'wp-ultimo'), $item->get_quantity()),
),
'unit_price' => array(
],
'unit_price' => [
'icon' => 'dashicons-wu-info1 wu-align-middle wu-mr-1',
'label' => __('Unit Price', 'wp-ultimo'),
'value' => wu_format_currency($item->get_unit_price()),
),
);
],
];
$second_row = array();
$second_row = [];
$url_atts = array(
$url_atts = [
'id' => $this->get_payment()->get_id(),
'line_item_id' => $item->get_id(),
);
];
$second_row['change'] = array(
$second_row['change'] = [
'wrapper_classes' => 'wubox',
'icon' => 'dashicons-wu-edit1 wu-align-middle wu-mr-1',
'label' => '',
'value' => __('Edit', 'wp-ultimo'),
'url' => wu_get_form_url('edit_line_item', $url_atts),
);
];
$second_row['remove'] = array(
$second_row['remove'] = [
'wrapper_classes' => 'wu-text-red-500 wubox',
'icon' => 'dashicons-wu-trash-2 wu-align-middle wu-mr-1',
'label' => '',
'value' => __('Remove', 'wp-ultimo'),
'url' => wu_get_form_url('delete_line_item', $url_atts),
);
];
/*
* Adds discounts
@ -90,22 +90,22 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
$tax_rate = $item->get_discount_rate() . '%';
}
$tax_label = $item->get_discount_rate() ? ($item->get_discount_label() ? $item->get_discount_label() : __('Discount', 'wp-ultimo')) : __('No discount', 'wp-ultimo');
$tax_label = $item->get_discount_rate() ? ($item->get_discount_label() ?: __('Discount', 'wp-ultimo')) : __('No discount', 'wp-ultimo');
$tooltip = sprintf('%s (%s)', $tax_rate, $tax_label);
$first_row['discounts_total'] = array(
$first_row['discounts_total'] = [
'icon' => 'dashicons-wu-percent wu-align-middle wu-mr-1',
'label' => $tooltip,
'value' => sprintf(__('Discounts: %s', 'wp-ultimo'), wu_format_currency($item->get_discount_total())),
);
];
}
$first_row['subtotal'] = array(
$first_row['subtotal'] = [
'icon' => 'dashicons-wu-info1 wu-align-middle wu-mr-1',
'label' => '',
'value' => sprintf(__('Subtotal: %s', 'wp-ultimo'), wu_format_currency($item->get_subtotal())),
);
];
/*
* Adds Taxes
@ -115,31 +115,31 @@ class Payment_Line_Item_List_Table extends Line_Item_List_Table {
$tax_rate = $item->get_tax_rate() . '%';
}
$tax_label = $item->get_tax_rate() ? ($item->get_tax_label() ? $item->get_tax_label() : __('Tax Applied', 'wp-ultimo')) : __('No Taxes Applied', 'wp-ultimo');
$tax_label = $item->get_tax_rate() ? ($item->get_tax_label() ?: __('Tax Applied', 'wp-ultimo')) : __('No Taxes Applied', 'wp-ultimo');
$tooltip = sprintf('%s (%s)', $tax_rate, $tax_label);
$first_row['tax_total'] = array(
$first_row['tax_total'] = [
'icon' => 'dashicons-wu-percent wu-align-middle wu-mr-1',
'label' => $tooltip,
'value' => sprintf(__('Taxes: %s', 'wp-ultimo'), wu_format_currency($item->get_tax_total())),
);
];
}
$first_row['description'] = array(
$first_row['description'] = [
'icon' => 'dashicons-wu-file-text wu-align-middle wu-mr-1',
'label' => __('Item Description', 'wp-ultimo'),
'value' => $item->get_description(),
);
];
echo wu_responsive_table_row(
array(
[
'id' => '',
'title' => $item->get_title(),
'url' => '',
'image' => '',
'status' => sprintf('<span class="wu-text-sm wu-font-medium wu-text-gray-700">%s</span>', wu_format_currency($item->get_total())),
),
],
$first_row,
$second_row
);