WordPress.org

Make WordPress Core

Changeset 38146


Ignore:
Timestamp:
07/23/2016 10:58:23 AM (2 years ago)
Author:
ocean90
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r38028 r38146  
    336336
    337337    /**
    338      * Display the search box.
    339      *
    340      * @since 3.1.0
    341      * @access public
    342      *
    343      * @param string $text The search button text
    344      * @param string $input_id The search input id
     338     * Displays the search box.
     339     *
     340     * @since 3.1.0
     341     * @access public
     342     *
     343     * @param string $text     The 'submit' button label.
     344     * @param string $input_id ID attribute value for the search input field.
    345345     */
    346346    public function search_box( $text, $input_id ) {
     
    360360?>
    361361<p class="search-box">
    362     <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
    363     <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
    364     <?php submit_button( $text, 'button', '', false, array('id' => 'search-submit') ); ?>
     362    <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
     363    <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
     364    <?php submit_button( $text, 'button', '', false, array( 'id' => 'search-submit' ) ); ?>
    365365</p>
    366366<?php
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r38141 r38146  
    343343
    344344    /**
    345      * Display the search box.
     345     * Displays the search box.
    346346     *
    347347     * @since 4.6.0
    348348     * @access public
    349349     *
    350      * @param string $text The search button text
    351      * @param string $input_id The search input id
     350     * @param string $text     The 'submit' button label.
     351     * @param string $input_id ID attribute value for the search input field.
    352352     */
    353353    public function search_box( $text, $input_id ) {
     
    366366        ?>
    367367        <p class="search-box">
    368             <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
    369             <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...' ); ?>"/>
    370             <input type="submit" id="search-submit" class="button hide-if-js" value="<?php echo esc_attr( $text ); ?>">
     368            <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
     369            <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...' ); ?>"/>
     370            <?php submit_button( $text, 'button hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?>
    371371        </p>
    372372        <?php
Note: See TracChangeset for help on using the changeset viewer.