| 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 = ''; |
| 233 | |
| 234 | if ( ! empty( $title ) ) |
| 235 | $content .= _x( '“', 'opening curly double quote' ) . $title . _x( '”', 'closing curly double quote' );; |
| 236 | |
| 237 | if ( ! empty( $meta['album'] ) ) |
| 238 | $content .= ' ' . sprintf( _x( 'from %s', 'album/work name' ), $meta['album'] ); |
| 239 | |
| 240 | if ( ! empty( $meta['artist'] ) ) |
| 241 | $content .= ' ' . sprintf( _x( 'by %s', 'artist/creator name' ), $meta['artist'] ); |
| 242 | |
| 243 | if ( ! empty( $content ) ) |
| 244 | $content .= '. '; |
| 245 | |
| 246 | if ( ! empty( $meta['year'] ) ) |
| 247 | $content .= sprintf( __( 'Released: %d.' ), $meta['year'] ) . ' '; |
| 248 | |
| 249 | if ( ! empty( $meta['track_number'] ) ) { |
| 250 | list( $track, $length ) = explode( '/', $meta['track_number'] ); |
| 251 | $content .= sprintf( __( 'Track %d of %d.' ), $track, $length ) . ' '; |
| 252 | } |
| 253 | |
| 254 | if ( ! empty( $meta['genre'] ) ) |
| 255 | $content .= sprintf( __( 'Genre: %s.' ), $meta['genre'] ) . ' '; |
| 256 | |
2393 | | <?php if ( $media_dims ) : ?> |
| 2430 | <?php |
| 2431 | if ( preg_match( '#^audio|video#', $post->post_mime_type ) ): |
| 2432 | |
| 2433 | $fields = array( |
| 2434 | 'mime_type' => __( 'Mime-type:' ), |
| 2435 | 'year' => __( 'Year:' ), |
| 2436 | 'genre' => __( 'Genre:' ), |
| 2437 | 'length_formatted' => __( 'Length:' ), |
| 2438 | ); |
| 2439 | |
| 2440 | foreach ( $fields as $key => $label ): |
| 2441 | if ( ! empty( $meta[$key] ) ) : ?> |
| 2442 | <div class="misc-pub-section"> |
| 2443 | <?php echo $label ?> <strong><?php echo esc_html( $meta[$key] ); ?></strong> |
| 2444 | </div> |
| 2445 | <?php |
| 2446 | endif; |
| 2447 | endforeach; |
| 2448 | |
| 2449 | if ( ! empty( $meta['bitrate'] ) ) : ?> |
| 2450 | <div class="misc-pub-section"> |
| 2451 | <?php _e( 'Bitrate:' ); ?> <strong><?php |
| 2452 | echo $meta['bitrate'] / 1000, 'kb/s'; |
| 2453 | |
| 2454 | if ( ! empty( $meta['bitrate_mode'] ) ) |
| 2455 | echo ' ', strtoupper( $meta['bitrate_mode'] ); |
| 2456 | |
| 2457 | ?></strong> |
| 2458 | </div> |
| 2459 | <?php |
| 2460 | endif; |
| 2461 | |
| 2462 | $audio_fields = array( |
| 2463 | 'dataformat' => __( 'Audio Format:' ), |
| 2464 | 'codec' => __( 'Audio Codec:' ) |
| 2465 | ); |
| 2466 | |
| 2467 | foreach ( $audio_fields as $key => $label ): |
| 2468 | if ( ! empty( $meta['audio'][$key] ) ) : ?> |
| 2469 | <div class="misc-pub-section"> |
| 2470 | <?php echo $label; ?> <strong><?php echo esc_html( $meta['audio'][$key] ); ?></strong> |
| 2471 | </div> |
| 2472 | <?php |
| 2473 | endif; |
| 2474 | endforeach; |
| 2475 | |
| 2476 | endif; |
| 2477 | |
| 2478 | if ( $media_dims ) : ?> |