WordPress.org

Make WordPress Core

Changeset 31305


Ignore:
Timestamp:
01/30/2015 04:05:52 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Rename $instances to $instance in wp_audio_shortcode() and wp_video_shortcode() for consistency with gallery_shortcode() and wp_playlist_shortcode().

see #31151.

File:
1 edited

Legend:

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

    r31304 r31305  
    14931493 *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default empty.
    14941494 *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
    1495  *     @type string $id       The 'id' attribute for the `<audio>` element. Default 'audio-{$post_id}-{$instances}'.
     1495 *     @type string $id       The 'id' attribute for the `<audio>` element. Default 'audio-{$post_id}-{$instance}'.
    14961496 *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
    14971497 * }
     
    15021502    $post_id = get_post() ? get_the_ID() : 0;
    15031503
    1504     static $instances = 0;
    1505     $instances++;
     1504    static $instance = 0;
     1505    $instance++;
    15061506
    15071507    /**
     
    15121512     * @since 3.6.0
    15131513     *
    1514      * @param string $html      Empty variable to be replaced with shortcode markup.
    1515      * @param array  $attr      Attributes of the shortcode. @see wp_audio_shortcode()
    1516      * @param string $content   Shortcode content.
    1517      * @param int    $instances Unique numeric ID of this audio shortcode instance.
    1518      */
    1519     $override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances );
     1514     * @param string $html     Empty variable to be replaced with shortcode markup.
     1515     * @param array  $attr     Attributes of the shortcode. @see wp_audio_shortcode()
     1516     * @param string $content  Shortcode content.
     1517     * @param int    $instance Unique numeric ID of this audio shortcode instance.
     1518     */
     1519    $override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instance );
    15201520    if ( '' !== $override ) {
    15211521        return $override;
     
    15931593    $html_atts = array(
    15941594        'class'    => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ),
    1595         'id'       => sprintf( 'audio-%d-%d', $post_id, $instances ),
     1595        'id'       => sprintf( 'audio-%d-%d', $post_id, $instance ),
    15961596        'loop'     => wp_validate_boolean( $atts['loop'] ),
    15971597        'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
     
    16131613
    16141614    $html = '';
    1615     if ( 'mediaelement' === $library && 1 === $instances ) {
     1615    if ( 'mediaelement' === $library && 1 === $instance ) {
    16161616        $html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
    16171617    }
     
    16261626            }
    16271627            $type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
    1628             $url = add_query_arg( '_', $instances, $atts[ $fallback ] );
     1628            $url = add_query_arg( '_', $instance, $atts[ $fallback ] );
    16291629            $html .= sprintf( $source, $type['type'], esc_url( $url ) );
    16301630        }
     
    16911691 *                            Default 'wp-video-shortcode'.
    16921692 *     @type string $id       The 'id' attribute for the `<video>` element.
    1693  *                            Default 'video-{$post_id}-{$instances}'.
     1693 *                            Default 'video-{$post_id}-{$instance}'.
    16941694 * }
    16951695 * @param string $content Optional. Shortcode content.
     
    17001700    $post_id = get_post() ? get_the_ID() : 0;
    17011701
    1702     static $instances = 0;
    1703     $instances++;
     1702    static $instance = 0;
     1703    $instance++;
    17041704
    17051705    /**
     
    17131713     * @see wp_video_shortcode()
    17141714     *
    1715      * @param string $html      Empty variable to be replaced with shortcode markup.
    1716      * @param array  $attr      Attributes of the video shortcode.
    1717      * @param string $content   Video shortcode content.
    1718      * @param int    $instances Unique numeric ID of this video shortcode instance.
    1719      */
    1720     $override = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instances );
     1715     * @param string $html     Empty variable to be replaced with shortcode markup.
     1716     * @param array  $attr     Attributes of the video shortcode.
     1717     * @param string $content  Video shortcode content.
     1718     * @param int    $instance Unique numeric ID of this video shortcode instance.
     1719     */
     1720    $override = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instance );
    17211721    if ( '' !== $override ) {
    17221722        return $override;
     
    18251825    $html_atts = array(
    18261826        'class'    => apply_filters( 'wp_video_shortcode_class', 'wp-video-shortcode' ),
    1827         'id'       => sprintf( 'video-%d-%d', $post_id, $instances ),
     1827        'id'       => sprintf( 'video-%d-%d', $post_id, $instance ),
    18281828        'width'    => absint( $atts['width'] ),
    18291829        'height'   => absint( $atts['height'] ),
     
    18471847
    18481848    $html = '';
    1849     if ( 'mediaelement' === $library && 1 === $instances ) {
     1849    if ( 'mediaelement' === $library && 1 === $instance ) {
    18501850        $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
    18511851    }
     
    18661866                $type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
    18671867            }
    1868             $url = add_query_arg( '_', $instances, $atts[ $fallback ] );
     1868            $url = add_query_arg( '_', $instance, $atts[ $fallback ] );
    18691869            $html .= sprintf( $source, $type['type'], esc_url( $url ) );
    18701870        }
Note: See TracChangeset for help on using the changeset viewer.