Example #1
0
 /**
  * @since 1.0
  */
 public function handle_bulkactions($action, $result)
 {
     global $wp_list_table, $wp_query;
     if (!$result || $action != 'bulk-posts') {
         return;
     }
     if (empty($wp_list_table)) {
         return;
     }
     if (!in_array($wp_list_table->current_action(), array('trash', 'untrash', 'delete')) || empty($_REQUEST['post'])) {
         return;
     }
     if (empty($_REQUEST['basa-selectall']) || empty($_REQUEST['basa-num-items'])) {
         return;
     }
     $num_items = intval($_REQUEST['basa-num-items']);
     if (!$num_items) {
         return;
     }
     add_filter('request', array($this, 'request_all_ids'));
     wp_edit_posts_query();
     remove_filter('request', array($this, 'request_all_ids'));
     $num_posts = count($wp_query->posts);
     if ($num_items != $num_posts) {
         return;
     }
     $_REQUEST['post'] = $wp_query->posts;
 }
	function prepare_items() {
		global $post_type_object, $avail_post_stati, $wp_query, $per_page, $mode;

		$avail_post_stati = wp_edit_posts_query();

		$this->hierarchical_display = ( $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'] );

		$total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;

		$post_type = $post_type_object->name;
		$per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
 		$per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );

		if ( $this->hierarchical_display )
			$total_pages = ceil( $total_items / $per_page );
		else
			$total_pages = $wp_query->max_num_pages;

		$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];

		$this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash';

		$this->set_pagination_args( array(
			'total_items' => $total_items,
			'total_pages' => $total_pages,
			'per_page' => $per_page
		) );
	}
 function prepare_items()
 {
     global $avail_post_stati, $wp_query, $per_page, $mode;
     $avail_post_stati = wp_edit_posts_query();
     $this->hierarchical_display = is_post_type_hierarchical($this->screen->post_type) && 'menu_order title' == $wp_query->query['orderby'];
     $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
     $post_type = $this->screen->post_type;
     $per_page = $this->get_items_per_page('edit_' . $post_type . '_per_page');
     /** This filter is documented in wp-admin/includes/post.php */
     $per_page = apply_filters('edit_posts_per_page', $per_page, $post_type);
     if ($this->hierarchical_display) {
         $total_pages = ceil($total_items / $per_page);
     } else {
         $total_pages = $wp_query->max_num_pages;
     }
     $mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
     $this->is_trash = isset($_REQUEST['post_status']) && $_REQUEST['post_status'] == 'trash';
     $this->set_pagination_args(array('total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page));
 }
 function prepare_items()
 {
     global $post_type_object, $avail_post_stati, $wp_query, $per_page, $mode;
     $avail_post_stati = wp_edit_posts_query();
     $this->hierarchical_display = false;
     $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
     $post_type = 'post';
     //$post_type_object->name;
     $per_page = $this->get_items_per_page('edit_' . $post_type . '_per_page');
     $per_page = apply_filters('edit_posts_per_page', $per_page, $post_type);
     $total_pages = $wp_query->max_num_pages;
     $mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
     $this->is_trash = isset($_REQUEST['post_status']) && $_REQUEST['post_status'] == 'trash';
     $this->set_pagination_args(array('total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page));
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = array();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $current_page = $this->get_pagenum();
 }
 /**
  *
  * @global array    $avail_post_stati
  * @global WP_Query $wp_query
  * @global int      $per_page
  * @global string   $mode
  */
 public function prepare_items()
 {
     global $avail_post_stati, $wp_query, $per_page, $mode;
     // is going to call wp()
     $avail_post_stati = wp_edit_posts_query();
     $this->set_hierarchical_display(is_post_type_hierarchical($this->screen->post_type) && 'menu_order title' === $wp_query->query['orderby']);
     $post_type = $this->screen->post_type;
     $per_page = $this->get_items_per_page('edit_' . $post_type . '_per_page');
     /** This filter is documented in wp-admin/includes/post.php */
     $per_page = apply_filters('edit_posts_per_page', $per_page, $post_type);
     if ($this->hierarchical_display) {
         $total_items = $wp_query->post_count;
     } elseif ($wp_query->found_posts || $this->get_pagenum() === 1) {
         $total_items = $wp_query->found_posts;
     } else {
         $post_counts = (array) wp_count_posts($post_type, 'readable');
         if (isset($_REQUEST['post_status']) && in_array($_REQUEST['post_status'], $avail_post_stati)) {
             $total_items = $post_counts[$_REQUEST['post_status']];
         } elseif (isset($_REQUEST['show_sticky']) && $_REQUEST['show_sticky']) {
             $total_items = $this->sticky_posts_count;
         } elseif (isset($_GET['author']) && $_GET['author'] == get_current_user_id()) {
             $total_items = $this->user_posts_count;
         } else {
             $total_items = array_sum($post_counts);
             // Subtract post types that are not included in the admin all list.
             foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) {
                 $total_items -= $post_counts[$state];
             }
         }
     }
     if (!empty($_REQUEST['mode'])) {
         $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
         set_user_setting('posts_list_mode', $mode);
     } else {
         $mode = get_user_setting('posts_list_mode', 'list');
     }
     $this->is_trash = isset($_REQUEST['post_status']) && $_REQUEST['post_status'] === 'trash';
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
 }
Example #6
0
    }
    if (isset($deleted)) {
        $sendback = add_query_arg('deleted', $deleted, $sendback);
    }
    wp_redirect($sendback);
    exit;
} elseif (isset($_GET['_wp_http_referer']) && !empty($_GET['_wp_http_referer'])) {
    wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
    exit;
}
if (empty($title)) {
    $title = __('Edit Posts');
}
$parent_file = 'edit.php';
wp_enqueue_script('inline-edit-post');
list($post_stati, $avail_post_stati) = wp_edit_posts_query();
require_once 'admin-header.php';
if (!isset($_GET['paged'])) {
    $_GET['paged'] = 1;
}
if (empty($_GET['mode'])) {
    $mode = 'list';
} else {
    $mode = attribute_escape($_GET['mode']);
}
?>

<div class="wrap">
<?php 
screen_icon();
?>
Example #7
0
    exit;
} elseif (!empty($_GET['_wp_http_referer'])) {
    wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
    exit;
}
$title = sprintf(__('Edit %s'), $post_type_object->label);
wp_enqueue_script('inline-edit-post');
$user_posts = false;
if (!current_user_can($post_type_object->edit_others_cap)) {
    $user_posts_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(1) FROM {$wpdb->posts} WHERE post_type = '%s' AND post_status NOT IN ('trash', 'auto-draft') AND post_author = %d", $post_type, $current_user->ID));
    $user_posts = true;
    if ($user_posts_count && empty($_GET['post_status']) && empty($_GET['all_posts']) && empty($_GET['author'])) {
        $_GET['author'] = $current_user->ID;
    }
}
$avail_post_stati = wp_edit_posts_query();
if ($post_type_object->hierarchical) {
    $num_pages = ceil($wp_query->post_count / $per_page);
} else {
    $num_pages = $wp_query->max_num_pages;
}
require_once './admin-header.php';
if (empty($_GET['mode'])) {
    $mode = 'list';
} else {
    $mode = esc_attr($_GET['mode']);
}
?>

