Make WordPress Core


Ignore:
Timestamp:
03/03/2014 04:20:12 PM (10 years ago)
Author:
markjaquith
Message:

Eliminate some of our last remaining create_function() instances

  • Moved some into private function callbacks
  • Eliminated some that weren't necessary anymore

props obenland, markjaquith, nacin. fixes #14424

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r27369 r27373  
    22562256        $form_class .= ' html-uploader';
    22572257
    2258     $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
    2259     if ( $_GET['paged'] < 1 )
    2260         $_GET['paged'] = 1;
    2261     $start = ( $_GET['paged'] - 1 ) * 10;
    2262     if ( $start < 1 )
    2263         $start = 0;
    2264     add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
    2265 
    2266     list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
     2258    $q = $_GET;
     2259    $q['posts_per_page'] = 10;
     2260    $q = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
     2261    if ( $q['paged'] < 1 ) {
     2262        $q['paged'] = 1;
     2263    }
     2264    $q['offset'] = ( $q['paged'] - 1 ) * 10;
     2265    if ( $q['offset'] < 1 ) {
     2266        $q['offset'] = 0;
     2267    }
     2268
     2269    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q );
    22672270
    22682271?>
Note: See TracChangeset for help on using the changeset viewer.