Make WordPress Core


Ignore:
Timestamp:
03/30/2014 07:27:31 PM (10 years ago)
Author:
wonderboymusic
Message:

Metadata for audio and video files:

  • Make attachment metadata for audio files editable by providing a metabox on the Edit Media page
  • Standardize on using the attachment title everywhere
  • Label the Caption and Description fields for audio and video appropriately
  • Make the playlist Underscore templates more straightforward

See #27574.

File:
1 edited

Legend:

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

    r27690 r27862  
    236236                update_post_meta( $post_ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) );
    237237        }
     238    }
     239
     240    if ( 'attachment' === $post_data['post_type'] && preg_match( '#^audio|video#', $post_data['post_mime_type'] ) ) {
     241        $id3data = wp_get_attachment_metadata( $post_ID );
     242        if ( ! is_array( $id3data ) ) {
     243            $id3data = array();
     244        }
     245
     246        foreach ( wp_get_relevant_id3_keys() as $key => $label ) {
     247            if ( isset( $post_data[ 'id3_' . $key ] ) ) {
     248                if ( current_user_can( 'unfiltered_html' ) ) {
     249                    $id3data[ $key ] = wp_unslash( $post_data[ 'id3_' . $key ] );
     250                } else {
     251                    $id3data[ $key ] = wp_unslash( wp_kses_post( $post_data[ 'id3_' . $key ] ) );
     252                }
     253            }
     254        }
     255        wp_update_attachment_metadata( $post_ID, $id3data );
    238256    }
    239257
Note: See TracChangeset for help on using the changeset viewer.