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

@ -25,7 +25,7 @@ class Webhook_List_Table extends Base_List_Table {
* @since 2.0.0
* @var string
*/
protected $query_class = '\\WP_Ultimo\\Database\\Webhooks\\Webhook_Query';
protected $query_class = \WP_Ultimo\Database\Webhooks\Webhook_Query::class;
/**
* Initializes the table.
@ -35,15 +35,15 @@ class Webhook_List_Table extends Base_List_Table {
public function __construct() {
parent::__construct(
array(
[
'singular' => __('Webhook', 'wp-ultimo'), // singular name of the listed records
'plural' => __('Webhooks', 'wp-ultimo'), // plural name of the listed records
'ajax' => true, // does this table support ajax?
'add_new' => array(
'add_new' => [
'url' => wu_get_form_url('add_new_webhook_modal'),
'classes' => 'wubox',
),
)
],
]
);
}
/**
@ -55,10 +55,10 @@ class Webhook_List_Table extends Base_List_Table {
*/
public function column_name($item): string {
$url_atts = array(
$url_atts = [
'id' => $item->get_id(),
'model' => 'webhook',
);
];
$title = sprintf(
'<a href="%s"><strong>%s</strong></a>
@ -69,7 +69,7 @@ class Webhook_List_Table extends Base_List_Table {
__('Sending Test..', 'wp-ultimo')
);
$actions = array(
$actions = [
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-webhook', $url_atts), __('Edit', 'wp-ultimo')),
'test' => sprintf('<a id="action_button" data-title="' . $item->get_name() . '" data-page="list" data-action="wu_send_test_event" data-event="' . $item->get_event() . '" data-object="' . $item->get_id() . '" data-url="%s" href="">%s</a>', $item->get_webhook_url(), __('Send Test', 'wp-ultimo')),
'delete' => sprintf(
@ -81,7 +81,7 @@ class Webhook_List_Table extends Base_List_Table {
),
__('Delete', 'wp-ultimo')
),
);
];
return $title . $this->row_actions($actions);
}
@ -126,9 +126,9 @@ class Webhook_List_Table extends Base_List_Table {
$count = $item->get_count();
$actions = array(
$actions = [
'edit' => sprintf('<a href="%s">%s</a>', '', __('See Events', 'wp-ultimo')),
);
];
return $count . $this->row_actions($actions);
}
@ -141,7 +141,7 @@ class Webhook_List_Table extends Base_List_Table {
*/
public function column_integration($item): string {
return ucwords(str_replace(array('_', '-'), ' ', (string) $item->get_integration()));
return ucwords(str_replace(['_', '-'], ' ', (string) $item->get_integration()));
}
/**
@ -165,7 +165,7 @@ class Webhook_List_Table extends Base_List_Table {
*/
public function get_columns() {
$columns = array(
$columns = [
'cb' => '<input type="checkbox" />',
'name' => __('Name', 'wp-ultimo'),
'webhook_url' => __('Target URL', 'wp-ultimo'),
@ -174,7 +174,7 @@ class Webhook_List_Table extends Base_List_Table {
'integration' => __('Integration', 'wp-ultimo'),
'active' => __('Active', 'wp-ultimo'),
'id' => __('ID', 'wp-ultimo'),
);
];
return $columns;
}
@ -185,9 +185,9 @@ class Webhook_List_Table extends Base_List_Table {
*/
public function get_filters(): array {
return array(
'filters' => array(),
'date_filters' => array(),
);
return [
'filters' => [],
'date_filters' => [],
];
}
}