Function to prep 's' for display on admin pages that don't run WP_Query(). Props Viper007Bond. see #7552

git-svn-id: http://svn.automattic.com/wordpress/trunk@9074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-10-03 03:06:43 +00:00
parent 4acbfa76ec
commit b50f25ae11
7 changed files with 21 additions and 7 deletions

View File

@ -143,7 +143,7 @@ endif; ?>
<form class="search-form" action="<?php echo $pagenow ?>" method="get">
<p class="search-box">
<label class="hidden" for="post-search-input"><?php _e('Search Categories'); ?>:</label>
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
</form>

View File

@ -176,7 +176,7 @@ unset($status_links);
<form class="search-form" action="<?php echo $pagenow ?>" method="get">
<p class="search-box">
<label class="hidden" for="post-search-input"><?php _e( 'Search Comments' ); ?>:</label>
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo $search; ?>" />
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
</p>
</form>

View File

@ -79,7 +79,7 @@ endif; ?>
<form class="search-form" action="<?php echo $pagenow ?>" method="get">
<p class="search-box">
<label class="hidden" for="post-search-input"><?php _e( 'Search Categories' ); ?>:</label>
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
</form>

View File

@ -165,7 +165,7 @@ endif;
<form class="search-form" action="<?php echo $pagenow ?>" method="get">
<p class="search-box">
<label class="hidden" for="post-search-input"><?php _e( 'Search Pages' ); ?>:</label>
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
</p>
</form>

View File

@ -146,7 +146,7 @@ endif; ?>
<form class="search-form" action="<?php echo $pagenow ?>" method="get">
<p class="search-box">
<label class="hidden" for="post-search-input"><?php _e( 'Search Tags' ); ?>:</label>
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
</p>
</form>

View File

@ -2978,4 +2978,18 @@ function _draft_or_post_title($post_id = 0)
return $title;
}
?>
/**
* Display the search query.
*
* A simple wrapper to display the "s" parameter in a GET URI. This function
* should only be used when {@link the_search_query()} cannot.
*
* @uses attribute_escape
* @since 2.7.0
*
*/
function _admin_search_query() {
echo ( isset($_GET['s']) ) ? attribute_escape( stripslashes( $_GET['s'] ) ) : '';
}
?>

View File

@ -124,7 +124,7 @@ echo $select_order;
<form class="search-form" action="<?php echo $pagenow ?>" method="get">
<p class="search-box">
<label class="hidden" for="post-search-input"><?php _e( 'Search Links' ); ?>:</label>
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="text" class="search-input" id="post-search-input" name="s" value="<?php _admin_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
</p>
</form>