Make WordPress Core


Ignore:
Timestamp:
07/15/2014 09:50:41 PM (11 years ago)
Author:
wonderboymusic
Message:

Make audio and video URLs/embed handlers work in <iframe>-sandbox'd MCE views.

Introduce:
get_editor_stylesheets()
wp_media_mce_styles().

See #28905.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r29151 r29176  
    26532653    }
    26542654
    2655     // TODO: needed?
    2656     $parsed = do_shortcode( $parsed );
     2655    if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) {
     2656        $styles = '';
     2657        $mce_styles = wp_media_mce_styles();
     2658        foreach ( $mce_styles as $style ) {
     2659            $styles .= sprintf( '<link rel="stylesheet" href="%s"/>', $style );
     2660        }
     2661
     2662        $html = do_shortcode( $parsed );
     2663
     2664        global $wp_scripts;
     2665        if ( ! empty( $wp_scripts ) ) {
     2666            $wp_scripts->done = array();
     2667        }
     2668        ob_start();
     2669        wp_print_scripts( 'wp-mediaelement' );
     2670        $scripts = ob_get_clean();
     2671
     2672        $parsed = $styles . $html . $scripts;
     2673    }
     2674
    26572675
    26582676    if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) ||
Note: See TracChangeset for help on using the changeset viewer.