<div class="wrap">
<?php 
Example #8
0
    function orders_page()
    {
        //load single order view if id is set
        if (isset($_GET['order_id'])) {
            $this->single_order_page();
            return;
        }
        //force post type
        global $wpdb, $post_type, $wp_query, $wp_locale, $current_screen;
        $post_type = 'mp_order';
        $_GET['post_type'] = $post_type;
        $post_type_object = get_post_type_object($post_type);
        if (!current_user_can($post_type_object->cap->edit_posts)) {
            wp_die(__('Cheatin&#8217; uh?'));
        }
        $pagenum = isset($_GET['paged']) ? absint($_GET['paged']) : 0;
        if (empty($pagenum)) {
            $pagenum = 1;
        }
        $per_page = 'edit_' . $post_type . '_per_page';
        $per_page = (int) get_user_option($per_page);
        if (empty($per_page) || $per_page < 1) {
            $per_page = 15;
        }
        // @todo filter based on type
        $per_page = apply_filters('edit_posts_per_page', $per_page);
        // Handle bulk actions
        if (isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['bulk_edit']) || isset($_GET['action'])) {
            check_admin_referer('update-order-status');
            $sendback = remove_query_arg(array('received', 'paid', 'shipped', 'closed', 'ids'), wp_get_referer());
            if (($_GET['action'] != -1 || $_GET['action2'] != -1) && (isset($_GET['post']) || isset($_GET['ids']))) {
                $post_ids = isset($_GET['post']) ? array_map('intval', (array) $_GET['post']) : explode(',', $_GET['ids']);
                $doaction = $_GET['action'] != -1 ? $_GET['action'] : $_GET['action2'];
            }
            switch ($doaction) {
                case 'received':
                    $received = 0;
                    foreach ((array) $post_ids as $post_id) {
                        $this->update_order_status($post_id, 'received');
                        $received++;
                    }
                    $msg = sprintf(_n('%s order marked as Received.', '%s orders marked as Received.', $received, 'mp'), number_format_i18n($received));
                    break;
                case 'paid':
                    $paid = 0;
                    foreach ((array) $post_ids as $post_id) {
                        $this->update_order_status($post_id, 'paid');
                        $paid++;
                    }
                    $msg = sprintf(_n('%s order marked as Paid.', '%s orders marked as Paid.', $paid, 'mp'), number_format_i18n($paid));
                    break;
                case 'shipped':
                    $shipped = 0;
                    foreach ((array) $post_ids as $post_id) {
                        $this->update_order_status($post_id, 'shipped');
                        $shipped++;
                    }
                    $msg = sprintf(_n('%s order marked as Shipped.', '%s orders marked as Shipped.', $shipped, 'mp'), number_format_i18n($shipped));
                    break;
                case 'closed':
                    $closed = 0;
                    foreach ((array) $post_ids as $post_id) {
                        $this->update_order_status($post_id, 'closed');
                        $closed++;
                    }
                    $msg = sprintf(_n('%s order Closed.', '%s orders Closed.', $closed, 'mp'), number_format_i18n($closed));
                    break;
            }
        }
        $avail_post_stati = wp_edit_posts_query();
        $num_pages = $wp_query->max_num_pages;
        $mode = 'list';
        ?>

    <div class="wrap">
    <div class="icon32"><img src="<?php 
        echo $this->plugin_url . 'images/shopping-cart.png';
        ?>
