When a video shortcode has content in its body, append it as inner HTML in the resulting <video>.

Reverts [27096].
Fixes #26628.
See #27016.



git-svn-id: https://develop.svn.wordpress.org/trunk@27097 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
wonderboymusic 2014-02-05 01:42:02 +00:00
parent 3ccf9e9d29
commit 71947f18d3
3 changed files with 15 additions and 8 deletions

View File

@ -1233,6 +1233,14 @@ function wp_video_shortcode( $attr, $content = '' ) {
$html .= sprintf( $source, $type['type'], esc_url( $$fallback ) );
}
}
if ( ! empty( $content ) ) {
if ( false !== strpos( $content, "\n" ) )
$content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
$html .= trim( $content );
}
if ( 'mediaelement' === $library )
$html .= wp_mediaelement_fallback( $fileurl );
$html .= '</video>';

View File

@ -368,7 +368,6 @@ CONTENT;
/**
* Test [video] shortcode processing
*
* @ticket 26864
*/
function test_video_shortcode_body() {
$width = 720;
@ -393,13 +392,13 @@ VIDEO;
$content = apply_filters( 'the_content', $video );
$expected = '<div style="width: ' . $w . 'px; max-width: 100%;" class="wp-video">' .
"<!--[if lt IE 9]><script>document.createElement(\'video\');</script><![endif]-->\n" .
"<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n" .
'<video class="wp-video-shortcode" id="video-0-1" width="' . $w . '" height="' . $h . '" preload="metadata" controls="controls">' .
'<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4" />' .
'<source type="video/webm" src="myvideo.webm" />' .
'<source type="video/ogg" src="myvideo.ogv" />' .
'<track kind="subtitles" src="subtitles.srt" srclang="en" />' .
'<track kind="chapters" src="chapters.srt" srclang="en" />' .
'<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' .
'<!-- Ogg/Vorbis for older Firefox and Opera versions --><source type="video/ogg" src="myvideo.ogv" />' .
'<!-- Optional: Add subtitles for each language --><track kind="subtitles" src="subtitles.srt" srclang="en" />' .
'<!-- Optional: Add chapters --><track kind="chapters" src="chapters.srt" srclang="en" />' .
'<a href="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4">' .
"http://domain.tld/wp-content/uploads/2013/12/xyz.mp4</a></video></div>\n";