WordPress.org

Make WordPress Core

Ticket #47752: 47752.diff

File 47752.diff, 2.8 KB (added by killerbishop, 13 months ago)

Patch for #47752 - includes fix and unit test

  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index 1ca29cf864..d411b9ebe2 100644
    a b function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) { 
    27352735                                $type = false;
    27362736                                $ext  = false;
    27372737                        }
     2738                } elseif ( 'text/html' === $real_mime ) {
     2739                        // Subrip text files can optionally contain HTML tags
     2740                        if ( 'srt' !== $ext ) {
     2741                                $type = false;
     2742                                $ext  = false;
     2743                        }
    27382744                } elseif ( 'text/rtf' === $real_mime ) {
    27392745                        // Special casing for RTF files.
    27402746                        if ( ! in_array(
  • new file tests/phpunit/data/uploads/test.srt

    diff --git a/tests/phpunit/data/uploads/test.srt b/tests/phpunit/data/uploads/test.srt
    new file mode 100644
    index 0000000000..a531b9c5a8
    - +  
     10
     200:00:00,1 --> 00:00:04
     3HTML5 <video> and <audio> was supposed to be awesome, powerful, and fun.
     4
     51
     600:00:04 --> 00:00:07
     7But browser vendors couldn't agree on a codec
     8
     92
     1000:00:07 --> 00:00:10
     11and older browsers don't support <video> at all.
     12
     133
     1400:00:10 --> 00:00:12
     15This means <video src="myfile.mp4" /> doesn't work ...
     16
     174
     1800:00:12 --> 00:00:14
     19until now.
     20
     215
     2200:00:14 --> 00:00:18
     23Introducing MediaElement.js, an HTML5 <video> and <audio> player
     24
     256
     2600:00:18 --> 00:00:21
     27that looks and works the same in every browser (even iPhone and Android).
     28
     297
     3000:00:21 --> 00:00:24
     31For older browsers, it has custom Flash and Silverlight plugins
     32
     338
     3400:00:24 --> 00:00:27
     35that fully replicate the HTML5 MediaElement API
     36
     379
     3800:00:27 --> 00:00:30
     39so you can build a consistent control UI using just HTML and CSS.
     40
     4110
     4200:00:30 --> 00:00:33
     43MediaElement.js even supports newer standards
     44
     4511
     4600:00:33 --> 00:00:36
     47like the <track> element that enables the subtitles you're reading right now.
     48
     4912
     5000:00:36 --> 00:00:39
     51The subtitles can even be translated into any language using Google's Translation API.
     52
     5313
     5400:00:39 --> 00:00:42
     55As a bonus, the Flash and Silverlight fallbacks allow you to use FLV and WMV files.
     56
     5714
     5800:00:42 --> 00:00:45
     59Hope you like it.
     60
     61Come follow me at <a href="http://twitter.com/johndyer">twitter.com/johndyer</a>
     62 No newline at end of file
  • tests/phpunit/tests/functions.php

    diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
    index 2191af7ddb..26bb59738a 100644
    a b public function _wp_check_filetype_and_ext_data() { 
    13841384                                                        'proper_filename' => false,
    13851385                                                ),
    13861386                                        ),
     1387                                        array(
     1388                                                DIR_TESTDATA . '/uploads/test.srt',
     1389                                                'test.srt',
     1390                                                array(
     1391                                                        'ext'             => 'srt',
     1392                                                        'type'            => 'text/plain',
     1393                                                        'proper_filename' => false,
     1394                                                ),
     1395                                        ),
     1396
    13871397                                )
    13881398                        );
    13891399                }