47 if ( ! isset( $_REQUEST['post_id'] ) ) { |
47 if ( ! isset( $_REQUEST['post_id'] ) ) { |
48 unset( $tabs['gallery'] ); |
48 unset( $tabs['gallery'] ); |
49 return $tabs; |
49 return $tabs; |
50 } |
50 } |
51 |
51 |
52 $post_id = intval( $_REQUEST['post_id'] ); |
52 $post_id = (int) $_REQUEST['post_id']; |
53 |
53 |
54 if ( $post_id ) { |
54 if ( $post_id ) { |
55 $attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) ); |
55 $attachments = (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ); |
56 } |
56 } |
57 |
57 |
58 if ( empty( $attachments ) ) { |
58 if ( empty( $attachments ) ) { |
59 unset( $tabs['gallery'] ); |
59 unset( $tabs['gallery'] ); |
60 return $tabs; |
60 return $tabs; |
123 * @param string $caption Image caption. |
123 * @param string $caption Image caption. |
124 * @param string $title Image title attribute. |
124 * @param string $title Image title attribute. |
125 * @param string $align Image CSS alignment property. |
125 * @param string $align Image CSS alignment property. |
126 * @param string $url Optional. Image src URL. Default empty. |
126 * @param string $url Optional. Image src URL. Default empty. |
127 * @param bool|string $rel Optional. Value for rel attribute or whether to add a default value. Default false. |
127 * @param bool|string $rel Optional. Value for rel attribute or whether to add a default value. Default false. |
128 * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width |
128 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of |
129 * and height values in pixels (in that order). Default 'medium'. |
129 * width and height values in pixels (in that order). Default 'medium'. |
130 * @param string $alt Optional. Image alt attribute. Default empty. |
130 * @param string $alt Optional. Image alt attribute. Default empty. |
131 * @return string The HTML output to insert into the editor. |
131 * @return string The HTML output to insert into the editor. |
132 */ |
132 */ |
133 function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = false, $size = 'medium', $alt = '' ) { |
133 function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = false, $size = 'medium', $alt = '' ) { |
134 |
134 |
150 |
150 |
151 /** |
151 /** |
152 * Filters the image HTML markup to send to the editor when inserting an image. |
152 * Filters the image HTML markup to send to the editor when inserting an image. |
153 * |
153 * |
154 * @since 2.5.0 |
154 * @since 2.5.0 |
|
155 * @since 5.6.0 The `$rel` parameter was added. |
155 * |
156 * |
156 * @param string $html The image HTML markup to send. |
157 * @param string $html The image HTML markup to send. |
157 * @param int $id The attachment ID. |
158 * @param int $id The attachment ID. |
158 * @param string $caption The image caption. |
159 * @param string $caption The image caption. |
159 * @param string $title The image title. |
160 * @param string $title The image title. |
160 * @param string $align The image alignment. |
161 * @param string $align The image alignment. |
161 * @param string $url The image source URL. |
162 * @param string $url The image source URL. |
162 * @param string|array $size Size of image. Image size or array of width and height values |
163 * @param string|int[] $size Requested image size. Can be any registered image size name, or |
163 * (in that order). Default 'medium'. |
164 * an array of width and height values in pixels (in that order). |
164 * @param string $alt The image alternative, or alt, text. |
165 * @param string $alt The image alternative, or alt, text. |
|
166 * @param string $rel The image rel attribute. |
165 */ |
167 */ |
166 $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt ); |
168 $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt, $rel ); |
167 |
169 |
168 return $html; |
170 return $html; |
169 } |
171 } |
170 |
172 |
171 /** |
173 /** |
172 * Adds image shortcode with caption to editor. |
174 * Adds image shortcode with caption to editor. |
173 * |
175 * |
174 * @since 2.6.0 |
176 * @since 2.6.0 |
175 * |
177 * |
176 * @param string $html The image HTML markup to send. |
178 * @param string $html The image HTML markup to send. |
177 * @param integer $id Image attachment ID. |
179 * @param int $id Image attachment ID. |
178 * @param string $caption Image caption. |
180 * @param string $caption Image caption. |
179 * @param string $title Image title attribute (not used). |
181 * @param string $title Image title attribute (not used). |
180 * @param string $align Image CSS alignment property. |
182 * @param string $align Image CSS alignment property. |
181 * @param string $url Image source URL (not used). |
183 * @param string $url Image source URL (not used). |
182 * @param string $size Image size (`thumbnail`, `medium`, `large`, `full`, or added with `add_image_size()`) (not used). |
184 * @param string $size Image size (not used). |
183 * @param string $alt Image `alt` attribute (not used). |
185 * @param string $alt Image `alt` attribute (not used). |
184 * @return string The image HTML markup with caption shortcode. |
186 * @return string The image HTML markup with caption shortcode. |
185 */ |
187 */ |
186 function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { |
188 function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { |
187 |
189 |
426 * Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload(). |
428 * Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload(). |
427 * |
429 * |
428 * @since 2.6.0 |
430 * @since 2.6.0 |
429 * @since 5.3.0 The `$post_id` parameter was made optional. |
431 * @since 5.3.0 The `$post_id` parameter was made optional. |
430 * |
432 * |
431 * @param array $file_array Array similar to a `$_FILES` upload array. |
433 * @param string[] $file_array Array that represents a `$_FILES` upload array. |
432 * @param int $post_id Optional. The post ID the media is associated with. |
434 * @param int $post_id Optional. The post ID the media is associated with. |
433 * @param string $desc Optional. Description of the side-loaded file. Default null. |
435 * @param string $desc Optional. Description of the side-loaded file. Default null. |
434 * @param array $post_data Optional. Post data to override. Default empty array. |
436 * @param array $post_data Optional. Post data to override. Default empty array. |
435 * @return int|WP_Error The ID of the attachment or a WP_Error on failure. |
437 * @return int|WP_Error The ID of the attachment or a WP_Error on failure. |
436 */ |
438 */ |
437 function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) { |
439 function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_data = array() ) { |
438 $overrides = array( 'test_form' => false ); |
440 $overrides = array( 'test_form' => false ); |
439 |
441 |
440 $time = current_time( 'mysql' ); |
442 if ( isset( $post_data['post_date'] ) && substr( $post_data['post_date'], 0, 4 ) > 0 ) { |
441 $post = get_post( $post_id ); |
443 $time = $post_data['post_date']; |
442 |
444 } else { |
443 if ( $post ) { |
445 $post = get_post( $post_id ); |
444 if ( substr( $post->post_date, 0, 4 ) > 0 ) { |
446 if ( $post && substr( $post->post_date, 0, 4 ) > 0 ) { |
445 $time = $post->post_date; |
447 $time = $post->post_date; |
|
448 } else { |
|
449 $time = current_time( 'mysql' ); |
446 } |
450 } |
447 } |
451 } |
448 |
452 |
449 $file = wp_handle_sideload( $file_array, $overrides, $time ); |
453 $file = wp_handle_sideload( $file_array, $overrides, $time ); |
450 |
454 |
527 wp_enqueue_style( 'deprecated-media' ); |
531 wp_enqueue_style( 'deprecated-media' ); |
528 } |
532 } |
529 |
533 |
530 ?> |
534 ?> |
531 <script type="text/javascript"> |
535 <script type="text/javascript"> |
532 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();}}}; |
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();}}}; |
533 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', |
537 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup', |
534 isRtl = <?php echo (int) is_rtl(); ?>; |
538 isRtl = <?php echo (int) is_rtl(); ?>; |
535 </script> |
539 </script> |
536 <?php |
540 <?php |
537 /** This action is documented in wp-admin/admin-header.php */ |
541 /** This action is documented in wp-admin/admin-header.php */ |
538 do_action( 'admin_enqueue_scripts', 'media-upload-popup' ); |
542 do_action( 'admin_enqueue_scripts', 'media-upload-popup' ); |
690 * Filters the upload iframe source URL for a specific media type. |
694 * Filters the upload iframe source URL for a specific media type. |
691 * |
695 * |
692 * The dynamic portion of the hook name, `$type`, refers to the type |
696 * The dynamic portion of the hook name, `$type`, refers to the type |
693 * of media uploaded. |
697 * of media uploaded. |
694 * |
698 * |
|
699 * Possible hook names include: |
|
700 * |
|
701 * - `image_upload_iframe_src` |
|
702 * - `media_upload_iframe_src` |
|
703 * |
695 * @since 3.0.0 |
704 * @since 3.0.0 |
696 * |
705 * |
697 * @param string $upload_iframe_src The upload iframe source URL by type. |
706 * @param string $upload_iframe_src The upload iframe source URL. |
698 */ |
707 */ |
699 $upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src ); |
708 $upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src ); |
700 |
709 |
701 return add_query_arg( 'TB_iframe', true, $upload_iframe_src ); |
710 return add_query_arg( 'TB_iframe', true, $upload_iframe_src ); |
702 } |
711 } |
887 * Filters the URL sent to the editor for a specific media type. |
896 * Filters the URL sent to the editor for a specific media type. |
888 * |
897 * |
889 * The dynamic portion of the hook name, `$type`, refers to the type |
898 * The dynamic portion of the hook name, `$type`, refers to the type |
890 * of media being sent. |
899 * of media being sent. |
891 * |
900 * |
|
901 * Possible hook names include: |
|
902 * |
|
903 * - `audio_send_to_editor_url` |
|
904 * - `file_send_to_editor_url` |
|
905 * - `video_send_to_editor_url` |
|
906 * |
892 * @since 3.3.0 |
907 * @since 3.3.0 |
893 * |
908 * |
894 * @param string $html HTML markup sent to the editor. |
909 * @param string $html HTML markup sent to the editor. |
895 * @param string $src Media source URL. |
910 * @param string $src Media source URL. |
896 * @param string $title Media title. |
911 * @param string $title Media title. |
956 |
971 |
957 return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); |
972 return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); |
958 } |
973 } |
959 |
974 |
960 /** |
975 /** |
961 * Downloads an image from the specified URL and attaches it to a post. |
976 * Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post. |
962 * |
977 * |
963 * @since 2.6.0 |
978 * @since 2.6.0 |
964 * @since 4.2.0 Introduced the `$return` parameter. |
979 * @since 4.2.0 Introduced the `$return` parameter. |
965 * @since 4.8.0 Introduced the 'id' option within the `$return` parameter. |
980 * @since 4.8.0 Introduced the 'id' option for the `$return` parameter. |
966 * @since 5.3.0 The `$post_id` parameter was made optional. |
981 * @since 5.3.0 The `$post_id` parameter was made optional. |
967 * @since 5.4.0 The original URL of the attachment is stored in the `_source_url` |
982 * @since 5.4.0 The original URL of the attachment is stored in the `_source_url` |
968 * post meta value. |
983 * post meta value. |
969 * |
984 * |
970 * @param string $file The URL of the image to download. |
985 * @param string $file The URL of the image to download. |
971 * @param int $post_id Optional. The post ID the media is to be associated with. |
986 * @param int $post_id Optional. The post ID the media is to be associated with. |
972 * @param string $desc Optional. Description of the image. |
987 * @param string $desc Optional. Description of the image. |
973 * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL), |
988 * @param string $return Optional. Accepts 'html' (image tag html) or 'src' (URL), |
974 * or 'id' (attachment ID). Default 'html'. |
989 * or 'id' (attachment ID). Default 'html'. |
975 * @return string|WP_Error Populated HTML img tag on success, WP_Error object otherwise. |
990 * @return string|int|WP_Error Populated HTML img tag, attachment ID, or attachment source |
|
991 * on success, WP_Error object otherwise. |
976 */ |
992 */ |
977 function media_sideload_image( $file, $post_id = 0, $desc = null, $return = 'html' ) { |
993 function media_sideload_image( $file, $post_id = 0, $desc = null, $return = 'html' ) { |
978 if ( ! empty( $file ) ) { |
994 if ( ! empty( $file ) ) { |
979 |
995 |
|
996 $allowed_extensions = array( 'jpg', 'jpeg', 'jpe', 'png', 'gif', 'webp' ); |
|
997 |
|
998 /** |
|
999 * Filters the list of allowed file extensions when sideloading an image from a URL. |
|
1000 * |
|
1001 * The default allowed extensions are: |
|
1002 * |
|
1003 * - `jpg` |
|
1004 * - `jpeg` |
|
1005 * - `jpe` |
|
1006 * - `png` |
|
1007 * - `gif` |
|
1008 * |
|
1009 * @since 5.6.0 |
|
1010 * |
|
1011 * @param string[] $allowed_extensions Array of allowed file extensions. |
|
1012 * @param string $file The URL of the image to download. |
|
1013 */ |
|
1014 $allowed_extensions = apply_filters( 'image_sideload_extensions', $allowed_extensions, $file ); |
|
1015 $allowed_extensions = array_map( 'preg_quote', $allowed_extensions ); |
|
1016 |
980 // Set variables for storage, fix file filename for query strings. |
1017 // Set variables for storage, fix file filename for query strings. |
981 preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches ); |
1018 preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file, $matches ); |
982 |
1019 |
983 if ( ! $matches ) { |
1020 if ( ! $matches ) { |
984 return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL.' ) ); |
1021 return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL.' ) ); |
985 } |
1022 } |
986 |
1023 |
2269 /** |
2311 /** |
2270 * Outputs the legacy media upload form for a given media type. |
2312 * Outputs the legacy media upload form for a given media type. |
2271 * |
2313 * |
2272 * @since 2.5.0 |
2314 * @since 2.5.0 |
2273 * |
2315 * |
2274 * @param string $type |
2316 * @param string $type |
2275 * @param object $errors |
2317 * @param array $errors |
2276 * @param integer $id |
2318 * @param int|WP_Error $id |
2277 */ |
2319 */ |
2278 function media_upload_type_form( $type = 'file', $errors = null, $id = null ) { |
2320 function media_upload_type_form( $type = 'file', $errors = null, $id = null ) { |
2279 |
2321 |
2280 media_upload_header(); |
2322 media_upload_header(); |
2281 |
2323 |
2282 $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
2324 $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2283 |
2325 |
2284 $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2326 $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2285 |
2327 |
2286 /** |
2328 /** |
2287 * Filters the media upload form action URL. |
2329 * Filters the media upload form action URL. |
2345 * |
2387 * |
2346 * @since 2.7.0 |
2388 * @since 2.7.0 |
2347 * |
2389 * |
2348 * @param string $type |
2390 * @param string $type |
2349 * @param object $errors |
2391 * @param object $errors |
2350 * @param integer $id |
2392 * @param int $id |
2351 */ |
2393 */ |
2352 function media_upload_type_url_form( $type = null, $errors = null, $id = null ) { |
2394 function media_upload_type_url_form( $type = null, $errors = null, $id = null ) { |
2353 if ( null === $type ) { |
2395 if ( null === $type ) { |
2354 $type = 'image'; |
2396 $type = 'image'; |
2355 } |
2397 } |
2356 |
2398 |
2357 media_upload_header(); |
2399 media_upload_header(); |
2358 |
2400 |
2359 $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
2401 $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2360 |
2402 |
2361 $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2403 $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" ); |
2362 /** This filter is documented in wp-admin/includes/media.php */ |
2404 /** This filter is documented in wp-admin/includes/media.php */ |
2363 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
2405 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
2364 $form_class = 'media-upload-form type-form validate'; |
2406 $form_class = 'media-upload-form type-form validate'; |
2502 global $redir_tab, $type; |
2544 global $redir_tab, $type; |
2503 |
2545 |
2504 $redir_tab = 'gallery'; |
2546 $redir_tab = 'gallery'; |
2505 media_upload_header(); |
2547 media_upload_header(); |
2506 |
2548 |
2507 $post_id = intval( $_REQUEST['post_id'] ); |
2549 $post_id = (int) $_REQUEST['post_id']; |
2508 $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" ); |
2550 $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" ); |
2509 /** This filter is documented in wp-admin/includes/media.php */ |
2551 /** This filter is documented in wp-admin/includes/media.php */ |
2510 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
2552 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
2511 $form_class = 'media-upload-form validate'; |
2553 $form_class = 'media-upload-form validate'; |
2512 |
2554 |
2665 function media_upload_library_form( $errors ) { |
2707 function media_upload_library_form( $errors ) { |
2666 global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; |
2708 global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types; |
2667 |
2709 |
2668 media_upload_header(); |
2710 media_upload_header(); |
2669 |
2711 |
2670 $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; |
2712 $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0; |
2671 |
2713 |
2672 $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" ); |
2714 $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" ); |
2673 /** This filter is documented in wp-admin/includes/media.php */ |
2715 /** This filter is documented in wp-admin/includes/media.php */ |
2674 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
2716 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); |
2675 $form_class = 'media-upload-form validate'; |
2717 $form_class = 'media-upload-form validate'; |
3190 |
3232 |
3191 printf( |
3233 printf( |
3192 /* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */ |
3234 /* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */ |
3193 __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ), |
3235 __( '<a href="%1$s" %2$s>Describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ), |
3194 esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), |
3236 esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ), |
3195 'target="_blank" rel="noopener noreferrer"', |
3237 'target="_blank" rel="noopener"', |
3196 sprintf( |
3238 sprintf( |
3197 '<span class="screen-reader-text"> %s</span>', |
3239 '<span class="screen-reader-text"> %s</span>', |
3198 /* translators: Accessibility text. */ |
3240 /* translators: Accessibility text. */ |
3199 __( '(opens in a new tab)' ) |
3241 __( '(opens in a new tab)' ) |
3200 ) |
3242 ) |
3262 /** This filter is documented in wp-admin/includes/media.php */ |
3304 /** This filter is documented in wp-admin/includes/media.php */ |
3263 $media_dims = apply_filters( 'media_meta', $media_dims, $post ); |
3305 $media_dims = apply_filters( 'media_meta', $media_dims, $post ); |
3264 |
3306 |
3265 $att_url = wp_get_attachment_url( $attachment_id ); |
3307 $att_url = wp_get_attachment_url( $attachment_id ); |
3266 |
3308 |
|
3309 $author = new WP_User( $post->post_author ); |
|
3310 |
|
3311 $uploaded_by_name = __( '(no author)' ); |
|
3312 $uploaded_by_link = ''; |
|
3313 |
|
3314 if ( $author->exists() ) { |
|
3315 $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname; |
|
3316 $uploaded_by_link = get_edit_user_link( $author->ID ); |
|
3317 } |
3267 ?> |
3318 ?> |
|
3319 <div class="misc-pub-section misc-pub-uploadedby"> |
|
3320 <?php if ( $uploaded_by_link ) { ?> |
|
3321 <?php _e( 'Uploaded by:' ); ?> <a href="<?php echo $uploaded_by_link; ?>"><strong><?php echo $uploaded_by_name; ?></strong></a> |
|
3322 <?php } else { ?> |
|
3323 <?php _e( 'Uploaded by:' ); ?> <strong><?php echo $uploaded_by_name; ?></strong> |
|
3324 <?php } ?> |
|
3325 </div> |
|
3326 |
|
3327 <?php |
|
3328 if ( $post->post_parent ) { |
|
3329 $post_parent = get_post( $post->post_parent ); |
|
3330 if ( $post_parent ) { |
|
3331 $uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' ); |
|
3332 $uploaded_to_link = get_edit_post_link( $post->post_parent, 'raw' ); |
|
3333 ?> |
|
3334 <div class="misc-pub-section misc-pub-uploadedto"> |
|
3335 <?php if ( $uploaded_to_link ) { ?> |
|
3336 <?php _e( 'Uploaded to:' ); ?> <a href="<?php echo $uploaded_to_link; ?>"><strong><?php echo $uploaded_to_title; ?></strong></a> |
|
3337 <?php } else { ?> |
|
3338 <?php _e( 'Uploaded to:' ); ?> <strong><?php echo $uploaded_to_title; ?></strong> |
|
3339 <?php } ?> |
|
3340 </div> |
|
3341 <?php |
|
3342 } |
|
3343 } |
|
3344 ?> |
|
3345 |
3268 <div class="misc-pub-section misc-pub-attachment"> |
3346 <div class="misc-pub-section misc-pub-attachment"> |
3269 <label for="attachment_url"><?php _e( 'File URL:' ); ?></label> |
3347 <label for="attachment_url"><?php _e( 'File URL:' ); ?></label> |
3270 <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr( $att_url ); ?>" /> |
3348 <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr( $att_url ); ?>" /> |
3271 <span class="copy-to-clipboard-container"> |
3349 <span class="copy-to-clipboard-container"> |
3272 <button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php _e( 'Copy URL' ); ?></button> |
3350 <button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php _e( 'Copy URL to clipboard' ); ?></button> |
3273 <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> |
3351 <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> |
3274 </span> |
3352 </span> |
3275 </div> |
3353 </div> |
3276 <div class="misc-pub-section misc-pub-filename"> |
3354 <div class="misc-pub-section misc-pub-filename"> |
3277 <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong> |
3355 <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong> |
3645 * @since 4.9.0 |
3723 * @since 4.9.0 |
3646 * |
3724 * |
3647 * @link https://github.com/JamesHeinrich/getID3/blob/master/structure.txt |
3725 * @link https://github.com/JamesHeinrich/getID3/blob/master/structure.txt |
3648 * |
3726 * |
3649 * @param array $metadata The metadata returned by getID3::analyze(). |
3727 * @param array $metadata The metadata returned by getID3::analyze(). |
3650 * @return int|bool A UNIX timestamp for the media's creation date if available |
3728 * @return int|false A UNIX timestamp for the media's creation date if available |
3651 * or a boolean FALSE if a timestamp could not be determined. |
3729 * or a boolean FALSE if a timestamp could not be determined. |
3652 */ |
3730 */ |
3653 function wp_get_media_creation_timestamp( $metadata ) { |
3731 function wp_get_media_creation_timestamp( $metadata ) { |
3654 $creation_date = false; |
3732 $creation_date = false; |
3655 |
3733 |
3656 if ( empty( $metadata['fileformat'] ) ) { |
3734 if ( empty( $metadata['fileformat'] ) ) { |