'Settings', 'singular' => 'Setting', )); $this->items = $objects; $this->public = $public; $this->setting_prefix = $setting_prefix; $this->prepare_items(); } function ajax_user_can() { return true; } function prepare_items() { $search = sanitize_text_field(!empty($_REQUEST['s']) ? trim(stripslashes($_REQUEST['s'])) : ''); $args = array( 'search' => $search, 'page' => $this->get_pagenum(), 'number' => 10, ); $orderBy = sanitize_text_field(!empty($_REQUEST['orderby']) ? trim(stripslashes($_REQUEST['orderby'])) : ''); if (!empty($orderBy)) $args['orderby'] = $orderBy; $order = sanitize_text_field(!empty($_REQUEST['order']) ? trim(stripslashes($_REQUEST['order'])) : ''); if (!empty($order)) $args['order'] = $order; $this->callback_args = $args; $this->set_pagination_args(array( 'total_items' => sizeof($this->items), 'per_page' => 10, )); } function get_bulk_actions() { $actions = array(); $actions['hide'] = __('Hide from results', "ajaxy-instant-search"); $actions['show'] = __('Show in results', "ajaxy-instant-search"); return $actions; } function current_action() { if (isset($_REQUEST['action']) && ('hide' == sanitize_text_field($_REQUEST['action']) || 'hide' == sanitize_text_field($_REQUEST['action2']))) return 'bulk-hide'; return parent::current_action(); } function get_columns() { $columns = array( 'cb' => '', 'title' => __('Title', "ajaxy-instant-search"), 'type' => __('Type', "ajaxy-instant-search"), 'search_setting' => __('Search setting', "ajaxy-instant-search"), 'show_on_search' => __('Search', "ajaxy-instant-search"), 'limit_results' => __('Limit', "ajaxy-instant-search"), 'order' => __('Order', "ajaxy-instant-search") ); return $columns; } function get_column_info() { if (isset($this->_column_headers)) return $this->_column_headers; $columns = $this->get_columns(); $hidden = array(); $this->_column_headers = array($columns, $hidden, $this->get_sortable_columns(), 'cb'); return $this->_column_headers; } function get_sortable_columns() { return array(); } function display_rows_or_placeholder() { $args = wp_parse_args($this->callback_args, array( 'page' => 1, 'number' => 20, 'search' => '', 'hide_empty' => 0 )); extract($args, EXTR_SKIP); $args['offset'] = ($page - 1) * $number; // convert it to table rows $out = ''; $args['order'] = sanitize_text_field(isset($_REQUEST['order']) ? $_REQUEST['order'] : ''); $args['orderby'] = sanitize_text_field(isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : ''); if (!empty($this->items)) { foreach ($this->items as $object) { $this->single_row($object); } } if (empty($this->items)) { $out = sprintf('