Changeset 27869
- Timestamp:
- 03/31/2014 05:15:39 AM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r27864 r27869 2662 2662 <div class="wp_attachment_details edit-form-section"> 2663 2663 <p> 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 /> 2664 <label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br /> 2668 2665 <textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea> 2669 2666 </p> … … 2689 2686 2690 2687 <label for="content"><strong><?php _e( 'Description' ); ?></strong><?php 2691 if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) : ?>: <?php2692 _e( 'Displayed on attachment pages.' );2693 endif?></label>2688 if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) { 2689 echo ': ' . __( 'Displayed on attachment pages.' ); 2690 } ?></label> 2694 2691 <?php wp_editor( $post->post_content, 'attachment_content', $editor_args ); ?> 2695 2692 … … 2729 2726 <div class="misc-pub-section misc-pub-filetype"> 2730 2727 <?php _e( 'File type:' ); ?> <strong><?php 2731 if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) 2728 if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) { 2732 2729 echo esc_html( strtoupper( $matches[1] ) ); 2733 else 2730 list( $mime_type ) = explode( '/', $post->post_mime_type ); 2731 if ( $mime_type !== 'image' && ! empty( $meta['mime_type'] ) ) { 2732 if ( $meta['mime_type'] !== "$mime_type/" . strtolower( $matches[1] ) ) { 2733 echo ' (' . $meta['mime_type'] . ')'; 2734 } 2735 } 2736 } else { 2734 2737 echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) ); 2738 } 2735 2739 ?></strong> 2736 2740 </div> … … 2752 2756 endif; 2753 2757 2754 if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) :2758 if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) { 2755 2759 2756 2760 /** … … 2762 2766 * @since 3.7.0 2763 2767 * 2764 * @param array $fields { 2765 * An array of the attachment metadata keys and labels. 2766 * 2767 * @type string $mime_type Label to be shown before the field mime_type. 2768 * @type string $year Label to be shown before the field year. 2769 * @type string $genre Label to be shown before the field genre. 2770 * @type string $length_formatted Label to be shown before the field length_formatted. 2771 * } 2768 * @param array $fields An array of the attachment metadata keys and labels. 2772 2769 */ 2773 2770 $fields = apply_filters( 'media_submitbox_misc_sections', array( 2774 'mime_type' => __( 'Mime-type:' ),2775 2771 'length_formatted' => __( 'Length:' ), 2772 'bitrate' => __( 'Bitrate:' ), 2776 2773 ) ); 2777 2774 2778 foreach ( $fields as $key => $label ): 2779 if ( ! empty( $meta[$key] ) ) : ?> 2775 foreach ( $fields as $key => $label ) { 2776 if ( empty( $meta[ $key ] ) ) { 2777 continue; 2778 } 2779 ?> 2780 2780 <div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php echo sanitize_html_class( $key ); ?>"> 2781 <?php echo $label ?> <strong><?php echo esc_html( $meta[$key] ); ?></strong> 2782 </div> 2783 <?php 2784 endif; 2785 endforeach; 2786 2787 if ( ! empty( $meta['bitrate'] ) ) : ?> 2788 <div class="misc-pub-section misc-pub-bitrate"> 2789 <?php _e( 'Bitrate:' ); ?> <strong><?php 2790 echo round( $meta['bitrate'] / 1000 ), 'kb/s'; 2791 2792 if ( ! empty( $meta['bitrate_mode'] ) ) 2793 echo ' ', strtoupper( $meta['bitrate_mode'] ); 2794 2781 <?php echo $label ?> <strong><?php 2782 switch ( $key ) { 2783 case 'bitrate' : 2784 echo round( $meta['bitrate'] / 1000 ) . 'kb/s'; 2785 if ( ! empty( $meta['bitrate_mode'] ) ) { 2786 echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) ); 2787 } 2788 break; 2789 default: 2790 echo esc_html( $meta[ $key ] ); 2791 break; 2792 } 2795 2793 ?></strong> 2796 2794 </div> 2797 2795 <?php 2798 endif;2796 } 2799 2797 2800 2798 /** … … 2806 2804 * @since 3.7.0 2807 2805 * 2808 * @param array $fields { 2809 * An array of the attachment metadata keys and labels. 2810 * 2811 * @type string $dataformat Label to be shown before the field dataformat. 2812 * @type string $codec Label to be shown before the field codec. 2813 * } 2806 * @param array $fields An array of the attachment metadata keys and labels. 2814 2807 */ 2815 2808 $audio_fields = apply_filters( 'audio_submitbox_misc_sections', array( … … 2818 2811 ) ); 2819 2812 2820 foreach ( $audio_fields as $key => $label ): 2821 if ( ! empty( $meta['audio'][$key] ) ) : ?> 2813 foreach ( $audio_fields as $key => $label ) { 2814 if ( empty( $meta['audio'][ $key ] ) ) { 2815 continue; 2816 } 2817 ?> 2822 2818 <div class="misc-pub-section misc-pub-audio misc-pub-<?php echo sanitize_html_class( $key ); ?>"> 2823 2819 <?php echo $label; ?> <strong><?php echo esc_html( $meta['audio'][$key] ); ?></strong> 2824 2820 </div> 2825 2821 <?php 2826 endif; 2827 endforeach; 2828 2829 endif; 2822 } 2823 2824 } 2830 2825 2831 2826 if ( $media_dims ) : ?> -
trunk/src/wp-admin/includes/meta-boxes.php
r27864 r27869 1072 1072 } 1073 1073 1074 foreach ( wp_get_ relevant_id3_keys( $post ) as $key => $label ): ?>1074 foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?> 1075 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="<?php1076 <label for="title"><?php echo $label ?></label><br /> 1077 <input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php 1078 1078 if ( ! empty( $meta[ $key ] ) ) { 1079 1079 echo esc_attr( $meta[ $key ] ); … … 1081 1081 ?>" /> 1082 1082 </p> 1083 <?php endforeach; 1084 } 1083 <?php 1084 endforeach; 1085 } -
trunk/src/wp-admin/includes/post.php
r27866 r27869 244 244 } 245 245 246 foreach ( wp_get_ relevant_id3_keys( $post) as $key => $label ) {246 foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) { 247 247 if ( isset( $post_data[ 'id3_' . $key ] ) ) { 248 248 $id3data[ $key ] = sanitize_text_field( wp_unslash( $post_data[ 'id3_' . $key ] ) ); -
trunk/src/wp-includes/media.php
r27865 r27869 1020 1020 <# } #> 1021 1021 <div class="wp-playlist-caption"> 1022 <span class="wp-playlist-item-meta wp-playlist-item-title">“{{ { data.title }}}”</span>1022 <span class="wp-playlist-item-meta wp-playlist-item-title">“{{ data.title }}”</span> 1023 1023 <# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #> 1024 1024 <# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #> … … 1030 1030 {{ data.index ? ( data.index + '. ' ) : '' }} 1031 1031 <# if ( data.caption ) { #> 1032 {{ { data.caption }}}1032 {{ data.caption }} 1033 1033 <# } else { #> 1034 <span class="wp-playlist-item-title">“{{ { data.title }}}”</span>1034 <span class="wp-playlist-item-title">“{{ data.title }}”</span> 1035 1035 <# if ( data.artists && data.meta.artist ) { #> 1036 1036 <span class="wp-playlist-item-artist"> — {{ data.meta.artist }}</span> … … 1039 1039 </div> 1040 1040 <# if ( data.meta.length_formatted ) { #> 1041 <div class="wp-playlist-item-length">{{ { data.meta.length_formatted }}}</div>1041 <div class="wp-playlist-item-length">{{ data.meta.length_formatted }}</div> 1042 1042 <# } #> 1043 1043 </div> … … 1203 1203 if ( ! empty( $meta ) ) { 1204 1204 1205 foreach ( wp_get_ relevant_id3_keys( $attachment ) as $key => $label ) {1205 foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) { 1206 1206 if ( ! empty( $meta[ $key ] ) ) { 1207 1207 $track['meta'][ $key ] = $meta[ $key ]; … … 1313 1313 1314 1314 /** 1315 * Return useful keys to use to lookup data from an attachment's stored metadata 1315 * Return useful keys to use to lookup data from an attachment's stored metadata. 1316 1316 * 1317 1317 * @since 3.9.0 1318 1318 * 1319 * @param WP_Post $post The post in question, provided for context. 1319 * @param WP_Post $attachment The attachment in question, provided for context. 1320 * @param string $context The context. Accepts 'edit', 'display'. Default 'display'. 1320 1321 * @return array 1321 1322 */ 1322 function wp_get_ relevant_id3_keys( $post) {1323 function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) { 1323 1324 $fields = array( 1324 1325 'artist' => __( 'Artist' ), 1325 1326 'album' => __( 'Album' ), 1326 'genre' => __( 'Genre' ),1327 'year' => __( 'Year' ),1328 'length_formatted' => __( 'Formatted Length' )1329 1327 ); 1328 1329 if ( 'display' === $context ) { 1330 $fields['genre'] = __( 'Genre' ); 1331 $fields['year'] = __( 'Year' ); 1332 $fields['length_formatted'] = _x( 'Length', 'video or audio' ); 1333 } 1330 1334 1331 1335 /** … … 1334 1338 * @since 3.9.0 1335 1339 * 1336 * @param array $fields Key/value pairs of field keys to labels.1337 * @param WP_Post $ post Post object.1340 * @param array $fields Key/value pairs of field keys to labels. 1341 * @param WP_Post $attachment Attachment object. 1338 1342 */ 1339 return apply_filters( 'wp_get_ relevant_id3_keys', $fields, $post );1343 return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context ); 1340 1344 } 1341 1345 /** … … 2334 2338 2335 2339 $response['meta'] = array(); 2336 foreach ( wp_get_ relevant_id3_keys( $attachment ) as $key => $label ) {2340 foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) { 2337 2341 if ( ! empty( $meta[ $key ] ) ) { 2338 2342 $response['meta'][ $key ] = $meta[ $key ];
Note: See TracChangeset
for help on using the changeset viewer.