Make WordPress Core

Ticket #31025: 31025.2.diff

File 31025.2.diff, 8.8 KB (added by swissspidy, 9 years ago)
  • src/wp-admin/edit-comments.php

    diff --git src/wp-admin/edit-comments.php src/wp-admin/edit-comments.php
    index fc105fe..f5448ab 100644
    if ( $post_id ) { 
    191191        _e( 'Comments' );
    192192}
    193193
    194 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) {
     194if ( isset($_REQUEST['s']) && strlen( $_REQUEST['s'] ) ) {
    195195        echo '<span class="subtitle">';
    196196        /* translators: %s: search keywords */
    197197        printf( __( 'Search results for &#8220;%s&#8221;' ),
  • src/wp-admin/edit-tags.php

    diff --git src/wp-admin/edit-tags.php src/wp-admin/edit-tags.php
    index 846928c..713c8b9 100644
    if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) { 
    311311
    312312<div class="wrap nosubsub">
    313313<h1><?php echo esc_html( $title );
    314 if ( !empty($_REQUEST['s']) )
    315         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
     314if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
     315        /* translators: %s: search keywords */
     316        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
     317}
     318?>
    316319</h1>
    317320
    318321<?php if ( $message ) : ?>
  • src/wp-admin/edit.php

    diff --git src/wp-admin/edit.php src/wp-admin/edit.php
    index 62c70e2..27d8f68 100644
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    303303echo esc_html( $post_type_object->labels->name );
    304304if ( current_user_can( $post_type_object->cap->create_posts ) )
    305305        echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
    306 if ( ! empty( $_REQUEST['s'] ) )
    307         printf( ' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() );
     306
     307if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
     308        /* translators: %s: search keywords */
     309        printf( ' <span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
     310}
    308311?></h1>
    309312
    310313<?php
  • src/wp-admin/includes/class-wp-plugins-list-table.php

    diff --git src/wp-admin/includes/class-wp-plugins-list-table.php src/wp-admin/includes/class-wp-plugins-list-table.php
    index a5e3d98..9fb8103 100644
    class WP_Plugins_List_Table extends WP_List_Table { 
    7575        public function prepare_items() {
    7676                global $status, $plugins, $totals, $page, $orderby, $order, $s;
    7777
    78                 wp_reset_vars( array( 'orderby', 'order', 's' ) );
     78                wp_reset_vars( array( 'orderby', 'order' ) );
    7979
    8080                /**
    8181                 * Filter the full array of plugins to list in the Plugins list table.
    class WP_Plugins_List_Table extends WP_List_Table { 
    224224                        }
    225225                }
    226226
    227                 if ( $s ) {
     227                if ( strlen( $s ) ) {
    228228                        $status = 'search';
    229229                        $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
    230230                }
    class WP_Plugins_List_Table extends WP_List_Table { 
    268268        }
    269269
    270270        /**
    271          * @staticvar string $term
     271         * @global string $s
     272         *
    272273         * @param array $plugin
    273274         * @return bool
    274275         */
    275276        public function _search_callback( $plugin ) {
    276                 static $term = null;
    277                 if ( is_null( $term ) )
    278                         $term = wp_unslash( $_REQUEST['s'] );
     277                global $s;
    279278
    280279                foreach ( $plugin as $value ) {
    281                         if ( false !== stripos( strip_tags( $value ), $term ) ) {
     280                        if ( is_string( $value ) && false !== stripos( strip_tags( $value ), $s ) ) {
    282281                                return true;
    283282                        }
    284283                }
  • src/wp-admin/link-manager.php

    diff --git src/wp-admin/link-manager.php src/wp-admin/link-manager.php
    index 5cf80cd..4dc3015 100644
    if ( ! current_user_can('manage_links') ) 
    7474
    7575<div class="wrap nosubsub">
    7676<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
    77 if ( !empty($_REQUEST['s']) )
    78         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
     77if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
     78        /* translators: %s: search keywords */
     79        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
     80}
     81?>
    7982</h1>
    8083
    8184<?php
  • src/wp-admin/network/sites.php

    diff --git src/wp-admin/network/sites.php src/wp-admin/network/sites.php
    index a0b699f..a87dfd2 100644
    require_once( ABSPATH . 'wp-admin/admin-header.php' ); 
    288288        <a href="<?php echo network_admin_url('site-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a>
    289289<?php endif; ?>
    290290
    291 <?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) {
     291<?php
     292if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
     293        /* translators: %s: search keywords */
    292294        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
    293295} ?>
    294296</h1>
  • src/wp-admin/network/themes.php

    diff --git src/wp-admin/network/themes.php src/wp-admin/network/themes.php
    index af22af1..29dd9e5 100644
    require_once(ABSPATH . 'wp-admin/admin-header.php'); 
    239239
    240240<div class="wrap">
    241241<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 }
    242 if ( $s )
    243         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?>
     242if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
     243        /* translators: %s: search keywords */
     244        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
     245}
     246?>
    244247</h1>
    245248
    246249<?php
  • src/wp-admin/network/users.php

    diff --git src/wp-admin/network/users.php src/wp-admin/network/users.php
    index f55ea6c..4e56ca3 100644
    if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( 
    212212                <a href="<?php echo network_admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a><?php
    213213        endif;
    214214
    215         if ( !empty( $usersearch ) )
    216         printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
     215        if ( strlen( $usersearch ) ) {
     216                /* translators: %s: search keywords */
     217                printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
     218        }
    217219        ?>
    218220        </h1>
    219221
  • src/wp-admin/plugins.php

    diff --git src/wp-admin/plugins.php src/wp-admin/plugins.php
    index 176f294..a55001e 100644
    if ( ! empty( $invalid ) ) { 
    481481<h1><?php echo esc_html( $title );
    482482if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?>
    483483 <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
    484 <?php }
    485 if ( $s )
    486         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?>
     484<?php
     485}
     486
     487if ( strlen( $s ) ) {
     488        /* translators: %s: search keywords */
     489        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
     490}
     491?>
    487492</h1>
    488493
    489494<?php
  • src/wp-admin/upload.php

    diff --git src/wp-admin/upload.php src/wp-admin/upload.php
    index 65bb790..6e089ac 100644
    echo esc_html( $title ); 
    220220if ( current_user_can( 'upload_files' ) ) { ?>
    221221        <a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
    222222}
    223 if ( ! empty( $_REQUEST['s'] ) )
    224         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
     223if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
     224        /* translators: %s: search keywords */
     225        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
     226}
     227?>
    225228</h1>
    226229
    227230<?php
  • src/wp-admin/users.php

    diff --git src/wp-admin/users.php src/wp-admin/users.php
    index e02c394..8bd8c6d 100644
    if ( current_user_can( 'create_users' ) ) { ?> 
    481481        <a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
    482482<?php }
    483483
    484 if ( $usersearch )
    485         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $usersearch ) ); ?>
     484if ( strlen( $usersearch ) ) {
     485        /* translators: %s: search keywords */
     486        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
     487}
     488?>
    486489</h1>
    487490
    488491<?php $wp_list_table->views(); ?>