" /></div>
    <h2><?php 
        _e('Manage Orders', 'mp');
        if (isset($_GET['s']) && $_GET['s']) {
            printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query());
        }
        ?>
    </h2>

    <?php 
        if (isset($msg)) {
            ?>
    <div class="updated fade"><p>
    <?php 
            echo $msg;
            ?>
    </p></div>
    <?php 
        }
        ?>

    <form id="posts-filter" action="<?php 
        echo admin_url('edit.php');
        ?>
" method="get">

    <ul class="subsubsub">
    <?php 
        if (empty($locked_post_status)) {
            $status_links = array();
            $num_posts = wp_count_posts($post_type, 'readable');
            $class = '';
            $allposts = '';
            $total_posts = array_sum((array) $num_posts);
            // Subtract post types that are not included in the admin all list.
            foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) {
                $total_posts -= $num_posts->{$state};
            }
            $class = empty($class) && empty($_GET['post_status']) ? ' class="current"' : '';
            $status_links[] = "<li><a href='edit.php?page=marketpress-orders&post_type=product{$allposts}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts'), number_format_i18n($total_posts)) . '</a>';
            foreach (get_post_stati(array(), 'objects') as $status) {
                $class = '';
                $status_name = $status->name;
                if (!in_array($status_name, $avail_post_stati)) {
                    continue;
                }
                if (empty($num_posts->{$status_name})) {
                    continue;
                }
                if (isset($_GET['post_status']) && $status_name == $_GET['post_status']) {
                    $class = ' class="current"';
                }
                $status_links[] = "<li><a href='edit.php?page=marketpress-orders&amp;post_status={$status_name}&amp;post_type=product'{$class}>" . sprintf(_n($status->label_count[0], $status->label_count[1], $num_posts->{$status_name}), number_format_i18n($num_posts->{$status_name})) . '</a>';
            }
            echo implode(" |</li>\n", $status_links) . '</li>';
            unset($status_links);
        }
        ?>
    </ul>

      <p class="search-box">
      	<label class="screen-reader-text" for="post-search-input"><?php 
        _e('Search Orders', 'mp');
        ?>
