List Table: Improve `WP_Plugins_List_Table::search_box()` which was added in [38033].

* Update DocBlock to use third-person singular verb and to include a period at the end.
* Use `submit_button()` for the submit button.
* Escape the ID attribute.
* Apply the same to `WP_List_Table::search_box()`.

See #37230.
Built from https://develop.svn.wordpress.org/trunk@38146


git-svn-id: http://core.svn.wordpress.org/trunk@38087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-07-23 11:00:36 +00:00
parent db9ec644f5
commit 51671afc0a
3 changed files with 13 additions and 13 deletions

View File

@ -335,13 +335,13 @@ class WP_List_Table {
} }
/** /**
* Display the search box. * Displays the search box.
* *
* @since 3.1.0 * @since 3.1.0
* @access public * @access public
* *
* @param string $text The search button text * @param string $text The 'submit' button label.
* @param string $input_id The search input id * @param string $input_id ID attribute value for the search input field.
*/ */
public function search_box( $text, $input_id ) { public function search_box( $text, $input_id ) {
if ( empty( $_REQUEST['s'] ) && !$this->has_items() ) if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
@ -359,9 +359,9 @@ class WP_List_Table {
echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />'; echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
?> ?>
<p class="search-box"> <p class="search-box">
<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
<?php submit_button( $text, 'button', '', false, array('id' => 'search-submit') ); ?> <?php submit_button( $text, 'button', '', false, array( 'id' => 'search-submit' ) ); ?>
</p> </p>
<?php <?php
} }

View File

@ -342,13 +342,13 @@ class WP_Plugins_List_Table extends WP_List_Table {
} }
/** /**
* Display the search box. * Displays the search box.
* *
* @since 4.6.0 * @since 4.6.0
* @access public * @access public
* *
* @param string $text The search button text * @param string $text The 'submit' button label.
* @param string $input_id The search input id * @param string $input_id ID attribute value for the search input field.
*/ */
public function search_box( $text, $input_id ) { public function search_box( $text, $input_id ) {
if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
@ -365,9 +365,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
} }
?> ?>
<p class="search-box"> <p class="search-box">
<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
<input type="search" id="<?php echo $input_id ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>"/> <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>"/>
<input type="submit" id="search-submit" class="button hide-if-js" value="<?php echo esc_attr( $text ); ?>"> <?php submit_button( $text, 'button hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?>
</p> </p>
<?php <?php
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-beta4-38145'; $wp_version = '4.6-beta4-38146';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.