Make WordPress Core


Ignore:
Timestamp:
03/30/2014 09:07:04 PM (10 years ago)
Author:
nacin
Message:

Cleanups for audio/video metadata, see [27862].

see #27574.

File:
1 edited

Legend:

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

    r27862 r27864  
    10171017<script type="text/html" id="tmpl-wp-playlist-current-item">
    10181018    <# if ( data.image ) { #>
    1019     <img src="{{{ data.thumb.src }}}"/>
     1019    <img src="{{ data.thumb.src }}"/>
    10201020    <# } #>
    10211021    <div class="wp-playlist-caption">
    10221022        <span class="wp-caption-meta wp-caption-title">&#8220;{{{ data.title }}}&#8221;</span>
    1023         <# if ( data.meta.album ) { #><span class="wp-caption-meta wp-caption-album">{{{ data.meta.album }}}</span><# } #>
    1024         <# if ( data.meta.artist ) { #><span class="wp-caption-meta wp-caption-artist">{{{ data.meta.artist }}}</span><# } #>
     1023        <# if ( data.meta.album ) { #><span class="wp-caption-meta wp-caption-album">{{ data.meta.album }}</span><# } #>
     1024        <# if ( data.meta.artist ) { #><span class="wp-caption-meta wp-caption-artist">{{ data.meta.artist }}</span><# } #>
    10251025    </div>
    10261026</script>
     
    10281028    <div class="wp-playlist-item">
    10291029        <div class="wp-playlist-caption">
    1030             {{{ data.index ? ( data.index + '.&nbsp;' ) : '' }}}
     1030            {{ data.index ? ( data.index + '. ' ) : '' }}
    10311031            <# if ( data.caption ) { #>
    10321032                {{{ data.caption }}}
     
    10351035                <# if ( data.artists && data.meta.artist ) { #>
    10361036                <span class="wp-caption-by"><?php _e( 'by' ) ?></span>
    1037                 <span class="wp-caption-artist">{{{ data.meta.artist }}}</span>
     1037                <span class="wp-caption-artist">{{ data.meta.artist }}</span>
    10381038                <# } #>
    10391039            <# } #>
     
    12041204        if ( ! empty( $meta ) ) {
    12051205
    1206             foreach ( wp_get_relevant_id3_keys() as $key => $label ) {
     1206            foreach ( wp_get_relevant_id3_keys( $attachment ) as $key => $label ) {
    12071207                if ( ! empty( $meta[ $key ] ) ) {
    12081208                    $track['meta'][ $key ] = $meta[ $key ];
     
    13181318 * @since 3.9.0
    13191319 *
     1320 * @param WP_Post $post The post in question, provided for context.
    13201321 * @return array
    13211322 */
    1322 function wp_get_relevant_id3_keys() {
     1323function wp_get_relevant_id3_keys( $post ) {
    13231324    $fields = array(
    13241325        'artist' => __( 'Artist' ),
     
    13281329        'length_formatted' => __( 'Formatted Length' )
    13291330    );
     1331
    13301332    /**
    1331      * Filter the editable list of keys to lookup data from an attachment's metadata
     1333     * Filter the editable list of keys to lookup data from an attachment's metadata.
    13321334     *
    13331335     * @since 3.9.0
    13341336     *
    1335      * @param array $fields
     1337     * @param array   $fields Key/value pairs of field keys to labels.
     1338     * @param WP_Post $post   Post object.
    13361339     */
    1337     return apply_filters( 'wp_get_relevant_id3_keys', $fields );
     1340    return apply_filters( 'wp_get_relevant_id3_keys', $fields, $post );
    13381341}
    13391342/**
     
    23322335
    23332336        $response['meta'] = array();
    2334         foreach ( wp_get_relevant_id3_keys() as $key => $label ) {
     2337        foreach ( wp_get_relevant_id3_keys( $attachment ) as $key => $label ) {
    23352338            if ( ! empty( $meta[ $key ] ) ) {
    23362339                $response['meta'][ $key ] = $meta[ $key ];
Note: See TracChangeset for help on using the changeset viewer.