:</label>
      	<input type="text" id="post-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
      	<input type="submit" value="<?php 
        _e('Search Orders', 'mp');
        ?>
" class="button" />
      </p>

      <input type="hidden" name="post_type" class="post_status_page" value="product" />
      <input type="hidden" name="page" class="post_status_page" value="marketpress-orders" />
      <?php 
        if (!empty($_GET['post_status'])) {
            ?>
      <input type="hidden" name="post_status" class="post_status_page" value="<?php 
            echo esc_attr($_GET['post_status']);
            ?>
" />
      <?php 
        }
        ?>

      <?php 
        if (have_posts()) {
            ?>

      <div class="tablenav">
      <?php 
            $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $num_pages, 'current' => $pagenum));
            ?>

      <div class="alignleft actions">
      <select name="action">
      <option value="-1" selected="selected"><?php 
            _e('Change Status', 'mp');
            ?>
</option>
      <option value="received"><?php 
            _e('Received', 'mp');
            ?>
</option>
      <option value="paid"><?php 
            _e('Paid', 'mp');
            ?>
</option>
      <option value="shipped"><?php 
            _e('Shipped', 'mp');
            ?>
</option>
      <option value="closed"><?php 
            _e('Closed', 'mp');
            ?>
</option>
      </select>
      <input type="submit" value="<?php 
            esc_attr_e('Apply');
            ?>
" name="doaction" id="doaction" class="button-secondary action" />
      <?php 
            wp_nonce_field('update-order-status');
            ?>

      <?php 
            // view filters
            if (!is_singular()) {
                $arc_query = $wpdb->prepare("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM {$wpdb->posts} WHERE post_type = %s ORDER BY post_date DESC", $post_type);
                $arc_result = $wpdb->get_results($arc_query);
                $month_count = count($arc_result);
                if ($month_count && !(1 == $month_count && 0 == $arc_result[0]->mmonth)) {
                    $m = isset($_GET['m']) ? (int) $_GET['m'] : 0;
                    ?>
      <select name='m'>
      <option<?php 
                    selected($m, 0);
                    ?>
 value='0'><?php 
                    _e('Show all dates');
                    ?>
</option>
      <?php 
                    foreach ($arc_result as $arc_row) {
                        if ($arc_row->yyear == 0) {
                            continue;
                        }
                        $arc_row->mmonth = zeroise($arc_row->mmonth, 2);
                        if ($arc_row->yyear . $arc_row->mmonth == $m) {
                            $default = ' selected="selected"';
                        } else {
                            $default = '';
                        }
                        echo "<option{$default} value='" . esc_attr("{$arc_row->yyear}{$arc_row->mmonth}") . "'>";
                        echo $wp_locale->get_month($arc_row->mmonth) . " {$arc_row->yyear}";
                        echo "</option>\n";
                    }
                    ?>
      </select>
      <?php 
                }
                ?>

      <input type="submit" id="post-query-submit" value="<?php 
                esc_attr_e('Filter');
                ?>
" class="button-secondary" />
      <?php 
            }
            ?>
      </div>

      <?php 
            if ($page_links) {
                ?>
      <div class="tablenav-pages"><?php 
                $count_posts = $post_type_object->hierarchical ? $wp_query->post_count : $wp_query->found_posts;
                $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($pagenum - 1) * $per_page + 1), number_format_i18n(min($pagenum * $per_page, $count_posts)), number_format_i18n($count_posts), $page_links);
                echo $page_links_text;
                ?>
