Make WordPress Core

Ticket #37233: 37233.diff

File 37233.diff, 9.2 KB (added by swissspidy, 9 years ago)
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index 5e04365..4de1e5a 100644
    function wp_ajax_search_install_plugins() { 
    38493849
    38503850        ob_start();
    38513851        $wp_list_table->display();
     3852        $status['count'] = count( $wp_list_table->items );
    38523853        $status['items'] = ob_get_clean();
    38533854
    38543855        wp_send_json_success( $status );
  • src/wp-admin/includes/class-wp-plugin-install-list-table.php

    diff --git src/wp-admin/includes/class-wp-plugin-install-list-table.php src/wp-admin/includes/class-wp-plugin-install-list-table.php
    index d917fbd..5c9d6cf 100644
    class WP_Plugin_Install_List_Table extends WP_List_Table { 
    285285                ?>
    286286        </ul>
    287287
    288         <?php install_search_form( isset( $views['plugin-install-search'] ) ); ?>
     288        <?php install_search_form(); ?>
    289289</div>
    290290<?php
    291291        }
  • src/wp-admin/includes/plugin-install.php

    diff --git src/wp-admin/includes/plugin-install.php src/wp-admin/includes/plugin-install.php
    index f99cfce..d6c3ffe 100644
    function install_dashboard() { 
    246246 * Display search form for searching plugins.
    247247 *
    248248 * @since 2.7.0
     249 * @since 4.6.0 The optional `$type_selector` parameter was deprecated and renamed to `$deprecated`.
    249250 *
    250  * @param bool $type_selector
     251 * @param bool $deprecated Not used.
    251252 */
    252 function install_search_form( $type_selector = true ) {
     253function install_search_form( $deprecated = true ) {
    253254        $type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term';
    254255        $term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : '';
    255         $input_attrs = '';
    256         $button_type = 'button screen-reader-text';
    257 
    258         // assume no $type_selector means it's a simplified search form
    259         if ( ! $type_selector ) {
    260                 $input_attrs = 'class="wp-filter-search" placeholder="' . esc_attr__( 'Search Plugins' ) . '" ';
    261         }
    262 
    263256        ?><form class="search-form search-plugins" method="get">
    264257                <input type="hidden" name="tab" value="search" />
    265                 <?php if ( $type_selector ) : ?>
    266258                <select name="type" id="typeselector">
    267259                        <option value="term"<?php selected('term', $type) ?>><?php _e('Keyword'); ?></option>
    268260                        <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>
    269261                        <option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option>
    270262                </select>
    271                 <?php endif; ?>
    272263                <label><span class="screen-reader-text"><?php _e('Search Plugins'); ?></span>
    273                         <input type="search" name="s" value="<?php echo esc_attr($term) ?>" <?php echo $input_attrs; ?>/>
     264                        <input type="search" name="s" value="<?php echo esc_attr($term) ?>" class="wp-filter-search" placeholder="<?php esc_attr__( 'Search Plugins' ); ?>" />
    274265                </label>
    275                 <?php submit_button( __( 'Search Plugins' ), $button_type, false, false, array( 'id' => 'search-submit' ) ); ?>
     266                <input type="submit" id="search-submit" class="button hide-if-js" value="<?php echo esc_attr__( 'Search Plugins' ); ?>">
    276267        </form><?php
    277268}
    278269
  • src/wp-admin/js/updates.js

    diff --git src/wp-admin/js/updates.js src/wp-admin/js/updates.js
    index 0de60b5..4cf39ae 100644
     
    15821582        };
    15831583
    15841584        $( function() {
    1585                 var $pluginFilter    = $( '#plugin-filter' ),
    1586                         $bulkActionForm  = $( '#bulk-action-form' ),
    1587                         $filesystemModal = $( '#request-filesystem-credentials-dialog' ),
    1588                         $pluginSearch    = $( '.plugins-php .wp-filter-search' );
     1585                var $pluginFilter        = $( '#plugin-filter' ),
     1586                    $bulkActionForm      = $( '#bulk-action-form' ),
     1587                    $filesystemModal     = $( '#request-filesystem-credentials-dialog' ),
     1588                    $pluginSearch        = $( '.plugins-php .wp-filter-search' ),
     1589                    $pluginInstallSearch = $( '.plugin-install-php .wp-filter-search' );
    15891590
    15901591                /*
    15911592                 * Whether a user needs to submit filesystem credentials.
     
    19671968                        wp.updates.queueChecker();
    19681969                } );
    19691970
     1971                if ( $pluginInstallSearch.length > 0 ) {
     1972                        $pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' );
     1973                }
     1974
    19701975                /**
    19711976                 * Handles changes to the plugin search box on the new-plugin page,
    19721977                 * searching the repository dynamically.
    19731978                 *
    19741979                 * @since 4.6.0
    19751980                 */
    1976                 $( '.plugin-install-php .wp-filter-search' ).on( 'keyup search', _.debounce( function() {
    1977                         var $form = $( '#plugin-filter' ).empty(),
    1978                                 data  = _.extend( {
    1979                                         _ajax_nonce: wp.updates.ajaxNonce,
    1980                                         s:           $( '<p />' ).html( $( this ).val() ).text(),
    1981                                         tab:         'search',
    1982                                         type:        $( '#typeselector' ).val()
    1983                                 }, { type: 'term' } );
     1981                $pluginInstallSearch.on( 'keyup search', _.debounce( function( event ) {
     1982                        var $form          = $( '#plugin-filter' ),
     1983                            $searchTab     = $( '.plugin-install-search' ),
     1984                            data           = _.extend( {
     1985                                    _ajax_nonce: wp.updates.ajaxNonce,
     1986                                    s:           event.target.value,
     1987                                    tab:         'search',
     1988                                    type:        $( '#typeselector' ).val()
     1989                            }, { type: 'term' } ),
     1990                            searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, '_ajax_nonce' ) );
     1991
     1992                        // Clear on escape.
     1993                        if ( 'keyup' === event.type && 27 === event.which ) {
     1994                                event.target.value = '';
     1995                        }
    19841996
    19851997                        if ( wp.updates.searchTerm === data.s ) {
    19861998                                return;
    19871999                        } else {
     2000                                $form.empty();
    19882001                                wp.updates.searchTerm = data.s;
    19892002                        }
    19902003
    19912004                        if ( history.pushState ) {
    1992                                 history.pushState( null, '', location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, '_ajax_nonce' ) ) );
     2005                                history.pushState( null, '', searchLocation );
     2006                        }
     2007
     2008                        if ( ! $searchTab.length ) {
     2009                                $searchTab = $( '<li class="plugin-install-search"><a></a></li>' );
     2010                                $searchTab.find( 'a' )
     2011                                        .addClass( 'current' )
     2012                                        .attr( 'href', searchLocation )
     2013                                        .text( wp.updates.l10n.searchResultsLabel );
     2014
     2015                                $( '.wp-filter .filter-links .current' )
     2016                                        .removeClass( 'current' )
     2017                                        .parents( '.filter-links' )
     2018                                        .prepend( $searchTab );
    19932019                        }
    19942020
    19952021                        if ( 'undefined' !== typeof wp.updates.searchRequest ) {
     
    20012027                                $( 'body' ).removeClass( 'loading-content' );
    20022028                                $form.append( response.items );
    20032029                                delete wp.updates.searchRequest;
     2030
     2031                                if ( 0 === response.count ) {
     2032                                        wp.a11y.speak( wp.updates.l10n.noPluginsFound );
     2033                                } else {
     2034                                        wp.a11y.speak( wp.updates.l10n.pluginsFound.replace( '%d', response.count ) );
     2035                                }
    20042036                        } );
    20052037                }, 500 ) );
    20062038
  • src/wp-admin/plugin-install.php

    diff --git src/wp-admin/plugin-install.php src/wp-admin/plugin-install.php
    index 2d28248..1981e77 100644
    get_current_screen()->add_help_tab( array( 
    7070'id'            => 'overview',
    7171'title'         => __('Overview'),
    7272'content'       =>
    73         '<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'https://wordpress.org/plugins/') . '</p>'
     73        '<p>' . sprintf( __('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress Plugin Directory</a> are compatible with the license WordPress uses.' ), 'https://wordpress.org/plugins/' ) . '</p>' .
     74        '<p>' . __( 'You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>'
     75
    7476) );
    7577get_current_screen()->add_help_tab( array(
    7678'id'            => 'adding-plugins',
  • src/wp-includes/script-loader.php

    diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
    index 2945b48..11eca1a 100644
    function wp_default_scripts( &$scripts ) { 
    600600                        'l10n'       => array(
    601601                                /* translators: %s: Search string */
    602602                                'searchResults'              => __( 'Search results for &#8220;%s&#8221;' ),
     603                                'searchResultsLabel'         => __( 'Search Results' ),
    603604                                'noPlugins'                  => __( 'You do not appear to have any plugins available at this time.' ),
    604605                                'noItemsSelected'            => __( 'Please select at least one item to perform this action on.' ),
    605606                                'updating'                   => __( 'Updating...' ), // No ellipsis.
  • tests/qunit/fixtures/updates.js

    diff --git tests/qunit/fixtures/updates.js tests/qunit/fixtures/updates.js
    index d570aa6..fe59d3e 100644
    window._wpUpdatesSettings = { 
    22        'ajax_nonce': '719b10f05d',
    33        'l10n': {
    44                'searchResults': 'Search results for &#8220;%s&#8221;',
     5                'searchResultsLabel': 'Search Results',
    56                'noPlugins': 'You do not appear to have any plugins available at this time.',
    67                'noItemsSelected': 'Please select at least one item to perform this action on.',
    78                'updating': 'Updating...',