WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/19/2015 03:55:39 AM (6 years ago)
Author:
wonderboymusic
Message:

Replace array_shift() with reset() where appropriate for performance.

Props SergeyBiryukov.
Fixes #31259.

File:
1 edited

Legend:

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

    r31799 r31829  
    622622
    623623    if ( isset($_POST['send']) ) {
    624         $keys = array_keys($_POST['send']);
    625         $send_id = (int) array_shift($keys);
     624        $keys = array_keys( $_POST['send'] );
     625        $send_id = (int) reset( $keys );
    626626    }
    627627
     
    13581358    $post_mime_types = get_post_mime_types();
    13591359    $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
    1360     $type = array_shift( $keys );
     1360    $type = reset( $keys );
    13611361    $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
    13621362
Note: See TracChangeset for help on using the changeset viewer.