Make WordPress Core

Changeset 27097


Ignore:
Timestamp:
02/05/2014 01:42:02 AM (13 years ago)
Author:
wonderboymusic
Message:

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

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

Location:
trunk
Files:
3 edited

Legend:

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

    r27094 r27097  
    35853585/**
    35863586 * Properly strip all HTML tags including script and style
    3587  * 
    3588  * This differs from strip_tags() because it removes the contents of 
     3587 *
     3588 * This differs from strip_tags() because it removes the contents of
    35893589 * the <script> and <style> tags. E.g. strip_tags( '<script>something</script>' )
    35903590 * will return 'something'. wp_strip_all_tags will return ''
  • trunk/src/wp-includes/media.php

    r27063 r27097  
    12341234                }
    12351235        }
     1236
     1237        if ( ! empty( $content ) ) {
     1238                if ( false !== strpos( $content, "\n" ) )
     1239                        $content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
     1240
     1241                $html .= trim( $content );
     1242        }
     1243
    12361244        if ( 'mediaelement' === $library )
    12371245                $html .= wp_mediaelement_fallback( $fileurl );
  • trunk/tests/phpunit/tests/media.php

    r27096 r27097  
    369369         * Test [video] shortcode processing
    370370         *
    371          * @ticket 26864
    372371         */
    373372        function test_video_shortcode_body() {
    … …  
    394393
    395394                $expected = '<div style="width: ' . $w . 'px; max-width: 100%;" class="wp-video">' .
    396                         "<!--[if lt IE 9]><script>document.createElement(\'video\');</script><![endif]-->\n" .
     395                        "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n" .
    397396                        '<video class="wp-video-shortcode" id="video-0-1" width="' . $w . '" height="' . $h . '" preload="metadata" controls="controls">' .
    398397                        '<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4" />' .
    399                         '<source type="video/webm" src="myvideo.webm" />' .
    400                         '<source type="video/ogg" src="myvideo.ogv" />' .
    401                         '<track kind="subtitles" src="subtitles.srt" srclang="en" />' .
    402                         '<track kind="chapters" src="chapters.srt" srclang="en" />' .
     398                        '<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' .
     399                        '<!-- Ogg/Vorbis for older Firefox and Opera versions --><source type="video/ogg" src="myvideo.ogv" />' .
     400                        '<!-- Optional: Add subtitles for each language --><track kind="subtitles" src="subtitles.srt" srclang="en" />' .
     401                        '<!-- Optional: Add chapters --><track kind="chapters" src="chapters.srt" srclang="en" />' .
    403402                        '<a href="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4">' .
    404403                        "http://domain.tld/wp-content/uploads/2013/12/xyz.mp4</a></video></div>\n";
Note: See TracChangeset for help on using the changeset viewer.