Make WordPress Core

Ticket #25661: 25661.2.diff

File 25661.2.diff, 10.5 KB (added by DrewAPicture, 12 years ago)

Second pass + standards tweaks

  • src/wp-includes/media.php

     
    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      ID of the div element for the caption.
     630 *     @type string $align   Class name that aligns the caption. Default 'alignnone'. Accepts 'alignleft',
     631 *                           'aligncenter', alignright', 'alignnone'.
     632 *     @type int    $width   The width of the caption, in pixels.
     633 *     @type string $caption The caption text.
     634 * }
    627635 * @param string $content Optional. Shortcode content.
    628  * @return string
     636 * @return string HTML content to display the caption.
    629637 */
    630 function img_caption_shortcode($attr, $content = null) {
     638function img_caption_shortcode( $attr, $content = null ) {
    631639        // New-style shortcode with the caption inside the shortcode with the link and image tags.
    632640        if ( ! isset( $attr['caption'] ) ) {
    633641                if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
     
    636644                }
    637645        }
    638646
    639         // Allow plugins/themes to override the default caption template.
    640         $output = apply_filters('img_caption_shortcode', '', $attr, $content);
     647        /**
     648         * Filter the default caption shortcode output.
     649         *
     650         * If the filtered output isn't empty, it will be used instead of generating
     651         * the default caption template.
     652         *
     653         * @since 2.6.0
     654         *
     655         * @see img_caption_shortcode()
     656         *
     657         * @param string $output  The caption output. Default empty.
     658         * @param array  $attr    Attributes of the caption shortcode.
     659         * @param string $content The image element, possibly wrapped in a hyperlink.
     660         */
     661        $output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
    641662        if ( $output != '' )
    642663                return $output;
    643664
     
    665686         *
    666687         * @since 3.7.0
    667688         *
    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.
     689         * @see img_caption_shortcode()
    671690         *
    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.
     691         * @param int    $caption_width Width of the caption in pixels. To remove this inline style,
     692         *                              return zero.
     693         * @param array  $atts          Attributes of the caption shortcode.
     694         * @param string $content       The image element, possibly wrapped in a hyperlink.
    678695         */
    679696        $caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content );
    680697
     
    696713 *
    697714 * @since 2.5.0
    698715 *
    699  * @param array $attr Attributes of the shortcode.
     716 * @param array $attr {
     717 *     Attributes of the gallery shortcode.
     718 *
     719 *     @type string $order      Order of the images in the gallery. Default 'ASC'. Accepts 'ASC', 'DESC'.
     720 *     @type string $orderby    The field to use when ordering the images. Default 'menu_order ID'.
     721 *                              Accepts any valid SQL ORDERBY statement.
     722 *     @type int    $id         Post ID.
     723 *     @type string $itemtag    HTML tag to use for each image in the gallery. Default 'dl'.
     724 *     @type string $icontag    HTML tag to use for each image's icon. Default 'dt'.
     725 *     @type string $captiontag HTML tag to use for each image's caption. Default 'dd'.
     726 *     @type int    $columns    Number of columns of images to display. Default 3.
     727 *     @type string $size       Size of the images to display. Default 'thumbnail'.
     728 *     @type string $ids        A comma-separated list of IDs of attachments to display. Default empty.
     729 *     @type string $include    A comma-separated list of IDs of attachments to include. Default empty.
     730 *     @type string $exclude    A comma-separated list of IDs of attachments to exclude. Default empty.
     731 *     @type string $link       What to link each image to. Default empty (links to the attachment page).
     732 *                              Accepts 'file', 'none'.
     733 * }
    700734 * @return string HTML content to display gallery.
    701735 */
    702 function gallery_shortcode($attr) {
     736function gallery_shortcode( $attr ) {
    703737        $post = get_post();
    704738
    705739        static $instance = 0;
     
    712746                $attr['include'] = $attr['ids'];
    713747        }
    714748
    715         // Allow plugins/themes to override the default gallery template.
    716         $output = apply_filters('post_gallery', '', $attr);
     749        /**
     750         * Filter the default gallery shortcode output.
     751         *
     752         * If the filtered output isn't empty, it will be used instead of generating
     753         * the default gallery template.
     754         *
     755         * @since 2.5.0
     756         *
     757         * @see gallery_shortcode()
     758         *
     759         * @param string $output The gallery output. Default empty.
     760         * @param array  $attr   Attributes of the gallery shortcode.
     761         */
     762        $output = apply_filters( 'post_gallery', '', $attr );
    717763        if ( $output != '' )
    718764                return $output;
    719765
     
    875921 *
    876922 * @since 3.6.0
    877923 *
    878  * @param array  $attr    Attributes of the shortcode.
     924 * @param array $attr {
     925 *     Attributes of the audio shortcode.
     926 *
     927 *     @type string $src      URL to the source of the audio file. Default empty.
     928 *     @type string $loop     The 'loop' attribute for the `<audio>` element. Default empty.
     929 *     @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
     930 *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default empty.
     931 *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
     932 *     @type string $id       The 'id' attribute for the `<audio>` element. Default 'audio-{$post_id}-{$instances}'.
     933 *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
     934 * }
    879935 * @param string $content Optional. Shortcode content.
    880936 * @return string HTML content to display audio.
    881937 */
     
    886942        $instances++;
    887943
    888944        /**
    889          * Override the default audio shortcode.
     945         * Filter the default audio shortcode output.
    890946         *
    891          * @since 3.7.0
     947         * If the filtered output isn't empty, it will be used instead of generating the default audio template.
    892948         *
    893          * @param null              Empty variable to be replaced with shortcode markup.
    894          * @param array  $attr      Attributes of the shortcode.
     949         * @since 3.6.0
     950         *
     951         * @param string $html      Empty variable to be replaced with shortcode markup.
     952         * @param array  $attr      Attributes of the shortcode. @see wp_audio_shortcode()
    895953         * @param string $content   Shortcode content.
    896954         * @param int    $instances Unique numeric ID of this audio shortcode instance.
    897955         */
    898         $html = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances );
     956        $html = '';
     957        $html = apply_filters( 'wp_audio_shortcode_override', $html, $attr, $content, $instances );
    899958        if ( '' !== $html )
    900959                return $html;
    901960
     
    10121071 *
    10131072 * @since 3.6.0
    10141073 *
    1015  * @param array  $attr    Attributes of the shortcode.
     1074 * @param array $attr {
     1075 *     Attributes of the shortcode.
     1076 *
     1077 *     @type string $src      URL to the source of the video file. Default empty.
     1078 *     @type int    $height   Height of the video embed in pixels. Default 360.
     1079 *     @type int    $width    Width of the video embed in pixels. Default $content_width or 640.
     1080 *     @type string $poster   The 'poster' attribute for the `<video>` element. Default empty.
     1081 *     @type string $loop     The 'loop' attribute for the `<video>` element. Default empty.
     1082 *     @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty.
     1083 *     @type string $preload  The 'preload' attribute for the `<video>` element.
     1084 *                            Default 'metadata'.
     1085 *     @type string $class    The 'class' attribute for the `<video>` element.
     1086 *                            Default 'wp-video-shortcode'.
     1087 *     @type string $id       The 'id' attribute for the `<video>` element.
     1088 *                            Default 'video-{$post_id}-{$instances}'.
     1089 * }
    10161090 * @param string $content Optional. Shortcode content.
    10171091 * @return string HTML content to display video.
    10181092 */
     
    10241098        $instances++;
    10251099
    10261100        /**
    1027          * Override the default video shortcode.
     1101         * Filter the default video shortcode output.
    10281102         *
    1029          * @since 3.7.0
     1103         * If the filtered output isn't empty, it will be used instead of generating
     1104         * the default video template.
    10301105         *
    1031          * @param null              Empty variable to be replaced with shortcode markup.
    1032          * @param array  $attr      Attributes of the shortcode.
    1033          * @param string $content   Shortcode content.
     1106         * @since 3.6.0
     1107         *
     1108         * @see wp_video_shortcode()
     1109         *
     1110         * @param string $html      Empty variable to be replaced with shortcode markup.
     1111         * @param array  $attr      Attributes of the video shortcode.
     1112         * @param string $content   Video shortcode content.
    10341113         * @param int    $instances Unique numeric ID of this video shortcode instance.
    10351114         */
    10361115        $html = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instances );
  • src/wp-includes/class-wp-embed.php

     
    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  Width of the embed in pixels.
     137         *     @type int $height 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         */
     
    158163                                                 *
    159164                                                 * @since 2.9.0
    160165                                                 *
     166                                                 * @see WP_Embed::shortcode()
     167                                                 *
    161168                                                 * @param mixed  $return The shortcode callback function to call.
    162169                                                 * @param string $url    The attempted embed URL.
    163170                                                 * @param array  $attr   An array of shortcode attributes.
     
    189196                                         *
    190197                                         * @since 2.9.0
    191198                                         *
     199                                         * @see WP_Embed::shortcode()
     200                                         *
    192201                                         * @param mixed  $cache   The cached HTML result, stored in post meta.
    193202                                         * @param string $url     The attempted embed URL.
    194203                                         * @param array  $attr    An array of shortcode attributes.