</div>
      <?php 
            }
            ?>

      <div class="clear"></div>
      </div>

      <div class="clear"></div>

      <table class="widefat <?php 
            echo $post_type_object->hierarchical ? 'page' : 'post';
            ?>
 fixed" cellspacing="0">
      	<thead>
      	<tr>
      <?php 
            print_column_headers($current_screen);
            ?>
      	</tr>
      	</thead>

      	<tfoot>
      	<tr>
      <?php 
            print_column_headers($current_screen, false);
            ?>
      	</tr>
      	</tfoot>

      	<tbody>
      <?php 
            if (function_exists('post_rows')) {
                post_rows();
            } else {
                $wp_list_table = _get_list_table('WP_Posts_List_Table');
                $wp_list_table->display_rows();
            }
            ?>
      	</tbody>
      </table>

      <div class="tablenav">

      <?php 
            if ($page_links) {
                echo "<div class='tablenav-pages'>{$page_links_text}</div>";
            }
            ?>

      <div class="alignleft actions">
      <select name="action2">
      <option value="-1" selected="selected"><?php 
            _e('Change Status', 'mp');
            ?>
</option>
      <option value="received"><?php 
            _e('Received', 'mp');
            ?>
</option>
      <option value="paid"><?php 
            _e('Paid', 'mp');
            ?>
</option>
      <option value="shipped"><?php 
            _e('Shipped', 'mp');
            ?>
</option>
      <option value="closed"><?php 
            _e('Closed', 'mp');
            ?>
</option>
      </select>
      <input type="submit" value="<?php 
            esc_attr_e('Apply');
            ?>
" name="doaction2" id="doaction2" class="button-secondary action" />
      <br class="clear" />
      </div>
      <br class="clear" />
      </div>

      <?php 
        } else {
            // have_posts()
            ?>
      <div class="clear"></div>
      <p><?php 
            _e('No Orders Yet', 'mp');
            ?>
</p>
      <?php 
        }
        ?>

      </form>

			<div class="icon32"><img src="<?php 
        echo $this->plugin_url . 'images/download.png';
        ?>
" /></div>
			<h2><?php 
        _e('Export Orders', 'mp');
        ?>
</h2>
			<form action="<?php 
        echo admin_url('admin-ajax.php?action=mp-orders-export');
        ?>
" method="post">
				<?php 
        $months = $wpdb->get_results($wpdb->prepare("\r\n\t\t\t\tSELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month\r\n\t\t\t\tFROM {$wpdb->posts}\r\n\t\t\t\tWHERE post_type = %s\r\n\t\t\t\tORDER BY post_date DESC\r\n\t\t\t", 'mp_order'));
        $month_count = count($months);
        if (!$month_count || 1 == $month_count && 0 == $months[0]->month) {
            return;
        }
        $m = isset($_GET['m']) ? (int) $_GET['m'] : 0;
        ?>
			<select name='m'>
				<option<?php 
        selected($m, 0);
        ?>
 value='0'><?php 
        _e('Show all dates');
        ?>
</option>
	<?php 
        foreach ($months as $arc_row) {
            if (0 == $arc_row->year) {
                continue;
            }
            $month = zeroise($arc_row->month, 2);
            $year = $arc_row->year;
            printf("<option %s value='%s'>%s</option>\n", selected($m, $year . $month, false), esc_attr($arc_row->year . $month), $wp_locale->get_month($month) . " {$year}");
        }
        $status = isset($_GET['post_status']) ? $_GET['post_status'] : 'all';
        ?>
			</select>
			<select name="order_status">
      <option<?php 
        selected($status, 'all');
        ?>
 value="all" selected="selected"><?php 
        _e('All Statuses', 'mp');
        ?>
</option>
      <option<?php 
        selected($status, 'order_received');
        ?>
 value="order_received"><?php 
        _e('Received', 'mp');
        ?>
</option>
      <option<?php 
        selected($status, 'order_paid');
        ?>
 value="order_paid"><?php 
        _e('Paid', 'mp');
        ?>
</option>
      <option<?php 
        selected($status, 'order_shipped');
        ?>
 value="order_shipped"><?php 
        _e('Shipped', 'mp');
        ?>
</option>
      <option<?php 
        selected($status, 'order_closed');
        ?>
 value="order_closed"><?php 
        _e('Closed', 'mp');
        ?>
