Make WordPress Core

Ticket #27718: 27718.2.diff

File 27718.2.diff, 24.6 KB (added by DrewAPicture, 13 years ago)

27718.diff​ + full pass

  • 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    Audio shortcode HTML output.
     1834         * @param array  $atts    Array of audio shortcode attributes
     1835         * @param string $audio   Audio file.
     1836         * @param int    $post_id Post ID.
     1837         * @param string $library Media library used for the audio shortcode.
     1838
     1839         * @param string $html    Video shortcode HTML output.
     1840         * @param array  $atts    Array of video shortcode attributes.
     1841         * @param string $video   Video file.
     1842         * @param int    $post_id Post ID.
     1843         * @param string $library Media library used for the video shortcode.
     1844         */
    16801845        return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library );
    16811846}
    16821847add_shortcode( 'video', 'wp_video_shortcode' );
    … …  
    17311896        }
    17321897
    17331898        $adjacent = $prev ? 'previous' : 'next';
     1899
     1900        /**
     1901         * Filter the adjacent image link.
     1902         *
     1903         * The dynamic portion of the hook name, $adjacent, refers to the type of adjacency,
     1904         * either 'next', or 'previous'.
     1905         *
     1906         * @since 3.5.0
     1907         *
     1908         * @param string $output        Adjacent image HTML markup.
     1909         * @param int    $attachment_id Attachment ID
     1910         * @param string $size          Image size.
     1911         * @param string $text          Link text.
     1912         */
    17341913        echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
    17351914}
    17361915
    … …  
    18662045
    18672046        $height = min( ceil( $width * 1.5 ), 1000 );
    18682047
     2048        /**
     2049         * Filter the default array of embed dimensions.
     2050         *
     2051         * @since 2.9.0
     2052         *
     2053         * @param int $width  Width of the embed in pixels.
     2054         * @param int $height Height of the embed in pixels.
     2055         */
    18692056        return apply_filters( 'embed_defaults', compact( 'width', 'height' ) );
    18702057}
    18712058
    … …  
    19592146 * @since 2.9.0
    19602147 */
    19612148function wp_maybe_load_embeds() {
    1962         if ( ! apply_filters( 'load_default_embeds', true ) )
     2149        /**
     2150         * Filter whether to load the default embed handlers.
     2151         *
     2152         * Returning a falsey value will prevent loading the default embed handlers.
     2153         *
     2154         * @since 2.9.0
     2155         *
     2156         * @param bool $maybe_load_embeds Whether to load the embeds library. Default true.
     2157         */
     2158        if ( ! apply_filters( 'load_default_embeds', true ) ) {
    19632159                return;
     2160        }
     2161
    19642162        wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
     2163
     2164        /**
     2165         * Filter the audio embed handler callback.
     2166         *
     2167         * @since 3.6.0
     2168         *
     2169         * @param callback $handler Audio embed handler callback function.
     2170         */
    19652171        wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . join( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );
     2172
     2173        /**
     2174         * Filter the video embed handler callback.
     2175         *
     2176         * @since 3.6.0
     2177         *
     2178         * @param callback $handler Video embed handler callback function.
     2179         */
    19662180        wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
    19672181}
    19682182
    … …  
    19872201                list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] );
    19882202        }
    19892203
     2204        /**
     2205         * Filter the Google Video embed output.
     2206         *
     2207         * @since 2.9.0
     2208         *
     2209         * @param string $html    Google Video HTML embed markup.
     2210         * @param array  $matches The regex matches from the provided regex.
     2211         * @param array  $attr    An array of embed attributes.
     2212         * @param string $url     The original URL that was matched by the regex.
     2213         * @param array  $rawattr The original unmodified attributes.
     2214         */
    19902215        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 );
    19912216}
    19922217
    … …  
    20032228 */
    20042229function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
    20052230        $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) );
     2231
     2232        /**
     2233         * Filter the audio embed output.
     2234         *
     2235         * @since 3.6.0
     2236         *
     2237         * @param string $audio   Audio embed output.
     2238         * @param array  $attr    An array of embed attributes.
     2239         * @param string $url     The original URL that was matched by the regex.
     2240         * @param array  $rawattr The original unmodified attributes.
     2241         */
    20062242        return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
    20072243}
    20082244
    … …  
    20242260                $dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] );
    20252261        }
    20262262        $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) );
     2263
     2264        /**
     2265         * Filter the video embed output.
     2266         *
     2267         * @since 3.6.0
     2268         *
     2269         * @param string $video   Video embed output.
     2270         * @param array  $attr    An array of embed attributes.
     2271         * @param string $url     The original URL that was matched by the regex.
     2272         * @param array  $rawattr The original unmodified attributes.
     2273         */
    20272274        return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr );
    20282275}
    20292276
    … …  
    20572304function wp_max_upload_size() {
    20582305        $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
    20592306        $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;
     2307
     2308        /**
     2309         * Filter the maximum upload size allowed in php.ini.
     2310         *
     2311         * @since 2.5.0
     2312         *
     2313         * @param int $size    Max upload size limit in bytes.
     2314         * @param int $u_bytes Maximum upload filesize in bytes.
     2315         * @param int $p_bytes Maximum size of POST data in bytes.
     2316         */
     2317        return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
    20622318}
    20632319
    20642320/**
    … …  
    21252381        require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
    21262382        require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
    21272383
    2128         $implementations = apply_filters( 'wp_image_editors',
    2129                 array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
     2384        /**
     2385         * Filter the list of image editing library classes.
     2386         *
     2387         * @since 3.5.0
     2388         *
     2389         * @param array $image_editors List of available image editors. Defaults are
     2390         *                             'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'.
     2391         */
     2392        $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
    21302393
    21312394        foreach ( $implementations as $implementation ) {
    21322395                if ( ! call_user_func( array( $implementation, 'test' ), $args ) )
    … …  
    21802443        if ( wp_is_mobile() )
    21812444                $defaults['multi_selection'] = false;
    21822445
     2446        /**
     2447         * Filter the Plupload default settings.
     2448         *
     2449         * @since 3.4.0
     2450         *
     2451         * @param array $defaults Default Plupload settings array.
     2452         */
    21832453        $defaults = apply_filters( 'plupload_default_settings', $defaults );
    21842454
    21852455        $params = array(
    21862456                'action' => 'upload-attachment',
    21872457        );
    21882458
     2459        /**
     2460         * Filter the Plupload default parameters.
     2461         *
     2462         * @since 3.4.0
     2463         *
     2464         * @param array $params Default Plupload parameters array.
     2465         */
    21892466        $params = apply_filters( 'plupload_default_params', $params );
    21902467        $params['_wpnonce'] = wp_create_nonce( 'media-form' );
    21912468        $defaults['multipart_params'] = $params;
    … …  
    22722549
    22732550        if ( $meta && 'image' === $type ) {
    22742551                $sizes = array();
     2552
    22752553                /** This filter is documented in wp-admin/includes/media.php */
    22762554                $possible_sizes = apply_filters( 'image_size_names_choose', array(
    22772555                        'thumbnail' => __('Thumbnail'),
    … …  
    22862564                // If the filter does not return something, then image_downsize() is just an expensive
    22872565                // way to check the image metadata, which we do second.
    22882566                foreach ( $possible_sizes as $size => $label ) {
     2567
     2568                        /** This filter is documented in wp-includes/media.php */
    22892569                        if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
    22902570                                if ( ! $downsize[3] )
    22912571                                        continue;
    … …  
    23602640        if ( function_exists('get_compat_media_markup') )
    23612641                $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
    23622642
     2643        /**
     2644         * Filter the attachment data prepared for JavaScript.
     2645         *
     2646         * @since 3.5.0
     2647         *
     2648         * @param array      $response   Array of prepared attachment data.
     2649         * @param int|object $attachment Attachment ID or object.
     2650         * @param array      $meta       Array of attachment meta data.
     2651         */
    23632652        return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
    23642653}
    23652654
    … …  
    23922681                'library'  => '',
    23932682        );
    23942683
     2684        /** This filter is documented in wp-admin/includes/media.php */
    23952685        $tabs = apply_filters( 'media_upload_tabs', $tabs );
    23962686        unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
    23972687
    … …  
    24272717                'tabs'      => $tabs,
    24282718                'tabUrl'    => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
    24292719                'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
     2720                /** This filter is documented in wp-admin/includes/media.php */
    24302721                'captions'  => ! apply_filters( 'disable_captions', '' ),
    24312722                'nonce'     => array(
    24322723                        'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
    … …  
    25722863                'addToVideoPlaylistTitle'  => __( 'Add to Video Playlist' ),
    25732864        );
    25742865
     2866        /**
     2867         * Filter the media view settings.
     2868         *
     2869         * @since 3.5.0
     2870         *
     2871         * @param array   $settings List of media view settings.
     2872         * @param WP_Post $post     Post object.
     2873         */
    25752874        $settings = apply_filters( 'media_view_settings', $settings, $post );
    2576         $strings  = apply_filters( 'media_view_strings',  $strings,  $post );
    25772875
     2876        /**
     2877         * Filter the media view strings.
     2878         *
     2879         * @since 3.5.0
     2880         *
     2881         * @param array   $strings List of media view strings.
     2882         * @param WP_Post $post    Post object.
     2883         */
     2884        $strings  = apply_filters( 'media_view_strings', $strings,  $post );
     2885
    25782886        $strings['settings'] = $settings;
    25792887
    25802888        wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
    … …  
    25942902        add_action( 'wp_footer', 'wp_print_media_templates' );
    25952903        add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );
    25962904
     2905        /**
     2906         * Fires at the conclusion of wp_enqueue_media().
     2907         *
     2908         * @since 3.5.0
     2909         */
    25972910        do_action( 'wp_enqueue_media' );
    25982911}
    25992912
    26002913/**
    2601  * Retrieve media attached to the passed post
     2914 * Retrieve media attached to the passed post.
    26022915 *
    26032916 * @since 3.6.0
    26042917 *
    … …  
    26192932                'order' => 'ASC',
    26202933        );
    26212934
     2935        /**
     2936         * Filter arguments used to retrieve media attached to the given post.
     2937         *
     2938         * @since 3.6.0
     2939         *
     2940         * @param array  $args Post query arguments.
     2941         * @param string $type Mime type of the desired media.
     2942         * @param mixed  $post Post ID or object.
     2943         */
    26222944        $args = apply_filters( 'get_attached_media_args', $args, $type, $post );
    26232945
    26242946        $children = get_children( $args );
    26252947
     2948        /**
     2949         * Filter the
     2950         *
     2951         * @since 3.6.0
     2952         *
     2953         * @param array  $children Associative array of media attached to the given post.
     2954         * @param string $type     Mime type of the media desired.
     2955         * @param mixed  $post     Post ID or object.
     2956         */
    26262957        return (array) apply_filters( 'get_attached_media', $children, $type, $post );
    26272958}
    26282959
    … …  
    26542985}
    26552986
    26562987/**
    2657  * Retrieve galleries from the passed post's content
     2988 * Retrieve galleries from the passed post's content.
    26582989 *
    26592990 * @since 3.6.0
    26602991 *
    2661  * @param mixed $post Optional. Post ID or object.
    2662  * @param boolean $html Whether to return HTML or data in the array
     2992 * @param int|WP_Post $post Optional. Post ID or object.
     2993 * @param bool        $html Whether to return HTML or data in the array
    26632994 * @return array A list of arrays, each containing gallery data and srcs parsed
    26642995 *              from the expanded shortcode
    26652996 */
    … …  
    26953026                }
    26963027        }
    26973028
     3029        /**
     3030         * Filter the list of galleries found in the post content.
     3031         *
     3032         * @since 3.6.0
     3033         *
     3034         * @param array   $galleries Associative array of galleries found in the post content.
     3035         * @param WP_Post $post      Post object.
     3036         */
    26983037        return apply_filters( 'get_post_galleries', $galleries, $post );
    26993038}
    27003039
    … …  
    27033042 *
    27043043 * @since 3.6.0
    27053044 *
    2706  * @param mixed $post Optional. Post ID or object.
    2707  * @param boolean $html Whether to return HTML or data
     3045 * @param int|WP_Post $post Optional. Post ID or object.
     3046 * @param bool        $html Whether to return HTML or data
    27083047 * @return string|array Gallery data and srcs parsed from the expanded shortcode
    27093048 */
    27103049function get_post_gallery( $post = 0, $html = true ) {
    27113050        $galleries = get_post_galleries( $post, $html );
    27123051        $gallery = reset( $galleries );
    27133052
     3053        /**
     3054         * Filter the found post gallery.
     3055         *
     3056         * @since 3.6.0
     3057         *
     3058         * @param array       $gallery   The first-found post gallery.
     3059         * @param int|WP_Post $post      Post ID or object.
     3060         * @param array       $galleries Associative array of all found post galleries.
     3061         */
    27143062        return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
    27153063}
    27163064