Ejemplo n.º 1
0
 /**
  * Get all modules
  */
 function get_all()
 {
     global $wpdb;
     $rows = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}redirection_modules WHERE id > 0 ORDER BY id");
     $items = array();
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             $items[] = Red_Module::new_item($row);
         }
     }
     return $items;
 }
Ejemplo n.º 2
0
 function prepare_items($type = '', $id = 0)
 {
     global $wpdb;
     $table = $wpdb->prefix . 'redirection_modules';
     $rows = $wpdb->get_results("SELECT * FROM {$table}");
     $this->total_items = $wpdb->get_var("SELECT COUNT(*) FROM {$table}");
     $columns = $this->get_columns();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, array(), $sortable);
     $this->items = array();
     foreach ((array) $rows as $row) {
         $this->items[] = Red_Module::new_item($row);
     }
     $this->set_pagination_args(array('total_items' => $this->total_items, 'per_page' => 100, 'total_pages' => ceil($this->total_items / 100)));
 }