'upload_files', 'screen' => 'upload_files', ) ); } public function set_parent($parent) { $this->parent=$parent; } public function set_list($list,$page_num=1) { $this->list=$list; $this->page_num=$page_num; } protected function get_table_classes() { return array( 'widefat striped' ); } public function print_column_headers( $with_id = true ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); if (!empty($columns['cb'])) { static $cb_counter = 1; $columns['cb'] = '' . ''; $cb_counter++; } foreach ( $columns as $column_key => $column_display_name ) { $class = array( 'manage-column', "column-$column_key" ); if ( in_array( $column_key, $hidden ) ) { $class[] = 'hidden'; } if ( $column_key === $primary ) { $class[] = 'column-primary'; } if ( $column_key === 'cb' ) { $class[] = 'check-column'; } $tag='th'; $tag = ( 'cb' === $column_key ) ? 'td' : 'th'; $scope = ( 'th' === $tag ) ? 'scope="col"' : ''; $id = $with_id ? "id='$column_key'" : ''; if ( ! empty( $class ) ) { $class = "class='" . join( ' ', $class ) . "'"; } echo "<$tag $scope $id $class>$column_display_name$tag>"; } } public function get_columns() { $sites_columns = array( 'cb' => __( ' ', 'wpvivid-backuprestore' ), 'file_regex' => __( 'File Regex', 'wpvivid-backuprestore' ) ); return $sites_columns; } public function get_pagenum() { if($this->page_num=='first') { $this->page_num=1; } else if($this->page_num=='last') { $this->page_num=$this->_pagination_args['total_pages']; } $pagenum = $this->page_num ? $this->page_num : 0; if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) { $pagenum = $this->_pagination_args['total_pages']; } return max( 1, $pagenum ); } public function column_cb( $item ) { $html=''; echo $html; } public function column_file_regex( $item ) { echo $item; } public function has_items() { return !empty($this->list); } public function prepare_items() { $columns = $this->get_columns(); $hidden = array(); $sortable = array(); $this->_column_headers = array($columns, $hidden, $sortable); $total_items =sizeof($this->list); $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => 10, ) ); } public function display_rows() { $this->_display_rows( $this->list ); } private function _display_rows( $list ) { $page=$this->get_pagenum(); $page_list=$list; $temp_page_list=array(); $count=0; while ( $count<$page ) { $temp_page_list = array_splice( $page_list, 0, 10); $count++; } foreach ( $temp_page_list as $key=>$item) { $this->single_row($item); } } public function single_row($item) { ?>