'Settings', 'singular' => 'Setting', ) ); $this->objects = $objects; $this->public = $public; $this->setting_prefix = $setting_prefix; } var $row_class = ''; 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->objects), 'per_page' => 10, ) ); } function has_items() { // todo: populate $this->items in prepare_items() return true; } function get_bulk_actions() { $actions = array(); $actions['hide'] = __( 'Hide from results' ); $actions['show'] = __( 'Show in results' ); 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' ), 'type' => __( 'Type' ), 'search_setting'=> __( 'Search setting' ), 'show_on_search' => __( 'Search' ), 'limit_results' => __( 'Limit' ), 'order' => __( 'Order' ) ); return $columns; } function get_column_info() { if ( isset( $this->_column_headers ) ) return $this->_column_headers; $screen = get_current_screen(); $columns = $this->get_columns(); $hidden = array(); $this->_column_headers = array( $columns, $hidden, $this->get_sortable_columns() ); 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'] = $offset = ( $page - 1 ) * $number; // convert it to table rows $out = ''; $count = 0; $orderby = 'order'; $_REQUEST['order'] = (isset($_REQUEST['order']) ? $_REQUEST['order'] :''); $_REQUEST['orderby'] = (isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] :''); $order = (in_array($_REQUEST['order'], array('asc','desc')) ? $_REQUEST['order']: 'asc'); switch($_REQUEST['orderby']){ case 'n': $orderby = 'name'; break; case 'o': $orderby = 'order'; break; case 't': $orderby = 'type'; break; default: $orderby = 'order'; break; } if(!empty($this->objects)){ foreach($this->objects as $object){ $this->single_row($object); } } if ( empty( $this->objects ) ) { list( $columns, $hidden ) = $this->get_column_info(); echo '