Allow searching for `0` throughout the admin.

Fixes #31025.
Built from https://develop.svn.wordpress.org/trunk@36302


git-svn-id: http://core.svn.wordpress.org/trunk@36269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2016-01-14 20:06:25 +00:00
parent d4b30f47bf
commit aaa11d6207
12 changed files with 53 additions and 27 deletions

View File

@ -191,7 +191,7 @@ if ( $post_id ) {
_e( 'Comments' ); _e( 'Comments' );
} }
if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) { if ( isset($_REQUEST['s']) && strlen( $_REQUEST['s'] ) ) {
echo '<span class="subtitle">'; echo '<span class="subtitle">';
/* translators: %s: search keywords */ /* translators: %s: search keywords */
printf( __( 'Search results for &#8220;%s&#8221;' ), printf( __( 'Search results for &#8220;%s&#8221;' ),

View File

@ -311,8 +311,11 @@ if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) {
<div class="wrap nosubsub"> <div class="wrap nosubsub">
<h1><?php echo esc_html( $title ); <h1><?php echo esc_html( $title );
if ( !empty($_REQUEST['s']) ) if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?> /* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
}
?>
</h1> </h1>
<?php if ( $message ) : ?> <?php if ( $message ) : ?>

View File

@ -303,8 +303,11 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
echo esc_html( $post_type_object->labels->name ); echo esc_html( $post_type_object->labels->name );
if ( current_user_can( $post_type_object->cap->create_posts ) ) if ( current_user_can( $post_type_object->cap->create_posts ) )
echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
if ( ! empty( $_REQUEST['s'] ) )
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
/* translators: %s: search keywords */
printf( ' <span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() ); printf( ' <span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
}
?></h1> ?></h1>
<?php <?php

View File

@ -75,7 +75,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
public function prepare_items() { public function prepare_items() {
global $status, $plugins, $totals, $page, $orderby, $order, $s; global $status, $plugins, $totals, $page, $orderby, $order, $s;
wp_reset_vars( array( 'orderby', 'order', 's' ) ); wp_reset_vars( array( 'orderby', 'order' ) );
/** /**
* Filter the full array of plugins to list in the Plugins list table. * Filter the full array of plugins to list in the Plugins list table.
@ -224,7 +224,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
} }
} }
if ( $s ) { if ( strlen( $s ) ) {
$status = 'search'; $status = 'search';
$plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
} }
@ -268,17 +268,16 @@ class WP_Plugins_List_Table extends WP_List_Table {
} }
/** /**
* @staticvar string $term * @global string $s
*
* @param array $plugin * @param array $plugin
* @return bool * @return bool
*/ */
public function _search_callback( $plugin ) { public function _search_callback( $plugin ) {
static $term = null; global $s;
if ( is_null( $term ) )
$term = wp_unslash( $_REQUEST['s'] );
foreach ( $plugin as $value ) { foreach ( $plugin as $value ) {
if ( is_string( $value ) && false !== stripos( strip_tags( $value ), $term ) ) { if ( is_string( $value ) && false !== stripos( strip_tags( $value ), $s ) ) {
return true; return true;
} }
} }

View File

@ -74,8 +74,11 @@ if ( ! current_user_can('manage_links') )
<div class="wrap nosubsub"> <div class="wrap nosubsub">
<h1><?php echo esc_html( $title ); ?> <a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php <h1><?php echo esc_html( $title ); ?> <a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php
if ( !empty($_REQUEST['s']) ) if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?> /* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
}
?>
</h1> </h1>
<?php <?php

View File

@ -288,7 +288,9 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<a href="<?php echo network_admin_url('site-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> <a href="<?php echo network_admin_url('site-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a>
<?php endif; ?> <?php endif; ?>
<?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) { <?php
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
/* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) ); printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
} ?> } ?>
</h1> </h1>

View File

@ -239,8 +239,11 @@ require_once(ABSPATH . 'wp-admin/admin-header.php');
<div class="wrap"> <div class="wrap">
<h1><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="page-title-action"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } <h1><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="page-title-action"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php }
if ( $s ) if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?> /* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
}
?>
</h1> </h1>
<?php <?php

View File

@ -212,8 +212,10 @@ if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty(
<a href="<?php echo network_admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a><?php <a href="<?php echo network_admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a><?php
endif; endif;
if ( !empty( $usersearch ) ) if ( strlen( $usersearch ) ) {
/* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) ); printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
}
?> ?>
</h1> </h1>

View File

@ -481,9 +481,14 @@ if ( ! empty( $invalid ) ) {
<h1><?php echo esc_html( $title ); <h1><?php echo esc_html( $title );
if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?> if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?>
<a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a> <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
<?php } <?php
if ( $s ) }
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?>
if ( strlen( $s ) ) {
/* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
}
?>
</h1> </h1>
<?php <?php

View File

@ -220,8 +220,11 @@ echo esc_html( $title );
if ( current_user_can( 'upload_files' ) ) { ?> if ( current_user_can( 'upload_files' ) ) { ?>
<a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php <a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
} }
if ( ! empty( $_REQUEST['s'] ) ) if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?> /* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
}
?>
</h1> </h1>
<?php <?php

View File

@ -481,8 +481,11 @@ if ( current_user_can( 'create_users' ) ) { ?>
<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a> <a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
<?php } <?php }
if ( $usersearch ) if ( strlen( $usersearch ) ) {
printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $usersearch ) ); ?> /* translators: %s: search keywords */
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
}
?>
</h1> </h1>
<?php $wp_list_table->views(); ?> <?php $wp_list_table->views(); ?>

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-alpha-36301'; $wp_version = '4.5-alpha-36302';
/** /**
* 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.