Ticket #37373: 37373.1.diff
| File 37373.1.diff, 3.4 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/includes/ajax-actions.php
3788 3788 function wp_ajax_search_plugins() { 3789 3789 check_ajax_referer( 'updates' ); 3790 3790 3791 global $wp_list_table, $hook_suffix, $s; 3792 $hook_suffix = 'plugins.php'; 3791 $pagenow = wp_unslash( $_POST['pagenow'] ); 3792 if ( 'plugins-network' === $pagenow || 'plugins' === $pagenow ) { 3793 set_current_screen( $pagenow ); 3794 } 3793 3795 3794 3796 /** @var WP_Plugins_List_Table $wp_list_table */ 3795 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); 3796 $status = array(); 3797 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table', array( 3798 'screen' => get_current_screen(), 3799 ) ); 3797 3800 3801 $status = array(); 3802 3798 3803 if ( ! $wp_list_table->ajax_user_can() ) { 3799 3804 $status['errorMessage'] = __( 'Sorry, you are not allowed to manage plugins for this site.' ); 3800 3805 wp_send_json_error( $status ); … … 3806 3811 'action' => null, 3807 3812 ) ), network_admin_url( 'plugins.php', 'relative' ) ); 3808 3813 3814 global $s; 3809 3815 $s = sanitize_text_field( $_POST['s'] ); 3810 3816 3811 3817 $wp_list_table->prepare_items(); … … 3822 3828 * Ajax handler for searching plugins to install. 3823 3829 * 3824 3830 * @since 4.6.0 3825 *3826 * @global WP_List_Table $wp_list_table Current list table instance.3827 * @global string $hook_suffix Current admin page.3828 3831 */ 3829 3832 function wp_ajax_search_install_plugins() { 3830 3833 check_ajax_referer( 'updates' ); 3831 3834 3832 global $wp_list_table, $hook_suffix; 3833 $hook_suffix = 'plugin-install.php'; 3835 $pagenow = wp_unslash( $_POST['pagenow'] ); 3836 if ( 'plugin-install-network' === $pagenow || 'plugin-install' === $pagenow ) { 3837 set_current_screen( $pagenow ); 3838 } 3834 3839 3835 3840 /** @var WP_Plugin_Install_List_Table $wp_list_table */ 3836 $wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table' ); 3837 $status = array(); 3841 $wp_list_table = _get_list_table( 'WP_Plugin_Install_List_Table', array( 3842 'screen' => get_current_screen(), 3843 ) ); 3838 3844 3845 $status = array(); 3846 3839 3847 if ( ! $wp_list_table->ajax_user_can() ) { 3840 3848 $status['errorMessage'] = __( 'Sorry, you are not allowed to manage plugins for this site.' ); 3841 3849 wp_send_json_error( $status ); -
src/wp-admin/js/updates.js
2033 2033 _ajax_nonce: wp.updates.ajaxNonce, 2034 2034 s: $( '<p />' ).html( $( this ).val() ).text(), 2035 2035 tab: 'search', 2036 type: $( '#typeselector' ).val() 2036 type: $( '#typeselector' ).val(), 2037 pagenow: pagenow 2037 2038 }, { type: 'term' } ); 2038 2039 2039 2040 if ( wp.updates.searchTerm === data.s ) { … … 2043 2044 } 2044 2045 2045 2046 if ( history.pushState ) { 2046 history.pushState( null, '', location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, '_ajax_nonce') ) );2047 history.pushState( null, '', location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) ) ); 2047 2048 } 2048 2049 2049 2050 if ( 'undefined' !== typeof wp.updates.searchRequest ) { … … 2071 2072 $pluginSearch.on( 'keyup input', _.debounce( function( event ) { 2072 2073 var data = { 2073 2074 _ajax_nonce: wp.updates.ajaxNonce, 2074 s: event.target.value 2075 s: event.target.value, 2076 pagenow: pagenow 2075 2077 }; 2076 2078 2077 2079 // Clear on escape.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)