Make WordPress Core


Ignore:
Timestamp:
03/09/2014 01:00:53 AM (8 years ago)
Author:
wonderboymusic
Message:

Audio/Video shortcodes in the media modal:

  • Add embedMimes to _wpMediaViewsL10n
  • Use escape instead of interpolate when setting attributes in Underscore templates
  • When creating the <audio> and <video> tags dynamically, set inner <source> nodes instead of the src attribute and properly set the mime-type per source as the type attribute. This is also drastically reduces the amount of code used to generate the tags.

See #27016.

File:
1 edited

Legend:

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

    r27472 r27476  
    23432343    );
    23442344
     2345    $exts = array_merge( wp_get_audio_extensions(), wp_get_video_extensions() );
     2346    $mimes = get_allowed_mime_types();
     2347    $ext_mimes = array();
     2348    foreach ( $exts as $ext ) {
     2349        foreach ( $mimes as $ext_preg => $mime_match ) {
     2350            if ( preg_match( '#' . $ext . '#i', $ext_preg ) ) {
     2351                $ext_mimes[ $ext ] = $mime_match;
     2352                break;
     2353            }
     2354        }
     2355    }
     2356
    23452357    $settings = array(
    23462358        'tabs'      => $tabs,
     
    23552367        ),
    23562368        'defaultProps' => $props,
    2357         'embedExts'    => array_merge( wp_get_audio_extensions(), wp_get_video_extensions() ),
     2369        'embedExts'    => $exts,
     2370        'embedMimes'   => $ext_mimes
    23582371    );
    23592372
Note: See TracChangeset for help on using the changeset viewer.