Ticket #25375: 25375.6.diff
| File 25375.6.diff, 22.7 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/includes/media.php
21 21 'library' => __('Media Library') 22 22 ); 23 23 24 return apply_filters('media_upload_tabs', $_default_tabs); 24 /** 25 * Filter the available tabs in the legacy (pre-3.5.0) media popup. 26 * 27 * @since 2.5.0 28 * 29 * @param array $_default_tabs An array of media tabs. 30 */ 31 return apply_filters( 'media_upload_tabs', $_default_tabs ); 25 32 } 26 33 27 34 /** … … 73 80 elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) 74 81 $current = $_GET['tab']; 75 82 else 76 $current = apply_filters('media_upload_default_tab', $default); 83 /** 84 * Filter the default tab in the legacy (pre-3.5.0) media popup. 85 * 86 * @since 2.5.0 87 * 88 * @param string $default The default media popup tab. 89 */ 90 $current = apply_filters( 'media_upload_default_tab', $default ); 77 91 78 92 foreach ( $tabs as $callback => $text ) { 79 93 $class = ''; … … 113 127 if ( $url ) 114 128 $html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>"; 115 129 130 /** 131 * Filter the image HTML markup to send to the editor. 132 * 133 * @since 2.5.0 134 * 135 * @param string $html The image HTML markup to send. 136 * @param int $id The attachment id. 137 * @param string $caption The image caption. 138 * @param string $title The image title. 139 * @param string $align The image alignment. 140 * @param string $url The image source URL. 141 * @param string $size The image size. 142 * @param string $alt The image alternative, or alt, text. 143 */ 116 144 $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt ); 117 145 118 146 return $html; … … 135 163 */ 136 164 function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { 137 165 166 /** 167 * Filter whether to disable captions. 168 * 169 * Prevents image captions from being appended to image HTML when inserted into the editor. 170 * 171 * @since 2.7.0 172 * 173 * @param bool $bool Whether to disable appending captions. Returning true to the filter 174 * will disable captions. Default empty string. 175 */ 138 176 if ( empty($caption) || apply_filters( 'disable_captions', '' ) ) 139 177 return $html; 140 178 … … 156 194 157 195 $shcode = '[caption id="' . $id . '" align="align' . $align . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]'; 158 196 197 /** 198 * Filter the image HTML markup including the caption shortcode. 199 * 200 * @since 2.6.0 201 * 202 * @param string $shcode The image HTML markup with caption shortcode. 203 * @param string $html The image HTML markup. 204 */ 159 205 return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); 160 206 } 161 207 add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 ); … … 397 443 //]]> 398 444 </script> 399 445 <?php 400 do_action('admin_enqueue_scripts', 'media-upload-popup'); 401 do_action('admin_print_styles-media-upload-popup'); 402 do_action('admin_print_styles'); 403 do_action('admin_print_scripts-media-upload-popup'); 404 do_action('admin_print_scripts'); 405 do_action('admin_head-media-upload-popup'); 406 do_action('admin_head'); 446 /** This action is documented in wp-admin/admin-header.php */ 447 do_action( 'admin_enqueue_scripts', 'media-upload-popup' ); 407 448 408 if ( is_string($content_func) ) 449 /** 450 * Print admin styles enqueued for the legacy (pre-3.5.0) media upload popup. 451 * 452 * @since 2.9.0 453 */ 454 do_action( 'admin_print_styles-media-upload-popup' ); 455 456 /** This action is documented in wp-admin/admin-header.php */ 457 do_action( 'admin_print_styles' ); 458 459 /** 460 * Print admin scripts enqueued for the legacy (pre-3.5.0) media upload popup. 461 * 462 * @since 2.9.0 463 */ 464 do_action( 'admin_print_scripts-media-upload-popup' ); 465 466 /** This action is documented in wp-admin/admin-header.php */ 467 do_action( 'admin_print_scripts' ); 468 469 /** 470 * Print scripts enqueued for the admin header for the legacy (pre-3.5.0) 471 * media upload popup. 472 * 473 * @since 2.9.0 474 */ 475 do_action( 'admin_head-media-upload-popup' ); 476 477 /** This action is documented in wp-admin/admin-header.php */ 478 do_action( 'admin_head' ); 479 480 if ( is_string( $content_func ) ) { 481 /** 482 * Fires in the admin header for each specific form tab in the legacy 483 * (pre-3.5.0) media upload popup. 484 * 485 * The dynamic portion of the hook, $content_func, refers to the form 486 * callback for the media upload type. Possible values include 487 * 'media_upload_type_form', 'media_upload_type_url_form', and 488 * 'media_upload_library_form'. 489 * 490 * @since 2.5.0 491 */ 409 492 do_action( "admin_head_{$content_func}" ); 493 } 410 494 ?> 411 495 </head> 412 496 <body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js"> … … 418 502 $args = array_slice($args, 1); 419 503 call_user_func_array($content_func, $args); 420 504 421 do_action('admin_print_footer_scripts'); 505 /** This action is documented in wp-admin/admin-footer.php */ 506 do_action( 'admin_print_footer_scripts' ); 422 507 ?> 423 508 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> 424 509 </body> … … 446 531 447 532 echo '<a href="#" id="insert-media-button" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>'; 448 533 449 // Don't use this filter. Want to add a button? Use the media_buttons action. 450 $legacy_filter = apply_filters('media_buttons_context', ''); // deprecated 534 /** 535 * Filter the legacy (pre-3.5.0) media buttons. 536 * 537 * @since 2.5.0 538 * @deprecated 3.5.0 Use 'media_buttons' action instead. 539 * 540 * @param string $string Media buttons context. Default empty. 541 */ 542 $legacy_filter = apply_filters( 'media_buttons_context', '' ); 451 543 452 544 if ( $legacy_filter ) { 453 545 // #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag. … … 472 564 if ( ! empty( $tab ) ) 473 565 $upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src); 474 566 475 $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src); 567 /** 568 * Filter the upload iframe source URL for a specific media type. 569 * 570 * The dynamic portion of the hook name, $type, refers to the type 571 * of media uploaded. 572 * 573 * @since 3.0.0 574 * 575 * @param string $upload_iframe_src The upload iframe source URL by type. 576 */ 577 $upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src ); 476 578 477 579 return add_query_arg('TB_iframe', true, $upload_iframe_src); 478 580 } … … 514 616 $post['post_parent'] = $attachment['post_parent']; 515 617 } 516 618 517 $post = apply_filters('attachment_fields_to_save', $post, $attachment); 619 /** 620 * Filter the attachment fields to be saved. 621 * 622 * @since 2.5.0 623 * 624 * @see wp_get_attachment_metadata() 625 * 626 * @param WP_Post $post The WP_Post object. 627 * @param array $attachment An array of attachment metadata. 628 */ 629 $post = apply_filters( 'attachment_fields_to_save', $post, $attachment ); 518 630 519 631 if ( isset($attachment['image_alt']) ) { 520 632 $image_alt = wp_unslash( $attachment['image_alt'] ); … … 561 673 $html = "<a href='{$attachment['url']}'$rel>$html</a>"; 562 674 } 563 675 564 $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment); 676 /** 677 * Filter the HTML markup for a media item sent to the editor. 678 * 679 * @since 2.5.0 680 * 681 * @see wp_get_attachment_metadata() 682 * 683 * @param string $html HTML markup for a media item sent to the editor. 684 * @param int $send_id The first key from the $_POST['send'] data. 685 * @param array $attachment Array of attachment metadata. 686 */ 687 $html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment ); 565 688 return media_send_to_editor($html); 566 689 } 567 690 … … 608 731 && ( 'audio' == $ext_type || 'video' == $ext_type ) ) 609 732 $type = $ext_type; 610 733 734 /** 735 * Filter the URL sent to the editor for a specific media type. 736 * 737 * The dynamic portion of the hook name, $type, refers to the type 738 * of media being sent. 739 * 740 * @since 3.3.0 741 * 742 * @param string $html HTML markup sent to the editor. 743 * @param string $src Media source URL. 744 * @param string $title Media title. 745 */ 611 746 $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title ); 612 747 } else { 613 748 $align = ''; … … 619 754 if ( !empty($src) ) 620 755 $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />"; 621 756 757 /** 758 * Filter the image URL sent to the editor. 759 * 760 * @since 2.8.0 761 * 762 * @param string $html HTML markup sent to the editor for an image. 763 * @param string $src Image source URL. 764 * @param string $alt Image alternate, or alt, text. 765 * @param string $align The image alignment. Default 'alignnone'. Possible values include 766 * 'alignleft', 'aligncenter', 'alignright', 'alignnone'. 767 */ 622 768 $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align ); 623 769 } 624 770 … … 778 924 */ 779 925 function image_size_input_fields( $post, $check = '' ) { 780 926 781 // get a list of the actual pixel dimensions of each possible intermediate version of this image 782 $size_names = apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) ); 927 /** 928 * Filter the names and labels of the default image sizes. 929 * 930 * @since 3.3.0 931 * 932 * @param array $size_names Array of image sizes and their names. Default values 933 * include 'Thumbnail', 'Medium', 'Large', 'Full Size'. 934 */ 935 $size_names = apply_filters( 'image_size_names_choose', array( 936 'thumbnail' => __( 'Thumbnail' ), 937 'medium' => __( 'Medium' ), 938 'large' => __( 'Large' ), 939 'full' => __( 'Full Size' ) 940 ) ); 783 941 784 942 if ( empty($check) ) 785 943 $check = get_user_setting('imgsize', 'medium'); … … 1061 1219 unset( $form_fields['image_alt'] ); 1062 1220 } 1063 1221 1064 $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); 1222 /** 1223 * Filter the attachment fields to edit. 1224 * 1225 * @since 2.5.0 1226 * 1227 * @param array $form_fields An array of attachment form fields. 1228 * @param WP_Post $post The WP_Post attachment object. 1229 */ 1230 $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); 1065 1231 1066 1232 return $form_fields; 1067 1233 } … … 1126 1292 1127 1293 $default_args = array( 'errors' => null, 'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true ); 1128 1294 $args = wp_parse_args( $args, $default_args ); 1295 1296 /** 1297 * Filter the arguments used to retrieve an image for the edit image form. 1298 * 1299 * @since 3.1.0 1300 * 1301 * @see get_media_item 1302 * 1303 * @param array $args An array of arguments. 1304 */ 1129 1305 $args = apply_filters( 'get_media_item_args', $args ); 1130 1306 extract( $args, EXTR_SKIP ); 1131 1307 … … 1180 1356 $meta = wp_get_attachment_metadata( $post->ID ); 1181 1357 if ( isset( $meta['width'], $meta['height'] ) ) 1182 1358 $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; 1359 1360 /** 1361 * Filter the media metadata. 1362 * 1363 * @since 2.5.0 1364 * 1365 * @param string $media_dims The HTML markup containing the media dimensions. 1366 * @param WP_Post $post The WP_Post attachment object. 1367 */ 1183 1368 $media_dims = apply_filters( 'media_meta', $media_dims, $post ); 1184 1369 1185 1370 $image_edit_button = ''; … … 1343 1528 $user_can_edit = current_user_can( 'edit_post', $attachment_id ); 1344 1529 1345 1530 $args = wp_parse_args( $args, $default_args ); 1531 1532 /** This filter is documented in wp-admin/includes/media.php */ 1346 1533 $args = apply_filters( 'get_media_item_args', $args ); 1347 1534 1348 1535 $form_fields = array(); … … 1376 1563 // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) 1377 1564 $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] ); 1378 1565 1566 /** This filter is documented in wp-admin/includes/media.php */ 1379 1567 $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); 1380 1568 1381 1569 unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], 1382 1570 $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], 1383 1571 $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); 1384 1572 1573 /** This filter is documented in wp-admin/includes/media.php */ 1385 1574 $media_meta = apply_filters( 'media_meta', '', $post ); 1386 1575 1387 1576 $defaults = array( … … 1541 1730 ?></div> 1542 1731 <?php 1543 1732 if ( is_multisite() && !is_upload_space_available() ) { 1733 /** 1734 * Fires when an upload will exceed the defined upload space quota for a network site. 1735 * 1736 * @since 3.5.0 1737 */ 1544 1738 do_action( 'upload_ui_over_quota' ); 1545 1739 return; 1546 1740 } 1547 1741 1548 do_action('pre-upload-ui'); 1742 /** 1743 * Fires just before the legacy (pre-3.5.0) upload interface is loaded. 1744 * 1745 * @since 2.6.0 1746 */ 1747 do_action( 'pre-upload-ui' ); 1549 1748 1550 1749 $post_params = array( 1551 1750 "post_id" => $post_id, … … 1555 1754 "short" => "1", 1556 1755 ); 1557 1756 1558 $post_params = apply_filters( 'upload_post_params', $post_params ); // hook change! old name: 'swfupload_post_params' 1757 /** 1758 * Filter the media upload post parameters. 1759 * 1760 * @since 3.1.0 As 'swfupload_post_params' 1761 * @since 3.3.0 1762 * 1763 * @param array $post_params An array of media upload parameters used by Plupload. 1764 */ 1765 $post_params = apply_filters( 'upload_post_params', $post_params ); 1559 1766 1560 1767 $plupload_init = array( 1561 1768 'runtimes' => 'html5,silverlight,flash,html4', … … 1579 1786 if ( wp_is_mobile() ) 1580 1787 $plupload_init['multi_selection'] = false; 1581 1788 1789 /** 1790 * Filter the default Plupload settings. 1791 * 1792 * @since 3.3.0 1793 * 1794 * @param array $plupload_init An array of default settings used by Plupload. 1795 */ 1582 1796 $plupload_init = apply_filters( 'plupload_init', $plupload_init ); 1583 1797 1584 1798 ?> … … 1598 1812 </script> 1599 1813 1600 1814 <div id="plupload-upload-ui" class="hide-if-no-js"> 1601 <?php do_action('pre-plupload-upload-ui'); // hook change, old name: 'pre-flash-upload-ui' ?> 1815 <?php 1816 /** 1817 * Fires before the upload interface loads. 1818 * 1819 * @since 2.6.0 As 'pre-flash-upload-ui' 1820 * @since 3.3.0 1821 */ 1822 do_action( 'pre-plupload-upload-ui' ); ?> 1602 1823 <div id="drag-drop-area"> 1603 1824 <div class="drag-drop-inside"> 1604 1825 <p class="drag-drop-info"><?php _e('Drop files here'); ?></p> … … 1606 1827 <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /></p> 1607 1828 </div> 1608 1829 </div> 1609 <?php do_action('post-plupload-upload-ui'); // hook change, old name: 'post-flash-upload-ui' ?> 1830 <?php 1831 /** 1832 * Fires after the upload interface loads. 1833 * 1834 * @since 2.6.0 As 'post-flash-upload-ui' 1835 * @since 3.3.0 1836 */ 1837 do_action( 'post-plupload-upload-ui' ); ?> 1610 1838 </div> 1611 1839 1612 1840 <div id="html-upload-ui" class="hide-if-js"> 1613 <?php do_action('pre-html-upload-ui'); ?> 1841 <?php 1842 /** 1843 * Fires before the upload button in the media upload interface. 1844 * 1845 * @since 2.6.0 1846 */ 1847 do_action( 'pre-html-upload-ui' ); 1848 ?> 1614 1849 <p id="async-upload-wrap"> 1615 1850 <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label> 1616 1851 <input type="file" name="async-upload" id="async-upload" /> … … 1618 1853 <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a> 1619 1854 </p> 1620 1855 <div class="clear"></div> 1621 <?php do_action('post-html-upload-ui'); ?> 1856 <?php 1857 /** 1858 * Fires after the upload button in the media upload interface. 1859 * 1860 * @since 2.6.0 1861 */ 1862 do_action( 'post-html-upload-ui' ); 1863 ?> 1622 1864 </div> 1623 1865 1624 1866 <span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></span> … … 1627 1869 <span class="big-file-warning"><?php _e('Your browser has some limitations uploading large files with the multi-file uploader. Please use the browser uploader for files over 100MB.'); ?></span> 1628 1870 <?php } 1629 1871 1630 do_action('post-upload-ui'); 1872 /** 1873 * Fires on the post upload UI screen. 1874 * 1875 * Legacy (pre-3.5.0) media workflow hook. 1876 * 1877 * @since 2.6.0 1878 */ 1879 do_action( 'post-upload-ui' ); 1631 1880 } 1632 1881 1633 1882 /** … … 1646 1895 $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0; 1647 1896 1648 1897 $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); 1649 $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); 1898 1899 /** 1900 * Filter the media upload form action URL. 1901 * 1902 * @since 2.6.0 1903 * 1904 * @param string $form_action_url The media upload form action URL. 1905 * @param string $type The type of media. Default 'file'. 1906 */ 1907 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1650 1908 $form_class = 'media-upload-form type-form validate'; 1651 1909 1652 1910 if ( get_user_setting('uploader') ) … … 1711 1969 $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; 1712 1970 1713 1971 $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); 1714 $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); 1972 /** This filter is documented in wp-admin/includes/media.php */ 1973 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1715 1974 $form_class = 'media-upload-form type-form validate'; 1716 1975 1717 1976 if ( get_user_setting('uploader') ) … … 1741 2000 if ( f.alt.value ) 1742 2001 alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1743 2002 1744 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?> 2003 <?php 2004 /** This filter is documented in wp-admin/includes/media.php */ 2005 if ( ! apply_filters( 'disable_captions', '' ) ) { 2006 ?> 1745 2007 if ( f.caption.value ) { 1746 2008 caption = f.caption.value.replace(/\r\n|\r/g, '\n'); 1747 2009 caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ … … 1818 2080 1819 2081 <div id="media-items"> 1820 2082 <div class="media-item media-blank"> 1821 <?php echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) ); ?> 2083 <?php 2084 /** 2085 * Filter the insert media from URL form HTML. 2086 * 2087 * @since 3.3.0 2088 * 2089 * @param string $form_html The insert from URL form HTML. 2090 */ 2091 echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) ); 2092 ?> 1822 2093 </div> 1823 2094 </div> 1824 2095 </form> … … 1840 2111 1841 2112 $post_id = intval($_REQUEST['post_id']); 1842 2113 $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id"); 1843 $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); 2114 /** This filter is documented in wp-admin/includes/media.php */ 2115 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1844 2116 $form_class = 'media-upload-form validate'; 1845 2117 1846 2118 if ( get_user_setting('uploader') ) … … 1986 2258 $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; 1987 2259 1988 2260 $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id"); 1989 $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); 2261 /** This filter is documented in wp-admin/includes/media.php */ 2262 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1990 2263 $form_class = 'media-upload-form validate'; 1991 2264 1992 2265 if ( get_user_setting('uploader') ) … … 2049 2322 2050 2323 $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>'; 2051 2324 } 2325 /** 2326 * Filter the media upload mime type list items. 2327 * 2328 * Returned values should begin with an <li> tag. 2329 * 2330 * @since 3.1.0 2331 * 2332 * @param array $type_links An array of list items containing mime type link HTML. 2333 */ 2052 2334 echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>'; 2053 2335 unset($type_links); 2054 2336 ?> … … 2148 2430 * @return string the form html 2149 2431 */ 2150 2432 function wp_media_insert_url_form( $default_view = 'image' ) { 2151 if ( !apply_filters( 'disable_captions', '' ) ) { 2433 /** This filter is documented in wp-admin/includes/media.php */ 2434 if ( ! apply_filters( 'disable_captions', '' ) ) { 2152 2435 $caption = ' 2153 2436 <tr class="image-only"> 2154 2437 <th valign="top" scope="row" class="label"> … … 2430 2713 $meta = wp_get_attachment_metadata( $post->ID ); 2431 2714 if ( isset( $meta['width'], $meta['height'] ) ) 2432 2715 $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; 2716 /** This filter is documented in wp-admin/includes/media.php */ 2433 2717 $media_dims = apply_filters( 'media_meta', $media_dims, $post ); 2434 2718 2435 2719 $att_url = wp_get_attachment_url( $post->ID ); … … 2469 2753 if ( preg_match( '#^(audio|video)#', $post->post_mime_type ) ): 2470 2754 2471 2755 /** 2472 * Audio and video metadata fields to be shown in the publish meta box.2756 * Filter the audio and video metadata fields to be shown in the publish meta box. 2473 2757 * 2474 2758 * The key for each item in the array should correspond to an attachment 2475 2759 * metadata key, and the value should be the desired label. 2476 2760 * 2477 * @since 3.7.02761 * @since 3.7.0 2478 2762 * 2479 2763 * @param array $fields { 2480 2764 * An array of the attachment metadata keys and labels. 2481 2765 * 2482 * @type string 'mime_type'Label to be shown before the field mime_type.2483 * @type string 'year'Label to be shown before the field year.2484 * @type string 'genre'Label to be shown before the field genre.2485 * @type string 'length_formatted'Label to be shown before the field length_formatted.2766 * @type string $mime_type Label to be shown before the field mime_type. 2767 * @type string $year Label to be shown before the field year. 2768 * @type string $genre Label to be shown before the field genre. 2769 * @type string $length_formatted Label to be shown before the field length_formatted. 2486 2770 * } 2487 2771 */ 2488 2772 $fields = apply_filters( 'media_submitbox_misc_sections', array( … … 2515 2799 endif; 2516 2800 2517 2801 /** 2518 * Audio attachment metadata fields to be shown in the publish meta box.2802 * Filter the audio attachment metadata fields to be shown in the publish meta box. 2519 2803 * 2520 2804 * The key for each item in the array should correspond to an attachment 2521 2805 * metadata key, and the value should be the desired label. 2522 2806 * 2523 * @since 3.7.02807 * @since 3.7.0 2524 2808 * 2525 2809 * @param array $fields { 2526 2810 * An array of the attachment metadata keys and labels. 2527 2811 * 2528 * @type string 'dataformat'Label to be shown before the field dataformat.2529 * @type string 'codec'Label to be shown before the field codec.2812 * @type string $dataformat Label to be shown before the field dataformat. 2813 * @type string $codec Label to be shown before the field codec. 2530 2814 * } 2531 2815 */ 2532 2816 $audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(