public function test_column_heading_is_hooked() { self::$class_instance->setup_page_analysis(); // @todo -> is this double ! correct ? $hooked = !!has_filter('manage_post_posts_columns', array(self::$class_instance, 'column_heading')); $this->assertTrue($hooked); }
/** * 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(); }