Make WordPress Core

Changeset 28128


Ignore:
Timestamp:
04/15/2014 01:35:49 AM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-includes/media.php.

Props scottlee for the initial patch. Props kpdesign, DrewAPicture.
Fixes #27718.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r28108 r28128  
    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
     
    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.
     
    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);
     
    274296 * @since 2.5.0
    275297 *
    276  * @uses apply_filters() The 'get_image_tag_class' filter is the IMG element
    277  *      class attribute.
    278  * @uses apply_filters() The 'get_image_tag' filter is the full IMG element with
    279  *      all attributes.
    280  *
    281298 * @param int $id Attachment ID.
    282299 * @param string $alt Image Description for the alt attribute.
     
    294311
    295312    $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
    296     $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
     313
     314    /**
     315     * Filter the value of the attachment's image tag class attribute.
     316     *
     317     * @since 2.6.0
     318     *
     319     * @param string $class CSS class name or space-separated list of classes.
     320     * @param int    $id    Attachment ID.
     321     * @param string $align Part of the class name for aligning the image.
     322     * @param string $size  Optional. Default is 'medium'.
     323     */
     324    $class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
    297325
    298326    $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />';
    299327
     328    /**
     329     * Filter the HTML content for the image tag.
     330     *
     331     * @since 2.6.0
     332     *
     333     * @param string $html  HTML content for the image.
     334     * @param int    $id    Attachment ID.
     335     * @param string $alt   Alternate text.
     336     * @param string $title Attachment title.
     337     * @param string $align Part of the class name for aligning the image.
     338     * @param string $size  Optional. Default is 'medium'.
     339     */
    300340    $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
    301341
     
    375415 *
    376416 * @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.
    379417 *
    380418 * @param int        $orig_w Original width in pixels.
     
    394432        return false;
    395433
    396     // plugins can use this to provide custom resize dimensions
     434    /**
     435     * Filter whether to preempt calculating the image resize dimensions.
     436     *
     437     * Passing a non-null value to the filter will effectively short-circuit
     438     * image_resize_dimensions(), returning that value instead.
     439     *
     440     * @since 3.4.0
     441     *
     442     * @param null|mixed $null   Whether to preempt output of the resize dimensions.
     443     * @param int        $orig_w Original width in pixels.
     444     * @param int        $orig_h Original height in pixels.
     445     * @param int        $dest_w New width in pixels.
     446     * @param int        $dest_h New height in pixels.
     447     * @param bool|array $crop   Whether to crop image to specified height and width or resize.
     448     *                           An array can specify positioning of the crop area. Default false.
     449     */
    397450    $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
    398451    if ( null !== $output )
     
    579632        $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
    580633
     634    /**
     635     * Filter the list of intermediate image sizes.
     636     *
     637     * @since 2.5.0
     638     *
     639     * @param array $image_sizes An array of intermediate image sizes. Defaults
     640     *                           are 'thumbnail', 'medium', 'large'.
     641     */
    581642    return apply_filters( 'intermediate_image_sizes', $image_sizes );
    582643}
     
    603664
    604665    if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
     666        /** This filter is documented in wp-includes/post.php */
    605667        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
    606668        $src_file = $icon_dir . '/' . wp_basename($src);
     
    620682 * browser scale down the image.
    621683 *
     684 * @since 2.5.0
     685 *
    622686 * @see add_image_size()
    623  * @uses apply_filters() Calls 'wp_get_attachment_image_attributes' hook on attributes array
    624687 * @uses wp_get_attachment_image_src() Gets attachment file URL and dimensions
    625  * @since 2.5.0
    626688 *
    627689 * @param int $attachment_id Image attachment ID.
     
    652714
    653715        $attr = wp_parse_args($attr, $default_attr);
     716
     717        /**
     718         * Filter the list of attachment image attributes.
     719         *
     720         * @since 2.8.0
     721         *
     722         * @param mixed $attr          Attributes for the image markup.
     723         * @param int   $attachment_id Image attachment ID.
     724         */
    654725        $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
    655726        $attr = array_map( 'esc_attr', $attr );
     
    9641035    $size_class = sanitize_html_class( $size );
    9651036    $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
     1037
     1038    /**
     1039     * Filter the default gallery shortcode CSS styles.
     1040     *
     1041     * @since 2.5.0
     1042     *
     1043     * @param string $gallery_style Default gallery shortcode CSS styles.
     1044     * @param string $gallery_div   Opening HTML div container for the gallery shortcode output.
     1045     */
    9661046    $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
    9671047
     
    10991179     *
    11001180     * @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.
     1181     * @param array  $attr   An array of shortcode attributes.
    11031182     */
    11041183    $output = apply_filters( 'post_playlist', '', $attr );
     
    12571336    if ( 1 === $instance ) {
    12581337        /**
    1259          * Hook to print and enqueue playlist scripts, styles, and JavaScript templates.
     1338         * Print and enqueue playlist scripts, styles, and JavaScript templates.
    12601339         *
    12611340         * @since 3.9.0
     
    13001379 */
    13011380function wp_mediaelement_fallback( $url ) {
     1381    /**
     1382     * Filter the Mediaelement fallback output for no-JS.
     1383     *
     1384     * @since 3.6.0
     1385     *
     1386     * @param string $output Fallback output for no-JS.
     1387     * @param string $url    Media file URL.
     1388     */
    13021389    return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
    13031390}
    13041391
    13051392/**
    1306  * Return a filtered list of WP-supported audio formats
     1393 * Return a filtered list of WP-supported audio formats.
    13071394 *
    13081395 * @since 3.6.0
     
    13101397 */
    13111398function wp_get_audio_extensions() {
     1399    /**
     1400     * Filter the list of supported audio formats.
     1401     *
     1402     * @since 3.6.0
     1403     *
     1404     * @param array $extensions An array of support audio formats. Defaults are
     1405     *                          'mp3', 'ogg', 'wma', 'm4a', 'wav'.
     1406     */
    13121407    return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'wma', 'm4a', 'wav' ) );
    13131408}
     
    13351430
    13361431    /**
    1337      * Filter the editable list of keys to lookup data from an attachment's metadata.
     1432     * Filter the editable list of keys to look up data from an attachment's metadata.
    13381433     *
    13391434     * @since 3.9.0
     
    13411436     * @param array   $fields     Key/value pairs of field keys to labels.
    13421437     * @param WP_Post $attachment Attachment object.
     1438     * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
    13431439     */
    13441440    return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
     
    13841480     * @param int    $instances Unique numeric ID of this audio shortcode instance.
    13851481     */
    1386     $html = '';
    1387     $html = apply_filters( 'wp_audio_shortcode_override', $html, $attr, $content, $instances );
     1482    $html = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances );
    13881483    if ( '' !== $html )
    13891484        return $html;
     
    14341529    }
    14351530
     1531    /**
     1532     * Filter the media library used for the audio shortcode.
     1533     *
     1534     * @since 3.6.0
     1535     *
     1536     * @param string $library Media library used for the audio shortcode.
     1537     */
    14361538    $library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );
    14371539    if ( 'mediaelement' === $library && did_action( 'init' ) ) {
     
    14401542    }
    14411543
     1544    /**
     1545     * Filter the class attribute for the audio shortcode output container.
     1546     *
     1547     * @since 3.6.0
     1548     *
     1549     * @param string $class CSS class or list of space-separated classes.
     1550     */
    14421551    $atts = array(
    14431552        'class'    => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ),
     
    14811590    $html .= '</audio>';
    14821591
     1592    /**
     1593     * Filter the audio shortcode output.
     1594     *
     1595     * @since 3.6.0
     1596     *
     1597     * @param string $html    Audio shortcode HTML output.
     1598     * @param array  $atts    Array of audio shortcode attributes.
     1599     * @param string $audio   Audio file.
     1600     * @param int    $post_id Post ID.
     1601     * @param string $library Media library used for the audio shortcode.
     1602     */
    14831603    return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );
    14841604}
     
    14921612 */
    14931613function wp_get_video_extensions() {
     1614    /**
     1615     * Filter the list of supported video formats.
     1616     *
     1617     * @since 3.6.0
     1618     *
     1619     * @param array $extensions An array of support video formats. Defaults are
     1620     *                          'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'.
     1621     */
    14941622    return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ) );
    14951623}
     
    16161744    }
    16171745
     1746    /**
     1747     * Filter the media library used for the video shortcode.
     1748     *
     1749     * @since 3.6.0
     1750     *
     1751     * @param string $library Media library used for the video shortcode.
     1752     */
    16181753    $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
    16191754    if ( 'mediaelement' === $library && did_action( 'init' ) ) {
     
    16221757    }
    16231758
     1759    /**
     1760     * Filter the class attribute for the video shortcode output container.
     1761     *
     1762     * @since 3.6.0
     1763     *
     1764     * @param string $class CSS class or list of space-separated classes.
     1765     */
    16241766    $atts = array(
    16251767        'class'    => apply_filters( 'wp_video_shortcode_class', 'wp-video-shortcode' ),
     
    16781820
    16791821    $html = sprintf( '<div style="width: %dpx; max-width: 100%%;" class="wp-video">%s</div>', $width, $html );
     1822
     1823    /**
     1824     * Filter the output of the video shortcode.
     1825     *
     1826     * @since 3.6.0
     1827     *
     1828     * @param string $html    Video shortcode HTML output.
     1829     * @param array  $atts    Array of video shortcode attributes.
     1830     * @param string $video   Video file.
     1831     * @param int    $post_id Post ID.
     1832     * @param string $library Media library used for the video shortcode.
     1833     */
    16801834    return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library );
    16811835}
     
    17321886
    17331887    $adjacent = $prev ? 'previous' : 'next';
     1888
     1889    /**
     1890     * Filter the adjacent image link.
     1891     *
     1892     * The dynamic portion of the hook name, $adjacent, refers to the type of adjacency,
     1893     * either 'next', or 'previous'.
     1894     *
     1895     * @since 3.5.0
     1896     *
     1897     * @param string $output        Adjacent image HTML markup.
     1898     * @param int    $attachment_id Attachment ID
     1899     * @param string $size          Image size.
     1900     * @param string $text          Link text.
     1901     */
    17341902    echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
    17351903}
     
    18672035    $height = min( ceil( $width * 1.5 ), 1000 );
    18682036
     2037    /**
     2038     * Filter the default array of embed dimensions.
     2039     *
     2040     * @since 2.9.0
     2041     *
     2042     * @param int $width  Width of the embed in pixels.
     2043     * @param int $height Height of the embed in pixels.
     2044     */
    18692045    return apply_filters( 'embed_defaults', compact( 'width', 'height' ) );
    18702046}
     
    19602136 */
    19612137function wp_maybe_load_embeds() {
    1962     if ( ! apply_filters( 'load_default_embeds', true ) )
     2138    /**
     2139     * Filter whether to load the default embed handlers.
     2140     *
     2141     * Returning a falsey value will prevent loading the default embed handlers.
     2142     *
     2143     * @since 2.9.0
     2144     *
     2145     * @param bool $maybe_load_embeds Whether to load the embeds library. Default true.
     2146     */
     2147    if ( ! apply_filters( 'load_default_embeds', true ) ) {
    19632148        return;
     2149    }
     2150
    19642151    wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
     2152
     2153    /**
     2154     * Filter the audio embed handler callback.
     2155     *
     2156     * @since 3.6.0
     2157     *
     2158     * @param callback $handler Audio embed handler callback function.
     2159     */
    19652160    wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . join( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );
     2161
     2162    /**
     2163     * Filter the video embed handler callback.
     2164     *
     2165     * @since 3.6.0
     2166     *
     2167     * @param callback $handler Video embed handler callback function.
     2168     */
    19662169    wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
    19672170}
     
    19882191    }
    19892192
     2193    /**
     2194     * Filter the Google Video embed output.
     2195     *
     2196     * @since 2.9.0
     2197     *
     2198     * @param string $html    Google Video HTML embed markup.
     2199     * @param array  $matches The regex matches from the provided regex.
     2200     * @param array  $attr    An array of embed attributes.
     2201     * @param string $url     The original URL that was matched by the regex.
     2202     * @param array  $rawattr The original unmodified attributes.
     2203     */
    19902204    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 );
    19912205}
     
    20042218function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
    20052219    $audio = sprintf( '[audio src="%s" /]', esc_url( $url ) );
     2220
     2221    /**
     2222     * Filter the audio embed output.
     2223     *
     2224     * @since 3.6.0
     2225     *
     2226     * @param string $audio   Audio embed output.
     2227     * @param array  $attr    An array of embed attributes.
     2228     * @param string $url     The original URL that was matched by the regex.
     2229     * @param array  $rawattr The original unmodified attributes.
     2230     */
    20062231    return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
    20072232}
     
    20252250    }
    20262251    $video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) );
     2252
     2253    /**
     2254     * Filter the video embed output.
     2255     *
     2256     * @since 3.6.0
     2257     *
     2258     * @param string $video   Video embed output.
     2259     * @param array  $attr    An array of embed attributes.
     2260     * @param string $url     The original URL that was matched by the regex.
     2261     * @param array  $rawattr The original unmodified attributes.
     2262     */
    20272263    return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr );
    20282264}
     
    20582294    $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
    20592295    $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;
     2296
     2297    /**
     2298     * Filter the maximum upload size allowed in php.ini.
     2299     *
     2300     * @since 2.5.0
     2301     *
     2302     * @param int $size    Max upload size limit in bytes.
     2303     * @param int $u_bytes Maximum upload filesize in bytes.
     2304     * @param int $p_bytes Maximum size of POST data in bytes.
     2305     */
     2306    return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
    20622307}
    20632308
     
    21262371    require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
    21272372
    2128     $implementations = apply_filters( 'wp_image_editors',
    2129         array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
     2373    /**
     2374     * Filter the list of image editing library classes.
     2375     *
     2376     * @since 3.5.0
     2377     *
     2378     * @param array $image_editors List of available image editors. Defaults are
     2379     *                             'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'.
     2380     */
     2381    $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
    21302382
    21312383    foreach ( $implementations as $implementation ) {
     
    21812433        $defaults['multi_selection'] = false;
    21822434
     2435    /**
     2436     * Filter the Plupload default settings.
     2437     *
     2438     * @since 3.4.0
     2439     *
     2440     * @param array $defaults Default Plupload settings array.
     2441     */
    21832442    $defaults = apply_filters( 'plupload_default_settings', $defaults );
    21842443
     
    21872446    );
    21882447
     2448    /**
     2449     * Filter the Plupload default parameters.
     2450     *
     2451     * @since 3.4.0
     2452     *
     2453     * @param array $params Default Plupload parameters array.
     2454     */
    21892455    $params = apply_filters( 'plupload_default_params', $params );
    21902456    $params['_wpnonce'] = wp_create_nonce( 'media-form' );
     
    22732539    if ( $meta && 'image' === $type ) {
    22742540        $sizes = array();
     2541
    22752542        /** This filter is documented in wp-admin/includes/media.php */
    22762543        $possible_sizes = apply_filters( 'image_size_names_choose', array(
     
    22872554        // way to check the image metadata, which we do second.
    22882555        foreach ( $possible_sizes as $size => $label ) {
     2556
     2557            /** This filter is documented in wp-includes/media.php */
    22892558            if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
    22902559                if ( ! $downsize[3] )
     
    23612630        $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
    23622631
     2632    /**
     2633     * Filter the attachment data prepared for JavaScript.
     2634     *
     2635     * @since 3.5.0
     2636     *
     2637     * @param array      $response   Array of prepared attachment data.
     2638     * @param int|object $attachment Attachment ID or object.
     2639     * @param array      $meta       Array of attachment meta data.
     2640     */
    23632641    return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
    23642642}
     
    23932671    );
    23942672
     2673    /** This filter is documented in wp-admin/includes/media.php */
    23952674    $tabs = apply_filters( 'media_upload_tabs', $tabs );
    23962675    unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
     
    24282707        'tabUrl'    => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
    24292708        'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
     2709        /** This filter is documented in wp-admin/includes/media.php */
    24302710        'captions'  => ! apply_filters( 'disable_captions', '' ),
    24312711        'nonce'     => array(
     
    25732853    );
    25742854
     2855    /**
     2856     * Filter the media view settings.
     2857     *
     2858     * @since 3.5.0
     2859     *
     2860     * @param array   $settings List of media view settings.
     2861     * @param WP_Post $post     Post object.
     2862     */
    25752863    $settings = apply_filters( 'media_view_settings', $settings, $post );
    2576     $strings  = apply_filters( 'media_view_strings',  $strings,  $post );
     2864
     2865    /**
     2866     * Filter the media view strings.
     2867     *
     2868     * @since 3.5.0
     2869     *
     2870     * @param array   $strings List of media view strings.
     2871     * @param WP_Post $post    Post object.
     2872     */
     2873    $strings = apply_filters( 'media_view_strings', $strings,  $post );
    25772874
    25782875    $strings['settings'] = $settings;
     
    25952892    add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );
    25962893
     2894    /**
     2895     * Fires at the conclusion of wp_enqueue_media().
     2896     *
     2897     * @since 3.5.0
     2898     */
    25972899    do_action( 'wp_enqueue_media' );
    25982900}
    25992901
    26002902/**
    2601  * Retrieve media attached to the passed post
     2903 * Retrieve media attached to the passed post.
    26022904 *
    26032905 * @since 3.6.0
     
    26202922    );
    26212923
     2924    /**
     2925     * Filter arguments used to retrieve media attached to the given post.
     2926     *
     2927     * @since 3.6.0
     2928     *
     2929     * @param array  $args Post query arguments.
     2930     * @param string $type Mime type of the desired media.
     2931     * @param mixed  $post Post ID or object.
     2932     */
    26222933    $args = apply_filters( 'get_attached_media_args', $args, $type, $post );
    26232934
    26242935    $children = get_children( $args );
    26252936
     2937    /**
     2938     * Filter the
     2939     *
     2940     * @since 3.6.0
     2941     *
     2942     * @param array  $children Associative array of media attached to the given post.
     2943     * @param string $type     Mime type of the media desired.
     2944     * @param mixed  $post     Post ID or object.
     2945     */
    26262946    return (array) apply_filters( 'get_attached_media', $children, $type, $post );
    26272947}
     
    26552975
    26562976/**
    2657  * Retrieve galleries from the passed post's content
     2977 * Retrieve galleries from the passed post's content.
    26582978 *
    26592979 * @since 3.6.0
    26602980 *
    2661  * @param mixed $post Optional. Post ID or object.
    2662  * @param boolean $html Whether to return HTML or data in the array
     2981 * @param int|WP_Post $post Optional. Post ID or object.
     2982 * @param bool        $html Whether to return HTML or data in the array.
    26632983 * @return array A list of arrays, each containing gallery data and srcs parsed
    2664  *      from the expanded shortcode
     2984 *               from the expanded shortcode.
    26652985 */
    26662986function get_post_galleries( $post, $html = true ) {
     
    26963016    }
    26973017
     3018    /**
     3019     * Filter the list of all found galleries in the given post.
     3020     *
     3021     * @since 3.6.0
     3022     *
     3023     * @param array   $galleries Associative array of all found post galleries.
     3024     * @param WP_Post $post      Post object.
     3025     */
    26983026    return apply_filters( 'get_post_galleries', $galleries, $post );
    26993027}
     
    27043032 * @since 3.6.0
    27053033 *
    2706  * @param mixed $post Optional. Post ID or object.
    2707  * @param boolean $html Whether to return HTML or data
    2708  * @return string|array Gallery data and srcs parsed from the expanded shortcode
     3034 * @param int|WP_Post $post Optional. Post ID or object.
     3035 * @param bool        $html Whether to return HTML or data.
     3036 * @return string|array Gallery data and srcs parsed from the expanded shortcode.
    27093037 */
    27103038function get_post_gallery( $post = 0, $html = true ) {
     
    27123040    $gallery = reset( $galleries );
    27133041
     3042    /**
     3043     * Filter the first-found post gallery.
     3044     *
     3045     * @since 3.6.0
     3046     *
     3047     * @param array       $gallery   The first-found post gallery.
     3048     * @param int|WP_Post $post      Post ID or object.
     3049     * @param array       $galleries Associative array of all found post galleries.
     3050     */
    27143051    return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
    27153052}
Note: See TracChangeset for help on using the changeset viewer.