WordPress.org

Make WordPress Core

Changeset 52245


Ignore:
Timestamp:
11/25/2021 08:34:01 AM (2 weeks ago)
Author:
audrasjb
Message:

Media: Replace some array keys with their numeric equivalent.

This change replaces ['0'] with [0] which brings better consistency, readability and performance.

Props chintan1896, adamsilverstein, costdev.
Fixes #53540.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r52204 r52245  
    37413741        case 'matroska':
    37423742        case 'webm':
    3743             if ( isset( $metadata['matroska']['comments']['creation_time']['0'] ) ) {
    3744                 $creation_date = strtotime( $metadata['matroska']['comments']['creation_time']['0'] );
    3745             } elseif ( isset( $metadata['matroska']['info']['0']['DateUTC_unix'] ) ) {
    3746                 $creation_date = (int) $metadata['matroska']['info']['0']['DateUTC_unix'];
     3743            if ( isset( $metadata['matroska']['comments']['creation_time'][0] ) ) {
     3744                $creation_date = strtotime( $metadata['matroska']['comments']['creation_time'][0] );
     3745            } elseif ( isset( $metadata['matroska']['info'][0]['DateUTC_unix'] ) ) {
     3746                $creation_date = (int) $metadata['matroska']['info'][0]['DateUTC_unix'];
    37473747            }
    37483748            break;
     
    37503750        case 'quicktime':
    37513751        case 'mp4':
    3752             if ( isset( $metadata['quicktime']['moov']['subatoms']['0']['creation_time_unix'] ) ) {
    3753                 $creation_date = (int) $metadata['quicktime']['moov']['subatoms']['0']['creation_time_unix'];
     3752            if ( isset( $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'] ) ) {
     3753                $creation_date = (int) $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'];
    37543754            }
    37553755            break;
  • trunk/src/wp-includes/media.php

    r52190 r52245  
    11301130function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
    11311131    $image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
    1132     return isset( $image['0'] ) ? $image['0'] : false;
     1132    return isset( $image[0] ) ? $image[0] : false;
    11331133}
    11341134
Note: See TracChangeset for help on using the changeset viewer.