WordPress.org

Make WordPress Core

Changeset 26915


Ignore:
Timestamp:
01/07/2014 04:06:48 PM (7 years ago)
Author:
johnbillion
Message:

Inline documentation for core shortcode attributes.

Props DrewAPicture, johnbillion.
Fixes #25661.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r25868 r26915  
    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.
     
    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.
     
    189196                     *
    190197                     * @since 2.9.0
     198                     *
     199                     * @see WP_Embed::shortcode()
    191200                     *
    192201                     * @param mixed  $cache   The cached HTML result, stored in post meta.
  • trunk/src/wp-includes/media.php

    r26589 r26915  
    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
    629  */
    630 function img_caption_shortcode($attr, $content = null) {
     636 * @return string HTML content to display the caption.
     637 */
     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'] ) ) {
     
    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;
     
    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 );
     
    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
     
    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;
     
    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.
     
    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;
     
    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.
     
    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     */
Note: See TracChangeset for help on using the changeset viewer.