Ticket #25375: 25375.5.diff
| File 25375.5.diff, 21.5 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 in the form of key/value pairs. 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 449 /** 450 * Prints styles enqueued for the legacy (pre-3.5.0) media upload popup. 451 * 452 * @since 2.9.0 453 * @since 3.5.0 454 */ 455 do_action( 'admin_print_styles-media-upload-popup' ); 456 457 /** This action is documented in wp-admin/admin-header.php */ 458 do_action( 'admin_print_styles' ); 459 460 /** 461 * Prints scripts enqueued for the legacy (pre-3.5.0) media upload popup. 462 * 463 * @since 2.9.0 464 * @since 3.5.0 465 */ 466 do_action( 'admin_print_scripts-media-upload-popup' ); 467 468 /** This action is documented in wp-admin/admin-header.php */ 469 do_action( 'admin_print_scripts' ); 470 471 /** 472 * Prints scripts enqueued for the admin header for the legacy (pre-3.5.0) media upload popup. 473 * 474 * @since 2.9.0 475 * @since 3.5.0 476 */ 477 do_action( 'admin_head-media-upload-popup' ); 478 479 /** This action is documented in wp-admin/admin-header.php */ 480 do_action( 'admin_head' ); 481 408 482 if ( is_string($content_func) ) 409 do_action( "admin_head_{$content_func}" ); 483 /** 484 * Fires in the admin header for specific media upload type forms. 485 * 486 * Part of the legacy (pre-3.5.0) media upload popup. 487 * 488 * The dynamic portion of the hook, $content_func, refers to the media 489 * upload type form callback. 490 * 491 * @since 2.5.0 492 */ 493 do_action( "admin_head_{$content_func}" ); 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. 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 by media type. 569 * 570 * The dynamic portion of the hook name, $type, refers to the type of media uploaded. 571 * 572 * @since 3.0.0 573 * 574 * @param string $upload_iframe_src The upload iframe source URL by type. 575 */ 576 $upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src ); 476 577 477 578 return add_query_arg('TB_iframe', true, $upload_iframe_src); 478 579 } … … 514 615 $post['post_parent'] = $attachment['post_parent']; 515 616 } 516 617 517 $post = apply_filters('attachment_fields_to_save', $post, $attachment); 618 /** 619 * Filter the attachment fields to be saved. 620 * 621 * @since 2.5.0 622 * 623 * @param WP_Post $post The WP_Post object. 624 * @param array $attachment An array of attachment metadata. 625 */ 626 $post = apply_filters( 'attachment_fields_to_save', $post, $attachment ); 518 627 519 628 if ( isset($attachment['image_alt']) ) { 520 629 $image_alt = wp_unslash( $attachment['image_alt'] ); … … 561 670 $html = "<a href='{$attachment['url']}'$rel>$html</a>"; 562 671 } 563 672 564 $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment); 673 /** 674 * Filter the media HTML markup sent to the editor. 675 * 676 * @since 2.5.0 677 * 678 * @param string $html The media's HTML markup sent to the editor. 679 * @param int $send_id The first key from the $_POST['send'] data. 680 * @param array $attachment The attachment metadata. 681 */ 682 $html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment ); 565 683 return media_send_to_editor($html); 566 684 } 567 685 … … 608 726 && ( 'audio' == $ext_type || 'video' == $ext_type ) ) 609 727 $type = $ext_type; 610 728 611 $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title ); 729 /** 730 * Filter the media URL sent to the editor by type. 731 * 732 * The dynamic portion of the hook name, $type, refers to the type of media being sent. 733 * 734 * @since 3.3.0 735 * 736 * @param string $html The HTML markup sent to the editor. 737 * @param string $src The media source URL. 738 * @param string $title The media title. 739 */ 740 $html = apply_filters( "{$type}_send_to_editor_url", $html, esc_url_raw( $src ), $title ); 612 741 } else { 613 742 $align = ''; 614 743 $alt = esc_attr( wp_unslash( $_POST['alt'] ) ); … … 619 748 if ( !empty($src) ) 620 749 $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />"; 621 750 751 /** 752 * Filter the image URL sent to the editor. 753 * 754 * @since 2.8.0 755 * 756 * @param string $html The HTML markup sent to the editor. 757 * @param string $src The image source URL. 758 * @param string $alt The image alternate, or alt, text. 759 * @param string $align The image alignment. Default 'alignnone'. 760 * Accepts 'alignleft', 'aligncenter', 'alignright', 'alignnone'. 761 */ 622 762 $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align ); 623 763 } 624 764 … … 779 919 function image_size_input_fields( $post, $check = '' ) { 780 920 781 921 // 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')) ); 922 $size_names = array( 923 'thumbnail' => __( 'Thumbnail' ), 924 'medium' => __( 'Medium' ), 925 'large' => __( 'Large' ), 926 'full' => __( 'Full Size' ) 927 ); 783 928 929 /** 930 * Filter the names of the default image sizes. 931 * 932 * @since 3.3.0 933 * 934 * @param array $size_names An array of image sizes and their names. 935 * Default 'Thumbnail', 'Medium', 'Large', 'Full Size'. 936 */ 937 $size_names = apply_filters( 'image_size_names_choose', $size_names ); 938 784 939 if ( empty($check) ) 785 940 $check = get_user_setting('imgsize', 'medium'); 786 941 … … 1061 1216 unset( $form_fields['image_alt'] ); 1062 1217 } 1063 1218 1064 $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); 1219 /** 1220 * Filter the attachment fields to edit. 1221 * 1222 * @since 2.5.0 1223 * 1224 * @param array $form_fields An array of attachment form fields. 1225 * @param WP_Post $post The WP_Post attachment object. 1226 */ 1227 $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); 1065 1228 1066 1229 return $form_fields; 1067 1230 } … … 1126 1289 1127 1290 $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 1291 $args = wp_parse_args( $args, $default_args ); 1292 1293 /** 1294 * Filter the arguments used to retrieve an image for the edit image form. 1295 * 1296 * @since 3.1.0 1297 * 1298 * @param array $args An array of arguments. @see get_media_item() 1299 */ 1129 1300 $args = apply_filters( 'get_media_item_args', $args ); 1130 1301 extract( $args, EXTR_SKIP ); 1131 1302 … … 1180 1351 $meta = wp_get_attachment_metadata( $post->ID ); 1181 1352 if ( isset( $meta['width'], $meta['height'] ) ) 1182 1353 $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; 1354 1355 /** 1356 * Filter the media metadata. 1357 * 1358 * @since 2.5.0 1359 * 1360 * @param string $media_dims The HTML markup containing the media dimensions. 1361 * @param WP_Post $post The WP_Post attachment object. 1362 */ 1183 1363 $media_dims = apply_filters( 'media_meta', $media_dims, $post ); 1184 1364 1185 1365 $image_edit_button = ''; … … 1343 1523 $user_can_edit = current_user_can( 'edit_post', $attachment_id ); 1344 1524 1345 1525 $args = wp_parse_args( $args, $default_args ); 1526 1527 /** This filter documented in wp-admin/includes/media.php */ 1346 1528 $args = apply_filters( 'get_media_item_args', $args ); 1347 1529 1348 1530 $form_fields = array(); … … 1376 1558 // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) 1377 1559 $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] ); 1378 1560 1561 /** This filter documented in wp-admin/includes/media.php */ 1379 1562 $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); 1380 1563 1381 1564 unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], … … 1382 1565 $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], 1383 1566 $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); 1384 1567 1568 /** This filter documented in wp-admin/includes/media.php */ 1385 1569 $media_meta = apply_filters( 'media_meta', '', $post ); 1386 1570 1387 1571 $defaults = array( … … 1541 1725 ?></div> 1542 1726 <?php 1543 1727 if ( is_multisite() && !is_upload_space_available() ) { 1728 /** 1729 * Fires when an upload will exceed the defined network site upload space quota. 1730 * 1731 * @since 3.5.0 1732 */ 1544 1733 do_action( 'upload_ui_over_quota' ); 1545 1734 return; 1546 1735 } 1547 1736 1548 do_action('pre-upload-ui'); 1737 /** 1738 * Fires just before the legacy (pre-3.5.0) upload interface is loaded. 1739 * 1740 * @since 2.6.0 1741 */ 1742 do_action( 'pre-upload-ui' ); 1549 1743 1550 1744 $post_params = array( 1551 1745 "post_id" => $post_id, … … 1555 1749 "short" => "1", 1556 1750 ); 1557 1751 1558 $post_params = apply_filters( 'upload_post_params', $post_params ); // hook change! old name: 'swfupload_post_params' 1752 /** 1753 * Filter the media upload post parameters. 1754 * 1755 * Previously named 'swfupload_post_params'. 1756 * 1757 * @since 3.3.0 1758 * @since 3.5.0 1759 * 1760 * @param array $post_params An array of media upload parameters used by Plupload. 1761 */ 1762 $post_params = apply_filters( 'upload_post_params', $post_params ); 1559 1763 1560 1764 $plupload_init = array( 1561 1765 'runtimes' => 'html5,silverlight,flash,html4', … … 1579 1783 if ( wp_is_mobile() ) 1580 1784 $plupload_init['multi_selection'] = false; 1581 1785 1786 /** 1787 * Filter the default Plupload settings. 1788 * 1789 * @since 3.3.0 1790 * 1791 * @param array $plupload_init An array of default settings used by Plupload. 1792 */ 1582 1793 $plupload_init = apply_filters( 'plupload_init', $plupload_init ); 1583 1794 1584 1795 ?> … … 1598 1809 </script> 1599 1810 1600 1811 <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' ?> 1812 <?php 1813 /** 1814 * Fires before the upload interface loads. 1815 * 1816 * Previously named 'pre-flash-upload-ui'. 1817 * 1818 * @since 3.3.0 1819 * @since 3.5.0 1820 */ 1821 do_action( 'pre-plupload-upload-ui' ); ?> 1602 1822 <div id="drag-drop-area"> 1603 1823 <div class="drag-drop-inside"> 1604 1824 <p class="drag-drop-info"><?php _e('Drop files here'); ?></p> … … 1606 1826 <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /></p> 1607 1827 </div> 1608 1828 </div> 1609 <?php do_action('post-plupload-upload-ui'); // hook change, old name: 'post-flash-upload-ui' ?> 1829 <?php 1830 /** 1831 * Fires after the upload interface loads. 1832 * 1833 * Previously named 'post-flash-upload-ui'. 1834 * 1835 * @since 3.3.0 1836 * @since 3.5.0 1837 */ 1838 do_action( 'post-plupload-upload-ui' ); ?> 1610 1839 </div> 1611 1840 1612 1841 <div id="html-upload-ui" class="hide-if-js"> 1613 <?php do_action('pre-html-upload-ui'); ?> 1842 <?php 1843 /** 1844 * Fires before the upload button in the media upload interface. 1845 * 1846 * @since 2.6.0 1847 */ 1848 do_action( 'pre-html-upload-ui' ); 1849 ?> 1614 1850 <p id="async-upload-wrap"> 1615 1851 <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label> 1616 1852 <input type="file" name="async-upload" id="async-upload" /> … … 1618 1854 <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a> 1619 1855 </p> 1620 1856 <div class="clear"></div> 1621 <?php do_action('post-html-upload-ui'); ?> 1857 <?php 1858 /** 1859 * Fires after the upload button in the media upload interface. 1860 * 1861 * @since 2.6.0 1862 */ 1863 do_action( 'post-html-upload-ui' ); 1864 ?> 1622 1865 </div> 1623 1866 1624 1867 <span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></span> … … 1627 1870 <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 1871 <?php } 1629 1872 1630 do_action('post-upload-ui'); 1873 /** 1874 * Fires on the post upload UI screen. 1875 * 1876 * Legacy (pre-3.5.0) media workflow hook. 1877 * 1878 * @since 2.6.0 1879 * @since 3.5.0 1880 */ 1881 do_action( 'post-upload-ui' ); 1631 1882 } 1632 1883 1633 1884 /** … … 1646 1897 $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0; 1647 1898 1648 1899 $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); 1900 1901 /** 1902 * Filter the media upload form action URL. 1903 * 1904 * @since 2.6.0 1905 * 1906 * @param string $form_action_url The media upload form action URL. 1907 * @param string $type The type of media. Default 'file'. 1908 */ 1909 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1650 1910 $form_class = 'media-upload-form type-form validate'; 1651 1911 1652 1912 if ( get_user_setting('uploader') ) … … 1711 1971 $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; 1712 1972 1713 1973 $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); 1974 /** This filter documented in wp-admin/includes/media.php */ 1975 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1715 1976 $form_class = 'media-upload-form type-form validate'; 1716 1977 1717 1978 if ( get_user_setting('uploader') ) … … 1741 2002 if ( f.alt.value ) 1742 2003 alt = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1743 2004 1744 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?> 2005 <?php 2006 /** This filter documented in wp-admin/includes/media.php */ 2007 if ( ! apply_filters( 'disable_captions', '' ) ) { 2008 ?> 1745 2009 if ( f.caption.value ) { 1746 2010 caption = f.caption.value.replace(/\r\n|\r/g, '\n'); 1747 2011 caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){ … … 1818 2082 1819 2083 <div id="media-items"> 1820 2084 <div class="media-item media-blank"> 1821 <?php echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) ); ?> 2085 <?php 2086 $form_html = wp_media_insert_url_form( $type ); 2087 /** 2088 * Filter the insert from URL form HTML. 2089 * 2090 * @since 3.3.0 2091 * 2092 * @param string $form_html The insert from URL form HTML. 2093 */ 2094 echo apply_filters( 'type_url_form_media', $form_html ); 2095 ?> 1822 2096 </div> 1823 2097 </div> 1824 2098 </form> … … 1840 2114 1841 2115 $post_id = intval($_REQUEST['post_id']); 1842 2116 $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); 2117 /** This filter documented in wp-admin/includes/media.php */ 2118 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1844 2119 $form_class = 'media-upload-form validate'; 1845 2120 1846 2121 if ( get_user_setting('uploader') ) … … 1986 2261 $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; 1987 2262 1988 2263 $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); 2264 /** This filter documented in wp-admin/includes/media.php */ 2265 $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type ); 1990 2266 $form_class = 'media-upload-form validate'; 1991 2267 1992 2268 if ( get_user_setting('uploader') ) … … 2049 2325 2050 2326 $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 2327 } 2328 /** 2329 * Filter the media upload mime type list items. 2330 * 2331 * @since 3.1.0 2332 * 2333 * @param array $type_links An array of list items containing mime type link HTML. 2334 */ 2052 2335 echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>'; 2053 2336 unset($type_links); 2054 2337 ?> … … 2148 2431 * @return string the form html 2149 2432 */ 2150 2433 function wp_media_insert_url_form( $default_view = 'image' ) { 2434 /** This filter documented in wp-admin/includes/media.php */ 2151 2435 if ( !apply_filters( 'disable_captions', '' ) ) { 2152 2436 $caption = ' 2153 2437 <tr class="image-only"> … … 2430 2714 $meta = wp_get_attachment_metadata( $post->ID ); 2431 2715 if ( isset( $meta['width'], $meta['height'] ) ) 2432 2716 $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; 2717 /** This filter documented in wp-admin/includes/media.php */ 2433 2718 $media_dims = apply_filters( 'media_meta', $media_dims, $post ); 2434 2719 2435 2720 $att_url = wp_get_attachment_url( $post->ID ); … … 2469 2754 if ( preg_match( '#^(audio|video)#', $post->post_mime_type ) ): 2470 2755 2471 2756 /** 2472 * Audio and video metadata fields to be shown in the publish meta box.2757 * Filter the audio and video metadata fields to be shown in the publish meta box. 2473 2758 * 2474 2759 * The key for each item in the array should correspond to an attachment 2475 2760 * metadata key, and the value should be the desired label. 2476 2761 * 2477 * @since 3.7.02762 * @since 3.7.0 2478 2763 * 2479 2764 * @param array $fields { 2480 2765 * An array of the attachment metadata keys and labels. … … 2515 2800 endif; 2516 2801 2517 2802 /** 2518 * Audio attachment metadata fields to be shown in the publish meta box.2803 * Filter the audio attachment metadata fields to be shown in the publish meta box. 2519 2804 * 2520 2805 * The key for each item in the array should correspond to an attachment 2521 2806 * metadata key, and the value should be the desired label. 2522 2807 * 2523 * @since 3.7.02808 * @since 3.7.0 2524 2809 * 2525 2810 * @param array $fields { 2526 2811 * An array of the attachment metadata keys and labels.