Make WordPress Core

Ticket #25661: 25661.diff

File 25661.diff, 10.6 KB (added by johnbillion, 12 years ago)
  • wp-includes/class-wp-embed.php

    diff --git wp-includes/class-wp-embed.php wp-includes/class-wp-embed.php
    index 275c280..94db0bf 100644
    class WP_Embed { 
    130130         * @uses get_post_meta()
    131131         * @uses update_post_meta()
    132132         *
    133          * @param array $attr Shortcode attributes.
     133         * @param array $attr {
     134         *     Shortcode attributes. Optional.
     135         *
     136         *     @type int $width  The width of the embed in pixels.
     137         *     @type int $height The height of the embed in pixels.
     138         * }
    134139         * @param string $url The URL attempting to be embedded.
    135140         * @return string The embed HTML on success, otherwise the original URL.
    136141         */
    class WP_Embed { 
    160165                                                 *
    161166                                                 * @param mixed  $return The shortcode callback function to call.
    162167                                                 * @param string $url    The attempted embed URL.
    163                                                  * @param array  $attr   An array of shortcode attributes.
     168                                                 * @param array  $attr   An array of shortcode attributes. @see WP_Embed::shortcode()
    164169                                                 */
    165170                                                return apply_filters( 'embed_handler_html', $return, $url, $attr );
    166171                                }
    class WP_Embed { 
    191196                                         *
    192197                                         * @param mixed  $cache   The cached HTML result, stored in post meta.
    193198                                         * @param string $url     The attempted embed URL.
    194                                          * @param array  $attr    An array of shortcode attributes.
     199                                         * @param array  $attr    An array of shortcode attributes. @see WP_Embed::shortcode()
    195200                                         * @param int    $post_ID Post ID.
    196201                                         */
    197202                                        return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index 8e150a5..b99096b 100644
    add_shortcode('caption', 'img_caption_shortcode'); 
    623623 *
    624624 * @since 2.6.0
    625625 *
    626  * @param array $attr Attributes attributed to the shortcode.
     626 * @param array $attr {
     627 *     Attributes of the caption shortcode.
     628 *
     629 *     @type string $id      The ID of the div element for the caption.
     630 *     @type string $align   The class name that aligns the caption. Default 'alignnone'. Accepts 'alignleft',
     631 *                           'aligncenter', alignright', 'alignnone'.
     632 *     @type int    $width   The width of the caption.
     633 *     @type string $caption The caption text.
     634 * }
    627635 * @param string $content Optional. Shortcode content.
    628636 * @return string
    629637 */
    function img_caption_shortcode($attr, $content = null) { 
    636644                }
    637645        }
    638646
    639         // Allow plugins/themes to override the default caption template.
    640         $output = apply_filters('img_caption_shortcode', '', $attr, $content);
     647        /**
     648         * Allow plugins/themes to short-circuit the default caption template.
     649         *
     650         * If the filtered output isn't empty, it will be used instead of generating the default caption template.
     651         *
     652         * @since 2.6.0
     653         *
     654         * @param string $output  The caption output. Default ''.
     655         * @param array  $attr    Attributes of the caption shortcode. @see img_caption_shortcode()
     656         * @param string $content The image element, possibly wrapped in a hyperlink.
     657         */
     658        $output = '';
     659        $output = apply_filters( 'img_caption_shortcode', $output, $attr, $content );
    641660        if ( $output != '' )
    642661                return $output;
    643662
    function img_caption_shortcode($attr, $content = null) { 
    665684         *
    666685         * @since 3.7.0
    667686         *
    668          * @param int $caption_width Width in pixels. To remove this inline style, return zero.
    669          * @param array $atts {
    670          *     The attributes of the caption shortcode.
    671          *
    672          *     @type string 'id'      The ID of the div element for the caption.
    673          *     @type string 'align'   The class name that aligns the caption. Default 'alignnone'.
    674          *     @type int    'width'   The width of the image being captioned.
    675          *     @type string 'caption' The image's caption.
    676          * }
    677          * @param string $content The image element, possibly wrapped in a hyperlink.
     687         * @param int    $caption_width Width in pixels. To remove this inline style, return zero.
     688         * @param array  $atts          Attributes of the caption shortcode. @see img_caption_shortcode()
     689         * @param string $content       The image element, possibly wrapped in a hyperlink.
    678690         */
    679691        $caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content );
    680692
    add_shortcode('gallery', 'gallery_shortcode'); 
    696708 *
    697709 * @since 2.5.0
    698710 *
    699  * @param array $attr Attributes of the shortcode.
     711 * @param array $attr {
     712 *     Attributes of the gallery shortcode.
     713 *
     714 *     @type string $order      The order of the images in the gallery. Default 'ASC'. Accepts 'ASC', 'DESC'.
     715 *     @type string $orderby    The field to use when ordering the images. Default 'menu_order ID'. Accepts any
     716 *                              valid SQL ORDERBY statement.
     717 *     @type int    $id         The post ID. Default The current post ID.
     718 *     @type string $itemtag    The HTML tag to use for each image in the gallery. Default 'dl'.
     719 *     @type string $icontag    The HTML tag to use for each image's icon. Default 'dt'.
     720 *     @type string $captiontag The HTML tag to use for each image's caption. Default 'dd'.
     721 *     @type int    $columns    The number of columns of images to display. Default 3.
     722 *     @type string $size       The size of the images to display. Default 'thumbnail'.
     723 *     @type string $ids        A comma-separated list of IDs of attachments to display. Default ''.
     724 *     @type string $include    A comma-separated list of IDs of attachments to include. Default ''.
     725 *     @type string $exclude    A comma-separated list of IDs of attachments to exclude. Default ''.
     726 *     @type string $link       What to link each image to. Default '' (links to the attachment page). Accepts 'file', 'none'.
     727 * }
    700728 * @return string HTML content to display gallery.
    701729 */
    702730function gallery_shortcode($attr) {
    function gallery_shortcode($attr) { 
    712740                $attr['include'] = $attr['ids'];
    713741        }
    714742
    715         // Allow plugins/themes to override the default gallery template.
    716         $output = apply_filters('post_gallery', '', $attr);
     743        /**
     744         * Allow plugins/themes to short-circuit the default gallery template.
     745         *
     746         * If the filtered output isn't empty, it will be used instead of generating the default gallery template.
     747         *
     748         * @since 2.5.0
     749         *
     750         * @param string $output The gallery output. Default ''.
     751         * @param array  $attr   Attributes of the gallery shortcode. @see gallery_shortcode()
     752         */
     753        $output = apply_filters( 'post_gallery', '', $attr );
    717754        if ( $output != '' )
    718755                return $output;
    719756
    function wp_get_audio_extensions() { 
    875912 *
    876913 * @since 3.6.0
    877914 *
    878  * @param array  $attr    Attributes of the shortcode.
     915 * @param array $attr {
     916 *     Attributes of the shortcode.
     917 *
     918 *     @type string $src      The URL to the source of the audio file. Default ''.
     919 *     @type string $loop     The 'loop' attribute for the `<audio>` element. Default ''.
     920 *     @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default ''.
     921 *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default ''.
     922 *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
     923 *     @type string $id       The 'id' attribute for the `<audio>` element. Default 'audio-{$post_id}-{$instances}'.
     924 *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
     925 * }
    879926 * @param string $content Optional. Shortcode content.
    880927 * @return string HTML content to display audio.
    881928 */
    function wp_audio_shortcode( $attr, $content = '' ) { 
    886933        $instances++;
    887934
    888935        /**
    889          * Override the default audio shortcode.
     936         * Short-circuit the default audio template.
    890937         *
    891          * @since 3.7.0
     938         * If the filtered output isn't empty, it will be used instead of generating the default audio template.
     939         *
     940         * @since 3.6.0
    892941         *
    893          * @param null              Empty variable to be replaced with shortcode markup.
    894          * @param array  $attr      Attributes of the shortcode.
     942         * @param string $html      Empty variable to be replaced with shortcode markup.
     943         * @param array  $attr      Attributes of the shortcode. @see wp_audio_shortcode()
    895944         * @param string $content   Shortcode content.
    896945         * @param int    $instances Unique numeric ID of this audio shortcode instance.
    897946         */
    898         $html = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances );
     947        $html = '';
     948        $html = apply_filters( 'wp_audio_shortcode_override', $html, $attr, $content, $instances );
    899949        if ( '' !== $html )
    900950                return $html;
    901951
    function wp_get_video_extensions() { 
    10121062 *
    10131063 * @since 3.6.0
    10141064 *
    1015  * @param array  $attr    Attributes of the shortcode.
     1065 * @param array $attr {
     1066 *     Attributes of the shortcode.
     1067 *
     1068 *     @type string $src      The URL to the source of the video file. Default ''.
     1069 *     @type int    $height   The height of the video embed in pixels. Default 360.
     1070 *     @type int    $width    The width of the video embed in pixels. Default $content_width or 640.
     1071 *     @type string $poster   The 'poster' attribute for the `<video>` element. Default ''.
     1072 *     @type string $loop     The 'loop' attribute for the `<video>` element. Default ''.
     1073 *     @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default ''.
     1074 *     @type string $preload  The 'preload' attribute for the `<video>` element. Default 'metadata'.
     1075 *     @type string $class    The 'class' attribute for the `<video>` element. Default 'wp-video-shortcode'.
     1076 *     @type string $id       The 'id' attribute for the `<video>` element. Default 'video-{$post_id}-{$instances}'.
     1077 * }
    10161078 * @param string $content Optional. Shortcode content.
    10171079 * @return string HTML content to display video.
    10181080 */
    function wp_video_shortcode( $attr, $content = '' ) { 
    10241086        $instances++;
    10251087
    10261088        /**
    1027          * Override the default video shortcode.
     1089         * Short-circuit the default video template.
    10281090         *
    1029          * @since 3.7.0
     1091         * If the filtered output isn't empty, it will be used instead of generating the default video template.
    10301092         *
    1031          * @param null              Empty variable to be replaced with shortcode markup.
    1032          * @param array  $attr      Attributes of the shortcode.
     1093         * @since 3.6.0
     1094         *
     1095         * @param string $html      Empty variable to be replaced with shortcode markup.
     1096         * @param array  $attr      Attributes of the shortcode. @see wp_video_shortcode()
    10331097         * @param string $content   Shortcode content.
    10341098         * @param int    $instances Unique numeric ID of this video shortcode instance.
    10351099         */
    1036         $html = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instances );
     1100        $html = '';
     1101        $html = apply_filters( 'wp_video_shortcode_override', $html, $attr, $content, $instances );
    10371102        if ( '' !== $html )
    10381103                return $html;
    10391104