| 227 | if ( preg_match( '#^audio#', $type ) ) { |
| 228 | $meta = wp_read_audio_metadata( $file ); |
| 229 | if ( ! empty( $meta['title'] ) ) |
| 230 | $title = $meta['title']; |
| 231 | |
| 232 | $content = trim( sprintf( |
| 233 | '%s%s%s.', |
| 234 | ! empty( $title ) ? '"' . $title . '"' : '', |
| 235 | ! empty( $meta['album'] ) ? sprintf( ' %s %s', __( 'from' ), $meta['album'] ) : '', |
| 236 | ! empty( $meta['artist'] ) ? sprintf( ' %s %s', __( 'by' ), $meta['artist'] ) : '' |
| 237 | ) ); |
| 238 | |
| 239 | if ( ! empty( $meta['year'] ) ) |
| 240 | $content .= sprintf( ' %s %d.', __( 'Released:' ), $meta['year'] ); |
| 241 | |
| 242 | if ( ! empty( $meta['track_number'] ) ) { |
| 243 | list( $track, $length ) = explode( '/', $meta['track_number'] ); |
| 244 | $content .= sprintf( ' %s %d %s %d.', __( 'Track' ), $track, __( 'of' ), $length ); |
| 245 | } |
| 246 | |
| 247 | if ( ! empty( $meta['genre'] ) ) |
| 248 | $content .= sprintf( ' %s %s.', __( 'Genre:' ), $meta['genre'] ); |
| 249 | |
2393 | | <?php if ( $media_dims ) : ?> |
| 2423 | <?php |
| 2424 | if ( preg_match( '#^audio|video#', $post->post_mime_type ) ): |
| 2425 | |
| 2426 | $fields = array( |
| 2427 | 'mime_type' => __( 'Mime-type:' ), |
| 2428 | 'year' => __( 'Year:' ), |
| 2429 | 'genre' => __( 'Genre:' ), |
| 2430 | 'length_formatted' => __( 'Length:' ), |
| 2431 | ); |
| 2432 | |
| 2433 | foreach ( $fields as $key => $label ): |
| 2434 | if ( ! empty( $meta[$key] ) ) : ?> |
| 2435 | <div class="misc-pub-section"> |
| 2436 | <?php echo $label ?> <strong><?php echo $meta[$key]; ?></strong> |
| 2437 | </div> |
| 2438 | <?php |
| 2439 | endif; |
| 2440 | endforeach; |
| 2441 | |
| 2442 | if ( ! empty( $meta['bitrate'] ) ) : ?> |
| 2443 | <div class="misc-pub-section"> |
| 2444 | <?php _e( 'Bitrate:' ); ?> <strong><?php |
| 2445 | echo $meta['bitrate'] / 1000, 'kb/s'; |
| 2446 | |
| 2447 | if ( ! empty( $meta['bitrate_mode'] ) ) |
| 2448 | echo ' ', strtoupper( $meta['bitrate_mode'] ); |
| 2449 | |
| 2450 | ?></strong> |
| 2451 | </div> |
| 2452 | <?php |
| 2453 | endif; |
| 2454 | |
| 2455 | $audio_fields = array( |
| 2456 | 'dataformat' => __( 'Audio Format:' ), |
| 2457 | 'codec' => __( 'Audio Codec:' ) |
| 2458 | ); |
| 2459 | |
| 2460 | foreach ( $audio_fields as $key => $label ): |
| 2461 | if ( ! empty( $meta['audio'][$key] ) ) : ?> |
| 2462 | <div class="misc-pub-section"> |
| 2463 | <?php echo $label; ?> <strong><?php echo $meta['audio'][$key]; ?></strong> |
| 2464 | </div> |
| 2465 | <?php |
| 2466 | endif; |
| 2467 | endforeach; |
| 2468 | |
| 2469 | endif; |
| 2470 | |
| 2471 | if ( $media_dims ) : ?> |