Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -27,7 +27,7 @@ class Payment_List_Table 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,15 +37,15 @@ class Payment_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Payment', 'wp-ultimo'),
|
||||
'plural' => __('Payments', 'wp-ultimo'),
|
||||
'ajax' => true,
|
||||
'add_new' => array(
|
||||
'add_new' => [
|
||||
'url' => wu_get_form_url('add_new_payment'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
|
||||
$_filter_fields['customer_id'] = wu_request('customer_id', false);
|
||||
|
||||
$_filter_fields['parent_id__in'] = array('0', 0, '', null);
|
||||
$_filter_fields['parent_id__in'] = ['0', 0, '', null];
|
||||
|
||||
return $_filter_fields;
|
||||
}
|
||||
@ -80,27 +80,27 @@ class Payment_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_hash($item) {
|
||||
|
||||
$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 title="%s" class="wubox" href="%s">%s</a>',
|
||||
__('Delete', 'wp-ultimo'),
|
||||
wu_get_form_url(
|
||||
'delete_modal',
|
||||
array(
|
||||
[
|
||||
'model' => 'payment',
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
];
|
||||
|
||||
$html = "<span class='wu-font-mono'><strong>{$code}</strong></span>";
|
||||
|
||||
@ -140,13 +140,13 @@ class Payment_List_Table extends Base_List_Table {
|
||||
return __('No product found', 'wp-ultimo');
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'product_id' => $product->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'view' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-product', $url_atts), __('View', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
$html = $product->get_name();
|
||||
|
||||
@ -176,7 +176,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'hash' => wu_tooltip(__('Reference Code', 'wp-ultimo'), 'dashicons-wu-hash wu-text-xs'),
|
||||
'status' => __('Status', 'wp-ultimo'),
|
||||
@ -185,7 +185,7 @@ class Payment_List_Table extends Base_List_Table {
|
||||
'total' => __('Total', 'wp-ultimo'),
|
||||
'date_created' => __('Created at', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -197,47 +197,47 @@ class Payment_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(
|
||||
return [
|
||||
'filters' => [
|
||||
|
||||
/**
|
||||
* Status
|
||||
*/
|
||||
'status' => array(
|
||||
'status' => [
|
||||
'label' => __('Status', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'pending' => __('Pending', 'wp-ultimo'),
|
||||
'completed' => __('Completed', 'wp-ultimo'),
|
||||
'refund' => __('Refund', 'wp-ultimo'),
|
||||
'partial' => __('Partial', 'wp-ultimo'),
|
||||
'failed' => __('Failed', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
/**
|
||||
* Gateway
|
||||
*/
|
||||
'gateway' => array(
|
||||
'gateway' => [
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'free' => __('Free', 'wp-ultimo'),
|
||||
'manual' => __('Manual', 'wp-ultimo'),
|
||||
'paypal' => __('Paypal', 'wp-ultimo'),
|
||||
'stripe' => __('Stripe', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'date_filters' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'date_filters' => [
|
||||
|
||||
/**
|
||||
* Created At
|
||||
*/
|
||||
'date_created' => array(
|
||||
'date_created' => [
|
||||
'label' => __('Created At', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -248,43 +248,43 @@ class Payment_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', 'all'),
|
||||
'label' => __('All Payments', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
Payment_Status::COMPLETED() => array(
|
||||
],
|
||||
Payment_Status::COMPLETED() => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', Payment_Status::COMPLETED()),
|
||||
'label' => __('Completed', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
Payment_Status::PENDING() => array(
|
||||
],
|
||||
Payment_Status::PENDING() => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', Payment_Status::PENDING()),
|
||||
'label' => __('Pending', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
Payment_Status::PARTIAL_REFUND() => array(
|
||||
],
|
||||
Payment_Status::PARTIAL_REFUND() => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', Payment_Status::PARTIAL_REFUND()),
|
||||
'label' => __('Partially Refunded', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
Payment_Status::REFUND() => array(
|
||||
],
|
||||
Payment_Status::REFUND() => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', Payment_Status::REFUND()),
|
||||
'label' => __('Refunded', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
Payment_Status::FAILED() => array(
|
||||
],
|
||||
Payment_Status::FAILED() => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', Payment_Status::FAILED()),
|
||||
'label' => __('Failed', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user