Make WordPress Core

Ticket #25375: 25375.7.diff

File 25375.7.diff, 23.7 KB (added by DrewAPicture, 12 years ago)
  • 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/**
     
    6875
    6976        if ( !empty($tabs) ) {
    7077                echo "<ul id='sidemenu'>\n";
    71                 if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
     78                if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) ) {
    7279                        $current = $redir_tab;
    73                 elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
     80                } elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) {
    7481                        $current = $_GET['tab'];
    75                 else
    76                         $current = apply_filters('media_upload_default_tab', $default);
     82                } else {
     83                        /** This filter is documented in wp-admin/media-upload.php */
     84                        $current = apply_filters( 'media_upload_default_tab', $default );
     85                }
    7786
    7887                foreach ( $tabs as $callback => $text ) {
    7988                        $class = '';
     
    113122        if ( $url )
    114123                $html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
    115124
     125        /**
     126         * Filter the image HTML markup to send to the editor.
     127         *
     128         * @since 2.5.0
     129         *
     130         * @param string $html    The image HTML markup to send.
     131         * @param int    $id      The attachment id.
     132         * @param string $caption The image caption.
     133         * @param string $title   The image title.
     134         * @param string $align   The image alignment.
     135         * @param string $url     The image source URL.
     136         * @param string $size    The image size.
     137         * @param string $alt     The image alternative, or alt, text.
     138         */
    116139        $html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );
    117140
    118141        return $html;
     
    135158 */
    136159function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
    137160
     161        /**
     162         * Filter whether to disable captions.
     163         *
     164         * Prevents image captions from being appended to image HTML when inserted into the editor.
     165         *
     166         * @since 2.6.0
     167         *
     168         * @param bool $bool Whether to disable appending captions. Returning true to the filter
     169         *                   will disable captions. Default empty string.
     170         */
    138171        if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
    139172                return $html;
    140173
     
    156189
    157190        $shcode = '[caption id="' . $id . '" align="align' . $align     . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';
    158191
     192        /**
     193         * Filter the image HTML markup including the caption shortcode.
     194         *
     195         * @since 2.6.0
     196         *
     197         * @param string $shcode The image HTML markup with caption shortcode.
     198         * @param string $html   The image HTML markup.
     199         */
    159200        return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
    160201}
    161202add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
     
    397438//]]>
    398439</script>
    399440<?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');
     441        /** This action is documented in wp-admin/admin-header.php */
     442        do_action( 'admin_enqueue_scripts', 'media-upload-popup' );
    407443
    408 if ( is_string($content_func) )
     444        /**
     445         * Print admin styles enqueued for the legacy (pre-3.5.0) media upload popup.
     446         *
     447         * @since 2.9.0
     448         */
     449        do_action( 'admin_print_styles-media-upload-popup' );
     450
     451        /** This action is documented in wp-admin/admin-header.php */
     452        do_action( 'admin_print_styles' );
     453
     454        /**
     455         * Print admin scripts enqueued for the legacy (pre-3.5.0) media upload popup.
     456         *
     457         * @since 2.9.0
     458         */
     459        do_action( 'admin_print_scripts-media-upload-popup' );
     460
     461        /** This action is documented in wp-admin/admin-header.php */
     462        do_action( 'admin_print_scripts' );
     463
     464        /**
     465         * Print scripts enqueued for the admin header for the legacy (pre-3.5.0)
     466         * media upload popup.
     467         *
     468         * @since 2.9.0
     469         */
     470        do_action( 'admin_head-media-upload-popup' );
     471
     472        /** This action is documented in wp-admin/admin-header.php */
     473        do_action( 'admin_head' );
     474
     475if ( is_string( $content_func ) ) {
     476        /**
     477         * Fires in the admin header for each specific form tab in the legacy
     478         * (pre-3.5.0) media upload popup.
     479         *
     480         * The dynamic portion of the hook, $content_func, refers to the form
     481         * callback for the media upload type. Possible values include
     482         * 'media_upload_type_form', 'media_upload_type_url_form', and
     483         * 'media_upload_library_form'.
     484         *
     485         * @since 2.5.0
     486         */
    409487        do_action( "admin_head_{$content_func}" );
     488}
    410489?>
    411490</head>
    412491<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js">
     
    418497        $args = array_slice($args, 1);
    419498        call_user_func_array($content_func, $args);
    420499
    421         do_action('admin_print_footer_scripts');
     500        /** This action is documented in wp-admin/admin-footer.php */
     501        do_action( 'admin_print_footer_scripts' );
    422502?>
    423503<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
    424504</body>
     
    446526
    447527        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>';
    448528
    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
     529        /**
     530         * Filter the legacy (pre-3.5.0) media buttons.
     531         *
     532         * @since 2.5.0
     533         * @deprecated 3.5.0 Use 'media_buttons' action instead.
     534         *
     535         * @param string $string Media buttons context. Default empty.
     536         */
     537        $legacy_filter = apply_filters( 'media_buttons_context', '' );
    451538
    452539        if ( $legacy_filter ) {
    453540                // #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
     
    472559        if ( ! empty( $tab ) )
    473560                $upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src);
    474561
    475         $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src);
     562        /**
     563         * Filter the upload iframe source URL for a specific media type.
     564         *
     565         * The dynamic portion of the hook name, $type, refers to the type
     566         * of media uploaded.
     567         *
     568         * @since 3.0.0
     569         *
     570         * @param string $upload_iframe_src The upload iframe source URL by type.
     571         */
     572        $upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src );
    476573
    477574        return add_query_arg('TB_iframe', true, $upload_iframe_src);
    478575}
     
    514611                                $post['post_parent'] = $attachment['post_parent'];
    515612                }
    516613
    517                 $post = apply_filters('attachment_fields_to_save', $post, $attachment);
     614                /**
     615                 * Filter the attachment fields to be saved.
     616                 *
     617                 * @since 2.5.0
     618                 *
     619                 * @see wp_get_attachment_metadata()
     620                 *
     621                 * @param WP_Post $post       The WP_Post object.
     622                 * @param array   $attachment An array of attachment metadata.
     623                 */
     624                $post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
    518625
    519626                if ( isset($attachment['image_alt']) ) {
    520627                        $image_alt = wp_unslash( $attachment['image_alt'] );
     
    561668                        $html = "<a href='{$attachment['url']}'$rel>$html</a>";
    562669                }
    563670
    564                 $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
     671                /**
     672                 * Filter the HTML markup for a media item sent to the editor.
     673                 *
     674                 * @since 2.5.0
     675                 *
     676                 * @see wp_get_attachment_metadata()
     677                 *
     678                 * @param string $html       HTML markup for a media item sent to the editor.
     679                 * @param int    $send_id    The first key from the $_POST['send'] data.
     680                 * @param array  $attachment Array of attachment metadata.
     681                 */
     682                $html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment );
    565683                return media_send_to_editor($html);
    566684        }
    567685
     
    608726                                && ( 'audio' == $ext_type || 'video' == $ext_type ) )
    609727                                        $type = $ext_type;
    610728
     729                        /**
     730                         * Filter the URL sent to the editor for a specific media type.
     731                         *
     732                         * The dynamic portion of the hook name, $type, refers to the type
     733                         * of media being sent.
     734                         *
     735                         * @since 3.3.0
     736                         *
     737                         * @param string $html  HTML markup sent to the editor.
     738                         * @param string $src   Media source URL.
     739                         * @param string $title Media title.
     740                         */
    611741                        $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
    612742                } else {
    613743                        $align = '';
     
    619749                        if ( !empty($src) )
    620750                                $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
    621751
     752                        /**
     753                         * Filter the image URL sent to the editor.
     754                         *
     755                         * @since 2.8.0
     756                         *
     757                         * @param string $html  HTML markup sent to the editor for an image.
     758                         * @param string $src   Image source URL.
     759                         * @param string $alt   Image alternate, or alt, text.
     760                         * @param string $align The image alignment. Default 'alignnone'. Possible values include
     761                         *                      'alignleft', 'aligncenter', 'alignright', 'alignnone'.
     762                         */
    622763                        $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align );
    623764                }
    624765
     
    778919 */
    779920function image_size_input_fields( $post, $check = '' ) {
    780921
    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')) );
     922        /**
     923         * Filter the names and labels of the default image sizes.
     924         *
     925         * @since 3.3.0
     926         *
     927         * @param array $size_names Array of image sizes and their names. Default values
     928         *                          include 'Thumbnail', 'Medium', 'Large', 'Full Size'.
     929         */
     930        $size_names = apply_filters( 'image_size_names_choose', array(
     931                'thumbnail' => __( 'Thumbnail' ),
     932                'medium'    => __( 'Medium' ),
     933                'large'     => __( 'Large' ),
     934                'full'      => __( 'Full Size' )
     935        ) );
    783936
    784937                if ( empty($check) )
    785938                        $check = get_user_setting('imgsize', 'medium');
     
    10611214                unset( $form_fields['image_alt'] );
    10621215        }
    10631216
    1064         $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
     1217        /**
     1218         * Filter the attachment fields to edit.
     1219         *
     1220         * @since 2.5.0
     1221         *
     1222         * @param array   $form_fields An array of attachment form fields.
     1223         * @param WP_Post $post        The WP_Post attachment object.
     1224         */
     1225        $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
    10651226
    10661227        return $form_fields;
    10671228}
     
    11261287
    11271288        $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 );
    11281289        $args = wp_parse_args( $args, $default_args );
     1290
     1291        /**
     1292         * Filter the arguments used to retrieve an image for the edit image form.
     1293         *
     1294         * @since 3.1.0
     1295         *
     1296         * @see get_media_item
     1297         *
     1298         * @param array $args An array of arguments.
     1299         */
    11291300        $args = apply_filters( 'get_media_item_args', $args );
    11301301        extract( $args, EXTR_SKIP );
    11311302
     
    11801351        $meta = wp_get_attachment_metadata( $post->ID );
    11811352        if ( isset( $meta['width'], $meta['height'] ) )
    11821353                $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$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         */
    11831363        $media_dims = apply_filters( 'media_meta', $media_dims, $post );
    11841364
    11851365        $image_edit_button = '';
     
    13431523        $user_can_edit = current_user_can( 'edit_post', $attachment_id );
    13441524
    13451525        $args = wp_parse_args( $args, $default_args );
     1526
     1527        /** This filter is documented in wp-admin/includes/media.php */
    13461528        $args = apply_filters( 'get_media_item_args', $args );
    13471529
    13481530        $form_fields = array();
     
    13761558        // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
    13771559        $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] );
    13781560
     1561        /** This filter is documented in wp-admin/includes/media.php */
    13791562        $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
    13801563
    13811564        unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
    13821565                $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
    13831566                $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
    13841567
     1568        /** This filter is documented in wp-admin/includes/media.php */
    13851569        $media_meta = apply_filters( 'media_meta', '', $post );
    13861570
    13871571        $defaults = array(
     
    15411725?></div>
    15421726<?php
    15431727if ( is_multisite() && !is_upload_space_available() ) {
     1728        /**
     1729         * Fires when an upload will exceed the defined upload space quota for a network site.
     1730         *
     1731         * @since 3.5.0
     1732         */
    15441733        do_action( 'upload_ui_over_quota' );
    15451734        return;
    15461735}
    15471736
    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 */
     1742do_action( 'pre-upload-ui' );
    15491743
    15501744$post_params = array(
    15511745                "post_id" => $post_id,
     
    15551749                "short" => "1",
    15561750);
    15571751
    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 * @since 3.1.0 As 'swfupload_post_params'
     1756 * @since 3.3.0
     1757 *
     1758 * @param array $post_params An array of media upload parameters used by Plupload.
     1759 */
     1760$post_params = apply_filters( 'upload_post_params', $post_params );
    15591761
    15601762$plupload_init = array(
    15611763        'runtimes' => 'html5,silverlight,flash,html4',
     
    15791781if ( wp_is_mobile() )
    15801782        $plupload_init['multi_selection'] = false;
    15811783
     1784/**
     1785 * Filter the default Plupload settings.
     1786 *
     1787 * @since 3.3.0
     1788 *
     1789 * @param array $plupload_init An array of default settings used by Plupload.
     1790 */
    15821791$plupload_init = apply_filters( 'plupload_init', $plupload_init );
    15831792
    15841793?>
     
    15981807</script>
    15991808
    16001809<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' ?>
     1810<?php
     1811/**
     1812 * Fires before the upload interface loads.
     1813 *
     1814 * @since 2.6.0 As 'pre-flash-upload-ui'
     1815 * @since 3.3.0
     1816 */
     1817do_action( 'pre-plupload-upload-ui' ); ?>
    16021818<div id="drag-drop-area">
    16031819        <div class="drag-drop-inside">
    16041820        <p class="drag-drop-info"><?php _e('Drop files here'); ?></p>
     
    16061822        <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /></p>
    16071823        </div>
    16081824</div>
    1609 <?php do_action('post-plupload-upload-ui'); // hook change, old name: 'post-flash-upload-ui' ?>
     1825<?php
     1826/**
     1827 * Fires after the upload interface loads.
     1828 *
     1829 * @since 2.6.0 As 'post-flash-upload-ui'
     1830 * @since 3.3.0
     1831 */
     1832do_action( 'post-plupload-upload-ui' ); ?>
    16101833</div>
    16111834
    16121835<div id="html-upload-ui" class="hide-if-js">
    1613 <?php do_action('pre-html-upload-ui'); ?>
     1836        <?php
     1837        /**
     1838         * Fires before the upload button in the media upload interface.
     1839         *
     1840         * @since 2.6.0
     1841         */
     1842        do_action( 'pre-html-upload-ui' );
     1843        ?>
    16141844        <p id="async-upload-wrap">
    16151845                <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
    16161846                <input type="file" name="async-upload" id="async-upload" />
     
    16181848                <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
    16191849        </p>
    16201850        <div class="clear"></div>
    1621 <?php do_action('post-html-upload-ui'); ?>
     1851<?php
     1852/**
     1853 * Fires after the upload button in the media upload interface.
     1854 *
     1855 * @since 2.6.0
     1856 */
     1857do_action( 'post-html-upload-ui' );
     1858?>
    16221859</div>
    16231860
    16241861<span class="max-upload-size"><?php printf( __( 'Maximum upload file size: %d%s.' ), esc_html($upload_size_unit), esc_html($sizes[$u]) ); ?></span>
     
    16271864        <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>
    16281865<?php }
    16291866
    1630         do_action('post-upload-ui');
     1867        /**
     1868         * Fires on the post upload UI screen.
     1869         *
     1870         * Legacy (pre-3.5.0) media workflow hook.
     1871         *
     1872         * @since 2.6.0
     1873         */
     1874        do_action( 'post-upload-ui' );
    16311875}
    16321876
    16331877/**
     
    16461890        $post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
    16471891
    16481892        $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);
     1893
     1894        /**
     1895         * Filter the media upload form action URL.
     1896         *
     1897         * @since 2.6.0
     1898         *
     1899         * @param string $form_action_url The media upload form action URL.
     1900         * @param string $type            The type of media. Default 'file'.
     1901         */
     1902        $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
    16501903        $form_class = 'media-upload-form type-form validate';
    16511904
    16521905        if ( get_user_setting('uploader') )
     
    17111964        $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
    17121965
    17131966        $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);
     1967        /** This filter is documented in wp-admin/includes/media.php */
     1968        $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
    17151969        $form_class = 'media-upload-form type-form validate';
    17161970
    17171971        if ( get_user_setting('uploader') )
     
    17411995                if ( f.alt.value )
    17421996                        alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    17431997
    1744 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
     1998<?php
     1999        /** This filter is documented in wp-admin/includes/media.php */
     2000        if ( ! apply_filters( 'disable_captions', '' ) ) {
     2001                ?>
    17452002                if ( f.caption.value ) {
    17462003                        caption = f.caption.value.replace(/\r\n|\r/g, '\n');
    17472004                        caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
     
    18182075
    18192076<div id="media-items">
    18202077<div class="media-item media-blank">
    1821 <?php echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) ); ?>
     2078<?php
     2079/**
     2080 * Filter the insert media from URL form HTML.
     2081 *
     2082 * @since 3.3.0
     2083 *
     2084 * @param string $form_html The insert from URL form HTML.
     2085 */
     2086echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) );
     2087?>
    18222088</div>
    18232089</div>
    18242090</form>
     
    18402106
    18412107        $post_id = intval($_REQUEST['post_id']);
    18422108        $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);
     2109        /** This filter is documented in wp-admin/includes/media.php */
     2110        $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
    18442111        $form_class = 'media-upload-form validate';
    18452112
    18462113        if ( get_user_setting('uploader') )
     
    19862253        $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
    19872254
    19882255        $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);
     2256        /** This filter is documented in wp-admin/includes/media.php */
     2257        $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
    19902258        $form_class = 'media-upload-form validate';
    19912259
    19922260        if ( get_user_setting('uploader') )
     
    20492317
    20502318        $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>';
    20512319}
     2320/**
     2321 * Filter the media upload mime type list items.
     2322 *
     2323 * Returned values should begin with an <li> tag.
     2324 *
     2325 * @since 3.1.0
     2326 *
     2327 * @param array $type_links An array of list items containing mime type link HTML.
     2328 */
    20522329echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
    20532330unset($type_links);
    20542331?>
     
    21482425 * @return string the form html
    21492426 */
    21502427function wp_media_insert_url_form( $default_view = 'image' ) {
    2151         if ( !apply_filters( 'disable_captions', '' ) ) {
     2428        /** This filter is documented in wp-admin/includes/media.php */
     2429        if ( ! apply_filters( 'disable_captions', '' ) ) {
    21522430                $caption = '
    21532431                <tr class="image-only">
    21542432                        <th valign="top" scope="row" class="label">
     
    24302708        $meta = wp_get_attachment_metadata( $post->ID );
    24312709        if ( isset( $meta['width'], $meta['height'] ) )
    24322710                $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
     2711        /** This filter is documented in wp-admin/includes/media.php */
    24332712        $media_dims = apply_filters( 'media_meta', $media_dims, $post );
    24342713
    24352714        $att_url = wp_get_attachment_url( $post->ID );
     
    24692748        if ( preg_match( '#^(audio|video)#', $post->post_mime_type ) ):
    24702749
    24712750                /**
    2472                  * Audio and video metadata fields to be shown in the publish meta box.
     2751                 * Filter the audio and video metadata fields to be shown in the publish meta box.
    24732752                 *
    24742753                 * The key for each item in the array should correspond to an attachment
    24752754                 * metadata key, and the value should be the desired label.
    24762755                 *
    2477                  * @since  3.7.0
     2756                 * @since 3.7.0
    24782757                 *
    24792758                 * @param array $fields {
    24802759                 *     An array of the attachment metadata keys and labels.
    24812760                 *
    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.
     2761                 *     @type string $mime_type        Label to be shown before the field mime_type.
     2762                 *     @type string $year             Label to be shown before the field year.
     2763                 *     @type string $genre            Label to be shown before the field genre.
     2764                 *     @type string $length_formatted Label to be shown before the field length_formatted.
    24862765                 * }
    24872766                 */
    24882767                $fields = apply_filters( 'media_submitbox_misc_sections', array(
     
    25152794                endif;
    25162795
    25172796                /**
    2518                  * Audio attachment metadata fields to be shown in the publish meta box.
     2797                 * Filter the audio attachment metadata fields to be shown in the publish meta box.
    25192798                 *
    25202799                 * The key for each item in the array should correspond to an attachment
    25212800                 * metadata key, and the value should be the desired label.
    25222801                 *
    2523                  * @since  3.7.0
     2802                 * @since 3.7.0
    25242803                 *
    25252804                 * @param array $fields {
    25262805                 *     An array of the attachment metadata keys and labels.
    25272806                 *
    2528                  *     @type string 'dataformat' Label to be shown before the field dataformat.
    2529                  *     @type string 'codec'      Label to be shown before the field codec.
     2807                 *     @type string $dataformat Label to be shown before the field dataformat.
     2808                 *     @type string $codec      Label to be shown before the field codec.
    25302809                 * }
    25312810                 */
    25322811                $audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(
  • src/wp-admin/media-upload.php

     
    4444                $type = apply_filters('media_upload_default_type', 'file');
    4545
    4646        // tab: gallery, library, or type-specific
    47         if ( isset($_GET['tab']) )
     47        if ( isset($_GET['tab']) ) {
    4848                $tab = strval($_GET['tab']);
    49         else
    50                 $tab = apply_filters('media_upload_default_tab', 'type');
     49        } else {
     50                /**
     51                 * Filter the default tab in the legacy (pre-3.5.0) media popup.
     52                 *
     53                 * @since 2.5.0
     54                 *
     55                 * @param string $type The default media popup tab.
     56                 */
     57                $tab = apply_filters( 'media_upload_default_tab', 'type' );
     58        }
    5159
    5260        $body_id = 'media-upload';
    5361