Make WordPress Core

Ticket #25375: 25375.6.diff

File 25375.6.diff, 22.7 KB (added by DrewAPicture, 12 years ago)

Final pass.

  • src/wp-admin/includes/media.php

     
    2121                'library' => __('Media Library')
    2222        );
    2323
    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 );
    2532}
    2633
    2734/**
     
    7380                elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
    7481                        $current = $_GET['tab'];
    7582                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 );
    7791
    7892                foreach ( $tabs as $callback => $text ) {
    7993                        $class = '';
     
    113127        if ( $url )
    114128                $html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
    115129
     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         */
    116144        $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );
    117145
    118146        return $html;
     
    135163 */
    136164function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
    137165
     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         */
    138176        if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
    139177                return $html;
    140178
     
    156194
    157195        $shcode = '[caption id="' . $id . '" align="align' . $align     . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';
    158196
     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         */
    159205        return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
    160206}
    161207add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
     
    397443//]]>
    398444</script>
    399445<?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' );
    407448
    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
     480if ( 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         */
    409492        do_action( "admin_head_{$content_func}" );
     493}
    410494?>
    411495</head>
    412496<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js">
     
    418502        $args = array_slice($args, 1);
    419503        call_user_func_array($content_func, $args);
    420504
    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' );
    422507?>
    423508<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
    424509</body>
     
    446531
    447532        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>';
    448533
    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', '' );
    451543
    452544        if ( $legacy_filter ) {
    453545                // #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
     
    472564        if ( ! empty( $tab ) )
    473565                $upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src);
    474566
    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 );
    476578
    477579        return add_query_arg('TB_iframe', true, $upload_iframe_src);
    478580}
     
    514616                                $post['post_parent'] = $attachment['post_parent'];
    515617                }
    516618
    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 );
    518630
    519631                if ( isset($attachment['image_alt']) ) {
    520632                        $image_alt = wp_unslash( $attachment['image_alt'] );
     
    561673                        $html = "<a href='{$attachment['url']}'$rel>$html</a>";
    562674                }
    563675
    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 );
    565688                return media_send_to_editor($html);
    566689        }
    567690
     
    608731                                && ( 'audio' == $ext_type || 'video' == $ext_type ) )
    609732                                        $type = $ext_type;
    610733
     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                         */
    611746                        $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
    612747                } else {
    613748                        $align = '';
     
    619754                        if ( !empty($src) )
    620755                                $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
    621756
     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                         */
    622768                        $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align );
    623769                }
    624770
     
    778924 */
    779925function image_size_input_fields( $post, $check = '' ) {
    780926
    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        ) );
    783941
    784942                if ( empty($check) )
    785943                        $check = get_user_setting('imgsize', 'medium');
     
    10611219                unset( $form_fields['image_alt'] );
    10621220        }
    10631221
    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 );
    10651231
    10661232        return $form_fields;
    10671233}
     
    11261292
    11271293        $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 );
    11281294        $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         */
    11291305        $args = apply_filters( 'get_media_item_args', $args );
    11301306        extract( $args, EXTR_SKIP );
    11311307
     
    11801356        $meta = wp_get_attachment_metadata( $post->ID );
    11811357        if ( isset( $meta['width'], $meta['height'] ) )
    11821358                $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$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         */
    11831368        $media_dims = apply_filters( 'media_meta', $media_dims, $post );
    11841369
    11851370        $image_edit_button = '';
     
    13431528        $user_can_edit = current_user_can( 'edit_post', $attachment_id );
    13441529
    13451530        $args = wp_parse_args( $args, $default_args );
     1531
     1532        /** This filter is documented in wp-admin/includes/media.php */
    13461533        $args = apply_filters( 'get_media_item_args', $args );
    13471534
    13481535        $form_fields = array();
     
    13761563        // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
    13771564        $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] );
    13781565
     1566        /** This filter is documented in wp-admin/includes/media.php */
    13791567        $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
    13801568
    13811569        unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
    13821570                $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
    13831571                $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
    13841572
     1573        /** This filter is documented in wp-admin/includes/media.php */
    13851574        $media_meta = apply_filters( 'media_meta', '', $post );
    13861575
    13871576        $defaults = array(
     
    15411730?></div>
    15421731<?php
    15431732if ( 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         */
    15441738        do_action( 'upload_ui_over_quota' );
    15451739        return;
    15461740}
    15471741
    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 */
     1747do_action( 'pre-upload-ui' );
    15491748
    15501749$post_params = array(
    15511750                "post_id" => $post_id,
     
    15551754                "short" => "1",
    15561755);
    15571756
    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 );
    15591766
    15601767$plupload_init = array(
    15611768        'runtimes' => 'html5,silverlight,flash,html4',
     
    15791786if ( wp_is_mobile() )
    15801787        $plupload_init['multi_selection'] = false;
    15811788
     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 */
    15821796$plupload_init = apply_filters( 'plupload_init', $plupload_init );
    15831797
    15841798?>
     
    15981812</script>
    15991813
    16001814<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 */
     1822do_action( 'pre-plupload-upload-ui' ); ?>
    16021823<div id="drag-drop-area">
    16031824        <div class="drag-drop-inside">
    16041825        <p class="drag-drop-info"><?php _e('Drop files here'); ?></p>
     
    16061827        <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /></p>
    16071828        </div>
    16081829</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 */
     1837do_action( 'post-plupload-upload-ui' ); ?>
    16101838</div>
    16111839
    16121840<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        ?>
    16141849        <p id="async-upload-wrap">
    16151850                <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
    16161851                <input type="file" name="async-upload" id="async-upload" />
     
    16181853                <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
    16191854        </p>
    16201855        <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 */
     1862do_action( 'post-html-upload-ui' );
     1863?>
    16221864</div>
    16231865
    16241866<span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></span>
     
    16271869        <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>
    16281870<?php }
    16291871
    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' );
    16311880}
    16321881
    16331882/**
     
    16461895        $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
    16471896
    16481897        $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 );
    16501908        $form_class = 'media-upload-form type-form validate';
    16511909
    16521910        if ( get_user_setting('uploader') )
     
    17111969        $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
    17121970
    17131971        $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 );
    17151974        $form_class = 'media-upload-form type-form validate';
    17161975
    17171976        if ( get_user_setting('uploader') )
     
    17412000                if ( f.alt.value )
    17422001                        alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    17432002
    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                ?>
    17452007                if ( f.caption.value ) {
    17462008                        caption = f.caption.value.replace(/\r\n|\r/g, '\n');
    17472009                        caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
     
    18182080
    18192081<div id="media-items">
    18202082<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 */
     2091echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) );
     2092?>
    18222093</div>
    18232094</div>
    18242095</form>
     
    18402111
    18412112        $post_id = intval($_REQUEST['post_id']);
    18422113        $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 );
    18442116        $form_class = 'media-upload-form validate';
    18452117
    18462118        if ( get_user_setting('uploader') )
     
    19862258        $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
    19872259
    19882260        $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 );
    19902263        $form_class = 'media-upload-form validate';
    19912264
    19922265        if ( get_user_setting('uploader') )
     
    20492322
    20502323        $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>';
    20512324}
     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 */
    20522334echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
    20532335unset($type_links);
    20542336?>
     
    21482430 * @return string the form html
    21492431 */
    21502432function 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', '' ) ) {
    21522435                $caption = '
    21532436                <tr class="image-only">
    21542437                        <th valign="top" scope="row" class="label">
     
    24302713        $meta = wp_get_attachment_metadata( $post->ID );
    24312714        if ( isset( $meta['width'], $meta['height'] ) )
    24322715                $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
     2716        /** This filter is documented in wp-admin/includes/media.php */
    24332717        $media_dims = apply_filters( 'media_meta', $media_dims, $post );
    24342718
    24352719        $att_url = wp_get_attachment_url( $post->ID );
     
    24692753        if ( preg_match( '#^(audio|video)#', $post->post_mime_type ) ):
    24702754
    24712755                /**
    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.
    24732757                 *
    24742758                 * The key for each item in the array should correspond to an attachment
    24752759                 * metadata key, and the value should be the desired label.
    24762760                 *
    2477                  * @since  3.7.0
     2761                 * @since 3.7.0
    24782762                 *
    24792763                 * @param array $fields {
    24802764                 *     An array of the attachment metadata keys and labels.
    24812765                 *
    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.
    24862770                 * }
    24872771                 */
    24882772                $fields = apply_filters( 'media_submitbox_misc_sections', array(
     
    25152799                endif;
    25162800
    25172801                /**
    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.
    25192803                 *
    25202804                 * The key for each item in the array should correspond to an attachment
    25212805                 * metadata key, and the value should be the desired label.
    25222806                 *
    2523                  * @since  3.7.0
     2807                 * @since 3.7.0
    25242808                 *
    25252809                 * @param array $fields {
    25262810                 *     An array of the attachment metadata keys and labels.
    25272811                 *
    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.
    25302814                 * }
    25312815                 */
    25322816                $audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(