280 /** |
280 /** |
281 * Saves a file submitted from a POST request and create an attachment post for it. |
281 * Saves a file submitted from a POST request and create an attachment post for it. |
282 * |
282 * |
283 * @since 2.5.0 |
283 * @since 2.5.0 |
284 * |
284 * |
285 * @param string $file_id Index of the `$_FILES` array that the file was sent. Required. |
285 * @param string $file_id Index of the `$_FILES` array that the file was sent. |
286 * @param int $post_id The post ID of a post to attach the media item to. Required, but can |
286 * @param int $post_id The post ID of a post to attach the media item to. Required, but can |
287 * be set to 0, creating a media item that has no relationship to a post. |
287 * be set to 0, creating a media item that has no relationship to a post. |
288 * @param array $post_data Optional. Overwrite some of the attachment. |
288 * @param array $post_data Optional. Overwrite some of the attachment. |
289 * @param array $overrides Optional. Override the wp_handle_upload() behavior. |
289 * @param array $overrides Optional. Override the wp_handle_upload() behavior. |
290 * @return int|WP_Error ID of the attachment or a WP_Error object on failure. |
290 * @return int|WP_Error ID of the attachment or a WP_Error object on failure. |
359 } |
359 } |
360 |
360 |
361 if ( ! empty( $meta['track_number'] ) ) { |
361 if ( ! empty( $meta['track_number'] ) ) { |
362 $track_number = explode( '/', $meta['track_number'] ); |
362 $track_number = explode( '/', $meta['track_number'] ); |
363 |
363 |
364 if ( isset( $track_number[1] ) ) { |
364 if ( is_numeric( $track_number[0] ) ) { |
365 /* translators: Audio file track information. 1: Audio track number, 2: Total audio tracks. */ |
365 if ( isset( $track_number[1] ) && is_numeric( $track_number[1] ) ) { |
366 $content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) ); |
366 $content .= ' ' . sprintf( |
367 } else { |
367 /* translators: Audio file track information. 1: Audio track number, 2: Total audio tracks. */ |
368 /* translators: Audio file track information. %s: Audio track number. */ |
368 __( 'Track %1$s of %2$s.' ), |
369 $content .= ' ' . sprintf( __( 'Track %s.' ), number_format_i18n( $track_number[0] ) ); |
369 number_format_i18n( $track_number[0] ), |
|
370 number_format_i18n( $track_number[1] ) |
|
371 ); |
|
372 } else { |
|
373 $content .= ' ' . sprintf( |
|
374 /* translators: Audio file track information. %s: Audio track number. */ |
|
375 __( 'Track %s.' ), |
|
376 number_format_i18n( $track_number[0] ) |
|
377 ); |
|
378 } |
370 } |
379 } |
371 } |
380 } |
372 |
381 |
373 if ( ! empty( $meta['genre'] ) ) { |
382 if ( ! empty( $meta['genre'] ) ) { |
374 /* translators: Audio file genre information. %s: Audio genre name. */ |
383 /* translators: Audio file genre information. %s: Audio genre name. */ |
531 wp_enqueue_style( 'deprecated-media' ); |
540 wp_enqueue_style( 'deprecated-media' ); |
532 } |
541 } |
533 |
542 |
534 ?> |
543 ?> |
535 <script type="text/javascript"> |
544 <script type="text/javascript"> |
536 addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(document).ready(func);else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; |
545 addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; |
537 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', |
546 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', |
538 isRtl = <?php echo (int) is_rtl(); ?>; |
547 isRtl = <?php echo (int) is_rtl(); ?>; |
539 </script> |
548 </script> |
540 <?php |
549 <?php |
541 /** This action is documented in wp-admin/admin-header.php */ |
550 /** This action is documented in wp-admin/admin-header.php */ |
575 if ( is_string( $content_func ) ) { |
584 if ( is_string( $content_func ) ) { |
576 /** |
585 /** |
577 * Fires in the admin header for each specific form tab in the legacy |
586 * Fires in the admin header for each specific form tab in the legacy |
578 * (pre-3.5.0) media upload popup. |
587 * (pre-3.5.0) media upload popup. |
579 * |
588 * |
580 * The dynamic portion of the hook, `$content_func`, refers to the form |
589 * The dynamic portion of the hook name, `$content_func`, refers to the form |
581 * callback for the media upload type. Possible values include |
590 * callback for the media upload type. |
582 * 'media_upload_type_form', 'media_upload_type_url_form', and |
|
583 * 'media_upload_library_form'. |
|
584 * |
591 * |
585 * @since 2.5.0 |
592 * @since 2.5.0 |
586 */ |
593 */ |
587 do_action( "admin_head_{$content_func}" ); |
594 do_action( "admin_head_{$content_func}" ); |
588 } |
595 } |
974 |
981 |
975 /** |
982 /** |
976 * Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post. |
983 * Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post. |
977 * |
984 * |
978 * @since 2.6.0 |
985 * @since 2.6.0 |
979 * @since 4.2.0 Introduced the `$return` parameter. |
986 * @since 4.2.0 Introduced the `$return_type` parameter. |
980 * @since 4.8.0 Introduced the 'id' option for the `$return` parameter. |
987 * @since 4.8.0 Introduced the 'id' option for the `$return_type` parameter. |
981 * @since 5.3.0 The `$post_id` parameter was made optional. |
988 * @since 5.3.0 The `$post_id` parameter was made optional. |
982 * @since 5.4.0 The original URL of the attachment is stored in the `_source_url` |
989 * @since 5.4.0 The original URL of the attachment is stored in the `_source_url` |
983 * post meta value. |
990 * post meta value. |
984 * |
991 * |
985 * @param string $file The URL of the image to download. |
992 * @param string $file The URL of the image to download. |
986 * @param int $post_id Optional. The post ID the media is to be associated with. |
993 * @param int $post_id Optional. The post ID the media is to be associated with. |
987 * @param string $desc Optional. Description of the image. |
994 * @param string $desc Optional. Description of the image. |
988 * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL), |
995 * @param string $return_type Optional. Accepts 'html' (image tag html) or 'src' (URL), |
989 * or 'id' (attachment ID). Default 'html'. |
996 * or 'id' (attachment ID). Default 'html'. |
990 * @return string|int|WP_Error Populated HTML img tag, attachment ID, or attachment source |
997 * @return string|int|WP_Error Populated HTML img tag, attachment ID, or attachment source |
991 * on success, WP_Error object otherwise. |
998 * on success, WP_Error object otherwise. |
992 */ |
999 */ |
993 function media_sideload_image( $file, $post_id = 0, $desc = null, $return = 'html' ) { |
1000 function media_sideload_image( $file, $post_id = 0, $desc = null, $return_type = 'html' ) { |
994 if ( ! empty( $file ) ) { |
1001 if ( ! empty( $file ) ) { |
995 |
1002 |
996 $allowed_extensions = array( 'jpg', 'jpeg', 'jpe', 'png', 'gif', 'webp' ); |
1003 $allowed_extensions = array( 'jpg', 'jpeg', 'jpe', 'png', 'gif', 'webp' ); |
997 |
1004 |
998 /** |
1005 /** |
1043 |
1050 |
1044 // Store the original attachment source in meta. |
1051 // Store the original attachment source in meta. |
1045 add_post_meta( $id, '_source_url', $file ); |
1052 add_post_meta( $id, '_source_url', $file ); |
1046 |
1053 |
1047 // If attachment ID was requested, return it. |
1054 // If attachment ID was requested, return it. |
1048 if ( 'id' === $return ) { |
1055 if ( 'id' === $return_type ) { |
1049 return $id; |
1056 return $id; |
1050 } |
1057 } |
1051 |
1058 |
1052 $src = wp_get_attachment_url( $id ); |
1059 $src = wp_get_attachment_url( $id ); |
1053 } |
1060 } |
1054 |
1061 |
1055 // Finally, check to make sure the file has been saved, then return the HTML. |
1062 // Finally, check to make sure the file has been saved, then return the HTML. |
1056 if ( ! empty( $src ) ) { |
1063 if ( ! empty( $src ) ) { |
1057 if ( 'src' === $return ) { |
1064 if ( 'src' === $return_type ) { |
1058 return $src; |
1065 return $src; |
1059 } |
1066 } |
1060 |
1067 |
1061 $alt = isset( $desc ) ? esc_attr( $desc ) : ''; |
1068 $alt = isset( $desc ) ? esc_attr( $desc ) : ''; |
1062 $html = "<img src='$src' alt='$alt' />"; |
1069 $html = "<img src='$src' alt='$alt' />"; |
1319 * @return array Filtered attachment form fields. |
1326 * @return array Filtered attachment form fields. |
1320 */ |
1327 */ |
1321 function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { |
1328 function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { |
1322 unset( $form_fields['image_url'] ); |
1329 unset( $form_fields['image_url'] ); |
1323 return $form_fields; |
1330 return $form_fields; |
1324 } |
|
1325 |
|
1326 /** |
|
1327 * Filters input from media_upload_form_handler() and assigns a default |
|
1328 * post_title from the file name if none supplied. |
|
1329 * |
|
1330 * Illustrates the use of the {@see 'attachment_fields_to_save'} filter |
|
1331 * which can be used to add default values to any field before saving to DB. |
|
1332 * |
|
1333 * @since 2.5.0 |
|
1334 * |
|
1335 * @param array $post The WP_Post attachment object converted to an array. |
|
1336 * @param array $attachment An array of attachment metadata. |
|
1337 * @return array Filtered attachment post object. |
|
1338 */ |
|
1339 function image_attachment_fields_to_save( $post, $attachment ) { |
|
1340 if ( 'image' === substr( $post['post_mime_type'], 0, 5 ) ) { |
|
1341 if ( strlen( trim( $post['post_title'] ) ) == 0 ) { |
|
1342 $attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid']; |
|
1343 $post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) ); |
|
1344 $post['errors']['post_title']['errors'][] = __( 'Empty Title filled from filename.' ); |
|
1345 } |
|
1346 } |
|
1347 |
|
1348 return $post; |
|
1349 } |
1331 } |
1350 |
1332 |
1351 /** |
1333 /** |
1352 * Retrieves the media element HTML to send to the editor. |
1334 * Retrieves the media element HTML to send to the editor. |
1353 * |
1335 * |
1511 |
1493 |
1512 return $form_fields; |
1494 return $form_fields; |
1513 } |
1495 } |
1514 |
1496 |
1515 /** |
1497 /** |
1516 * Retrieve HTML for media items of post gallery. |
1498 * Retrieves HTML for media items of post gallery. |
1517 * |
1499 * |
1518 * The HTML markup retrieved will be created for the progress of SWF Upload |
1500 * The HTML markup retrieved will be created for the progress of SWF Upload |
1519 * component. Will also create link for showing and hiding the form to modify |
1501 * component. Will also create link for showing and hiding the form to modify |
1520 * the image attachment. |
1502 * the image attachment. |
1521 * |
1503 * |
1522 * @since 2.5.0 |
1504 * @since 2.5.0 |
1523 * |
1505 * |
1524 * @global WP_Query $wp_the_query WordPress Query object. |
1506 * @global WP_Query $wp_the_query WordPress Query object. |
1525 * |
1507 * |
1526 * @param int $post_id Optional. Post ID. |
1508 * @param int $post_id Post ID. |
1527 * @param array $errors Errors for attachment, if any. |
1509 * @param array $errors Errors for attachment, if any. |
1528 * @return string |
1510 * @return string HTML content for media items of post gallery. |
1529 */ |
1511 */ |
1530 function get_media_items( $post_id, $errors ) { |
1512 function get_media_items( $post_id, $errors ) { |
1531 $attachments = array(); |
1513 $attachments = array(); |
1532 |
1514 |
1533 if ( $post_id ) { |
1515 if ( $post_id ) { |
2501 t.preloadImg.onerror = t.resetImageData; |
2483 t.preloadImg.onerror = t.resetImageData; |
2502 t.preloadImg.src = src; |
2484 t.preloadImg.src = src; |
2503 } |
2485 } |
2504 }; |
2486 }; |
2505 |
2487 |
2506 jQuery(document).ready( function($) { |
2488 jQuery( function($) { |
2507 $('.media-types input').click( function() { |
2489 $('.media-types input').click( function() { |
2508 $('table.describe').toggleClass('not-image', $('#not-image').prop('checked') ); |
2490 $('table.describe').toggleClass('not-image', $('#not-image').prop('checked') ); |
2509 }); |
2491 }); |
2510 }); |
2492 } ); |
2511 </script> |
2493 </script> |
2512 |
2494 |
2513 <div id="media-items"> |
2495 <div id="media-items"> |
2514 <div class="media-item media-blank"> |
2496 <div class="media-item media-blank"> |
2515 <?php |
2497 <?php |
2577 <a href="#" id="desc"><?php _e( 'Descending' ); ?></a> | |
2559 <a href="#" id="desc"><?php _e( 'Descending' ); ?></a> | |
2578 <a href="#" id="clear"><?php _ex( 'Clear', 'verb' ); ?></a> |
2560 <a href="#" id="clear"><?php _ex( 'Clear', 'verb' ); ?></a> |
2579 </div> |
2561 </div> |
2580 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="gallery-form"> |
2562 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="gallery-form"> |
2581 <?php wp_nonce_field( 'media-form' ); ?> |
2563 <?php wp_nonce_field( 'media-form' ); ?> |
2582 <?php // media_upload_form( $errors ); ?> |
|
2583 <table class="widefat"> |
2564 <table class="widefat"> |
2584 <thead><tr> |
2565 <thead><tr> |
2585 <th><?php _e( 'Media' ); ?></th> |
2566 <th><?php _e( 'Media' ); ?></th> |
2586 <th class="order-head"><?php _e( 'Order' ); ?></th> |
2567 <th class="order-head"><?php _e( 'Order' ); ?></th> |
2587 <th class="actions-head"><?php _e( 'Actions' ); ?></th> |
2568 <th class="actions-head"><?php _e( 'Actions' ); ?></th> |
2879 </div> |
2860 </div> |
2880 </form> |
2861 </form> |
2881 |
2862 |
2882 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="library-form"> |
2863 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="library-form"> |
2883 <?php wp_nonce_field( 'media-form' ); ?> |
2864 <?php wp_nonce_field( 'media-form' ); ?> |
2884 <?php // media_upload_form( $errors ); ?> |
|
2885 |
2865 |
2886 <script type="text/javascript"> |
2866 <script type="text/javascript"> |
2887 jQuery(function($){ |
2867 jQuery(function($){ |
2888 var preloaded = $(".media-item.preloaded"); |
2868 var preloaded = $(".media-item.preloaded"); |
2889 if ( preloaded.length > 0 ) { |
2869 if ( preloaded.length > 0 ) { |
2904 </form> |
2884 </form> |
2905 <?php |
2885 <?php |
2906 } |
2886 } |
2907 |
2887 |
2908 /** |
2888 /** |
2909 * Creates the form for external url |
2889 * Creates the form for external url. |
2910 * |
2890 * |
2911 * @since 2.7.0 |
2891 * @since 2.7.0 |
2912 * |
2892 * |
2913 * @param string $default_view |
2893 * @param string $default_view |
2914 * @return string the form html |
2894 * @return string HTML content of the form. |
2915 */ |
2895 */ |
2916 function wp_media_insert_url_form( $default_view = 'image' ) { |
2896 function wp_media_insert_url_form( $default_view = 'image' ) { |
2917 /** This filter is documented in wp-admin/includes/media.php */ |
2897 /** This filter is documented in wp-admin/includes/media.php */ |
2918 if ( ! apply_filters( 'disable_captions', '' ) ) { |
2898 if ( ! apply_filters( 'disable_captions', '' ) ) { |
2919 $caption = ' |
2899 $caption = ' |
3230 <p class="attachment-alt-text-description" id="alt-text-description"> |
3210 <p class="attachment-alt-text-description" id="alt-text-description"> |
3231 <?php |
3211 <?php |
3232 |
3212 |
3233 printf( |
3213 printf( |
3234 /* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */ |
3214 /* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */ |
3235 __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ), |
3215 __( '<a href="%1$s" %2$s>Learn how to describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ), |
3236 esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), |
3216 esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), |
3237 'target="_blank" rel="noopener"', |
3217 'target="_blank" rel="noopener"', |
3238 sprintf( |
3218 sprintf( |
3239 '<span class="screen-reader-text"> %s</span>', |
3219 '<span class="screen-reader-text"> %s</span>', |
3240 /* translators: Accessibility text. */ |
3220 /* translators: Accessibility text. */ |
3380 $file_size = false; |
3360 $file_size = false; |
3381 |
3361 |
3382 if ( isset( $meta['filesize'] ) ) { |
3362 if ( isset( $meta['filesize'] ) ) { |
3383 $file_size = $meta['filesize']; |
3363 $file_size = $meta['filesize']; |
3384 } elseif ( file_exists( $file ) ) { |
3364 } elseif ( file_exists( $file ) ) { |
3385 $file_size = filesize( $file ); |
3365 $file_size = wp_filesize( $file ); |
3386 } |
3366 } |
3387 |
3367 |
3388 if ( ! empty( $file_size ) ) { |
3368 if ( ! empty( $file_size ) ) { |
3389 ?> |
3369 ?> |
3390 <div class="misc-pub-section misc-pub-filesize"> |
3370 <div class="misc-pub-section misc-pub-filesize"> |
3493 <?php |
3473 <?php |
3494 } |
3474 } |
3495 } |
3475 } |
3496 |
3476 |
3497 /** |
3477 /** |
3498 * Parse ID3v2, ID3v1, and getID3 comments to extract usable data |
3478 * Parses ID3v2, ID3v1, and getID3 comments to extract usable data. |
3499 * |
3479 * |
3500 * @since 3.6.0 |
3480 * @since 3.6.0 |
3501 * |
3481 * |
3502 * @param array $metadata An existing array with data |
3482 * @param array $metadata An existing array with data. |
3503 * @param array $data Data supplied by ID3 tags |
3483 * @param array $data Data supplied by ID3 tags. |
3504 */ |
3484 */ |
3505 function wp_add_id3_tag_data( &$metadata, $data ) { |
3485 function wp_add_id3_tag_data( &$metadata, $data ) { |
3506 foreach ( array( 'id3v2', 'id3v1' ) as $version ) { |
3486 foreach ( array( 'id3v2', 'id3v1' ) as $version ) { |
3507 if ( ! empty( $data[ $version ]['comments'] ) ) { |
3487 if ( ! empty( $data[ $version ]['comments'] ) ) { |
3508 foreach ( $data[ $version ]['comments'] as $key => $list ) { |
3488 foreach ( $data[ $version ]['comments'] as $key => $list ) { |
3560 |
3540 |
3561 if ( ! class_exists( 'getID3', false ) ) { |
3541 if ( ! class_exists( 'getID3', false ) ) { |
3562 require ABSPATH . WPINC . '/ID3/getid3.php'; |
3542 require ABSPATH . WPINC . '/ID3/getid3.php'; |
3563 } |
3543 } |
3564 |
3544 |
3565 $id3 = new getID3(); |
3545 $id3 = new getID3(); |
|
3546 // Required to get the `created_timestamp` value. |
|
3547 $id3->options_audiovideo_quicktime_ReturnAtomData = true; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
3548 |
3566 $data = $id3->analyze( $file ); |
3549 $data = $id3->analyze( $file ); |
3567 |
3550 |
3568 if ( isset( $data['video']['lossless'] ) ) { |
3551 if ( isset( $data['video']['lossless'] ) ) { |
3569 $metadata['lossless'] = $data['video']['lossless']; |
3552 $metadata['lossless'] = $data['video']['lossless']; |
3570 } |
3553 } |
3643 * @since 4.9.0 |
3626 * @since 4.9.0 |
3644 * |
3627 * |
3645 * @param array $metadata Filtered Video metadata. |
3628 * @param array $metadata Filtered Video metadata. |
3646 * @param string $file Path to video file. |
3629 * @param string $file Path to video file. |
3647 * @param string $file_format File format of video, as analyzed by getID3. |
3630 * @param string $file_format File format of video, as analyzed by getID3. |
3648 * @param string $data Raw metadata from getID3. |
3631 * @param array $data Raw metadata from getID3. |
3649 */ |
3632 */ |
3650 return apply_filters( 'wp_read_video_metadata', $metadata, $file, $file_format, $data ); |
3633 return apply_filters( 'wp_read_video_metadata', $metadata, $file, $file_format, $data ); |
3651 } |
3634 } |
3652 |
3635 |
3653 /** |
3636 /** |
3654 * Retrieve metadata from an audio file's ID3 tags. |
3637 * Retrieves metadata from an audio file's ID3 tags. |
3655 * |
3638 * |
3656 * @since 3.6.0 |
3639 * @since 3.6.0 |
3657 * |
3640 * |
3658 * @param string $file Path to file. |
3641 * @param string $file Path to file. |
3659 * @return array|false Returns array of metadata, if found. |
3642 * @return array|false Returns array of metadata, if found. |
3671 |
3654 |
3672 if ( ! class_exists( 'getID3', false ) ) { |
3655 if ( ! class_exists( 'getID3', false ) ) { |
3673 require ABSPATH . WPINC . '/ID3/getid3.php'; |
3656 require ABSPATH . WPINC . '/ID3/getid3.php'; |
3674 } |
3657 } |
3675 |
3658 |
3676 $id3 = new getID3(); |
3659 $id3 = new getID3(); |
|
3660 // Required to get the `created_timestamp` value. |
|
3661 $id3->options_audiovideo_quicktime_ReturnAtomData = true; // phpcs:ignore WordPress.NamingConventions.ValidVariableName |
|
3662 |
3677 $data = $id3->analyze( $file ); |
3663 $data = $id3->analyze( $file ); |
3678 |
3664 |
3679 if ( ! empty( $data['audio'] ) ) { |
3665 if ( ! empty( $data['audio'] ) ) { |
3680 unset( $data['audio']['streams'] ); |
3666 unset( $data['audio']['streams'] ); |
3681 $metadata = $data['audio']; |
3667 $metadata = $data['audio']; |
3742 } |
3728 } |
3743 break; |
3729 break; |
3744 |
3730 |
3745 case 'matroska': |
3731 case 'matroska': |
3746 case 'webm': |
3732 case 'webm': |
3747 if ( isset( $metadata['matroska']['comments']['creation_time']['0'] ) ) { |
3733 if ( isset( $metadata['matroska']['comments']['creation_time'][0] ) ) { |
3748 $creation_date = strtotime( $metadata['matroska']['comments']['creation_time']['0'] ); |
3734 $creation_date = strtotime( $metadata['matroska']['comments']['creation_time'][0] ); |
3749 } elseif ( isset( $metadata['matroska']['info']['0']['DateUTC_unix'] ) ) { |
3735 } elseif ( isset( $metadata['matroska']['info'][0]['DateUTC_unix'] ) ) { |
3750 $creation_date = (int) $metadata['matroska']['info']['0']['DateUTC_unix']; |
3736 $creation_date = (int) $metadata['matroska']['info'][0]['DateUTC_unix']; |
3751 } |
3737 } |
3752 break; |
3738 break; |
3753 |
3739 |
3754 case 'quicktime': |
3740 case 'quicktime': |
3755 case 'mp4': |
3741 case 'mp4': |
3756 if ( isset( $metadata['quicktime']['moov']['subatoms']['0']['creation_time_unix'] ) ) { |
3742 if ( isset( $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'] ) ) { |
3757 $creation_date = (int) $metadata['quicktime']['moov']['subatoms']['0']['creation_time_unix']; |
3743 $creation_date = (int) $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix']; |
3758 } |
3744 } |
3759 break; |
3745 break; |
3760 } |
3746 } |
3761 |
3747 |
3762 return $creation_date; |
3748 return $creation_date; |