Make WordPress Core

Changeset 17006


Ignore:
Timestamp:
12/16/2010 08:45:10 PM (14 years ago)
Author:
scribu
Message:

Introduce WP_List_Table::search_box(). See #15353

Location:
trunk/wp-admin
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r16990 r17006  
    221221<form id="comments-form" action="" method="post">
    222222
    223 <?php if ( $wp_list_table->has_items() ) : ?>
    224 
    225 <p class="search-box">
    226     <label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
    227     <input type="text" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
    228     <?php submit_button( __( 'Search Comments' ), 'button', 'submit', false ); ?>
    229 </p>
    230 
    231 <?php endif; ?>
     223<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
    232224
    233225<?php if ( $post_id ) : ?>
  • trunk/wp-admin/edit-tags.php

    r17002 r17006  
    238238<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
    239239<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
    240 <p class="search-box">
    241     <label class="screen-reader-text" for="tag-search-input"><?php echo $tax->labels->search_items; ?>:</label>
    242     <input type="text" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
    243     <?php submit_button( $tax->labels->search_items, 'button', 'search-items', false ); ?>
    244 </p>
     240
     241<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?>
     242
    245243</form>
    246244<br class="clear" />
  • trunk/wp-admin/edit.php

    r16990 r17006  
    243243<form id="posts-filter" action="" method="get">
    244244
    245 <?php if ( $wp_list_table->has_items() ) : ?>
    246 
    247 <p class="search-box">
    248     <label class="screen-reader-text" for="post-search-input"><?php echo $post_type_object->labels->search_items; ?>:</label>
    249     <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
    250     <?php submit_button( $post_type_object->labels->search_items, 'button', 'submit', false ); ?>
    251 </p>
    252 
    253 <?php endif; ?>
     245<?php $wp_list_table->search_box( $post_type_object->labels->search_items, 'post' ); ?>
    254246
    255247<input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
  • trunk/wp-admin/includes/class-wp-list-table.php

    r17002 r17006  
    177177    function no_items() {
    178178        _e( 'No items found.' );
     179    }
     180
     181    /**
     182     * Display the search box.
     183     *
     184     * @since 3.1.0
     185     * @access public
     186     *
     187     * @param string $text The search button text
     188     * @param string $input_id The search input id
     189     */
     190    function search_box( $text, $input_id ) {
     191        if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
     192            return;
     193
     194        $input_id = $input_id . '-search-input';
     195
     196?>
     197<p class="search-box">
     198    <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
     199    <input type="text" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
     200    <?php submit_button( $text, 'button', 'submit', false ); ?>
     201</p>
     202<?php
    179203    }
    180204
  • trunk/wp-admin/link-manager.php

    r16990 r17006  
    7777<form id="posts-filter" action="" method="post">
    7878
    79 <?php if ( $wp_list_table->has_items() ) : ?>
    80 
    81 <p class="search-box">
    82     <label class="screen-reader-text" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label>
    83     <input type="text" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" />
    84     <?php submit_button( __( 'Search Links' ), 'button', '', false ); ?>
    85 </p>
    86 
    87 <?php endif; ?>
     79<?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?>
    8880
    8981<?php $wp_list_table->display(); ?>
  • trunk/wp-admin/network/site-themes.php

    r16990 r17006  
    153153
    154154<form method="get" action="">
    155 <p class="search-box">
    156     <label class="screen-reader-text" for="theme-search-input"><?php _e( 'Search Themes' ); ?>:</label>
    157     <input type="text" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
    158     <?php submit_button( __( 'Search Installed Themes' ), 'button', '', false ); ?>
    159 </p>
     155<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
    160156</form>
    161157
  • trunk/wp-admin/network/site-users.php

    r16990 r17006  
    212212
    213213<form class="search-form" action="" method="get">
    214 <p class="search-box">
    215     <label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label>
    216     <input type="text" id="user-search-input" name="s" value="<?php echo esc_attr($usersearch); ?>" />
    217     <?php submit_button( __( 'Search Users' ), 'button', 'submit', false ); ?>
    218 </p>
     214<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
    219215</form>
    220216
  • trunk/wp-admin/network/sites.php

    r16990 r17006  
    105105
    106106<form action="" method="get" id="ms-search">
    107 <p class="search-box">
     107<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?>
    108108<input type="hidden" name="action" value="blogs" />
    109 <input type="text" name="s" value="<?php echo esc_attr( $s ); ?>" />
    110 <?php submit_button( __( 'Search Sites' ), 'button', 'submit', false ); ?>
    111 </p>
    112109</form>
    113110
  • trunk/wp-admin/network/themes.php

    r16990 r17006  
    9595
    9696<form method="get" action="">
    97 <p class="search-box">
    98     <label class="screen-reader-text" for="theme-search-input"><?php _e( 'Search Themes' ); ?>:</label>
    99     <input type="text" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
    100     <?php submit_button( __( 'Search Installed Themes' ), 'button', '', false ); ?>
    101 </p>
     97<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
    10298</form>
    10399
  • trunk/wp-admin/network/users.php

    r16990 r17006  
    8080
    8181    <form action="" method="get" class="search-form">
    82         <p class="search-box">
    83         <input type="text" name="s" value="<?php echo esc_attr( $usersearch ); ?>" class="search-input" id="user-search-input" />
    84         <?php submit_button( __( 'Search Users' ), 'button', 'post-query-submit', false ); ?>
    85         </p>
     82        <?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
    8683    </form>
    8784
  • trunk/wp-admin/plugins.php

    r16990 r17006  
    378378<form method="post" action="">
    379379
    380 <?php if ( $wp_list_table->has_items() ) : ?>
    381 
    382 <p class="search-box">
    383     <label class="screen-reader-text" for="plugin-search-input"><?php _e( 'Search Plugins' ); ?>:</label>
    384     <input type="text" id="plugin-search-input" name="s" value="<?php _admin_search_query(); ?>" />
    385     <?php submit_button( __( 'Search Installed Plugins' ), 'button', '', false ); ?>
    386 </p>
    387 
    388 <?php endif; ?>
     380<?php $wp_list_table->search_box( __( 'Search Plugins' ), 'plugin' ); ?>
    389381
    390382<input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" />
  • trunk/wp-admin/themes.php

    r16990 r17006  
    147147<h3><?php _e('Available Themes'); ?></h3>
    148148
    149 <?php if ( $wp_list_table->has_items() ) : ?>
     149<?php if ( !empty( $_REQUEST['s'] ) || $wp_list_table->has_items() ) : ?>
    150150
    151151<form class="search-form filter-form" action="" method="get">
  • trunk/wp-admin/upload.php

    r16990 r17006  
    207207<form id="posts-filter" action="" method="post">
    208208
    209 <?php if ( $wp_list_table->has_items() ) : ?>
    210 
    211 <p class="search-box">
    212     <label class="screen-reader-text" for="media-search-input"><?php _e( 'Search Media' ); ?>:</label>
    213     <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
    214     <?php submit_button( __( 'Search Media' ), 'button', 'submit', false ); ?>
    215 </p>
    216 
    217 <?php endif; ?>
     209<?php $wp_list_table->search_box( __( 'Search Media' ), 'media' ); ?>
    218210
    219211<?php $wp_list_table->display(); ?>
  • trunk/wp-admin/users.php

    r16990 r17006  
    358358<form action="" method="post">
    359359
    360 <?php if ( $wp_list_table->has_items() ) : ?>
    361 
    362 <p class="search-box">
    363     <label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label>
    364     <input type="text" id="user-search-input" name="s" value="<?php echo esc_attr($usersearch); ?>" />
    365     <?php submit_button( __( 'Search Users' ), 'button', 'submit', false ); ?>
    366 </p>
    367 
    368 <?php endif; ?>
     360<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
    369361
    370362<?php $wp_list_table->display(); ?>
Note: See TracChangeset for help on using the changeset viewer.