Ticket #15355: clear_search.2.15355.patch
File clear_search.2.15355.patch, 13.0 KB (added by , 14 years ago) |
---|
-
wp-includes/script-loader.php
372 372 $scripts->localize( 'list-table', 'listTableL10n', array( 373 373 'loading' => __('Loading...'), 374 374 'error' => __('An error has occurred while loading the items.'), 375 'search' => __('Search results for “%s”') 375 'search' => __('Search results for “%s”'), 376 'clear_search' => __('Clear search results') 376 377 ) ); 377 378 378 379 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20100707' ); -
wp-admin/users.php
347 347 <div class="wrap"> 348 348 <?php screen_icon(); ?> 349 349 <h2><?php echo esc_html( $title ); if ( current_user_can( 'create_users' ) || current_user_can( 'promote_users' ) ) { ?> <a href="user-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'user'); ?></a><?php } 350 if ( $usersearch ) 351 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $usersearch ) ); ?> 350 _search_results_subtitle( admin_url( 'users.php' ) ); ?> 352 351 </h2> 353 352 354 353 <?php $wp_list_table->views(); ?> … … 356 355 <form class="search-form" action="" method="get"> 357 356 <p class="search-box"> 358 357 <label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label> 359 <input type="text" id="user-search-input" name=" usersearch" value="<?php echo esc_attr($usersearch); ?>" />358 <input type="text" id="user-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 360 359 <?php submit_button( __( 'Search Users' ), 'button', 'submit', false ); ?> 361 360 </p> 362 361 </form> -
wp-admin/edit-comments.php
127 127 <div class="wrap"> 128 128 <?php screen_icon(); ?> 129 129 <h2><?php echo esc_html( $title ); 130 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) 131 printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?> 130 _search_results_subtitle( admin_url( 'edit-comments.php' ) ); ?> 132 131 </h2> 133 132 134 133 <?php … … 200 199 201 200 <?php $wp_list_table->views(); ?> 202 201 203 <form id="comments-form" action="" method=" post">202 <form id="comments-form" action="" method="get"> 204 203 <p class="search-box"> 205 204 <label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label> 206 205 <input type="text" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" /> -
wp-admin/includes/class-wp-users-list-table.php
14 14 } 15 15 16 16 function prepare_items() { 17 global $role, $ usersearch;17 global $role, $search; 18 18 19 $ usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';19 $search = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; 20 20 21 21 $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; 22 22 … … 28 28 'number' => $users_per_page, 29 29 'offset' => ( $paged-1 ) * $users_per_page, 30 30 'role' => $role, 31 'search' => $ usersearch31 'search' => $search 32 32 ); 33 33 34 34 if ( isset( $_REQUEST['orderby'] ) ) -
wp-admin/includes/class-wp-ms-users-list-table.php
23 23 } 24 24 25 25 function prepare_items() { 26 global $ usersearch, $role, $wpdb;26 global $search, $role, $wpdb; 27 27 28 $ usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';28 $search = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; 29 29 30 30 $users_per_page = $this->get_items_per_page( 'users_network_per_page' ); 31 31 … … 36 36 $args = array( 37 37 'number' => $users_per_page, 38 38 'offset' => ( $paged-1 ) * $users_per_page, 39 'search' => $ usersearch,39 'search' => $search, 40 40 'blog_id' => 0 41 41 ); 42 42 … … 47 47 48 48 // If the network is large and a search is not being performed, show only the latest users with no paging in order 49 49 // to avoid expensive count queries. 50 if ( !$ usersearch && ( get_blog_count() >= 10000 ) ) {50 if ( !$search && ( get_blog_count() >= 10000 ) ) { 51 51 if ( !isset($_REQUEST['orderby']) ) 52 52 $_GET['orderby'] = $_REQUEST['orderby'] = 'id'; 53 53 if ( !isset($_REQUEST['order']) ) -
wp-admin/includes/template.php
2165 2165 return $button; 2166 2166 } 2167 2167 2168 /** 2169 * Print the search results sentence as a subtitle 2170 * 2171 * @since 3.1.0 2172 * 2173 * uses esc_html 2174 * 2175 * @param string $url The URL of the search page 2176 */ 2177 function _search_results_subtitle( $url ) { 2178 if ( !empty( $_REQUEST['s']) && !empty( $url ) ) 2179 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '<a id="clear-search" href="%s" class="ntdelbutton" title="' . __( 'Clear search results' ) . '">X</a></span>', esc_html( stripslashes( $_REQUEST['s'] ) ), $url ); 2180 return null; 2181 } -
wp-admin/edit-tags.php
212 212 <div class="wrap nosubsub"> 213 213 <?php screen_icon(); ?> 214 214 <h2><?php echo esc_html( $title ); 215 if ( !empty($_REQUEST['s']) ) 216 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?> 215 _search_results_subtitle( admin_url( "edit-tags.php?taxonomy=$taxonomy" ) ); ?> 217 216 </h2> 218 217 219 218 <?php if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) ) : ?> -
wp-admin/js/list-table.dev.js
220 220 listTable.update_rows(data, true, function() { 221 221 $('h2 .subtitle').remove(); 222 222 223 if ( data.s ) 224 $('h2').append($('<span class="subtitle">').html( 225 listTableL10n.search.replace('%s', this.htmlencode(data.s)) 226 )); 223 if ( data.s ) { 224 $('h2').append( $('<span class="subtitle">').html( 225 listTableL10n.search.replace('%s', this.htmlencode(data.s)) + 226 '<a id="clear-search" class="ntdelbutton" title="' + 227 listTableL10n.clear_search + 228 '">X</a></span>' 229 ) ); 230 } 231 227 232 }); 228 233 } 234 235 function clear_search() { 236 listTable.update_rows({'s': ''}, true, function() { 237 $('h2 .subtitle').remove(); 238 $('.search-box input[type="text"]').val(''); 239 }); 240 241 return false; 242 }; 243 229 244 $('.search-box :submit').click(change_search); 230 245 $('.search-box :text').keypress(change_search); 246 $('#clear-search').live('click', clear_search) 231 247 232 248 // tablenav dropdowns 233 249 $('#post-query-submit').click(function() { -
wp-admin/upload.php
152 152 <div class="wrap"> 153 153 <?php screen_icon(); ?> 154 154 <h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> <?php 155 if ( isset($_GET['s']) && $_GET['s'] ) 156 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', get_search_query() ); ?> 155 _search_results_subtitle( admin_url( 'upload.php' ) ); ?> 157 156 </h2> 158 157 159 158 <?php -
wp-admin/network/users.php
70 70 if ( current_user_can( 'create_users') ) : ?> 71 71 <a href="<?php echo network_admin_url('user-new.php'); ?>" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'users' ); ?></a><?php 72 72 endif; 73 74 if ( !empty( $usersearch ) ) 75 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $usersearch ) ); 76 ?> 73 _search_results_subtitle( network_admin_url( 'users.php' ) ); ?> 77 74 </h2> 78 75 79 76 <?php $wp_list_table->views(); ?> 80 77 81 78 <form action="" method="get" class="search-form"> 82 79 <p class="search-box"> 83 <input type="text" name="s" value="<?php echo esc_attr( $ usersearch ); ?>" class="search-input" id="user-search-input" />80 <input type="text" name="s" value="<?php echo esc_attr( $search ); ?>" class="search-input" id="user-search-input" /> 84 81 <?php submit_button( __( 'Search Users' ), 'button', 'post-query-submit', false ); ?> 85 82 </p> 86 83 </form> -
wp-admin/network/sites.php
94 94 <?php echo $msg; ?> 95 95 <?php if ( current_user_can( 'create_sites') ) : ?> 96 96 <a href="<?php echo network_admin_url('site-new.php'); ?>" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites' ); ?></a> 97 <?php endif; ?> 98 99 <?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) { 100 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); 101 } ?> 97 <?php endif; 98 _search_results_subtitle( network_admin_url( 'sites.php' ) ); ?> 102 99 </h2> 103 100 104 101 <form action="" method="get" id="ms-search"> 105 102 <p class="search-box"> 106 103 <input type="hidden" name="action" value="blogs" /> 107 <input type="text" name="s" value="<?php echo esc_attr( $s); ?>" />104 <input type="text" name="s" value="<?php _admin_search_query(); ?>" /> 108 105 <?php submit_button( __( 'Search Sites' ), 'button', 'submit', false ); ?> 109 106 </p> 110 107 </form> -
wp-admin/edit.php
170 170 <div class="wrap"> 171 171 <?php screen_icon(); ?> 172 172 <h2><?php echo esc_html( $post_type_object->labels->name ); ?> <a href="<?php echo $post_new_file ?>" class="button add-new-h2"><?php echo esc_html($post_type_object->labels->add_new); ?></a> <?php 173 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) 174 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', get_search_query() ); ?> 173 _search_results_subtitle( admin_url( "edit.php?post_type=$post_type" ) ); ?> 175 174 </h2> 176 175 177 176 <?php -
wp-admin/css/colors-classic.dev.css
684 684 } 685 685 686 686 .tagchecklist span a, 687 #bulk-titles div a { 687 #bulk-titles div a, 688 a#clear-search { 688 689 background: url(../images/xit.gif) no-repeat; 689 690 } 690 691 691 692 .tagchecklist span a:hover, 692 #bulk-titles div a:hover { 693 #bulk-titles div a:hover, 694 a#clear-search:hover { 693 695 background: url(../images/xit.gif) no-repeat -10px 0; 694 696 } 695 697 -
wp-admin/css/colors-fresh.dev.css
684 684 } 685 685 686 686 .tagchecklist span a, 687 #bulk-titles div a { 687 #bulk-titles div a, 688 a#clear-search { 688 689 background: url(../images/xit.gif) no-repeat; 689 690 } 690 691 691 692 .tagchecklist span a:hover, 692 #bulk-titles div a:hover { 693 #bulk-titles div a:hover, 694 a#clear-search:hover { 693 695 background: url(../images/xit.gif) no-repeat -10px 0; 694 696 } 695 697 -
wp-admin/css/wp-admin.dev.css
284 284 margin: -5px 0 0; 285 285 } 286 286 287 a#clear-search { 288 display: inline-block; 289 cursor: pointer; 290 height: 10px; 291 margin: 3px 5px 0; 292 overflow: hidden; 293 text-indent: -9999px; 294 width: 10px; 295 } 287 296 288 297 /*------------------------------------------------------------------------------ 289 298 3.0 - Actions -
wp-admin/link-manager.php
58 58 <div class="wrap nosubsub"> 59 59 <?php screen_icon(); ?> 60 60 <h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php 61 if ( !empty($_REQUEST['s']) ) 62 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( stripslashes($_REQUEST['s']) ) ); ?> 61 _search_results_subtitle( admin_url( 'link-manager.php' ) ); ?> 63 62 </h2> 64 63 65 64 <?php