Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -50,10 +50,10 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $labels = array(
|
||||
protected $labels = [
|
||||
'singular' => '',
|
||||
'plural' => '',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Keeps track of the current view mode for this particular list table.
|
||||
@ -69,7 +69,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
public $modes = array('list' => 'List');
|
||||
public $modes = ['list' => 'List'];
|
||||
|
||||
/**
|
||||
* The list table context.
|
||||
@ -105,7 +105,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @param string $context The new context to set.
|
||||
* @return void
|
||||
*/
|
||||
public function set_context($context = 'page') {
|
||||
public function set_context($context = 'page'): void {
|
||||
|
||||
$this->context = $context;
|
||||
}
|
||||
@ -117,28 +117,28 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*
|
||||
* @param array $args Arguments of the list table.
|
||||
*/
|
||||
public function __construct($args = array()) {
|
||||
public function __construct($args = []) {
|
||||
|
||||
$this->id = $this->get_table_id();
|
||||
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
array(
|
||||
[
|
||||
'screen' => $this->id,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
parent::__construct($args);
|
||||
|
||||
$this->labels = shortcode_atts($this->labels, $args);
|
||||
|
||||
add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
|
||||
add_action('admin_enqueue_scripts', [$this, 'register_scripts']);
|
||||
|
||||
add_action('in_admin_header', array($this, 'add_default_screen_options'));
|
||||
add_action('in_admin_header', [$this, 'add_default_screen_options']);
|
||||
|
||||
$this->set_list_mode();
|
||||
|
||||
$this->_args['add_new'] = wu_get_isset($args, 'add_new', array());
|
||||
$this->_args['add_new'] = wu_get_isset($args, 'add_new', []);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,13 +147,13 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function add_default_screen_options() {
|
||||
public function add_default_screen_options(): void {
|
||||
|
||||
$args = array(
|
||||
$args = [
|
||||
'default' => 20,
|
||||
'label' => $this->get_per_page_option_label(),
|
||||
'option' => $this->get_per_page_option_name(),
|
||||
);
|
||||
];
|
||||
|
||||
add_screen_option('per_page', $args);
|
||||
}
|
||||
@ -182,7 +182,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function set_list_mode() {
|
||||
public function set_list_mode(): void {
|
||||
|
||||
if ($this->context !== 'page') {
|
||||
$this->current_mode = 'list';
|
||||
@ -217,7 +217,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_label($label = 'singular') {
|
||||
|
||||
return isset($this->labels[ $label ]) ? $this->labels[ $label ] : 'Object';
|
||||
return $this->labels[ $label ] ?? 'Object';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,19 +232,19 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_items($per_page = 5, $page_number = 1, $count = false) {
|
||||
|
||||
$query_args = array(
|
||||
$query_args = [
|
||||
'number' => $per_page,
|
||||
'offset' => ($page_number - 1) * $per_page,
|
||||
'orderby' => wu_request('orderby', 'id'),
|
||||
'order' => wu_request('order', 'DESC'),
|
||||
'search' => wu_request('s', false),
|
||||
'count' => $count,
|
||||
);
|
||||
];
|
||||
|
||||
$extra_query_args = array(
|
||||
$extra_query_args = [
|
||||
'status',
|
||||
'type',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($extra_query_args as $extra_query_arg) {
|
||||
$query = wu_request($extra_query_arg, 'all');
|
||||
@ -351,7 +351,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
protected function has_search() {
|
||||
|
||||
return ! empty($this->get_schema_columns(array('searchable' => true)));
|
||||
return ! empty($this->get_schema_columns(['searchable' => true]));
|
||||
}
|
||||
/**
|
||||
* Generates the search field label, based on the table labels.
|
||||
@ -370,7 +370,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function prepare_items() {
|
||||
public function prepare_items(): void {
|
||||
|
||||
$this->_column_headers = $this->get_column_info();
|
||||
|
||||
@ -381,10 +381,10 @@ class Base_List_Table extends \WP_List_Table {
|
||||
$total_items = $this->record_count();
|
||||
|
||||
$this->set_pagination_args(
|
||||
array(
|
||||
[
|
||||
'total_items' => $total_items, // We have to calculate the total number of items.
|
||||
'per_page' => $per_page, // We have to determine how many items to show on a page.
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$this->items = $this->get_items($per_page, $current_page);
|
||||
@ -396,18 +396,18 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
wp_localize_script(
|
||||
'wu-ajax-list-table',
|
||||
'wu_list_table',
|
||||
array(
|
||||
[
|
||||
'base_url' => wu_get_form_url('bulk_actions'),
|
||||
'model' => strchr($this->get_table_id(), '_', true),
|
||||
'i18n' => array(
|
||||
'i18n' => [
|
||||
'confirm' => __('Confirm Action', 'wp-ultimo'),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
wp_enqueue_script('wu-ajax-list-table');
|
||||
@ -419,7 +419,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function display_ajax_filters() {
|
||||
public function display_ajax_filters(): void {
|
||||
|
||||
/**
|
||||
* Add the nonce field before we generate the results
|
||||
@ -453,7 +453,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function display_view_list() {
|
||||
public function display_view_list(): void {
|
||||
|
||||
printf('<div id="wu-%s" class="wu-list-table wu-mode-list">', esc_attr($this->id));
|
||||
|
||||
@ -473,7 +473,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function display_view_grid() {
|
||||
public function display_view_grid(): void {
|
||||
|
||||
printf('<div id="wu-%s" class="wu-list-table wu-mode-grid">', esc_attr($this->id));
|
||||
|
||||
@ -481,9 +481,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
|
||||
wu_get_template(
|
||||
'base/grid',
|
||||
array(
|
||||
[
|
||||
'table' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
@ -497,13 +497,13 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 3.1.0
|
||||
* @access public
|
||||
*/
|
||||
public function display() {
|
||||
public function display(): void {
|
||||
/*
|
||||
* Any items at all?
|
||||
*/
|
||||
if ( ! $this->has_items() && $this->context === 'page') {
|
||||
echo wu_render_empty_state(
|
||||
array(
|
||||
[
|
||||
'message' => sprintf(__("You don't have any %s yet.", 'wp-ultimo'), $this->labels['plural']),
|
||||
'sub_message' => $this->_args['add_new'] ? __('How about we create a new one?', 'wp-ultimo') : __('...but you will see them here once they get created.', 'wp-ultimo'),
|
||||
// translators: %s is the singular value of the model, such as Product, or Payment.
|
||||
@ -511,10 +511,10 @@ class Base_List_Table extends \WP_List_Table {
|
||||
'link_url' => wu_get_isset($this->_args['add_new'], 'url', ''),
|
||||
'link_classes' => wu_get_isset($this->_args['add_new'], 'classes', ''),
|
||||
'link_icon' => 'dashicons-wu-circle-with-plus',
|
||||
)
|
||||
]
|
||||
);
|
||||
} else {
|
||||
call_user_func(array($this, "display_view_{$this->current_mode}"));
|
||||
call_user_func([$this, "display_view_{$this->current_mode}"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,7 +525,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function filters() {
|
||||
public function filters(): void {
|
||||
|
||||
$filters = $this->get_filters();
|
||||
|
||||
@ -534,14 +534,14 @@ class Base_List_Table extends \WP_List_Table {
|
||||
if (true) {
|
||||
$args = array_merge(
|
||||
$filters,
|
||||
array(
|
||||
[
|
||||
'filters_el_id' => sprintf('%s-filters', $this->id),
|
||||
'has_search' => $this->has_search(),
|
||||
'search_label' => $this->get_search_input_label(),
|
||||
'views' => $views,
|
||||
'has_view_switch' => ! empty($this->modes),
|
||||
'table' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wu_get_template('base/filter', $args);
|
||||
@ -556,9 +556,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @param mixed $item The line item being displayed.
|
||||
* @return void
|
||||
*/
|
||||
public function single_row($item) {
|
||||
public function single_row($item): void {
|
||||
|
||||
call_user_func(array($this, "single_row_{$this->current_mode}"), $item);
|
||||
call_user_func([$this, "single_row_{$this->current_mode}"], $item);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -569,7 +569,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @param mixed $item The line item being displayed.
|
||||
* @return void
|
||||
*/
|
||||
public function single_row_list($item) {
|
||||
public function single_row_list($item): void {
|
||||
|
||||
parent::single_row($item);
|
||||
}
|
||||
@ -590,7 +590,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function no_items() {
|
||||
public function no_items(): void {
|
||||
|
||||
printf(
|
||||
'<div class="wu-py-6 wu-text-gray-600 wu-text-sm wu-text-center">
|
||||
@ -607,14 +607,14 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_bulk_actions() {
|
||||
|
||||
$default_bulk_actions = array(
|
||||
$default_bulk_actions = [
|
||||
'delete' => __('Delete', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
$has_active = $this->get_schema_columns(
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
if ($has_active) {
|
||||
@ -709,7 +709,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function ajax_response() {
|
||||
public function ajax_response(): void {
|
||||
|
||||
check_ajax_referer(sprintf('ajax-%s-nonce', $this->_get_js_var_name()), sprintf('_ajax_%s_nonce', $this->_get_js_var_name()));
|
||||
|
||||
@ -764,7 +764,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
/**
|
||||
* Build the response
|
||||
*/
|
||||
$response = array('rows' => $rows);
|
||||
$response = ['rows' => $rows];
|
||||
$response['pagination']['top'] = $pagination_top;
|
||||
$response['pagination']['bottom'] = $pagination_bottom;
|
||||
$response['column_headers'] = $headers;
|
||||
@ -798,13 +798,13 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function column_default($item, $column_name) {
|
||||
|
||||
$value = call_user_func(array($item, "get_{$column_name}"));
|
||||
$value = call_user_func([$item, "get_{$column_name}"]);
|
||||
|
||||
$datetime_columns = array_column(
|
||||
$this->get_schema_columns(
|
||||
array(
|
||||
[
|
||||
'date_query' => true,
|
||||
)
|
||||
]
|
||||
),
|
||||
'name'
|
||||
);
|
||||
@ -864,9 +864,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
</div>";
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $membership->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$status_classes = $membership->get_status_class();
|
||||
|
||||
@ -912,9 +912,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
</div>";
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $payment->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$status_classes = $payment->get_status_class();
|
||||
|
||||
@ -960,19 +960,19 @@ class Base_List_Table extends \WP_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();
|
||||
@ -1017,9 +1017,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
</div>";
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $product->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$image = $product->get_featured_image('thumbnail');
|
||||
|
||||
@ -1070,9 +1070,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
</div>";
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $site->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$site_link = wu_network_admin_url('wp-ultimo-edit-site', $url_atts);
|
||||
|
||||
@ -1146,7 +1146,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function _js_vars() {
|
||||
public function _js_vars(): void {
|
||||
|
||||
/**
|
||||
* Call the parent method for backwards compat.
|
||||
@ -1190,7 +1190,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function fill_normal_type($name) {
|
||||
|
||||
return isset($_REQUEST[ $name ]) ? ((array) $_REQUEST[ $name ]) : array();
|
||||
return isset($_REQUEST[ $name ]) ? ((array) $_REQUEST[ $name ]) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1203,11 +1203,11 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function fill_date_type($name) {
|
||||
|
||||
return (object) array(
|
||||
'after' => isset($_REQUEST[ $name ]['after']) ? $_REQUEST[ $name ]['after'] : 'all',
|
||||
'before' => isset($_REQUEST[ $name ]['before']) ? $_REQUEST[ $name ]['before'] : 'all',
|
||||
'type' => isset($_REQUEST[ 'filter_' . $name ]) ? $_REQUEST[ 'filter_' . $name ] : 'all',
|
||||
);
|
||||
return (object) [
|
||||
'after' => $_REQUEST[ $name ]['after'] ?? 'all',
|
||||
'before' => $_REQUEST[ $name ]['before'] ?? 'all',
|
||||
'type' => $_REQUEST[ 'filter_' . $name ] ?? 'all',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1218,53 +1218,53 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_default_date_filter_options() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'label' => __('All', 'wp-ultimo'),
|
||||
'after' => null,
|
||||
'before' => null,
|
||||
),
|
||||
'today' => array(
|
||||
],
|
||||
'today' => [
|
||||
'label' => __('Today', 'wp-ultimo'),
|
||||
'after' => date_i18n('Y-m-d 00:00:00', strtotime('today')),
|
||||
'before' => date_i18n('Y-m-d 23:59:59', strtotime('today')),
|
||||
),
|
||||
'yesterday' => array(
|
||||
],
|
||||
'yesterday' => [
|
||||
'label' => __('Yesterday', 'wp-ultimo'),
|
||||
'after' => date_i18n('Y-m-d 00:00:00', strtotime('yesterday')),
|
||||
'before' => date_i18n('Y-m-d 23:59:59', strtotime('yesterday')),
|
||||
),
|
||||
'last_week' => array(
|
||||
],
|
||||
'last_week' => [
|
||||
'label' => __('Last 7 Days', 'wp-ultimo'),
|
||||
'after' => date_i18n('Y-m-d 00:00:00', strtotime('last week')),
|
||||
'before' => date_i18n('Y-m-d 23:59:59', strtotime('today')),
|
||||
),
|
||||
'last_month' => array(
|
||||
],
|
||||
'last_month' => [
|
||||
'label' => __('Last 30 Days', 'wp-ultimo'),
|
||||
'after' => date_i18n('Y-m-d 00:00:00', strtotime('last month')),
|
||||
'before' => date_i18n('Y-m-d 23:59:59', strtotime('today')),
|
||||
),
|
||||
'current_month' => array(
|
||||
],
|
||||
'current_month' => [
|
||||
'label' => __('Current Month', 'wp-ultimo'),
|
||||
'after' => date_i18n('Y-m-d 00:00:00', strtotime('first day of this month')),
|
||||
'before' => date_i18n('Y-m-d 23:59:59', strtotime('today')),
|
||||
),
|
||||
'last_year' => array(
|
||||
],
|
||||
'last_year' => [
|
||||
'label' => __('Last 12 Months', 'wp-ultimo'),
|
||||
'after' => date_i18n('Y-m-d 00:00:00', strtotime('last year')),
|
||||
'before' => date_i18n('Y-m-d 23:59:59', strtotime('today')),
|
||||
),
|
||||
'year_to_date' => array(
|
||||
],
|
||||
'year_to_date' => [
|
||||
'label' => __('Year to Date', 'wp-ultimo'),
|
||||
'after' => date_i18n('Y-m-d 00:00:00', strtotime('first day of january this year')),
|
||||
'before' => date_i18n('Y-m-d 23:59:59', strtotime('today')),
|
||||
),
|
||||
'custom' => array(
|
||||
],
|
||||
'custom' => [
|
||||
'label' => __('Custom', 'wp-ultimo'),
|
||||
'after' => null,
|
||||
'before' => null,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1281,7 +1281,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
* @param boolean $field Field to return.
|
||||
* @return array.
|
||||
*/
|
||||
protected function get_schema_columns($args = array(), $operator = 'and', $field = false) {
|
||||
protected function get_schema_columns($args = [], $operator = 'and', $field = false) {
|
||||
|
||||
$query_class = new $this->query_class();
|
||||
|
||||
@ -1302,15 +1302,15 @@ class Base_List_Table extends \WP_List_Table {
|
||||
public function get_sortable_columns() {
|
||||
|
||||
$sortable_columns_from_schema = $this->get_schema_columns(
|
||||
array(
|
||||
[
|
||||
'sortable' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$sortable_columns = array();
|
||||
$sortable_columns = [];
|
||||
|
||||
foreach ($sortable_columns_from_schema as $sortable_column_from_schema) {
|
||||
$sortable_columns[ $sortable_column_from_schema->name ] = array($sortable_column_from_schema->name, false);
|
||||
$sortable_columns[ $sortable_column_from_schema->name ] = [$sortable_column_from_schema->name, false];
|
||||
}
|
||||
|
||||
return $sortable_columns;
|
||||
@ -1324,9 +1324,9 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_extra_fields() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
|
||||
$_filter_fields = array();
|
||||
$_filter_fields = [];
|
||||
|
||||
if (isset($filters['filters'])) {
|
||||
foreach ($filters['filters'] as $field_name => $field) {
|
||||
@ -1347,7 +1347,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
|
||||
$filters = $this->get_filters();
|
||||
|
||||
$_filter_fields = array();
|
||||
$_filter_fields = [];
|
||||
|
||||
if (isset($filters['date_filters'])) {
|
||||
foreach ($filters['date_filters'] as $field_name => $field) {
|
||||
@ -1374,7 +1374,7 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_extra_query_fields() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1389,10 +1389,10 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_hidden_fields() {
|
||||
|
||||
$final_fields = array(
|
||||
'order' => isset($this->_pagination_args['order']) ? $this->_pagination_args['order'] : '',
|
||||
'orderby' => isset($this->_pagination_args['orderby']) ? $this->_pagination_args['orderby'] : '',
|
||||
);
|
||||
$final_fields = [
|
||||
'order' => $this->_pagination_args['order'] ?? '',
|
||||
'orderby' => $this->_pagination_args['orderby'] ?? '',
|
||||
];
|
||||
|
||||
return $final_fields;
|
||||
}
|
||||
@ -1405,14 +1405,14 @@ class Base_List_Table extends \WP_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'type',
|
||||
'url' => '#',
|
||||
'label' => sprintf(__('All %s', 'wp-ultimo'), $this->get_label('plural')),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Broadcasts\\Broadcast_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Broadcasts\Broadcast_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -35,15 +35,15 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Broadcast', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Broadcasts', '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_broadcast_message'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -113,16 +113,16 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
|
||||
$content = wp_trim_words(wp_strip_all_tags($item->get_content()), 7);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'slug' => $item->get_slug(),
|
||||
'model' => 'broadcast',
|
||||
);
|
||||
];
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-broadcast', $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', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
return $title . $content . $this->row_actions($actions);
|
||||
}
|
||||
@ -160,9 +160,9 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
case 1:
|
||||
$customer = array_pop($targets);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$customer_link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
@ -171,10 +171,10 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$display_name = $customer->get_display_name();
|
||||
@ -206,14 +206,14 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'class' => 'wu-rounded-full wu-border-solid wu-border-1 wu-border-white hover:wu-border-gray-400',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $customer->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$customer_link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
@ -221,13 +221,13 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
}
|
||||
|
||||
if ($targets_count < 7) {
|
||||
$modal_atts = array(
|
||||
$modal_atts = [
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $item->get_id(),
|
||||
'width' => '400',
|
||||
'height' => '360',
|
||||
'target_type' => 'customers',
|
||||
);
|
||||
];
|
||||
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu-mr-2">
|
||||
@ -244,13 +244,13 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
return $html;
|
||||
}
|
||||
|
||||
$modal_atts = array(
|
||||
$modal_atts = [
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $item->get_id(),
|
||||
'width' => '400',
|
||||
'height' => '360',
|
||||
'target_type' => 'customers',
|
||||
);
|
||||
];
|
||||
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu-ml-4">
|
||||
@ -326,9 +326,9 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
|
||||
$description = sprintf(__('%s customer(s) targeted.', 'wp-ultimo'), $customer_count);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $product->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$product_link = wu_network_admin_url('wp-ultimo-edit-product', $url_atts);
|
||||
|
||||
@ -349,9 +349,9 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
$html = '<div class="wu-p-2 wu-mr-1 wu-flex wu-rounded wu-items-center wu-border wu-border-solid wu-border-gray-300 wu-bg-gray-100 wu-relative wu-overflow-hidden">';
|
||||
|
||||
foreach ($products as $product) {
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $product->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$product_link = wu_network_admin_url('wp-ultimo-edit-product', $url_atts);
|
||||
|
||||
@ -371,13 +371,13 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
}
|
||||
|
||||
if ($product_count > 1 && $product_count < 5) {
|
||||
$modal_atts = array(
|
||||
$modal_atts = [
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $item->get_id(),
|
||||
'width' => '400',
|
||||
'height' => '360',
|
||||
'target_type' => 'products',
|
||||
);
|
||||
];
|
||||
|
||||
$html .= sprintf(
|
||||
'<div class="wu-inline-block wu-ml-4">
|
||||
@ -393,13 +393,13 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
return $html;
|
||||
}
|
||||
|
||||
$modal_atts = array(
|
||||
$modal_atts = [
|
||||
'action' => 'wu_modal_targets_display',
|
||||
'object_id' => $item->get_id(),
|
||||
'width' => '400',
|
||||
'height' => '360',
|
||||
'target_type' => 'products',
|
||||
);
|
||||
];
|
||||
|
||||
$html .= sprintf('<div class="wu-inline-block wu-ml-4"><a href="%s" title="%s" class="wubox"><span class="wu-pl-2 wu-uppercase wu-text-xs wu-font-bold"> %s %s</span></a></div>', wu_get_form_url('view_broadcast_targets', $modal_atts), __('Targets', 'wp-ultimo'), $product_count, __('Targets', 'wp-ultimo'));
|
||||
|
||||
@ -416,7 +416,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'type' => __('Type', 'wp-ultimo'),
|
||||
'the_content' => __('Content', 'wp-ultimo'),
|
||||
@ -424,7 +424,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
'target_products' => __('Target Products', 'wp-ultimo'),
|
||||
'date_created' => __('Date', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -435,32 +435,32 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(
|
||||
'type' => array(
|
||||
return [
|
||||
'filters' => [
|
||||
'type' => [
|
||||
'label' => __('Broadcast Type', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'broadcast_notice' => __('Email', 'wp-ultimo'),
|
||||
'broadcast_email' => __('Notices', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
'status' => array(
|
||||
],
|
||||
],
|
||||
'status' => [
|
||||
'label' => __('Notice Type', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'info' => __('Info - Blue', 'wp-ultimo'),
|
||||
'success' => __('Success - Green', 'wp-ultimo'),
|
||||
'warning' => __('Warning - Yellow', 'wp-ultimo'),
|
||||
'error' => __('Error - Red', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'date_filters' => array(
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'date_filters' => [
|
||||
'date_created' => [
|
||||
'label' => __('Date', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -469,7 +469,7 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
public function register_scripts(): void {
|
||||
|
||||
parent::register_scripts();
|
||||
}
|
||||
@ -482,25 +482,25 @@ class Broadcast_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('type', 'all'),
|
||||
'label' => __('All Broadcasts', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'broadcast_email' => array(
|
||||
],
|
||||
'broadcast_email' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'broadcast_email'),
|
||||
'label' => __('Emails', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'broadcast_notice' => array(
|
||||
],
|
||||
'broadcast_notice' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'broadcast_notice'),
|
||||
'label' => __('Notices', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Checkout_Forms\\Checkout_Form_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Checkout_Forms\Checkout_Form_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -35,15 +35,15 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Checkout Form', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Checkout Forms', '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_checkout_form'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -55,30 +55,30 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_name($item): string {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'slug' => $item->get_slug(),
|
||||
'model' => 'checkout_form',
|
||||
);
|
||||
];
|
||||
|
||||
$title = sprintf('<strong><a href="%s">%s</a></strong>', wu_network_admin_url('wp-ultimo-edit-checkout-form', $url_atts), $item->get_name());
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-checkout-form', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'duplicate' => sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
wu_network_admin_url(
|
||||
'wp-ultimo-checkout-forms',
|
||||
array(
|
||||
[
|
||||
'action' => 'duplicate',
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
__('Duplicate', 'wp-ultimo')
|
||||
),
|
||||
'get_shortcode' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Shortcode', 'wp-ultimo'), wu_get_form_url('shortcode_checkout', $url_atts), __('Shortcode', 'wp-ultimo')),
|
||||
'delete' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete', 'wp-ultimo'), wu_get_form_url('delete_modal', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
return $title . $this->row_actions($actions);
|
||||
}
|
||||
@ -134,7 +134,7 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function process_single_action() {
|
||||
public function process_single_action(): void {
|
||||
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
@ -169,10 +169,10 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-checkout-form',
|
||||
array(
|
||||
[
|
||||
'id' => $new_checkout_form->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
@ -189,13 +189,13 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'name' => __('Form Name', 'wp-ultimo'),
|
||||
'slug' => __('Form Slug', 'wp-ultimo'),
|
||||
'steps' => __('Steps', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -206,9 +206,9 @@ class Checkout_Form_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
return [
|
||||
'filters' => [],
|
||||
'date_filters' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Customers\\Customer_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Customers\Customer_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -33,24 +33,24 @@ class Customer_List_Table extends Base_List_Table {
|
||||
* @param array $args Table attributes.
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct($args = array()) {
|
||||
public function __construct($args = []) {
|
||||
|
||||
$this->modes = array(
|
||||
$this->modes = [
|
||||
'grid' => __('Grid View'),
|
||||
'list' => __('List View'),
|
||||
);
|
||||
];
|
||||
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
array(
|
||||
[
|
||||
'singular' => __('Customer', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Customers', '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_customer'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
parent::__construct($args);
|
||||
@ -72,11 +72,11 @@ class Customer_List_Table extends Base_List_Table {
|
||||
|
||||
// Search relevant users
|
||||
$user_ids = get_users(
|
||||
array(
|
||||
[
|
||||
'number' => -1,
|
||||
'search' => '*' . $search . '*',
|
||||
'fields' => 'ids',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
// No results, go back
|
||||
@ -95,9 +95,9 @@ class Customer_List_Table extends Base_List_Table {
|
||||
if (wu_request('filter', 'all') === 'vip') {
|
||||
$_filter_fields['vip'] = 1;
|
||||
} elseif (wu_request('filter', 'all') === 'online') {
|
||||
$_filter_fields['last_login_query'] = array(
|
||||
$_filter_fields['last_login_query'] = [
|
||||
'after' => '-3 minutes',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $_filter_fields;
|
||||
@ -114,15 +114,15 @@ class Customer_List_Table extends Base_List_Table {
|
||||
// Get user info
|
||||
$user = get_user_by('id', $item->get_user_id());
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
// Check if user exists
|
||||
if ( ! $user) {
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'delete' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete', 'wp-ultimo'), wu_get_form_url('delete_modal', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
return sprintf('<strong>#%s</strong> - %s', $item->get_user_id(), __('User not found', 'wp-ultimo')) . $this->row_actions($actions);
|
||||
}
|
||||
@ -133,9 +133,9 @@ class Customer_List_Table extends Base_List_Table {
|
||||
'<a href="%s">%s</a>',
|
||||
wu_network_admin_url(
|
||||
'wp-ultimo-edit-customer',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
$user->display_name
|
||||
);
|
||||
@ -150,7 +150,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
|
||||
$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 = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-customer', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'switch-to' => $item->get_user_id() !== get_current_user_id() ? $url_switch_to : false,
|
||||
'delete' => sprintf(
|
||||
@ -158,14 +158,14 @@ class Customer_List_Table extends Base_List_Table {
|
||||
__('Delete', 'wp-ultimo'),
|
||||
wu_get_form_url(
|
||||
'delete_modal',
|
||||
array(
|
||||
[
|
||||
'model' => 'customer',
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
];
|
||||
|
||||
$actions = array_filter($actions);
|
||||
|
||||
@ -193,9 +193,9 @@ class Customer_List_Table extends Base_List_Table {
|
||||
36,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$html .= '</div>';
|
||||
@ -214,13 +214,13 @@ class Customer_List_Table extends Base_List_Table {
|
||||
|
||||
$subscription_count = count($item->get_memberships());
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'customer_id' => $item->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'view' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-memberships', $url_atts), __('View', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
return $subscription_count . $this->row_actions($actions);
|
||||
}
|
||||
@ -233,7 +233,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'customer_status' => '',
|
||||
'name' => __('Name', 'wp-ultimo'),
|
||||
@ -241,7 +241,7 @@ class Customer_List_Table extends Base_List_Table {
|
||||
'date_registered' => __('Customer Since', 'wp-ultimo'),
|
||||
'memberships' => __('Memberships', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -254,14 +254,14 @@ class Customer_List_Table extends Base_List_Table {
|
||||
* @param WP_Ultimo\Models\Customer $item The line item being displayed.
|
||||
* @return void
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
public function single_row_grid($item): void {
|
||||
|
||||
wu_get_template(
|
||||
'base/customers/grid-item',
|
||||
array(
|
||||
[
|
||||
'item' => $item,
|
||||
'table' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -273,10 +273,10 @@ class Customer_List_Table extends Base_List_Table {
|
||||
public function get_filters(): array {
|
||||
|
||||
$filters = $this->get_schema_columns(
|
||||
array(
|
||||
[
|
||||
'searchable' => true,
|
||||
'date_query' => true,
|
||||
),
|
||||
],
|
||||
'or'
|
||||
);
|
||||
|
||||
@ -294,18 +294,18 @@ class Customer_List_Table extends Base_List_Table {
|
||||
if ($item->date_query === true) {
|
||||
$filter_type = 'date';
|
||||
$rule = 'is_after';
|
||||
} elseif (in_array(strtolower((string) $item->name), array('smallint'), true)) {
|
||||
} elseif (in_array(strtolower((string) $item->name), ['smallint'], true)) {
|
||||
$filter_type = 'bool';
|
||||
$rule = 'is_true';
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'field' => $item->name,
|
||||
'label' => $label,
|
||||
'type' => $filter_type,
|
||||
'rule' => $rule,
|
||||
'value' => wu_request($item->name, ''),
|
||||
);
|
||||
];
|
||||
},
|
||||
$filters
|
||||
);
|
||||
@ -321,30 +321,30 @@ class Customer_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'filter',
|
||||
'url' => add_query_arg(
|
||||
array(
|
||||
[
|
||||
'filter' => 'all',
|
||||
)
|
||||
]
|
||||
),
|
||||
'label' => __('All Customers', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'vip' => array(
|
||||
],
|
||||
'vip' => [
|
||||
'field' => 'filter',
|
||||
'url' => add_query_arg('filter', 'vip'),
|
||||
'label' => __('VIP Customers', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'online' => array(
|
||||
],
|
||||
'online' => [
|
||||
'field' => 'filter',
|
||||
'url' => add_query_arg('filter', 'online'),
|
||||
'label' => __('Online Customers', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,9 +27,9 @@ class Customers_Membership_List_Table extends Membership_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -42,7 +42,7 @@ class Customers_Membership_List_Table extends Membership_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
$p = $item->get_plan();
|
||||
|
||||
@ -53,46 +53,46 @@ class Customers_Membership_List_Table extends Membership_List_Table {
|
||||
$products_list = $p ? sprintf(_n('Contains %s', 'Contains %1$s and %2$s other product(s)', $product_count, 'wp-ultimo'), $p->get_name(), count($item->get_addon_ids())) : ''; // phpcs:ignore
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_hash(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-membership',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'status' => $this->column_status($item),
|
||||
),
|
||||
array(
|
||||
'total' => array(
|
||||
],
|
||||
[
|
||||
'total' => [
|
||||
'icon' => 'dashicons-wu-shopping-bag1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Payment Total', 'wp-ultimo'),
|
||||
'value' => $item->get_price_description(),
|
||||
),
|
||||
'products' => array(
|
||||
],
|
||||
'products' => [
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Products', 'wp-ultimo'),
|
||||
'value' => $products_list,
|
||||
),
|
||||
'gateway' => array(
|
||||
],
|
||||
'gateway' => [
|
||||
'icon' => 'dashicons-wu-credit-card2 wu-align-middle wu-mr-1',
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'value' => wu_slug_to_name($item->get_gateway()),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_expiration' => array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'date_expiration' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Expires', 'wp-ultimo'),
|
||||
'value' => sprintf($expired ? __('Expired %s', 'wp-ultimo') : __('Expiring %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_expiration()))),
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Created at', 'wp-ultimo'),
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ class Customers_Payment_List_Table extends Payment_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -42,39 +42,39 @@ class Customers_Payment_List_Table extends Payment_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_hash(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-payment',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'status' => $this->column_status($item),
|
||||
),
|
||||
array(
|
||||
'total' => array(
|
||||
],
|
||||
[
|
||||
'total' => [
|
||||
'icon' => 'dashicons-wu-shopping-bag1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Payment Total', 'wp-ultimo'),
|
||||
'value' => wu_format_currency($item->get_total()),
|
||||
),
|
||||
'gateway' => array(
|
||||
],
|
||||
'gateway' => [
|
||||
'icon' => 'dashicons-wu-credit-card2 wu-align-middle wu-mr-1',
|
||||
'label' => __('Gateway', 'wp-ultimo'),
|
||||
'value' => wu_slug_to_name($item->get_gateway()),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'date_created' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -54,58 +54,58 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
$m = $item->get_membership();
|
||||
|
||||
$redirect = current_user_can('wu_edit_sites') ? 'wp-ultimo-edit-site' : 'wp-ultimo-sites';
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url(
|
||||
$redirect,
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
array(
|
||||
'link' => array(
|
||||
],
|
||||
[
|
||||
'link' => [
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
'value' => $item->get_active_site_url(),
|
||||
),
|
||||
'dashboard' => array(
|
||||
],
|
||||
'dashboard' => [
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
),
|
||||
'membership' => array(
|
||||
],
|
||||
'membership' => [
|
||||
'icon' => 'dashicons-wu-rotate-ccw wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Membership', 'wp-ultimo'),
|
||||
'value' => $m ? $m->get_hash() : '',
|
||||
'url' => $m ? wu_network_admin_url(
|
||||
'wp-ultimo-edit-membership',
|
||||
array(
|
||||
[
|
||||
'id' => $m->get_id(),
|
||||
)
|
||||
]
|
||||
) : '',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'date_created' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
/* translators: the placeholder is a date */
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
return $sites;
|
||||
}
|
||||
|
||||
$pending_sites = array();
|
||||
$pending_sites = [];
|
||||
|
||||
$page = wu_request('page');
|
||||
|
||||
@ -140,11 +140,11 @@ class Customers_Site_List_Table extends Site_List_Table {
|
||||
switch ($page) {
|
||||
case 'wp-ultimo-edit-membership':
|
||||
$membership = wu_get_membership($id);
|
||||
$pending_sites = $membership && $membership->get_pending_site() ? array($membership->get_pending_site()) : array();
|
||||
$pending_sites = $membership && $membership->get_pending_site() ? [$membership->get_pending_site()] : [];
|
||||
break;
|
||||
case 'wp-ultimo-edit-customer':
|
||||
$customer = wu_get_customer($id);
|
||||
$pending_sites = $customer ? $customer->get_pending_sites() : array();
|
||||
$pending_sites = $customer ? $customer->get_pending_sites() : [];
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Discount_Codes\\Discount_Code_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Discount_Codes\Discount_Code_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -35,15 +35,15 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Discount Code', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Discount Codes', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'add_new' => [
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-discount-code'),
|
||||
'classes' => '',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -55,14 +55,14 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_name($item): string {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'discount_code',
|
||||
);
|
||||
];
|
||||
|
||||
$title = sprintf('<a href="%s"><strong>%s</strong></a>', wu_network_admin_url('wp-ultimo-edit-discount-code', $url_atts), $item->get_name());
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-discount-code', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'delete' => sprintf(
|
||||
'<a title="%s" class="wubox" href="%s">%s</a>',
|
||||
@ -73,7 +73,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
];
|
||||
|
||||
return $title . $this->row_actions($actions);
|
||||
}
|
||||
@ -183,7 +183,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'name' => __('Name', 'wp-ultimo'),
|
||||
'coupon_code' => __('Code', 'wp-ultimo'),
|
||||
@ -191,7 +191,7 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
'value' => __('Value', 'wp-ultimo'),
|
||||
'setup_fee_value' => __('Setup Fee Value', 'wp-ultimo'),
|
||||
'date_expiration' => __('Dates', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -202,9 +202,9 @@ class Discount_Code_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
return [
|
||||
'filters' => [],
|
||||
'date_filters' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Domains\\Domain_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Domains\Domain_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -38,15 +38,15 @@ class Domain_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Domain', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Domains', '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_domain'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -75,19 +75,19 @@ class Domain_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_domain($item): string {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'domain',
|
||||
);
|
||||
];
|
||||
|
||||
$domain = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-domain', $url_atts), $item->get_domain());
|
||||
|
||||
$html = "<span class='wu-font-mono'><strong>{$domain}</strong></span>";
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-domain', $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', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
return $html . $this->row_actions($actions);
|
||||
}
|
||||
@ -156,7 +156,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'domain' => __('Domain', 'wp-ultimo'),
|
||||
'stage' => __('Stage', 'wp-ultimo'),
|
||||
@ -165,7 +165,7 @@ class Domain_List_Table extends Base_List_Table {
|
||||
'primary_domain' => __('Primary', 'wp-ultimo'),
|
||||
'secure' => __('HTTPS', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -176,52 +176,52 @@ class Domain_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(
|
||||
return [
|
||||
'filters' => [
|
||||
|
||||
/**
|
||||
* Active
|
||||
*/
|
||||
'active' => array(
|
||||
'active' => [
|
||||
'label' => __('Active', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
0 => __('Inactive', 'wp-ultimo'),
|
||||
1 => __('Active', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
/**
|
||||
* Primay
|
||||
*/
|
||||
'primary_domain' => array(
|
||||
'primary_domain' => [
|
||||
'label' => __('Is Primary', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
0 => __('Not Primary Domain', 'wp-ultimo'),
|
||||
1 => __('Primary Domain', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
/**
|
||||
* Secure (HTTPS)
|
||||
*/
|
||||
'secure' => array(
|
||||
'secure' => [
|
||||
'label' => __('HTTPS', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
0 => __('Non-HTTPS', 'wp-ultimo'),
|
||||
1 => __('HTTPS', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
/**
|
||||
* Stage
|
||||
*/
|
||||
'stage' => array(
|
||||
'stage' => [
|
||||
'label' => __('Verification Stage', 'wp-ultimo'),
|
||||
'options' => Domain_Stage::to_array(),
|
||||
),
|
||||
],
|
||||
|
||||
),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
],
|
||||
'date_filters' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Emails\\Email_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Emails\Email_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -35,15 +35,15 @@ class Email_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Email', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Emails', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'add_new' => [
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-email'),
|
||||
'classes' => '',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -59,11 +59,11 @@ class Email_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_items($per_page = 5, $page_number = 1, $count = false) {
|
||||
|
||||
$query = array(
|
||||
$query = [
|
||||
'number' => $per_page,
|
||||
'offset' => ($page_number - 1) * $per_page,
|
||||
'count' => $count,
|
||||
);
|
||||
];
|
||||
|
||||
$search = wu_request('s');
|
||||
|
||||
@ -74,12 +74,12 @@ class Email_List_Table extends Base_List_Table {
|
||||
$target = wu_request('target');
|
||||
|
||||
if ($target && $target !== 'all') {
|
||||
$query['meta_query'] = array(
|
||||
'type' => array(
|
||||
$query['meta_query'] = [
|
||||
'type' => [
|
||||
'key' => 'wu_target',
|
||||
'value' => $target,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$query = apply_filters("wu_{$this->id}_get_items", $query, $this);
|
||||
@ -95,10 +95,10 @@ class Email_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_title($item): string {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'email',
|
||||
);
|
||||
];
|
||||
|
||||
$title = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-email', $url_atts), $item->get_title());
|
||||
|
||||
@ -108,11 +108,11 @@ class Email_List_Table extends Base_List_Table {
|
||||
|
||||
$content = wp_trim_words(wp_strip_all_tags($item->get_content()), 6);
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-email', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'duplicate' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-email', $url_atts), __('Duplicate', 'wp-ultimo')),
|
||||
'send-test' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Send Test Email', 'wp-ultimo'), wu_get_form_url('send_new_test', $url_atts), __('Send Test Email', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
$slug = $item->get_slug();
|
||||
|
||||
@ -190,14 +190,14 @@ class Email_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __('Content', 'wp-ultimo'),
|
||||
'slug' => __('Event', 'wp-ultimo'),
|
||||
'event' => __('slug', 'wp-ultimo'),
|
||||
'schedule' => __('When', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -208,7 +208,7 @@ class Email_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function process_single_action() {
|
||||
public function process_single_action(): void {
|
||||
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
@ -269,10 +269,10 @@ class Email_List_Table extends Base_List_Table {
|
||||
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-email',
|
||||
array(
|
||||
[
|
||||
'id' => $new_email->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
@ -287,23 +287,23 @@ class Email_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(
|
||||
'type' => array(
|
||||
return [
|
||||
'filters' => [
|
||||
'type' => [
|
||||
'label' => __('Email Type', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'email_email' => __('Email', 'wp-ultimo'),
|
||||
'broadcast_email' => __('Notices', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'date_filters' => array(
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'date_filters' => [
|
||||
'date_created' => [
|
||||
'label' => __('Date', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -314,25 +314,25 @@ class Email_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'target',
|
||||
'url' => add_query_arg('target', 'all'),
|
||||
'label' => __('All Emails', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'admin' => array(
|
||||
],
|
||||
'admin' => [
|
||||
'field' => 'target',
|
||||
'url' => add_query_arg('target', 'admin'),
|
||||
'label' => __('Admin Emails', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'customer' => array(
|
||||
],
|
||||
'customer' => [
|
||||
'field' => 'target',
|
||||
'url' => add_query_arg('target', 'customer'),
|
||||
'label' => __('Customer Emails', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Events\\Event_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Events\Event_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -37,11 +37,11 @@ class Event_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Event', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Events', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -103,19 +103,19 @@ class Event_List_Table extends Base_List_Table {
|
||||
32,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$display_name = $item->get_author_display_name();
|
||||
|
||||
$id = $item->get_author_id();
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_author_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$initiator_link = wu_network_admin_url('wp-ultimo-edit-customer', $url_atts);
|
||||
|
||||
@ -175,12 +175,12 @@ class Event_List_Table extends Base_List_Table {
|
||||
|
||||
$message = wp_trim_words($item->get_message(), 13);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'event',
|
||||
);
|
||||
];
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'view' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-view-event', $url_atts), __('View', 'wp-ultimo')),
|
||||
'delete' => sprintf(
|
||||
'<a title="%s" class="wubox" href="%s">%s</a>',
|
||||
@ -191,7 +191,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
];
|
||||
|
||||
return $message . $this->row_actions($actions);
|
||||
}
|
||||
@ -204,7 +204,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'initiator' => __('Initiator', 'wp-ultimo'),
|
||||
'message' => __('Event Message', 'wp-ultimo'),
|
||||
@ -212,7 +212,7 @@ class Event_List_Table extends Base_List_Table {
|
||||
'object_type' => __('Type', 'wp-ultimo'),
|
||||
'date_created' => __('Created at', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return apply_filters('wu_events_list_table_get_columns', $columns, $this);
|
||||
}
|
||||
@ -223,25 +223,25 @@ class Event_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(
|
||||
'severity' => array(
|
||||
return [
|
||||
'filters' => [
|
||||
'severity' => [
|
||||
'label' => __('Severity', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
Event::SEVERITY_SUCCESS => __('Success', 'wp-ultimo'),
|
||||
Event::SEVERITY_NEUTRAL => __('Neutral', 'wp-ultimo'),
|
||||
Event::SEVERITY_INFO => __('Info', 'wp-ultimo'),
|
||||
Event::SEVERITY_WARNING => __('Warning', 'wp-ultimo'),
|
||||
Event::SEVERITY_FATAL => __('Fatal', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'date_filters' => array(
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'date_filters' => [
|
||||
'date_created' => [
|
||||
'label' => __('Created At', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ class Inside_Events_List_Table extends Event_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -42,20 +42,20 @@ class Inside_Events_List_Table extends Event_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
$first_row = array(
|
||||
'id' => array(
|
||||
$first_row = [
|
||||
'id' => [
|
||||
'icon' => 'dashicons-wu-hash wu-align-middle wu-mr-1',
|
||||
'label' => __('Event ID', 'wp-ultimo'),
|
||||
'value' => $item->get_id(),
|
||||
),
|
||||
'slug' => array(
|
||||
],
|
||||
'slug' => [
|
||||
'icon' => 'dashicons-wu-bookmark1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Event Type', 'wp-ultimo'),
|
||||
'value' => wu_slug_to_name($item->get_slug()),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$object_initiator = $item->get_initiator();
|
||||
|
||||
@ -67,10 +67,10 @@ class Inside_Events_List_Table extends Event_List_Table {
|
||||
16,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full wu-mr-1 wu-align-text-bottom',
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$display_name = $item->get_author_display_name();
|
||||
@ -79,25 +79,25 @@ class Inside_Events_List_Table extends Event_List_Table {
|
||||
}
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => '',
|
||||
'title' => sprintf('<span class="wu-font-normal">%s</span>', wp_trim_words($item->get_message(), 15)),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-view-event',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'status' => $value,
|
||||
),
|
||||
],
|
||||
$first_row,
|
||||
array(
|
||||
'date_created' => array(
|
||||
[
|
||||
'date_created' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Processed %s', 'wp-ultimo'), wu_human_time_diff($item->get_date_created(), '-1 day')),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Line_Item_List_Table extends Payment_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.
|
||||
@ -35,11 +35,11 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Line Item', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Line Items', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -93,15 +93,15 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
return '--';
|
||||
}
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $this->get_payment()->get_id(),
|
||||
'line_item_id' => $item->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Edit Item', 'wp-ultimo'), wu_get_form_url('edit_line_item', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'delete' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete Item', 'wp-ultimo'), wu_get_form_url('delete_line_item', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
$html = sprintf('<span class="wu-block wu-text-gray-700">%s</span>', $item->get_title());
|
||||
|
||||
@ -145,7 +145,7 @@ class Line_Item_List_Table extends Payment_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');
|
||||
|
||||
return $html . sprintf('<small class="wu-block">%s (%s)</small>', $tax_rate, $tax_label);
|
||||
}
|
||||
@ -168,7 +168,7 @@ class Line_Item_List_Table extends Payment_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');
|
||||
|
||||
return $html . sprintf('<small class="wu-block">%s (%s)</small>', $tax_rate, $tax_label);
|
||||
}
|
||||
@ -207,14 +207,14 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'service' => __('Service', 'wp-ultimo'),
|
||||
'unit_price' => __('Unit Price', 'wp-ultimo'),
|
||||
'discounts_total' => __('discounts', 'wp-ultimo'),
|
||||
'subtotal' => __('Subtotal', 'wp-ultimo'),
|
||||
'tax_total' => __('Taxes', 'wp-ultimo'),
|
||||
'total' => __('Total', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -227,6 +227,6 @@ class Line_Item_List_Table extends Payment_List_Table {
|
||||
*/
|
||||
public function get_sortable_columns() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -65,7 +65,7 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
$quantity = $item['quantity'];
|
||||
|
||||
@ -75,89 +75,89 @@ class Membership_Line_Item_List_Table extends Product_List_Table {
|
||||
|
||||
if ( ! $item) {
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'url' => false,
|
||||
'id' => 'not-found',
|
||||
'title' => __('Product not found', 'wp-ultimo'),
|
||||
'status' => '',
|
||||
'image' => $this->column_featured_image_id(new \WP_Ultimo\Models\Product()),
|
||||
),
|
||||
array(
|
||||
'quantity' => array(
|
||||
],
|
||||
[
|
||||
'quantity' => [
|
||||
'icon' => 'dashicons-wu-package wu-align-middle wu-mr-1',
|
||||
'label' => __('Quantity', 'wp-ultimo'),
|
||||
'value' => sprintf(__('x%d', 'wp-ultimo'), $quantity),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$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'), $quantity),
|
||||
),
|
||||
'total' => array(
|
||||
],
|
||||
'total' => [
|
||||
'icon' => 'dashicons-wu-shopping-bag1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Price description', 'wp-ultimo'),
|
||||
'value' => $item->get_price_description(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
$second_row = array(
|
||||
'slug' => array(
|
||||
$second_row = [
|
||||
'slug' => [
|
||||
'icon' => 'dashicons-wu-bookmark1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Product Slug', 'wp-ultimo'),
|
||||
'value' => $item->get_slug(),
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
if ($item->get_type() === 'plan') {
|
||||
$first_row['change'] = array(
|
||||
$first_row['change'] = [
|
||||
'wrapper_classes' => 'wubox',
|
||||
'icon' => 'dashicons-wu-edit1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => __('Upgrade or Downgrade', 'wp-ultimo'),
|
||||
'url' => wu_get_form_url(
|
||||
'change_membership_plan',
|
||||
array(
|
||||
[
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
);
|
||||
];
|
||||
} else {
|
||||
$first_row['remove'] = array(
|
||||
$first_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(
|
||||
'remove_membership_product',
|
||||
array(
|
||||
[
|
||||
'id' => $membership_id,
|
||||
'product_id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_name(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-product',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
],
|
||||
$first_row,
|
||||
$second_row
|
||||
);
|
||||
|
@ -27,7 +27,7 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Memberships\\Membership_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Memberships\Membership_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -37,11 +37,11 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Membership', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Memberships', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -59,14 +59,14 @@ class Membership_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
|
||||
@ -121,16 +121,16 @@ class Membership_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-membership', $url_atts), $item->get_hash());
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-membership', $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>";
|
||||
|
||||
@ -219,19 +219,19 @@ class Membership_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();
|
||||
@ -260,12 +260,12 @@ class Membership_List_Table_Widget extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'hash' => __('Ref.', 'wp-ultimo'),
|
||||
'status' => __('Status', 'wp-ultimo'),
|
||||
'customer' => __('Customer', 'wp-ultimo'),
|
||||
'amount' => __('Price', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Memberships\\Membership_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Memberships\Membership_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -35,15 +35,15 @@ class Membership_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Membership', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Memberships', '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_membership'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -74,14 +74,14 @@ class Membership_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_hash($item) {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'membership',
|
||||
);
|
||||
];
|
||||
|
||||
$code = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-membership', $url_atts), $item->get_hash());
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-membership', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'delete' => sprintf(
|
||||
'<a title="%s" class="wubox" href="%s">%s</a>',
|
||||
@ -92,7 +92,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
];
|
||||
|
||||
$html = "<span class='wu-font-mono'><strong>{$code}</strong></span>";
|
||||
|
||||
@ -170,7 +170,7 @@ class Membership_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'),
|
||||
@ -181,7 +181,7 @@ class Membership_List_Table extends Base_List_Table {
|
||||
'date_created' => __('Created at', 'wp-ultimo'),
|
||||
'date_expiration' => __('Expiration', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -226,45 +226,45 @@ class Membership_List_Table extends Base_List_Table {
|
||||
|
||||
$membership_status = new \WP_Ultimo\Database\Memberships\Membership_Status();
|
||||
|
||||
return array(
|
||||
'filters' => array(
|
||||
return [
|
||||
'filters' => [
|
||||
|
||||
/**
|
||||
* Status
|
||||
*/
|
||||
'status' => array(
|
||||
'status' => [
|
||||
'label' => __('Status', 'wp-ultimo'),
|
||||
'options' => $membership_status::to_array(),
|
||||
),
|
||||
],
|
||||
|
||||
),
|
||||
'date_filters' => array(
|
||||
],
|
||||
'date_filters' => [
|
||||
|
||||
/**
|
||||
* Created At
|
||||
*/
|
||||
'date_created' => array(
|
||||
'date_created' => [
|
||||
'label' => __('Created At', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
],
|
||||
|
||||
/**
|
||||
* Expiration Date
|
||||
*/
|
||||
'date_expiration' => array(
|
||||
'date_expiration' => [
|
||||
'label' => __('Expiration Date', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
],
|
||||
|
||||
/**
|
||||
* Renewal Date
|
||||
*/
|
||||
'date_renewed' => array(
|
||||
'date_renewed' => [
|
||||
'label' => __('Renewal Date', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,49 +275,49 @@ class Membership_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 Memberships', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'active' => array(
|
||||
],
|
||||
'active' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', 'active'),
|
||||
'label' => __('Active', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'trialing' => array(
|
||||
],
|
||||
'trialing' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', 'trialing'),
|
||||
'label' => __('Trialing', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'pending' => array(
|
||||
],
|
||||
'pending' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', 'pending'),
|
||||
'label' => __('Pending', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'on-hold' => array(
|
||||
],
|
||||
'on-hold' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', 'on-hold'),
|
||||
'label' => __('On Hold', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'expired' => array(
|
||||
],
|
||||
'expired' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', 'expired'),
|
||||
'label' => __('Expired', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'cancelled' => array(
|
||||
],
|
||||
'cancelled' => [
|
||||
'field' => 'status',
|
||||
'url' => add_query_arg('status', 'cancelled'),
|
||||
'label' => __('Cancelled', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ class Memberships_Site_List_Table extends Customers_Site_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -42,44 +42,44 @@ class Memberships_Site_List_Table extends Customers_Site_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
$redirect = current_user_can('wu_edit_sites') ? 'wp-ultimo-edit-site' : 'wp-ultimo-sites';
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_title(),
|
||||
'url' => wu_network_admin_url(
|
||||
$redirect,
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'image' => $this->column_featured_image_id($item),
|
||||
'status' => $this->column_type($item),
|
||||
),
|
||||
array(
|
||||
'link' => array(
|
||||
],
|
||||
[
|
||||
'link' => [
|
||||
'icon' => 'dashicons-wu-link1 wu-align-middle wu-mr-1',
|
||||
'label' => __('Visit Site', 'wp-ultimo'),
|
||||
'value' => __('Homepage', 'wp-ultimo'),
|
||||
'url' => $item->get_active_site_url(),
|
||||
),
|
||||
'dashboard' => array(
|
||||
],
|
||||
'dashboard' => [
|
||||
'icon' => 'dashicons-wu-browser wu-align-middle wu-mr-1',
|
||||
'label' => __('Go to the Dashboard', 'wp-ultimo'),
|
||||
'value' => __('Dashboard', 'wp-ultimo'),
|
||||
'url' => get_admin_url($item->get_id()),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'date_created' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->get_type() === 'pending' ? __('Not Available', 'wp-ultimo') : sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Products\\Product_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Products\Product_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -35,15 +35,15 @@ class Product_List_Table extends Base_List_Table {
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Product', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Products', 'wp-ultimo'), // plural name of the listed records
|
||||
'ajax' => true, // does this table support ajax?
|
||||
'add_new' => array(
|
||||
'add_new' => [
|
||||
'url' => wu_network_admin_url('wp-ultimo-edit-product'),
|
||||
'classes' => '',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -57,31 +57,31 @@ class Product_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_name($item) {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'product',
|
||||
);
|
||||
];
|
||||
|
||||
$title = sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-product', $url_atts), $item->get_name());
|
||||
|
||||
// Concatenate the two blocks
|
||||
$title = "<strong>$title</strong>";
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-product', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'duplicate' => sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
wu_network_admin_url(
|
||||
'wp-ultimo-products',
|
||||
array(
|
||||
[
|
||||
'action' => 'duplicate',
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
__('Duplicate', 'wp-ultimo')
|
||||
),
|
||||
'delete' => sprintf('<a title="%s" class="wubox" href="%s">%s</a>', __('Delete', 'wp-ultimo'), wu_get_form_url('delete_modal', $url_atts), __('Delete', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
return $title . $this->row_actions($actions);
|
||||
}
|
||||
@ -191,7 +191,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function process_single_action() {
|
||||
public function process_single_action(): void {
|
||||
|
||||
$bulk_action = $this->current_action();
|
||||
|
||||
@ -226,10 +226,10 @@ class Product_List_Table extends Base_List_Table {
|
||||
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-product',
|
||||
array(
|
||||
[
|
||||
'id' => $new_product->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
@ -246,7 +246,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'featured_image_id' => '<span class="dashicons-wu-image"></span>',
|
||||
'name' => __('Name', 'wp-ultimo'),
|
||||
@ -255,7 +255,7 @@ class Product_List_Table extends Base_List_Table {
|
||||
'amount' => __('Price', 'wp-ultimo'),
|
||||
'setup_fee' => __('Setup Fee', 'wp-ultimo'),
|
||||
'id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -268,14 +268,14 @@ class Product_List_Table extends Base_List_Table {
|
||||
* @param WP_Ultimo\Models\Product $item The line item being displayed.
|
||||
* @return void
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
public function single_row_grid($item): void {
|
||||
|
||||
wu_get_template(
|
||||
'base/products/grid-item',
|
||||
array(
|
||||
[
|
||||
'item' => $item,
|
||||
'table' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -286,9 +286,9 @@ class Product_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(),
|
||||
);
|
||||
return [
|
||||
'filters' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,31 +299,31 @@ class Product_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'all'),
|
||||
'label' => __('All Products', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'plan' => array(
|
||||
],
|
||||
'plan' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'plan'),
|
||||
'label' => __('Plans', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'package' => array(
|
||||
],
|
||||
'package' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'package'),
|
||||
'label' => __('Packages', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'service' => array(
|
||||
],
|
||||
'service' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'service'),
|
||||
'label' => __('Services', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ class Site_Customer_List_Table extends Customer_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -54,7 +54,7 @@ class Site_Customer_List_Table extends Customer_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
$last_login = sprintf(__('Last login %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_last_login())));
|
||||
|
||||
@ -63,46 +63,46 @@ class Site_Customer_List_Table extends Customer_List_Table {
|
||||
}
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
'title' => $item->get_display_name(),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-customer',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'image' => get_avatar(
|
||||
$item->get_user_id(),
|
||||
36,
|
||||
'identicon',
|
||||
'',
|
||||
array(
|
||||
[
|
||||
'force_display' => true,
|
||||
'class' => 'wu-rounded-full',
|
||||
)
|
||||
]
|
||||
),
|
||||
'status' => $this->column_status($item),
|
||||
),
|
||||
array(
|
||||
'total' => array(
|
||||
],
|
||||
[
|
||||
'total' => [
|
||||
'icon' => 'dashicons-wu-at-sign wu-align-middle wu-mr-1',
|
||||
'label' => __('Email Address', 'wp-ultimo'),
|
||||
'value' => $item->get_email_address(),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_expiration' => array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'date_expiration' => [
|
||||
'icon' => $item->is_online() === false ? 'dashicons-wu-calendar1 wu-align-middle wu-mr-1' : '',
|
||||
'label' => __('Last Login', 'wp-ultimo'),
|
||||
'value' => $last_login,
|
||||
),
|
||||
'date_created' => array(
|
||||
],
|
||||
'date_created' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Registered %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_registered()))),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $query_class = '\\WP_Ultimo\\Database\\Sites\\Site_Query';
|
||||
protected $query_class = \WP_Ultimo\Database\Sites\Site_Query::class;
|
||||
|
||||
/**
|
||||
* Initializes the table.
|
||||
@ -34,21 +34,21 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->modes = array(
|
||||
$this->modes = [
|
||||
'grid' => __('Grid View'),
|
||||
'list' => __('List View'),
|
||||
);
|
||||
];
|
||||
|
||||
parent::__construct(
|
||||
array(
|
||||
[
|
||||
'singular' => __('Site', 'wp-ultimo'), // singular name of the listed records
|
||||
'plural' => __('Sites', '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_site'),
|
||||
'classes' => 'wubox',
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@ -72,20 +72,20 @@ class Site_List_Table extends Base_List_Table {
|
||||
return $count ? count($pending_sites) : $pending_sites;
|
||||
}
|
||||
|
||||
$query = array(
|
||||
$query = [
|
||||
'number' => $per_page,
|
||||
'offset' => ($page_number - 1) * $per_page,
|
||||
'count' => $count,
|
||||
'search' => wu_request('s'),
|
||||
);
|
||||
];
|
||||
|
||||
if ($type && $type !== 'all') {
|
||||
$query['meta_query'] = array(
|
||||
'type' => array(
|
||||
$query['meta_query'] = [
|
||||
'type' => [
|
||||
'key' => 'wu_type',
|
||||
'value' => $type,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$query = apply_filters("wu_{$this->id}_get_items", $query, $this);
|
||||
@ -114,10 +114,10 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function column_path($item): string {
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'id' => $item->get_id(),
|
||||
'model' => 'site',
|
||||
);
|
||||
];
|
||||
|
||||
$title = $item->get_title();
|
||||
|
||||
@ -126,7 +126,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
// Concatenate the two blocks
|
||||
$title = "<strong>$title</strong>";
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'edit' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-edit-site', $url_atts), __('Edit', 'wp-ultimo')),
|
||||
'duplicate' => sprintf(
|
||||
'<a title="%s" class="wubox" href="%s">%s</a>',
|
||||
@ -146,16 +146,16 @@ class Site_List_Table extends Base_List_Table {
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
];
|
||||
|
||||
if ($item->get_type() === 'pending') {
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'duplicate' => sprintf(
|
||||
'<a title="%s" class="wubox" href="%s">%s</a>',
|
||||
__('Publish Site', 'wp-ultimo'),
|
||||
wu_get_form_url(
|
||||
'publish_pending_site',
|
||||
array('membership_id' => $item->get_membership_id())
|
||||
['membership_id' => $item->get_membership_id()]
|
||||
),
|
||||
__('Publish', 'wp-ultimo')
|
||||
),
|
||||
@ -164,23 +164,23 @@ class Site_List_Table extends Base_List_Table {
|
||||
__('Delete', 'wp-ultimo'),
|
||||
wu_get_form_url(
|
||||
'delete_modal',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_membership_id(),
|
||||
'model' => 'membership_meta_pending_site',
|
||||
'redirect_to' => urlencode(
|
||||
(string) wu_network_admin_url(
|
||||
'wp-ultimo-sites',
|
||||
array(
|
||||
[
|
||||
'type' => 'pending',
|
||||
'page' => wu_request('page', 1),
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
)
|
||||
]
|
||||
),
|
||||
__('Delete', 'wp-ultimo')
|
||||
),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $title . sprintf('<span class="wu-block">%s</span>', make_clickable($item->get_active_site_url())) . $this->row_actions($actions);
|
||||
@ -238,19 +238,19 @@ class Site_List_Table extends Base_List_Table {
|
||||
public function column_domains($item): string {
|
||||
|
||||
$domain = wu_get_domains(
|
||||
array(
|
||||
[
|
||||
'blog_id' => $item->get_id(),
|
||||
'count' => true,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
$url_atts = array(
|
||||
$url_atts = [
|
||||
'blog_id' => $item->get_id(),
|
||||
);
|
||||
];
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'view' => sprintf('<a href="%s">%s</a>', wu_network_admin_url('wp-ultimo-domains', $url_atts), __('View', 'wp-ultimo')),
|
||||
);
|
||||
];
|
||||
|
||||
return $domain . $this->row_actions($actions);
|
||||
}
|
||||
@ -263,7 +263,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'featured_image_id' => '<span class="dashicons-wu-image"></span>',
|
||||
'path' => __('URL', 'wp-ultimo'),
|
||||
@ -272,7 +272,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
'membership' => __('Membership', 'wp-ultimo'),
|
||||
'domains' => __('Domains', 'wp-ultimo'),
|
||||
'blog_id' => __('ID', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -285,14 +285,14 @@ class Site_List_Table extends Base_List_Table {
|
||||
* @param WP_Ultimo\Models\Customer $item The customer being shown.
|
||||
* @return void
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
public function single_row_grid($item): void {
|
||||
|
||||
wu_get_template(
|
||||
'base/sites/grid-item',
|
||||
array(
|
||||
[
|
||||
'item' => $item,
|
||||
'list_table' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -302,27 +302,27 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(
|
||||
'vip' => array(
|
||||
return [
|
||||
'filters' => [
|
||||
'vip' => [
|
||||
'label' => __('VIP Status', 'wp-ultimo'),
|
||||
'options' => array(
|
||||
'options' => [
|
||||
'0' => __('Regular Sites', 'wp-ultimo'),
|
||||
'1' => __('VIP Sites', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'date_filters' => array(
|
||||
'last_login' => array(
|
||||
],
|
||||
],
|
||||
],
|
||||
'date_filters' => [
|
||||
'last_login' => [
|
||||
'label' => __('Last Login', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
'date_registered' => array(
|
||||
],
|
||||
'date_registered' => [
|
||||
'label' => __('Site Since', 'wp-ultimo'),
|
||||
'options' => $this->get_default_date_filter_options(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -333,32 +333,32 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'all'),
|
||||
'label' => __('All Sites', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'customer_owned' => array(
|
||||
],
|
||||
'customer_owned' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'customer_owned'),
|
||||
'label' => __('Customer-Owned', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'site_template' => array(
|
||||
],
|
||||
'site_template' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'site_template'),
|
||||
'label' => __('Templates', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
'pending' => array(
|
||||
],
|
||||
'pending' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'pending'),
|
||||
'label' => __('Pending', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -368,9 +368,9 @@ class Site_List_Table extends Base_List_Table {
|
||||
*/
|
||||
public function get_bulk_actions() {
|
||||
|
||||
$actions = array(
|
||||
$actions = [
|
||||
'screenshot' => __('Take Screenshot', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
$actions[ wu_request('type', 'all') === 'pending' ? 'delete-pending' : 'delete' ] = __('Delete', 'wp-ultimo');
|
||||
|
||||
@ -383,7 +383,7 @@ class Site_List_Table extends Base_List_Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function process_single_action() {
|
||||
public function process_single_action(): void {
|
||||
|
||||
$action = $this->current_action();
|
||||
|
||||
@ -424,10 +424,10 @@ class Site_List_Table extends Base_List_Table {
|
||||
|
||||
$redirect_url = wu_network_admin_url(
|
||||
'wp-ultimo-edit-site',
|
||||
array(
|
||||
[
|
||||
'id' => $new_site->get_id(),
|
||||
'updated' => 1,
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
wp_redirect($redirect_url);
|
||||
|
@ -27,9 +27,9 @@ class Sites_Domain_List_Table extends Domain_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'responsive' => '',
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -42,40 +42,40 @@ class Sites_Domain_List_Table extends Domain_List_Table {
|
||||
* @param object $item The item being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function column_responsive($item) {
|
||||
public function column_responsive($item): void {
|
||||
|
||||
echo wu_responsive_table_row(
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
'title' => strtolower((string) $item->get_domain()),
|
||||
'url' => wu_network_admin_url(
|
||||
'wp-ultimo-edit-domain',
|
||||
array(
|
||||
[
|
||||
'id' => $item->get_id(),
|
||||
)
|
||||
]
|
||||
),
|
||||
'status' => $this->column_stage($item),
|
||||
),
|
||||
array(
|
||||
'primary' => array(
|
||||
],
|
||||
[
|
||||
'primary' => [
|
||||
'icon' => $item->is_primary_domain() ? 'dashicons-wu-filter_1 wu-align-text-bottom wu-mr-1' : 'dashicons-wu-plus-square wu-align-text-bottom wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->is_primary_domain() ? __('Primary', 'wp-ultimo') : __('Alias', 'wp-ultimo'),
|
||||
),
|
||||
'secure' => array(
|
||||
],
|
||||
'secure' => [
|
||||
'wrapper_classes' => $item->is_secure() ? 'wu-text-green-500' : '',
|
||||
'icon' => $item->is_secure() ? 'dashicons-wu-lock1 wu-align-text-bottom wu-mr-1' : 'dashicons-wu-lock1 wu-align-text-bottom wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => $item->is_secure() ? __('Secure (HTTPS)', 'wp-ultimo') : __('Not Secure (HTTP)', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'date_created' => array(
|
||||
],
|
||||
],
|
||||
[
|
||||
'date_created' => [
|
||||
'icon' => 'dashicons-wu-calendar1 wu-align-middle wu-mr-1',
|
||||
'label' => '',
|
||||
'value' => sprintf(__('Created %s', 'wp-ultimo'), wu_human_time_diff(strtotime((string) $item->get_date_created()))),
|
||||
),
|
||||
)
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ class Invoice_List_Table extends Parent_Payment_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'hash' => __('Code', 'wp-ultimo'),
|
||||
'status' => __('Status', 'wp-ultimo'),
|
||||
'total' => __('Total', 'wp-ultimo'),
|
||||
'date_created' => __('Created at', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
@ -49,6 +49,6 @@ class Invoice_List_Table extends Parent_Payment_List_Table {
|
||||
*/
|
||||
public function bulk_actions($which = '') {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->modes = array(
|
||||
$this->modes = [
|
||||
'grid' => __('Grid View'),
|
||||
);
|
||||
];
|
||||
|
||||
$this->current_mode = 'grid';
|
||||
}
|
||||
@ -45,7 +45,7 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,10 +55,10 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
return [
|
||||
'filters' => [],
|
||||
'date_filters' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,7 +71,7 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
*/
|
||||
public function bulk_actions($which = '') {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,14 +82,14 @@ class Product_List_Table extends Parent_Product_List_Table {
|
||||
* @param WP_Ultimo\Models\Customer $item The customer being shown.
|
||||
* @return void
|
||||
*/
|
||||
public function single_row_grid($item) {
|
||||
public function single_row_grid($item): void {
|
||||
|
||||
wu_get_template(
|
||||
'base/products/grid-item',
|
||||
array(
|
||||
[
|
||||
'item' => $item,
|
||||
'list_table' => $this,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->modes = array(
|
||||
$this->modes = [
|
||||
'grid' => __('Grid View'),
|
||||
);
|
||||
];
|
||||
|
||||
$this->current_mode = 'grid';
|
||||
}
|
||||
@ -45,7 +45,7 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
*/
|
||||
public function get_columns() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,10 +55,10 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
*/
|
||||
public function get_filters(): array {
|
||||
|
||||
return array(
|
||||
'filters' => array(),
|
||||
'date_filters' => array(),
|
||||
);
|
||||
return [
|
||||
'filters' => [],
|
||||
'date_filters' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,14 +69,14 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
*/
|
||||
public function get_views() {
|
||||
|
||||
return array(
|
||||
'all' => array(
|
||||
return [
|
||||
'all' => [
|
||||
'field' => 'type',
|
||||
'url' => add_query_arg('type', 'all'),
|
||||
'label' => __('Your Sites', 'wp-ultimo'),
|
||||
'count' => 0,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,21 +90,21 @@ class Site_List_Table extends Parent_Site_List_Table {
|
||||
$customer = wu_get_current_customer();
|
||||
|
||||
if ( ! $customer) {
|
||||
return array(
|
||||
'blog_id__in' => array('null_id'), // pass absurd value to make sure the query returns nothing.
|
||||
);
|
||||
return [
|
||||
'blog_id__in' => ['null_id'], // pass absurd value to make sure the query returns nothing.
|
||||
];
|
||||
}
|
||||
|
||||
$fields = parent::get_extra_fields();
|
||||
|
||||
$fields = array(
|
||||
'meta_query' => array(
|
||||
'customer_id' => array(
|
||||
$fields = [
|
||||
'meta_query' => [
|
||||
'customer_id' => [
|
||||
'key' => 'wu_customer_id',
|
||||
'value' => $customer->get_id(),
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
Reference in New Issue
Block a user