Changeset 27862
- Timestamp:
- 03/30/2014 07:27:31 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-form-advanced.php
r27657 r27862 140 140 add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); 141 141 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); 142 143 if ( preg_match( '#^audio#', $post->post_mime_type ) ) { 144 add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' ); 145 } 142 146 } else { 143 147 add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); -
trunk/src/wp-admin/includes/media.php
r27695 r27862 2662 2662 <div class="wp_attachment_details edit-form-section"> 2663 2663 <p> 2664 <label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br /> 2664 <label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong><?php 2665 if ( preg_match( '#^audio|video#', $post->post_mime_type ) ): ?>: <?php 2666 _e( "Custom label for item in a playlist. If empty, the file's available data is used." ); 2667 endif ?></label><br /> 2665 2668 <textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea> 2666 2669 </p> 2670 2667 2671 2668 2672 <?php if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) : ?> … … 2684 2688 ?> 2685 2689 2686 <label for="content"><strong><?php _e( 'Description' ); ?></strong></label> 2690 <label for="content"><strong><?php _e( 'Description' ); ?></strong><?php 2691 if ( preg_match( '#^audio|video#', $post->post_mime_type ) ): ?>: <?php 2692 _e( 'Displayed on attachment pages.' ); 2693 endif ?></label> 2687 2694 <?php wp_editor( $post->post_content, 'attachment_content', $editor_args ); ?> 2688 2695 … … 2766 2773 $fields = apply_filters( 'media_submitbox_misc_sections', array( 2767 2774 'mime_type' => __( 'Mime-type:' ), 2768 'year' => __( 'Year:' ),2769 'genre' => __( 'Genre:' ),2770 2775 'length_formatted' => __( 'Length:' ), 2771 2776 ) ); -
trunk/src/wp-admin/includes/meta-boxes.php
r27747 r27862 1058 1058 echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); 1059 1059 } 1060 1061 /** 1062 * Display fields for ID3 data 1063 * 1064 * @since 3.9.0 1065 * 1066 * @param WP_Post $post 1067 */ 1068 function attachment_id3_data_meta_box( $post ) { 1069 $meta = array(); 1070 if ( ! empty( $post->ID ) ) { 1071 $meta = wp_get_attachment_metadata( $post->ID ); 1072 } 1073 1074 foreach ( wp_get_relevant_id3_keys() as $key => $label ): ?> 1075 <p> 1076 <label for="title"><?php echo $label ?></label> 1077 <input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="widefat" value="<?php 1078 if ( ! empty( $meta[ $key ] ) ) { 1079 echo esc_attr( $meta[ $key ] ); 1080 } 1081 ?>" /> 1082 </p> 1083 <?php endforeach; 1084 } -
trunk/src/wp-admin/includes/post.php
r27690 r27862 236 236 update_post_meta( $post_ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) ); 237 237 } 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 ); 238 256 } 239 257 -
trunk/src/wp-includes/media.php
r27813 r27862 1019 1019 <img src="{{{ data.thumb.src }}}"/> 1020 1020 <# } #> 1021 <# if ( data.meta.title ) { #>1022 1021 <div class="wp-playlist-caption"> 1023 <span class="wp-caption-meta wp-caption-title">“{{{ data. meta.title }}}”</span>1024 < span class="wp-caption-meta wp-caption-album">{{{ data.meta.album }}}</span>1025 < span class="wp-caption-meta wp-caption-artist">{{{ data.meta.artist }}}</span>1022 <span class="wp-caption-meta wp-caption-title">“{{{ data.title }}}”</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><# } #> 1026 1025 </div> 1027 <# } else { #>1028 <div class="wp-playlist-caption">{{{ data.caption ? data.caption : data.title }}}</div>1029 <# } #>1030 1026 </script> 1031 1027 <script type="text/html" id="tmpl-wp-playlist-item"> 1032 1028 <div class="wp-playlist-item"> 1033 <# if ( ( data.title || data.meta.title ) && ( ! data.artists || data.meta.artist ) ) { #>1034 1029 <div class="wp-playlist-caption"> 1035 1030 {{{ data.index ? ( data.index + '. ' ) : '' }}} 1036 <span class="wp-caption-title">“{{{ data.title ? data.title : data.meta.title }}}”</span> 1037 <# if ( data.artists ) { #> 1038 <span class="wp-caption-by"><?php _e( 'by' ) ?></span> 1039 <span class="wp-caption-artist">{{{ data.meta.artist }}}</span> 1031 <# if ( data.caption ) { #> 1032 {{{ data.caption }}} 1033 <# } else { #> 1034 <span class="wp-caption-title">“{{{ data.title }}}”</span> 1035 <# if ( data.artists && data.meta.artist ) { #> 1036 <span class="wp-caption-by"><?php _e( 'by' ) ?></span> 1037 <span class="wp-caption-artist">{{{ data.meta.artist }}}</span> 1038 <# } #> 1040 1039 <# } #> 1041 1040 </div> 1042 <# } else { #>1043 <div class="wp-playlist-caption">{{{ data.index ? ( data.index + '.' ) : '' }}} {{{ data.caption ? data.caption : data.title }}}</div>1044 <# } #>1045 1041 <# if ( data.meta.length_formatted ) { #> 1046 1042 <div class="wp-playlist-item-length">{{{ data.meta.length_formatted }}}</div> … … 1208 1204 if ( ! empty( $meta ) ) { 1209 1205 1210 $keys = array( 'title', 'artist', 'band', 'album', 'genre', 'year', 'length', 'length_formatted' ); 1211 foreach ( $keys as $key ) { 1206 foreach ( wp_get_relevant_id3_keys() as $key => $label ) { 1212 1207 if ( ! empty( $meta[ $key ] ) ) { 1213 1208 $track['meta'][ $key ] = $meta[ $key ]; … … 1318 1313 } 1319 1314 1315 /** 1316 * Return useful keys to use to lookup data from an attachment's stored metadata 1317 * 1318 * @since 3.9.0 1319 * 1320 * @return array 1321 */ 1322 function wp_get_relevant_id3_keys() { 1323 $fields = array( 1324 'artist' => __( 'Artist' ), 1325 'album' => __( 'Album' ), 1326 'genre' => __( 'Genre' ), 1327 'year' => __( 'Year' ), 1328 'length_formatted' => __( 'Formatted Length' ) 1329 ); 1330 /** 1331 * Filter the editable list of keys to lookup data from an attachment's metadata 1332 * 1333 * @since 3.9.0 1334 * 1335 * @param array $fields 1336 */ 1337 return apply_filters( 'wp_get_relevant_id3_keys', $fields ); 1338 } 1320 1339 /** 1321 1340 * The Audio shortcode. … … 2313 2332 2314 2333 $response['meta'] = array(); 2315 $keys = array( 'title', 'artist', 'band', 'album', 'genre', 'year', 'length', 'length_formatted' ); 2316 foreach ( $keys as $key ) { 2334 foreach ( wp_get_relevant_id3_keys() as $key => $label ) { 2317 2335 if ( ! empty( $meta[ $key ] ) ) { 2318 2336 $response['meta'][ $key ] = $meta[ $key ];
Note: See TracChangeset
for help on using the changeset viewer.