Make WordPress Core


Ignore:
Timestamp:
01/27/2017 04:24:58 AM (8 years ago)
Author:
azaozz
Message:

TinyMCE: improve the previews for embedded WordPress posts:

  • Add option to force a sandbox iframe in wpview.
  • Use it to show the embedded post preview.
  • Remove the deprecated wpembed plugin.js

Fixes #39513.

File:
1 edited

Legend:

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

    r39934 r40019  
    30053005    }
    30063006
    3007 
    30083007    if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) ||
    30093008        preg_match( '%<link [^>]*href="http://%', $parsed ) ) ) ) {
     
    30153014    }
    30163015
    3017     wp_send_json_success( array(
     3016    $return = array(
    30183017        'body' => $parsed,
    30193018        'attr' => $wp_embed->last_attr
    3020     ) );
     3019    );
     3020
     3021    if ( strpos( $parsed, 'class="wp-embedded-content' ) ) {
     3022        if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
     3023            $script_src = includes_url( 'js/wp-embed.js' );
     3024        } else {
     3025            $script_src = includes_url( 'js/wp-embed.min.js' );
     3026        }
     3027
     3028        $return['head'] = '<script src="' . $script_src . '"></script>';
     3029        $return['sandbox'] = true;
     3030    }
     3031
     3032    wp_send_json_success( $return );
    30213033}
    30223034
Note: See TracChangeset for help on using the changeset viewer.