'appten_imagerotator', 'plural' => 'appten_imagerotators', 'ajax' => false ) ); } function column_default($item, $column_name){ switch($column_name) { case 'actions' : if($item->id == 1) { return '
Edit
'; } else { return '
Edit   Delete
'; } break; case 'shortcode' : return '
[appten_imagerotator id='.$item->id.']
'; break; default : return '
'.$item->$column_name.'
'; break; } } function column_cb($item){ return sprintf( '', $this->_args['singular'], $item->id ); } function get_columns(){ $columns = array( 'cb' => '', 'id' => 'Rotator ID', 'width' => 'Width', 'height' => 'Hight', 'shortcode' => 'Short Code', 'actions' => 'Actions' ); return $columns; } function get_bulk_actions() { $actions = array( 'delete' => 'Delete' ); return $actions; } function process_bulk_action() { if( 'delete'===$this->current_action() ) { foreach($_GET['appten_imagerotator'] as $appten_imagerotator) { $this->wpdb->query($this->wpdb->prepare("DELETE FROM $this->table_name WHERE id=%d",$appten_imagerotator)); } echo ''; } } function prepare_items( $data, $table_name, $wpdb, $category ) { $this->table_name = $table_name; $this->wpdb = $wpdb; $this->category = $category; $columns = $this->get_columns(); $hidden = array(); $sortable = array(); $this->_column_headers = array($columns, $hidden, $sortable); $this->process_bulk_action(); $per_page = 10; $current_page = $this->get_pagenum(); $total_items = count($data); $data = array_slice($data,(($current_page-1)*$per_page),$per_page); $this->items = $data; $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items/$per_page) ) ); } } ?>
Image Rotator." ); $table = new Imagerotator_Table(); $data = $wpdb->get_results("SELECT id,width,height FROM $table_name"); $table->prepare_items( $data, $table_name, $wpdb, $category); ?>


display() ?>