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,7 +27,7 @@ class Payment_List_Table_Widget extends Base_List_Table {
* @since 2.0.0
* @var string
*/
protected $query_class = '\\WP_Ultimo\\Database\\Payments\\Payment_Query';
protected $query_class = \WP_Ultimo\Database\Payments\Payment_Query::class;
/**
* Initializes the table.
@ -37,11 +37,11 @@ class Payment_List_Table_Widget extends Base_List_Table {
public function __construct() {
parent::__construct(
array(
[
'singular' => __('Payment', 'wp-ultimo'), // singular name of the listed records
'plural' => __('Payments', 'wp-ultimo'), // plural name of the listed records
'ajax' => true, // does this table support ajax?
)
]
);
}
@ -59,14 +59,14 @@ class Payment_List_Table_Widget extends Base_List_Table {
$query_class = new $this->query_class();
$query_args = array(
$query_args = [
'number' => 5,
'offset' => 1,
'orderby' => wu_request('orderby', 'date_created'),
'order' => wu_request('order', 'DESC'),
'search' => wu_request('s', false),
'count' => $count,
);
];
/**
* Accounts for hashes
@ -104,16 +104,16 @@ class Payment_List_Table_Widget extends Base_List_Table {
*/
public function column_hash($item): string {
$url_atts = array(
$url_atts = [
'id' => $item->get_id(),
);
];
$code = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-payment', $url_atts), $item->get_hash());
$actions = array(
$actions = [
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-payment', $url_atts), __('Edit', 'wp-ultimo')),
'delete' => sprintf('<a href="%s">%s</a>', '', __('Delete', 'wp-ultimo')),
);
];
$html = "<span class='wu-font-mono'><strong>{$code}</strong></span>";
@ -161,19 +161,19 @@ class Payment_List_Table_Widget extends Base_List_Table {
</div>";
}
$url_atts = array(
$url_atts = [
'id' => $customer->get_id(),
);
];
$avatar = get_avatar(
$customer->get_user_id(),
32,
'identicon',
'',
array(
[
'force_display' => true,
'class' => 'wu-rounded-full wu-mr-2',
)
]
);
$display_name = $customer->get_display_name();
@ -215,12 +215,12 @@ class Payment_List_Table_Widget extends Base_List_Table {
*/
public function get_columns() {
$columns = array(
$columns = [
'hash' => __('Ref.', 'wp-ultimo'),
'customer' => __('Customer', 'wp-ultimo'),
'total' => __('Total', 'wp-ultimo'),
'date_created' => __('Created at', 'wp-ultimo'),
);
];
return $columns;
}