'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 = !empty($_REQUEST['s']) ? trim(stripslashes($_REQUEST['s'])) : ''; $args = array( 'search' => $search, 'page' => $this->get_pagenum(), 'number' => 10, ); if (!empty($_REQUEST['orderby'])) $args['orderby'] = trim(stripslashes($_REQUEST['orderby'])); if (!empty($_REQUEST['order'])) $args['order'] = trim(stripslashes($_REQUEST['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_SF_PLUGIN_TEXT_DOMAIN); $actions['show'] = __('Show in results', AJAXY_SF_PLUGIN_TEXT_DOMAIN); return $actions; } function current_action() { if (isset($_REQUEST['action']) && ('hide' == $_REQUEST['action'] || 'hide' == $_REQUEST['action2'])) return 'bulk-hide'; return parent::current_action(); } function get_columns() { $columns = array( 'cb' => '', 'title' => __('Title', AJAXY_SF_PLUGIN_TEXT_DOMAIN), 'type' => __('Type', AJAXY_SF_PLUGIN_TEXT_DOMAIN), 'search_setting' => __('Search setting', AJAXY_SF_PLUGIN_TEXT_DOMAIN), 'show_on_search' => __('Search', AJAXY_SF_PLUGIN_TEXT_DOMAIN), 'limit_results' => __('Limit', AJAXY_SF_PLUGIN_TEXT_DOMAIN), 'order' => __('Order', AJAXY_SF_PLUGIN_TEXT_DOMAIN) ); 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 = ''; $_REQUEST['order'] = (isset($_REQUEST['order']) ? $_REQUEST['order'] : ''); $_REQUEST['orderby'] = (isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : ''); if (!empty($this->items)) { foreach ($this->items as $object) { $this->single_row($object); } } if (empty($this->items)) { echo '