Make WordPress Core

Ticket #32214: 32214.patch

File 32214.patch, 3.5 KB (added by scriptrunner, 10 years ago)
  • wp-includes/js/media/views/frame/video-details.js

     
    120120
    121121                        if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) {
    122122                                content += [
    123                                         '<track srclang="en" label="English"kind="subtitles" src="',
     123                                        '\[track srclang="en" label="English" kind="subtitles" src="',
    124124                                        attachment.get( 'url' ),
    125                                         '" />'
     125                                        '"\]\[/track\]'
    126126                                ].join('');
    127127
    128128                                controller.media.set( 'content', content );
  • wp-includes/js/media-audiovideo.js

     
    704704
    705705                        if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) {
    706706                                content += [
    707                                         '<track srclang="en" label="English"kind="subtitles" src="',
     707                                        '\[track srclang="en" label="English" kind="subtitles" src="',
    708708                                        attachment.get( 'url' ),
    709                                         '" />'
     709                                        '"\]\[/track\]'
    710710                                ].join('');
    711711
    712712                                controller.media.set( 'content', content );
  • wp-includes/media.php

     
    19211921        }
    19221922
    19231923        if ( ! empty( $content ) ) {
     1924                $html .= do_shortcode($content);
    19241925                if ( false !== strpos( $content, "\n" ) ) {
    19251926                        $content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
    19261927                }
     
    19541955add_shortcode( 'video', 'wp_video_shortcode' );
    19551956
    19561957/**
     1958 * Builds the Track shortcode output.
     1959 *
     1960 * This implements the functionality of the Track Shortcode for displaying
     1961 * time triggered text to the viewer.
     1962 *
     1963 * @since 3.6.0
     1964 *
     1965 * @param array  $attr {
     1966 *     Attributes of the shortcode.
     1967 *
     1968 *     @type string $kind     Type of track (subtitles, captions, chapters, descriptgions, or metadata).
     1969 *     @type string $src      URL to the source of the vtt file. Default empty.
     1970 *     @type string $srclang  The two-letter code (valid BCP 47 language tag) for the language of the text track, for example "en" for English.
     1971 *     @type int    $label    The label for the track that will be show to the user, for example in a menu that list the different languages available for subtitles.
     1972 *     @type int    $default  The default attribute can be used to have a track default to showing. Otherwise the viewer would need to select their language from the captions or subtitles menu. NOTE: For chapters, default is required if you want the chapters menu to show.
     1973 * }
     1974 * @param string $track Shortcode content.
     1975 * @return string|void HTML content to display track.
     1976 */
     1977function track_shortcode( $atts, $content = null ) {
     1978        extract( shortcode_atts( array(
     1979                'kind' => '',
     1980                'src' => '',
     1981                'srclang' => '',
     1982                'label' => '',
     1983                'default' => ''
     1984        ), $atts ) );
     1985       
     1986        if ( $kind )
     1987                $kind = " kind='" . $kind . "'";
     1988       
     1989        if ( $src )
     1990                $src = " src='" . $src . "'";
     1991       
     1992        if ( $srclang )
     1993                $srclang = " srclang='" . $srclang . "'";
     1994       
     1995        if ( $label )
     1996                $label = " label='" . $label . "'";
     1997       
     1998        if ( "true" == $default || "default" == $default )
     1999                $default = " default";
     2000        else
     2001                $default = "";
     2002       
     2003        $track = "
     2004                <track" . $kind . $src . $srclang . $label . $default . " />
     2005        ";
     2006       
     2007        return $track;
     2008}
     2009add_shortcode( 'track', 'track_shortcode' );
     2010
     2011/**
    19572012 * Displays previous image link that has the same post parent.
    19582013 *
    19592014 * @since 2.5.0