Introduce WP_List_Table::search_box(). See #15353
git-svn-id: http://svn.automattic.com/wordpress/trunk@17006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4e7270ab6a
commit
cfe09b99e5
|
@ -220,15 +220,7 @@ if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQU
|
|||
|
||||
<form id="comments-form" action="" method="post">
|
||||
|
||||
<?php if ( $wp_list_table->has_items() ) : ?>
|
||||
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
|
||||
<input type="text" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( __( 'Search Comments' ), 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
|
||||
|
||||
<?php if ( $post_id ) : ?>
|
||||
<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
|
||||
|
|
|
@ -237,11 +237,9 @@ endif; ?>
|
|||
<form class="search-form" action="" method="get">
|
||||
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
|
||||
<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="tag-search-input"><?php echo $tax->labels->search_items; ?>:</label>
|
||||
<input type="text" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( $tax->labels->search_items, 'button', 'search-items', false ); ?>
|
||||
</p>
|
||||
|
||||
<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?>
|
||||
|
||||
</form>
|
||||
<br class="clear" />
|
||||
|
||||
|
|
|
@ -242,15 +242,7 @@ $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated'
|
|||
|
||||
<form id="posts-filter" action="" method="get">
|
||||
|
||||
<?php if ( $wp_list_table->has_items() ) : ?>
|
||||
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="post-search-input"><?php echo $post_type_object->labels->search_items; ?>:</label>
|
||||
<input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
|
||||
<?php submit_button( $post_type_object->labels->search_items, 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php $wp_list_table->search_box( $post_type_object->labels->search_items, 'post' ); ?>
|
||||
|
||||
<input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
|
||||
<input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
|
||||
|
|
|
@ -178,6 +178,30 @@ class WP_List_Table {
|
|||
_e( 'No items found.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the search box.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $text The search button text
|
||||
* @param string $input_id The search input id
|
||||
*/
|
||||
function search_box( $text, $input_id ) {
|
||||
if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
|
||||
return;
|
||||
|
||||
$input_id = $input_id . '-search-input';
|
||||
|
||||
?>
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
|
||||
<input type="text" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( $text, 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an associative array ( id => link ) with the list
|
||||
* of views available on this table.
|
||||
|
|
|
@ -76,15 +76,7 @@ if ( isset($_REQUEST['deleted']) ) {
|
|||
|
||||
<form id="posts-filter" action="" method="post">
|
||||
|
||||
<?php if ( $wp_list_table->has_items() ) : ?>
|
||||
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label>
|
||||
<input type="text" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( __( 'Search Links' ), 'button', '', false ); ?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?>
|
||||
|
||||
<?php $wp_list_table->display(); ?>
|
||||
|
||||
|
|
|
@ -152,11 +152,7 @@ if ( isset( $_GET['update'] ) ) {
|
|||
<p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p>
|
||||
|
||||
<form method="get" action="">
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="theme-search-input"><?php _e( 'Search Themes' ); ?>:</label>
|
||||
<input type="text" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( __( 'Search Installed Themes' ), 'button', '', false ); ?>
|
||||
</p>
|
||||
<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
|
||||
</form>
|
||||
|
||||
<?php $wp_list_table->views(); ?>
|
||||
|
|
|
@ -211,11 +211,7 @@ if ( isset($_GET['update']) ) :
|
|||
endif; ?>
|
||||
|
||||
<form class="search-form" action="" method="get">
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label>
|
||||
<input type="text" id="user-search-input" name="s" value="<?php echo esc_attr($usersearch); ?>" />
|
||||
<?php submit_button( __( 'Search Users' ), 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
|
||||
</form>
|
||||
|
||||
<?php $wp_list_table->views(); ?>
|
||||
|
|
|
@ -104,11 +104,8 @@ require_once( '../admin-header.php' );
|
|||
</h2>
|
||||
|
||||
<form action="" method="get" id="ms-search">
|
||||
<p class="search-box">
|
||||
<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?>
|
||||
<input type="hidden" name="action" value="blogs" />
|
||||
<input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" />
|
||||
<?php submit_button( __( 'Search Sites' ), 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<form id="form-site-list" action="edit.php?action=allblogs" method="post">
|
||||
|
|
|
@ -94,11 +94,7 @@ require_once(ABSPATH . 'wp-admin/admin-header.php');
|
|||
<h2><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } ?></h2>
|
||||
|
||||
<form method="get" action="">
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="theme-search-input"><?php _e( 'Search Themes' ); ?>:</label>
|
||||
<input type="text" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( __( 'Search Installed Themes' ), 'button', '', false ); ?>
|
||||
</p>
|
||||
<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
|
||||
</form>
|
||||
|
||||
<?php $wp_list_table->views(); ?>
|
||||
|
|
|
@ -79,10 +79,7 @@ if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty(
|
|||
<?php $wp_list_table->views(); ?>
|
||||
|
||||
<form action="" method="get" class="search-form">
|
||||
<p class="search-box">
|
||||
<input type="text" name="s" value="<?php echo esc_attr( $usersearch ); ?>" class="search-input" id="user-search-input" />
|
||||
<?php submit_button( __( 'Search Users' ), 'button', 'post-query-submit', false ); ?>
|
||||
</p>
|
||||
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
|
||||
</form>
|
||||
|
||||
<form id="form-user-list" action='edit.php?action=allusers' method='post'>
|
||||
|
|
|
@ -377,15 +377,7 @@ if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plu
|
|||
|
||||
<form method="post" action="">
|
||||
|
||||
<?php if ( $wp_list_table->has_items() ) : ?>
|
||||
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="plugin-search-input"><?php _e( 'Search Plugins' ); ?>:</label>
|
||||
<input type="text" id="plugin-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( __( 'Search Installed Plugins' ), 'button', '', false ); ?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php $wp_list_table->search_box( __( 'Search Plugins' ), 'plugin' ); ?>
|
||||
|
||||
<input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" />
|
||||
<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
|
||||
|
|
|
@ -146,7 +146,7 @@ if ( ! current_user_can( 'switch_themes' ) ) {
|
|||
|
||||
<h3><?php _e('Available Themes'); ?></h3>
|
||||
|
||||
<?php if ( $wp_list_table->has_items() ) : ?>
|
||||
<?php if ( !empty( $_REQUEST['s'] ) || $wp_list_table->has_items() ) : ?>
|
||||
|
||||
<form class="search-form filter-form" action="" method="get">
|
||||
|
||||
|
|
|
@ -206,15 +206,7 @@ if ( !empty($message) ) { ?>
|
|||
|
||||
<form id="posts-filter" action="" method="post">
|
||||
|
||||
<?php if ( $wp_list_table->has_items() ) : ?>
|
||||
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="media-search-input"><?php _e( 'Search Media' ); ?>:</label>
|
||||
<input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
|
||||
<?php submit_button( __( 'Search Media' ), 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php $wp_list_table->search_box( __( 'Search Media' ), 'media' ); ?>
|
||||
|
||||
<?php $wp_list_table->display(); ?>
|
||||
|
||||
|
|
|
@ -357,15 +357,7 @@ if ( $usersearch )
|
|||
|
||||
<form action="" method="post">
|
||||
|
||||
<?php if ( $wp_list_table->has_items() ) : ?>
|
||||
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label>
|
||||
<input type="text" id="user-search-input" name="s" value="<?php echo esc_attr($usersearch); ?>" />
|
||||
<?php submit_button( __( 'Search Users' ), 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
|
||||
|
||||
<?php $wp_list_table->display(); ?>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue