Allow searching for 0 throughout the admin.

Fixes #31025.

git-svn-id: https://develop.svn.wordpress.org/trunk@36302 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2016-01-14 20:05:06 +00:00
parent 5209de6052
commit cc6fe1179d
11 changed files with 52 additions and 26 deletions

View File

@@ -75,7 +75,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
public function prepare_items() {
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.
@@ -224,7 +224,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
}
if ( $s ) {
if ( strlen( $s ) ) {
$status = 'search';
$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
* @return bool
*/
public function _search_callback( $plugin ) {
static $term = null;
if ( is_null( $term ) )
$term = wp_unslash( $_REQUEST['s'] );
global $s;
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;
}
}