Ticket #37233: 37233.4.diff
File 37233.4.diff, 9.8 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
3856 3856 3857 3857 ob_start(); 3858 3858 $wp_list_table->display(); 3859 $status['count'] = (int) $wp_list_table->get_pagination_arg( 'total_items' ); 3859 3860 $status['items'] = ob_get_clean(); 3860 3861 3861 3862 wp_send_json_success( $status ); -
src/wp-admin/includes/class-wp-plugin-install-list-table.php
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 } -
src/wp-admin/includes/plugin-install.php
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_selector251 * @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 form259 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 <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; ?>/> 263 <label><span class="screen-reader-text"><?php _e( 'Search Plugins' ); ?></span> 264 <input type="search" name="s" value="<?php echo esc_attr( $term ) ?>" class="wp-filter-search" placeholder="<?php esc_attr_e( '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 esc_attr_e( 'Search Plugins' ); ?>"> 276 267 </form><?php 277 268 } 278 269 -
src/wp-admin/js/updates.js
1598 1598 }; 1599 1599 1600 1600 $( function() { 1601 var $pluginFilter = $( '#plugin-filter' ), 1602 $bulkActionForm = $( '#bulk-action-form' ), 1603 $filesystemModal = $( '#request-filesystem-credentials-dialog' ), 1604 $pluginSearch = $( '.plugins-php .wp-filter-search' ); 1601 var $pluginFilter = $( '#plugin-filter' ), 1602 $bulkActionForm = $( '#bulk-action-form' ), 1603 $filesystemModal = $( '#request-filesystem-credentials-dialog' ), 1604 $pluginSearch = $( '.plugins-php .wp-filter-search' ), 1605 $pluginInstallSearch = $( '.plugin-install-php .wp-filter-search' ); 1605 1606 1606 1607 /* 1607 1608 * Whether a user needs to submit filesystem credentials. … … 2021 2022 wp.updates.queueChecker(); 2022 2023 } ); 2023 2024 2025 if ( $pluginInstallSearch.length > 0 ) { 2026 $pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' ); 2027 } 2028 2024 2029 /** 2025 2030 * Handles changes to the plugin search box on the new-plugin page, 2026 2031 * searching the repository dynamically. 2027 2032 * 2028 2033 * @since 4.6.0 2029 2034 */ 2030 $( '.plugin-install-php .wp-filter-search' ).on( 'keyup search', _.debounce( function() { 2031 var $form = $( '#plugin-filter' ).empty(), 2032 data = _.extend( { 2033 _ajax_nonce: wp.updates.ajaxNonce, 2034 s: $( this ).val(), 2035 tab: 'search', 2036 type: $( '#typeselector' ).val(), 2037 pagenow: pagenow 2038 }, { type: 'term' } ); 2035 $pluginInstallSearch.on( 'keyup input', _.debounce( function( event, eventtype ) { 2036 var $form = $( '#plugin-filter' ), $searchTab = $( '.plugin-install-search' ), 2037 data, searchLocation; 2039 2038 2040 if ( wp.updates.searchTerm === data.s ) { 2039 data = { 2040 _ajax_nonce: wp.updates.ajaxNonce, 2041 s: event.target.value, 2042 tab: 'search', 2043 type: $( '#typeselector' ).val(), 2044 pagenow: pagenow 2045 }; 2046 searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) ); 2047 2048 // Clear on escape. 2049 if ( 'keyup' === event.type && 27 === event.which ) { 2050 event.target.value = ''; 2051 } 2052 2053 if ( wp.updates.searchTerm === data.s && 'typechange' !== eventtype ) { 2041 2054 return; 2042 2055 } else { 2056 $form.empty(); 2043 2057 wp.updates.searchTerm = data.s; 2044 2058 } 2045 2059 2046 2060 if ( history.pushState ) { 2047 history.pushState( null, '', location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) ));2061 history.pushState( null, '', searchLocation ); 2048 2062 } 2049 2063 2064 if ( ! $searchTab.length ) { 2065 $searchTab = $( '<li class="plugin-install-search" />' ) 2066 .append( $( '<a />', { 2067 'class': 'current', 2068 'href': searchLocation, 2069 'text': wp.updates.l10n.searchResultsLabel 2070 } ) ); 2071 2072 $( '.wp-filter .filter-links .current' ) 2073 .removeClass( 'current' ) 2074 .parents( '.filter-links' ) 2075 .prepend( $searchTab ); 2076 } 2077 2050 2078 if ( 'undefined' !== typeof wp.updates.searchRequest ) { 2051 2079 wp.updates.searchRequest.abort(); 2052 2080 } … … 2056 2084 $( 'body' ).removeClass( 'loading-content' ); 2057 2085 $form.append( response.items ); 2058 2086 delete wp.updates.searchRequest; 2087 2088 if ( 0 === response.count ) { 2089 wp.a11y.speak( wp.updates.l10n.noPluginsFound ); 2090 } else { 2091 wp.a11y.speak( wp.updates.l10n.pluginsFound.replace( '%d', response.count ) ); 2092 } 2059 2093 } ); 2060 2094 }, 500 ) ); 2061 2095 … … 2132 2166 $document.on( 'submit', '.search-plugins', function( event ) { 2133 2167 event.preventDefault(); 2134 2168 2135 $( 'input.wp-filter-search' ).trigger( ' search' );2169 $( 'input.wp-filter-search' ).trigger( 'input' ); 2136 2170 } ); 2137 2171 2138 2172 /** … … 2141 2175 * @since 4.6.0 2142 2176 */ 2143 2177 $( '#typeselector' ).on( 'change', function() { 2144 $( 'input[name="s"]' ).trigger( ' search' );2178 $( 'input[name="s"]' ).trigger( 'input', 'typechange' ); 2145 2179 } ); 2146 2180 2147 2181 /** -
src/wp-admin/plugin-install.php
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', -
src/wp-includes/script-loader.php
609 609 'l10n' => array( 610 610 /* translators: %s: Search string */ 611 611 'searchResults' => __( 'Search results for “%s”' ), 612 'searchResultsLabel' => __( 'Search Results' ), 612 613 'noPlugins' => __( 'You do not appear to have any plugins available at this time.' ), 613 614 'noItemsSelected' => __( 'Please select at least one item to perform this action on.' ), 614 615 'updating' => __( 'Updating...' ), // No ellipsis. -
tests/qunit/fixtures/updates.js
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...',