Make WordPress Core

Ticket #24820: media-shortcode-cleanup.diff

File media-shortcode-cleanup.diff, 2.3 KB (added by rfair404, 13 years ago)

replaces the format based classes with wp-media and wp-{type} classes

  • wp-includes/js/mediaelement/wp-mediaelement.js

     
    66    $(function () {
    77                $('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
    88        });
    9 
    109}(jQuery));
    11  No newline at end of file
  • wp-includes/media.php

     
    860860                'src'      => '',
    861861                'loop'     => '',
    862862                'autoplay' => '',
    863                 'preload' => 'none'
     863                'preload'  => 'none',
     864                'width'    => empty( $content_width ) ? 640 : $content_width
     865
    864866        );
    865867        foreach ( $default_types as $type )
    866868                $defaults_atts[$type] = '';
     
    872874        if ( ! empty( $src ) ) {
    873875                $type = wp_check_filetype( $src );
    874876                if ( ! in_array( $type['ext'], $default_types ) )
    875                         return sprintf( '<a class="wp-post-format-link-audio" href="%s">%s</a>', esc_url( $src ), esc_html( $src ) );
     877                        return sprintf( '<a class="wp-media-embedded wp-audio" href="%s">%s</a>', esc_url( $src ), esc_html( $src ) );
    876878                $primary = true;
    877879                array_unshift( $default_types, 'src' );
    878880        } else {
     
    902904        if ( 'mediaelement' === $library && did_action( 'init' ) ) {
    903905                wp_enqueue_style( 'wp-mediaelement' );
    904906                wp_enqueue_script( 'wp-mediaelement' );
     907                wp_localize_script( 'wp_mediaelement', 'mediaelementArgs', array( 'maxWidth' => $max_width ));
    905908        }
    906909
    907910        $atts = array(
     
    10071010        if ( ! empty( $src ) ) {
    10081011                $type = wp_check_filetype( $src );
    10091012                if ( ! in_array( $type['ext'], $default_types ) )
    1010                         return sprintf( '<a class="wp-post-format-link-video" href="%s">%s</a>', esc_url( $src ), esc_html( $src ) );
     1013                        return sprintf( '<a class="wp-media-embedded wp-video" href="%s">%s</a>', esc_url( $src ), esc_html( $src ) );
    10111014                $primary = true;
    10121015                array_unshift( $default_types, 'src' );
    10131016        } else {
     
    10371040        if ( 'mediaelement' === $library && did_action( 'init' ) ) {
    10381041                wp_enqueue_style( 'wp-mediaelement' );
    10391042                wp_enqueue_script( 'wp-mediaelement' );
     1043                wp_localize_script( 'wp_mediaelement', 'mediaelementArgs', array( 'width' => $width ));
     1044
    10401045        }
    10411046
    10421047        $atts = array(