</option>
      </select>
			<input type="submit" value="<?php 
        _e('Download &raquo;', 'mp');
        ?>
" name="export_orders" class="button-secondary" />
			</form>


      <br class="clear">
    </div>
    <?php 
    }
 /**
  * Get the post list table rows for the searched term.
  *
  * Mimics admin/edit.php without all the chrome elements.
  *
  * @since 1.2.0
  * @todo Account for private status on media items?
  */
 public static function ajax_get_posts_list_table()
 {
     global $hook_suffix, $pagenow, $post_type, $post_type_object, $per_page, $mode, $wp_query;
     if (!isset($_REQUEST['nonce']) || !wp_verify_nonce($_REQUEST['nonce'], 'bils-posts-list-table-instant-search')) {
         echo '<tr class="no-items bils-error"><td class="colspanchange">Invalid nonce.</td></tr>';
         wp_die();
     }
     $post_type = $_REQUEST['post_type'];
     $post_type_object = get_post_type_object($post_type);
     // Determine the orderby argument.
     if (isset($_REQUEST['orderby']) && !empty($_REQUEST['orderby'])) {
         $orderby = $_REQUEST['orderby'];
     } else {
         $orderby = $post_type_object->hierarchical ? 'title' : 'post_date';
     }
     // Determine the order argument.
     if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) {
         $order = 'asc' == strtolower($_REQUEST['order']) ? 'asc' : 'desc';
     } else {
         $order = $post_type_object->hierarchical ? 'asc' : 'desc';
     }
     $args = array('s' => $_REQUEST['s'], 'post_type' => $post_type, 'post_status' => $_REQUEST['post_status'], 'orderby' => $orderby, 'order' => $order, 'posts_per_page' => 20);
     if ('attachment' == $post_type) {
         $args['post_status'] = 'inherit';
         $args['post_mime_type'] = $_REQUEST['post_mime_type'];
     }
     // WordPress SEO compatibility.
     if (function_exists('wpseo_admin_init')) {
         $pagenow = 'edit.php';
         wpseo_admin_init();
         if (class_exists('WPSEO_Metabox')) {
             $wpseo_metabox = new WPSEO_Metabox();
             $wpseo_metabox->setup_page_analysis();
         }
     }
     set_current_screen($_REQUEST['screen']);
     // Posts 2 Posts column compatibility.
     do_action('load-edit.php');
     add_filter('posts_search', array('Better_Internal_Link_Search', 'limit_search_to_title'), 10, 2);
     wp_edit_posts_query($args);
     if ('attachment' == $post_type) {
         $wp_list_table = _get_list_table('WP_Media_List_Table', array('screen' => $_REQUEST['screen']));
     } else {
         $wp_list_table = _get_list_table('WP_Posts_List_Table', array('screen' => $_REQUEST['screen']));
     }
     $wp_list_table->prepare_items();
     $wp_list_table->display_rows_or_placeholder();
     wp_die();
 }
 protected function get_query(array $args)
 {
     global $wp_query, $wp_the_query;
     $wp_the_query = $wp_query = new WP_Query();
     wp_edit_posts_query($args);
     return $wp_query;
 }
 function views_list($views)
 {
     global $wp_query;
     $avail_post_stati = wp_edit_posts_query();
     $num_posts = wp_count_posts('incsub_event', 'readable');
     $argvs = array('post_type' => 'incsub_event');
     foreach (get_post_stati($argvs, 'objects') as $status) {
         $class = '';
         $status_name = $status->name;
         if (!in_array($status_name, $avail_post_stati)) {
             continue;
         }
         if (empty($num_posts->{$status_name})) {
             continue;
         }
         if (isset($_GET['post_status']) && $status_name == $_GET['post_status']) {
             $class = ' class="current"';
         }
         $views[$status_name] = "<li><a href='edit.php?post_type=incsub_event&amp;post_status={$status_name}'{$class}>" . sprintf(_n($status->label_count[0], $status->label_count[1], $num_posts->{$status_name}), number_format_i18n($num_posts->{$status_name})) . '</a>';
     }
     return $views;
 }