Make WordPress Core

Ticket #24902: 24902.2.diff

File 24902.2.diff, 1.9 KB (added by nacin, 13 years ago)
  • wp-includes/media.php

     
    923923                $attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
    924924        }
    925925
    926         $html = sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) );
     926        $html = '';
     927        if ( 'mediaelement' === $library && 1 === $instances )
     928                $html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
     929        $html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) );
    927930
    928931        $fileurl = '';
    929932        $source = '<source type="%s" src="%s" />';
    … …  
    940943                $html .= wp_mediaelement_fallback( $fileurl );
    941944        $html .= '</audio>';
    942945
    943         return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id );
     946        return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );
    944947}
    945948add_shortcode( 'audio', apply_filters( 'wp_audio_shortcode_handler', 'wp_audio_shortcode' ) );
    946949
    … …  
    10611064                $attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
    10621065        }
    10631066
    1064         $html = sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) );
     1067        $html = '';
     1068        if ( 'mediaelement' === $library && 1 === $instances )
     1069                $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
     1070        $html .= sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) );
    10651071
    10661072        $fileurl = '';
    10671073        $source = '<source type="%s" src="%s" />';
    … …  
    10811087        $html .= '</video>';
    10821088
    10831089        $html = sprintf( '<div style="width: %dpx; max-width: 100%%;">%s</div>', $width, $html );
    1084         return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id );
     1090        return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library );
    10851091}
    10861092add_shortcode( 'video', apply_filters( 'wp_video_shortcode_handler', 'wp_video_shortcode' ) );
    10871093