Make WordPress Core

Ticket #27718: 27718.3.diff

File 27718.3.diff, 24.3 KB (added by DrewAPicture, 13 years ago)

copy/paste fix in wp_video_shortcode

  • src/wp-includes/media.php

     
    7878                $max_height = $height;
    7979        }
    8080
     81        /**
     82         * Filter the maximum image size dimensions for the editor.
     83         *
     84         * @since 2.5.0
     85         *
     86         * @param array        $max_image_size An array with the width as the first element,
     87         *                                     and the height as the second element.
     88         * @param string|array $size           Size of what the result image should be.
     89         * @param string       $context        The context the image is being resized for.
     90         *                                     Possible values are 'display' (like in a theme)
     91         *                                     or 'edit' (like inserting into an editor).
     92         */
    8193        list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );
    8294
    8395        return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
    … …  
    126138 * to the new image that was resized.
    127139 *
    128140 * @since 2.5.0
    129  * @uses apply_filters() Calls 'image_downsize' on $id and $size to provide
    130  *              resize services.
    131141 *
    132142 * @param int $id Attachment ID for image.
    133143 * @param array|string $size Optional, default is 'medium'. Size of image, either array or string.
    … …  
    138148        if ( !wp_attachment_is_image($id) )
    139149                return false;
    140150
    141         // plugins can use this to provide resize services
    142         if ( $out = apply_filters( 'image_downsize', false, $id, $size ) )
     151        /**
     152         * Filter whether to preempt the output of image_downsize().
     153         *
     154         * Passing a truthy value to the filter will effectively short-circuit
     155         * down-sizing the image, returning that value as output instead.
     156         *
     157         * @since 2.5.0
     158         *
     159         * @param bool         $downsize Whether to short-circuit the image downsize. Default false.
     160         * @param int          $id       Attachment ID for image.
     161         * @param array|string $size     Size of image, either array or string. Default 'medium'.
     162         */
     163        if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) {
    143164                return $out;
     165        }
    144166
    145167        $img_url = wp_get_attachment_url($id);
    146168        $meta = wp_get_attachment_metadata($id);
    … …  
    293315        $title = $title ? 'title="' . esc_attr( $title ) . '" ' : '';
    294316
    295317        $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
    296         $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
    297318
     319        /**
     320         * Filter the value of the attachment's image tag class attribute.
     321         *
     322         * @since 2.6.0
     323         *
     324         * @param string $class CSS class name or space-separated list of classes.
     325         * @param int    $id    Attachment ID.
     326         * @param string $align Part of the class name for aligning the image.
     327         * @param string $size  Optional. Default is 'medium'.
     328         */
     329        $class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
     330
    298331        $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />';
    299332
     333        /**
     334         * Filter the HTML content for the image tag.
     335         *
     336         * @since 2.6.0
     337         *
     338         * @param string $html  HTML content for the image
     339         * @param int    $id    Attachment ID.
     340         * @param string $alt   Alternate text.
     341         * @param string $title Attachment title.
     342         * @param string $align Part of the class name for aligning the image.
     343         * @param string $size  Optional. Default is 'medium'.
     344         */
    300345        $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
    301346
    302347        return $html;
    … …  
    374419 * 3. If true, images will be cropped to the specified dimensions using center positions.
    375420 *
    376421 * @since 2.5.0
    377  * @uses apply_filters() Calls 'image_resize_dimensions' on $orig_w, $orig_h, $dest_w,
    378  *                       $dest_h and $crop to provide custom resize dimensions.
    379422 *
    380423 * @param int        $orig_w Original width in pixels.
    381424 * @param int        $orig_h Original height in pixels.
    … …  
    393436        if ($dest_w <= 0 && $dest_h <= 0)
    394437                return false;
    395438
    396         // plugins can use this to provide custom resize dimensions
     439        /**
     440         * Filter whether to preempt calculating the image resize dimensions.
     441         *
     442         * Passing a non-null value to the filter will effectively short-circuit
     443         * image_resize_dimensions(), returning that value instead.
     444         *
     445         * @since 3.4.0
     446         *
     447         * @param null|mixed $null   Whether to preempt output of the resize dimensions.
     448         * @param int        $orig_w Original width in pixels.
     449         * @param int        $orig_h Original height in pixels.
     450         * @param int        $dest_w New width in pixels.
     451         * @param int        $dest_h New height in pixels.
     452         * @param bool|array $crop   Whether to crop image to specified height and width or resize.
     453         *                           An array can specify positioning of the crop area. Default false.
     454         */
    397455        $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
    398456        if ( null !== $output )
    399457                return $output;
    … …  
    578636        if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
    579637                $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
    580638
     639        /**
     640         * Filter the list of intermediate image sizes.
     641         *
     642         * @since 2.5.0
     643         *
     644         * @param array $image_sizes An array of intermediate image sizes. Defaults
     645         *                           are 'thumbnail', 'medium', 'large'.
     646         */
    581647        return apply_filters( 'intermediate_image_sizes', $image_sizes );
    582648}
    583649
    … …  
    602668        $src = false;
    603669
    604670        if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
     671                /** This filter is documented in wp-includes/post.php */
    605672                $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
    606673                $src_file = $icon_dir . '/' . wp_basename($src);
    607674                @list($width, $height) = getimagesize($src_file);
    … …  
    651718                        $default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title
    652719
    653720                $attr = wp_parse_args($attr, $default_attr);
     721
     722                /**
     723                 * Filter the list of attachment image attributes.
     724                 *
     725                 * @since 2.8.0
     726                 *
     727                 * @param mixed $attr          Attributes for the image markup.
     728                 * @param int   $attachment_id Image attachment ID.
     729                 */
    654730                $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
    655731                $attr = array_map( 'esc_attr', $attr );
    656732                $html = rtrim("<img $hwstring");
    … …  
    9631039
    9641040        $size_class = sanitize_html_class( $size );
    9651041        $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
     1042
     1043        /**
     1044         * Filter the default gallery shortcode CSS styles.
     1045         *
     1046         * @since 2.5.0
     1047         *
     1048         * @param string $gallery_style Default gallery shortcode CSS styles.
     1049         * @param string $gallery_div   Opening HTML div container for the gallery shortcode output.
     1050         */
    9661051        $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
    9671052
    9681053        $i = 0;
    … …  
    10981183         * @since 3.9.0
    10991184         *
    11001185         * @param string $output Playlist output. Default empty.
    1101          * @param array  $attr   Array of shortcode attributes.
    1102          * @param string $type   Type of playlist to generate output for.
     1186         * @param array  $attr   An array of shortcode attributes.
    11031187         */
    11041188        $output = apply_filters( 'post_playlist', '', $attr );
    11051189        if ( $output != '' ) {
    … …  
    12561340
    12571341        if ( 1 === $instance ) {
    12581342                /**
    1259                  * Hook to print and enqueue playlist scripts, styles, and JavaScript templates.
     1343                 * Print and enqueue playlist scripts, styles, and JavaScript templates.
    12601344                 *
    12611345                 * @since 3.9.0
    12621346                 *
    … …  
    12991383 * @return string Fallback HTML
    13001384 */
    13011385function wp_mediaelement_fallback( $url ) {
     1386        /**
     1387         * Filter the Mediaelement fallback output for no-JS.
     1388         *
     1389         * @since 3.6.0
     1390         *
     1391         * @param string $output Fallback output for no-JS.
     1392         * @param string $url    Media file URL.
     1393         */
    13021394        return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
    13031395}
    13041396
    13051397/**
    1306  * Return a filtered list of WP-supported audio formats
     1398 * Return a filtered list of WP-supported audio formats.
    13071399 *
    13081400 * @since 3.6.0
    13091401 * @return array
    13101402 */
    13111403function wp_get_audio_extensions() {
     1404        /**
     1405         * Filter the list of supported audio formats.
     1406         *
     1407         * @since 3.6.0
     1408         *
     1409         * @param array $extensions An array of support audio formats. Defaults are
     1410         *                          'mp3', 'ogg', 'wma', 'm4a', 'wav'.
     1411         */
    13121412        return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'wma', 'm4a', 'wav' ) );
    13131413}
    13141414
    … …  
    13341434        }
    13351435
    13361436        /**
    1337          * Filter the editable list of keys to lookup data from an attachment's metadata.
     1437         * Filter the editable list of keys to look up data from an attachment's metadata.
    13381438         *
    13391439         * @since 3.9.0
    13401440         *
    13411441         * @param array   $fields     Key/value pairs of field keys to labels.
    13421442         * @param WP_Post $attachment Attachment object.
     1443         * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
    13431444         */
    13441445        return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
    13451446}
    … …  
    13831484         * @param string $content   Shortcode content.
    13841485         * @param int    $instances Unique numeric ID of this audio shortcode instance.
    13851486         */
    1386         $html = '';
    1387         $html = apply_filters( 'wp_audio_shortcode_override', $html, $attr, $content, $instances );
     1487        $html = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances );
    13881488        if ( '' !== $html )
    13891489                return $html;
    13901490
    … …  
    14331533                array_unshift( $default_types, 'src' );
    14341534        }
    14351535
     1536        /**
     1537         * Filter the media library used for the audio shortcode.
     1538         *
     1539         * @since 3.6.0
     1540         *
     1541         * @param string $library Media library used for the audio shortcode.
     1542         */
    14361543        $library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );
    14371544        if ( 'mediaelement' === $library && did_action( 'init' ) ) {
    14381545                wp_enqueue_style( 'wp-mediaelement' );
    14391546                wp_enqueue_script( 'wp-mediaelement' );
    14401547        }
    14411548
     1549        /**
     1550         * Filter the class attribute for the audio shortcode output container.
     1551         *
     1552         * @since 3.6.0
     1553         *
     1554         * @param string $class CSS class or list of space-separated classes.
     1555         */
    14421556        $atts = array(
    14431557                'class'    => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ),
    14441558                'id'       => sprintf( 'audio-%d-%d', $post_id, $instances ),
    … …  
    14801594                $html .= wp_mediaelement_fallback( $fileurl );
    14811595        $html .= '</audio>';
    14821596
     1597        /**
     1598         * Filter the audio shortcode output.
     1599         *
     1600         * @since 3.6.0
     1601         *
     1602         * @param string $html    Audio shortcode HTML output.
     1603         * @param array  $atts    Array of audio shortcode attributes
     1604         * @param string $audio   Audio file.
     1605         * @param int    $post_id Post ID.
     1606         * @param string $library Media library used for the audio shortcode.
     1607         */
    14831608        return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );
    14841609}
    14851610add_shortcode( 'audio', 'wp_audio_shortcode' );
    … …  
    14911616 * @return array
    14921617 */
    14931618function wp_get_video_extensions() {
     1619        /**
     1620         * Filter the list of supported video formats.
     1621         *
     1622         * @since 3.6.0
     1623         *
     1624         * @param array $extensions An array of support video formats. Defaults are
     1625         *                          'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'.
     1626         */
    14941627        return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ) );
    14951628}
    14961629
    … …  
    16151748                array_unshift( $default_types, 'src' );
    16161749        }
    16171750
     1751        /**
     1752         * Filter the media library used for the video shortcode.
     1753         *
     1754         * @since 3.6.0
     1755         *
     1756         * @param string $library Media library used for the video shortcode.
     1757         */
    16181758        $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
    16191759        if ( 'mediaelement' === $library && did_action( 'init' ) ) {
    16201760                wp_enqueue_style( 'wp-mediaelement' );
    16211761                wp_enqueue_script( 'wp-mediaelement' );
    16221762        }
    16231763
     1764        /**
     1765         * Filter the class attribute for the video shortcode output container.
     1766         *
     1767         * @since 3.6.0
     1768         *
     1769         * @param string $class CSS class or list of space-separated classes.
     1770         */
    16241771        $atts = array(
    16251772                'class'    => apply_filters( 'wp_video_shortcode_class', 'wp-video-shortcode' ),
    16261773                'id'       => sprintf( 'video-%d-%d', $post_id, $instances ),
    … …  
    16771824        $html .= '</video>';
    16781825
    16791826        $html = sprintf( '<div style="width: %dpx; max-width: 100%%;" class="wp-video">%s</div>', $width, $html );
     1827
     1828        /**
     1829         * Filter the output of the video shortcode.
     1830         *
     1831         * @since 3.6.0
     1832         *
     1833         * @param string $html    Video shortcode HTML output.
     1834         * @param array  $atts    Array of video shortcode attributes.
     1835         * @param string $video   Video file.
     1836         * @param int    $post_id Post ID.
     1837         * @param string $library Media library used for the video shortcode.
     1838         */
    16801839        return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library );
    16811840}
    16821841add_shortcode( 'video', 'wp_video_shortcode' );
    … …  
    17311890        }
    17321891
    17331892        $adjacent = $prev ? 'previous' : 'next';
     1893
     1894        /**
     1895         * Filter the adjacent image link.
     1896         *
     1897         * The dynamic portion of the hook name, $adjacent, refers to the type of adjacency,
     1898         * either 'next', or 'previous'.
     1899         *
     1900         * @since 3.5.0
     1901         *
     1902         * @param string $output        Adjacent image HTML markup.
     1903         * @param int    $attachment_id Attachment ID
     1904         * @param string $size          Image size.
     1905         * @param string $text          Link text.
     1906         */
    17341907        echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
    17351908}
    17361909
    … …  
    18662039
    18672040        $height = min( ceil( $width * 1.5 ), 1000 );
    18682041
     2042        /**
     2043         * Filter the default array of embed dimensions.
     2044         *
     2045         * @since 2.9.0
     2046         *
     2047         * @param int $width  Width of the embed in pixels.
     2048         * @param int $height Height of the embed in pixels.
     2049         */
    18692050        return apply_filters( 'embed_defaults', compact( 'width', 'height' ) );
    18702051}
    18712052
    … …  
    19592140 * @since 2.9.0
    19602141 */
    19612142function wp_maybe_load_embeds() {
    1962         if ( ! apply_filters( 'load_default_embeds', true ) )
     2143        /**
     2144         * Filter whether to load the default embed handlers.
     2145         *
     2146         * Returning a falsey value will prevent loading the default embed handlers.
     2147         *
     2148         * @since 2.9.0
     2149         *
     2150         * @param bool $maybe_load_embeds Whether to load the embeds library. Default true.
     2151         */
     2152        if ( ! apply_filters( 'load_default_embeds', true ) ) {
    19632153                return;
     2154        }
     2155
    19642156        wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
     2157
     2158        /**
     2159         * Filter the audio embed handler callback.
     2160         *
     2161         * @since 3.6.0
     2162         *
     2163         * @param callback $handler Audio embed handler callback function.
     2164         */
    19652165        wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . join( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );
     2166
     2167        /**
     2168         * Filter the video embed handler callback.
     2169         *
     2170         * @since 3.6.0
     2171         *
     2172         * @param callback $handler Video embed handler callback function.
     2173         */
    19662174        wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
    19672175}
    19682176
    … …  
    19872195                list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] );
    19882196        }
    19892197
     2198        /**
     2199         * Filter the Google Video embed output.
     2200         *
     2201         * @since 2.9.0
     2202         *
     2203         * @param string $html    Google Video HTML embed markup.
     2204         * @param array  $matches The regex matches from the provided regex.
     2205         * @param array  $attr    An array of embed attributes.
     2206         * @param string $url     The original URL that was matched by the regex.
     2207         * @param array  $rawattr The original unmodified attributes.
     2208         */
    19902209        return apply_filters( 'embed_googlevideo', '<embed type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docid=' . esc_attr($matches[2]) . '&amp;hl=en&amp;fs=true" style="width:' . esc_attr($width) . 'px;height:' . esc_attr($height) . 'px" allowFullScreen="true" allowScriptAccess="always" />', $matches, $attr, $url, $rawattr );
    19912210}
    19922211
    … …  
    20032222 */
    20042223function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
    20052224        $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) );
     2225
     2226        /**
     2227         * Filter the audio embed output.
     2228         *
     2229         * @since 3.6.0
     2230         *
     2231         * @param string $audio   Audio embed output.
     2232         * @param array  $attr    An array of embed attributes.
     2233         * @param string $url     The original URL that was matched by the regex.
     2234         * @param array  $rawattr The original unmodified attributes.
     2235         */
    20062236        return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
    20072237}
    20082238
    … …  
    20242254                $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] );
    20252255        }
    20262256        $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) );
     2257
     2258        /**
     2259         * Filter the video embed output.
     2260         *
     2261         * @since 3.6.0
     2262         *
     2263         * @param string $video   Video embed output.
     2264         * @param array  $attr    An array of embed attributes.
     2265         * @param string $url     The original URL that was matched by the regex.
     2266         * @param array  $rawattr The original unmodified attributes.
     2267         */
    20272268        return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr );
    20282269}
    20292270
    … …  
    20572298function wp_max_upload_size() {
    20582299        $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
    20592300        $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
    2060         $bytes   = apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
    2061         return $bytes;
     2301
     2302        /**
     2303         * Filter the maximum upload size allowed in php.ini.
     2304         *
     2305         * @since 2.5.0
     2306         *
     2307         * @param int $size    Max upload size limit in bytes.
     2308         * @param int $u_bytes Maximum upload filesize in bytes.
     2309         * @param int $p_bytes Maximum size of POST data in bytes.
     2310         */
     2311        return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
    20622312}
    20632313
    20642314/**
    … …  
    21252375        require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
    21262376        require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
    21272377
    2128         $implementations = apply_filters( 'wp_image_editors',
    2129                 array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
     2378        /**
     2379         * Filter the list of image editing library classes.
     2380         *
     2381         * @since 3.5.0
     2382         *
     2383         * @param array $image_editors List of available image editors. Defaults are
     2384         *                             'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'.
     2385         */
     2386        $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
    21302387
    21312388        foreach ( $implementations as $implementation ) {
    21322389                if ( ! call_user_func( array( $implementation, 'test' ), $args ) )
    … …  
    21802437        if ( wp_is_mobile() )
    21812438                $defaults['multi_selection'] = false;
    21822439
     2440        /**
     2441         * Filter the Plupload default settings.
     2442         *
     2443         * @since 3.4.0
     2444         *
     2445         * @param array $defaults Default Plupload settings array.
     2446         */
    21832447        $defaults = apply_filters( 'plupload_default_settings', $defaults );
    21842448
    21852449        $params = array(
    21862450                'action' => 'upload-attachment',
    21872451        );
    21882452
     2453        /**
     2454         * Filter the Plupload default parameters.
     2455         *
     2456         * @since 3.4.0
     2457         *
     2458         * @param array $params Default Plupload parameters array.
     2459         */
    21892460        $params = apply_filters( 'plupload_default_params', $params );
    21902461        $params['_wpnonce'] = wp_create_nonce( 'media-form' );
    21912462        $defaults['multipart_params'] = $params;
    … …  
    22722543
    22732544        if ( $meta && 'image' === $type ) {
    22742545                $sizes = array();
     2546
    22752547                /** This filter is documented in wp-admin/includes/media.php */
    22762548                $possible_sizes = apply_filters( 'image_size_names_choose', array(
    22772549                        'thumbnail' => __('Thumbnail'),
    … …  
    22862558                // If the filter does not return something, then image_downsize() is just an expensive
    22872559                // way to check the image metadata, which we do second.
    22882560                foreach ( $possible_sizes as $size => $label ) {
     2561
     2562                        /** This filter is documented in wp-includes/media.php */
    22892563                        if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
    22902564                                if ( ! $downsize[3] )
    22912565                                        continue;
    … …  
    23602634        if ( function_exists('get_compat_media_markup') )
    23612635                $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
    23622636
     2637        /**
     2638         * Filter the attachment data prepared for JavaScript.
     2639         *
     2640         * @since 3.5.0
     2641         *
     2642         * @param array      $response   Array of prepared attachment data.
     2643         * @param int|object $attachment Attachment ID or object.
     2644         * @param array      $meta       Array of attachment meta data.
     2645         */
    23632646        return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
    23642647}
    23652648
    … …  
    23922675                'library'  => '',
    23932676        );
    23942677
     2678        /** This filter is documented in wp-admin/includes/media.php */
    23952679        $tabs = apply_filters( 'media_upload_tabs', $tabs );
    23962680        unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
    23972681
    … …  
    24272711                'tabs'      => $tabs,
    24282712                'tabUrl'    => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
    24292713                'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
     2714                /** This filter is documented in wp-admin/includes/media.php */
    24302715                'captions'  => ! apply_filters( 'disable_captions', '' ),
    24312716                'nonce'     => array(
    24322717                        'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
    … …  
    25722857                'addToVideoPlaylistTitle'  => __( 'Add to Video Playlist' ),
    25732858        );
    25742859
     2860        /**
     2861         * Filter the media view settings.
     2862         *
     2863         * @since 3.5.0
     2864         *
     2865         * @param array   $settings List of media view settings.
     2866         * @param WP_Post $post     Post object.
     2867         */
    25752868        $settings = apply_filters( 'media_view_settings', $settings, $post );
    2576         $strings  = apply_filters( 'media_view_strings',  $strings,  $post );
    25772869
     2870        /**
     2871         * Filter the media view strings.
     2872         *
     2873         * @since 3.5.0
     2874         *
     2875         * @param array   $strings List of media view strings.
     2876         * @param WP_Post $post    Post object.
     2877         */
     2878        $strings  = apply_filters( 'media_view_strings', $strings,  $post );
     2879
    25782880        $strings['settings'] = $settings;
    25792881
    25802882        wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
    … …  
    25942896        add_action( 'wp_footer', 'wp_print_media_templates' );
    25952897        add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );
    25962898
     2899        /**
     2900         * Fires at the conclusion of wp_enqueue_media().
     2901         *
     2902         * @since 3.5.0
     2903         */
    25972904        do_action( 'wp_enqueue_media' );
    25982905}
    25992906
    26002907/**
    2601  * Retrieve media attached to the passed post
     2908 * Retrieve media attached to the passed post.
    26022909 *
    26032910 * @since 3.6.0
    26042911 *
    … …  
    26192926                'order' => 'ASC',
    26202927        );
    26212928
     2929        /**
     2930         * Filter arguments used to retrieve media attached to the given post.
     2931         *
     2932         * @since 3.6.0
     2933         *
     2934         * @param array  $args Post query arguments.
     2935         * @param string $type Mime type of the desired media.
     2936         * @param mixed  $post Post ID or object.
     2937         */
    26222938        $args = apply_filters( 'get_attached_media_args', $args, $type, $post );
    26232939
    26242940        $children = get_children( $args );
    26252941
     2942        /**
     2943         * Filter the
     2944         *
     2945         * @since 3.6.0
     2946         *
     2947         * @param array  $children Associative array of media attached to the given post.
     2948         * @param string $type     Mime type of the media desired.
     2949         * @param mixed  $post     Post ID or object.
     2950         */
    26262951        return (array) apply_filters( 'get_attached_media', $children, $type, $post );
    26272952}
    26282953
    … …  
    26542979}
    26552980
    26562981/**
    2657  * Retrieve galleries from the passed post's content
     2982 * Retrieve galleries from the passed post's content.
    26582983 *
    26592984 * @since 3.6.0
    26602985 *
    2661  * @param mixed $post Optional. Post ID or object.
    2662  * @param boolean $html Whether to return HTML or data in the array
     2986 * @param int|WP_Post $post Optional. Post ID or object.
     2987 * @param bool        $html Whether to return HTML or data in the array
    26632988 * @return array A list of arrays, each containing gallery data and srcs parsed
    26642989 *              from the expanded shortcode
    26652990 */
    … …  
    26953020                }
    26963021        }
    26973022
     3023        /**
     3024         * Filter the list of galleries found in the post content.
     3025         *
     3026         * @since 3.6.0
     3027         *
     3028         * @param array   $galleries Associative array of galleries found in the post content.
     3029         * @param WP_Post $post      Post object.
     3030         */
    26983031        return apply_filters( 'get_post_galleries', $galleries, $post );
    26993032}
    27003033
    … …  
    27033036 *
    27043037 * @since 3.6.0
    27053038 *
    2706  * @param mixed $post Optional. Post ID or object.
    2707  * @param boolean $html Whether to return HTML or data
     3039 * @param int|WP_Post $post Optional. Post ID or object.
     3040 * @param bool        $html Whether to return HTML or data
    27083041 * @return string|array Gallery data and srcs parsed from the expanded shortcode
    27093042 */
    27103043function get_post_gallery( $post = 0, $html = true ) {
    27113044        $galleries = get_post_galleries( $post, $html );
    27123045        $gallery = reset( $galleries );
    27133046
     3047        /**
     3048         * Filter the found post gallery.
     3049         *
     3050         * @since 3.6.0
     3051         *
     3052         * @param array       $gallery   The first-found post gallery.
     3053         * @param int|WP_Post $post      Post ID or object.
     3054         * @param array       $galleries Associative array of all found post galleries.
     3055         */
    27143056        return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
    27153057}
    27163058