diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index 9751bc5..f4487c0 100644
|
|
function wp_ajax_search_install_plugins() { |
3851 | 3851 | |
3852 | 3852 | ob_start(); |
3853 | 3853 | $wp_list_table->display(); |
| 3854 | $status['count'] = (int) $wp_list_table->get_pagination_arg( 'total_items' ); |
3854 | 3855 | $status['items'] = ob_get_clean(); |
3855 | 3856 | |
3856 | 3857 | wp_send_json_success( $status ); |
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 { |
285 | 285 | ?> |
286 | 286 | </ul> |
287 | 287 | |
288 | | <?php install_search_form( isset( $views['plugin-install-search'] ) ); ?> |
| 288 | <?php install_search_form(); ?> |
289 | 289 | </div> |
290 | 290 | <?php |
291 | 291 | } |
diff --git src/wp-admin/includes/plugin-install.php src/wp-admin/includes/plugin-install.php
index f99cfce..d6c3ffe 100644
|
|
function install_dashboard() { |
246 | 246 | * Display search form for searching plugins. |
247 | 247 | * |
248 | 248 | * @since 2.7.0 |
| 249 | * @since 4.6.0 The optional `$type_selector` parameter was deprecated and renamed to `$deprecated`. |
249 | 250 | * |
250 | | * @param bool $type_selector |
| 251 | * @param bool $deprecated Not used. |
251 | 252 | */ |
252 | | function install_search_form( $type_selector = true ) { |
| 253 | function install_search_form( $deprecated = true ) { |
253 | 254 | $type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
254 | 255 | $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 | | |
263 | 256 | ?><form class="search-form search-plugins" method="get"> |
264 | 257 | <input type="hidden" name="tab" value="search" /> |
265 | | <?php if ( $type_selector ) : ?> |
266 | 258 | <select name="type" id="typeselector"> |
267 | 259 | <option value="term"<?php selected('term', $type) ?>><?php _e('Keyword'); ?></option> |
268 | 260 | <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option> |
269 | 261 | <option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option> |
270 | 262 | </select> |
271 | | <?php endif; ?> |
272 | 263 | <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' ); ?>" /> |
274 | 265 | </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' ); ?>"> |
276 | 267 | </form><?php |
277 | 268 | } |
278 | 269 | |
diff --git src/wp-admin/js/updates.js src/wp-admin/js/updates.js
index 24a8186..24db8af 100644
|
|
|
1590 | 1590 | }; |
1591 | 1591 | |
1592 | 1592 | $( function() { |
1593 | | var $pluginFilter = $( '#plugin-filter' ), |
1594 | | $bulkActionForm = $( '#bulk-action-form' ), |
1595 | | $filesystemModal = $( '#request-filesystem-credentials-dialog' ), |
1596 | | $pluginSearch = $( '.plugins-php .wp-filter-search' ); |
| 1593 | var $pluginFilter = $( '#plugin-filter' ), |
| 1594 | $bulkActionForm = $( '#bulk-action-form' ), |
| 1595 | $filesystemModal = $( '#request-filesystem-credentials-dialog' ), |
| 1596 | $pluginSearch = $( '.plugins-php .wp-filter-search' ), |
| 1597 | $pluginInstallSearch = $( '.plugin-install-php .wp-filter-search' ); |
1597 | 1598 | |
1598 | 1599 | /* |
1599 | 1600 | * Whether a user needs to submit filesystem credentials. |
… |
… |
|
1975 | 1976 | wp.updates.queueChecker(); |
1976 | 1977 | } ); |
1977 | 1978 | |
| 1979 | if ( $pluginInstallSearch.length > 0 ) { |
| 1980 | $pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' ); |
| 1981 | } |
| 1982 | |
1978 | 1983 | /** |
1979 | 1984 | * Handles changes to the plugin search box on the new-plugin page, |
1980 | 1985 | * searching the repository dynamically. |
1981 | 1986 | * |
1982 | 1987 | * @since 4.6.0 |
1983 | 1988 | */ |
1984 | | $( '.plugin-install-php .wp-filter-search' ).on( 'keyup search', _.debounce( function() { |
1985 | | var $form = $( '#plugin-filter' ).empty(), |
1986 | | data = _.extend( { |
1987 | | _ajax_nonce: wp.updates.ajaxNonce, |
1988 | | s: $( '<p />' ).html( $( this ).val() ).text(), |
1989 | | tab: 'search', |
1990 | | type: $( '#typeselector' ).val() |
1991 | | }, { type: 'term' } ); |
| 1989 | $pluginInstallSearch.on( 'keyup search', _.debounce( function( event ) { |
| 1990 | var $form = $( '#plugin-filter' ), |
| 1991 | $searchTab = $( '.plugin-install-search' ), |
| 1992 | data = { |
| 1993 | _ajax_nonce: wp.updates.ajaxNonce, |
| 1994 | s: event.target.value, |
| 1995 | tab: 'search', |
| 1996 | type: $( '#typeselector' ).val() |
| 1997 | }, |
| 1998 | searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, '_ajax_nonce' ) ); |
| 1999 | |
| 2000 | // Clear on escape. |
| 2001 | if ( 'keyup' === event.type && 27 === event.which ) { |
| 2002 | event.target.value = ''; |
| 2003 | } |
1992 | 2004 | |
1993 | 2005 | if ( wp.updates.searchTerm === data.s ) { |
1994 | 2006 | return; |
1995 | 2007 | } else { |
| 2008 | $form.empty(); |
1996 | 2009 | wp.updates.searchTerm = data.s; |
1997 | 2010 | } |
1998 | 2011 | |
1999 | 2012 | if ( history.pushState ) { |
2000 | | history.pushState( null, '', location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, '_ajax_nonce' ) ) ); |
| 2013 | history.pushState( null, '', searchLocation ); |
| 2014 | } |
| 2015 | |
| 2016 | if ( ! $searchTab.length ) { |
| 2017 | $searchTab = $( '<li class="plugin-install-search"><a></a></li>' ); |
| 2018 | $searchTab.find( 'a' ) |
| 2019 | .addClass( 'current' ) |
| 2020 | .attr( 'href', searchLocation ) |
| 2021 | .text( wp.updates.l10n.searchResultsLabel ); |
| 2022 | |
| 2023 | $( '.wp-filter .filter-links .current' ) |
| 2024 | .removeClass( 'current' ) |
| 2025 | .parents( '.filter-links' ) |
| 2026 | .prepend( $searchTab ); |
2001 | 2027 | } |
2002 | 2028 | |
2003 | 2029 | if ( 'undefined' !== typeof wp.updates.searchRequest ) { |
… |
… |
|
2009 | 2035 | $( 'body' ).removeClass( 'loading-content' ); |
2010 | 2036 | $form.append( response.items ); |
2011 | 2037 | delete wp.updates.searchRequest; |
| 2038 | |
| 2039 | if ( 0 === response.count ) { |
| 2040 | wp.a11y.speak( wp.updates.l10n.noPluginsFound ); |
| 2041 | } else { |
| 2042 | wp.a11y.speak( wp.updates.l10n.pluginsFound.replace( '%d', response.count ) ); |
| 2043 | } |
2012 | 2044 | } ); |
2013 | 2045 | }, 500 ) ); |
2014 | 2046 | |
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( |
70 | 70 | 'id' => 'overview', |
71 | 71 | 'title' => __('Overview'), |
72 | 72 | '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 | |
74 | 76 | ) ); |
75 | 77 | get_current_screen()->add_help_tab( array( |
76 | 78 | 'id' => 'adding-plugins', |
diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
index c2dadf2..8678dd7 100644
|
|
function wp_default_scripts( &$scripts ) { |
600 | 600 | 'l10n' => array( |
601 | 601 | /* translators: %s: Search string */ |
602 | 602 | 'searchResults' => __( 'Search results for “%s”' ), |
| 603 | 'searchResultsLabel' => __( 'Search Results' ), |
603 | 604 | 'noPlugins' => __( 'You do not appear to have any plugins available at this time.' ), |
604 | 605 | 'noItemsSelected' => __( 'Please select at least one item to perform this action on.' ), |
605 | 606 | 'updating' => __( 'Updating...' ), // No ellipsis. |
diff --git tests/qunit/fixtures/updates.js tests/qunit/fixtures/updates.js
index 8332039..8b2bd85 100644
|
|
window._wpUpdatesSettings = { |
2 | 2 | 'ajax_nonce': '719b10f05d', |
3 | 3 | 'l10n': { |
4 | 4 | 'searchResults': 'Search results for “%s”', |
| 5 | 'searchResultsLabel': 'Search Results', |
5 | 6 | 'noPlugins': 'You do not appear to have any plugins available at this time.', |
6 | 7 | 'noItemsSelected': 'Please select at least one item to perform this action on.', |
7 | 8 | 'updating': 'Updating...', |