WordPress.org

Make WordPress Core

Ticket #7552: consolidate-search-query-code.patch

File consolidate-search-query-code.patch, 5.1 KB (added by Viper007Bond, 6 years ago)

Consolidate code in search boxes via new function (updated for r9073)

  • wp-admin/categories.php

     
    143143<form class="search-form" action="<?php echo $pagenow ?>" method="get"> 
    144144<p class="search-box"> 
    145145        <label class="hidden" for="post-search-input"><?php _e('Search Categories'); ?>:</label> 
    146         <input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
     146        <input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 
    147147        <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" /> 
    148148</p> 
    149149</form> 
  • wp-admin/edit-comments.php

     
    176176<form class="search-form" action="<?php echo $pagenow ?>" method="get"> 
    177177<p class="search-box"> 
    178178        <label class="hidden" for="post-search-input"><?php _e( 'Search Comments' ); ?>:</label> 
    179         <input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo $search; ?>" /> 
     179        <input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 
    180180        <input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" /> 
    181181</p> 
    182182</form> 
  • wp-admin/edit-link-categories.php

     
    7979<form class="search-form" action="<?php echo $pagenow ?>" method="get"> 
    8080<p class="search-box"> 
    8181        <label class="hidden" for="post-search-input"><?php _e( 'Search Categories' ); ?>:</label> 
    82         <input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
     82        <input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 
    8383        <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" /> 
    8484</p> 
    8585</form> 
  • wp-admin/edit-pages.php

     
    165165<form class="search-form" action="<?php echo $pagenow ?>" method="get"> 
    166166<p class="search-box"> 
    167167        <label class="hidden" for="post-search-input"><?php _e( 'Search Pages' ); ?>:</label> 
    168         <input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
     168        <input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 
    169169        <input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" /> 
    170170</p> 
    171171</form> 
  • wp-admin/edit-tags.php

     
    146146<form class="search-form" action="<?php echo $pagenow ?>" method="get"> 
    147147<p class="search-box"> 
    148148        <label class="hidden" for="post-search-input"><?php _e( 'Search Tags' ); ?>:</label> 
    149         <input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
     149        <input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 
    150150        <input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" /> 
    151151</p> 
    152152</form> 
  • wp-admin/includes/template.php

     
    29782978        return $title; 
    29792979} 
    29802980 
    2981 ?> 
     2981/** 
     2982 * Display the search query. 
     2983 *  
     2984 * A simple wrapper to display the "s" parameter in a GET URI. This function 
     2985 * should only be used when {@link the_search_query()} cannot. 
     2986 * 
     2987 * @uses attribute_escape 
     2988 * @since 2.7.0 
     2989 *  
     2990 */ 
     2991function _admin_search_query() { 
     2992        echo ( isset($_GET['s']) ) ? attribute_escape( stripslashes( $_GET['s'] ) ) : ''; 
     2993} 
     2994 
     2995?> 
     2996 No newline at end of file 
  • wp-admin/link-manager.php

     
    124124<form class="search-form" action="<?php echo $pagenow ?>" method="get"> 
    125125<p class="search-box"> 
    126126        <label class="hidden" for="post-search-input"><?php _e( 'Search Links' ); ?>:</label> 
    127         <input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> 
     127        <input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 
    128128        <input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" /> 
    129129</p> 
    130130</form>