WordPress.org

Make WordPress Core

Changeset 30249


Ignore:
Timestamp:
11/06/2014 07:00:57 AM (5 years ago)
Author:
nacin
Message:

Plugin search: Wrap results in a form to fix pagination's paged input field.

Merges [29829] to the 4.0 branch.

props jesin, ocean90.
fixes #18724.

Location:
branches/4.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/wp-admin/includes/class-wp-plugin-install-list-table.php

    r29679 r30249  
    274274        }
    275275
    276         if ( 'top' ==  $which ) { ?>
     276        if ( 'top' ==  $which ) {
     277            wp_referer_field();
     278        ?>
    277279            <div class="tablenav top">
    278280                <div class="alignleft actions">
  • branches/4.0/src/wp-admin/includes/plugin-install.php

    r29636 r30249  
    236236    global $wp_list_table;
    237237
    238     if ( current_filter() == 'install_plugins_favorites' && empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) )
    239             return;
    240 
    241     $wp_list_table->display();
     238    if ( current_filter() == 'install_plugins_favorites' && empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) ) {
     239        return;
     240    }
     241
     242    ?>
     243    <form id="plugin-filter" action="" method="post">
     244        <?php $wp_list_table->display(); ?>
     245    </form>
     246    <?php
    242247}
    243248add_action( 'install_plugins_search',    'display_plugins_table' );
  • branches/4.0/src/wp-admin/plugin-install.php

    r29642 r30249  
    2525$wp_list_table = _get_list_table('WP_Plugin_Install_List_Table');
    2626$pagenum = $wp_list_table->get_pagenum();
     27
     28if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
     29    $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
     30
     31    if ( ! empty( $_REQUEST['paged'] ) ) {
     32        $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
     33    }
     34
     35    wp_redirect( $location );
     36    exit;
     37}
     38
    2739$wp_list_table->prepare_items();
     40
     41$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
     42
     43if ( $pagenum > $total_pages && $total_pages > 0 ) {
     44    wp_redirect( add_query_arg( 'paged', $total_pages ) );
     45    exit;
     46}
    2847
    2948$title = __( 'Add Plugins' );
Note: See TracChangeset for help on using the changeset viewer.