__('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? ] ); } /** * Uses the query class to return the items to be displayed. * * @since 2.0.0 * * @param integer $per_page Number of items to display per page. * @param integer $page_number Current page. * @param boolean $count If we should count records or return the actual records. * @return array */ public function get_items($per_page = 5, $page_number = 1, $count = false) { $query_class = new $this->query_class(); $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 */ if (isset($query_args['search']) && strlen((string) $query_args['search']) === Hash::LENGTH) { $item_id = Hash::decode($query_args['search']); if ($item_id) { unset($query_args['search']); $query_args['id'] = $item_id; } } $query_args = array_merge($query_args, $this->get_extra_query_fields()); $query_args = apply_filters("wu_{$this->id}_get_items", $query_args, $this); $function_name = 'wu_get_' . $query_class->get_plural_name(); if (function_exists($function_name)) { $query = $function_name($query_args); } else { $query = $query_class->query($query_args); } return $query; } /** * Displays the payment reference code. * * @since 2.0.0 * * @param WP_Ultimo\Models\Payment $item Payment object. */ public function column_hash($item): string { $url_atts = [ 'id' => $item->get_id(), ]; $code = sprintf('%s', wu_network_admin_url('wp-ultimo-edit-payment', $url_atts), $item->get_hash()); $actions = [ 'edit' => sprintf('%s', wu_network_admin_url('wp-ultimo-edit-payment', $url_atts), __('Edit', 'wp-ultimo')), 'delete' => sprintf('%s', '', __('Delete', 'wp-ultimo')), ]; $html = "{$code}"; return $html . $this->row_actions($actions); } /** * Displays the membership photo and special status. * * @since 2.0.0 * * @param WP_Ultimo\Models\Payment $item Payment object. * @return string */ public function column_status($item) { $label = $item->get_status_label(); $class = $item->get_status_class(); return "{$label}"; } /** * Displays the customer of the membership. * * @since 2.0.0 * * @param WP_Ultimo\Models\Membership $item Membership object. * @return string */ public function column_customer($item) { $customer = $item->get_customer(); if ( ! $customer) { $not_found = __('No customer found', 'wp-ultimo'); return "