WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/05/2015 05:59:10 AM (7 years ago)
Author:
wonderboymusic
Message:

Allow inline editing of width and height parameters while previewing an embed in the media modal:

  • Use wp.shortcode() instead of manually constructing a shortcode in views/embed/link
  • Allow a URL to transition to a shortcode (and vice versa) when returning an embed to TinyMCE
  • In WP_Embed, store the last URL and last set of attributes requested in class properties
  • wp_ajax_parse_embed(), allow [embed]s to have attributes. Return attr in the response.

This is a first pass to allow broad testing with recent MCE view changes.

See #31139.

File:
1 edited

Legend:

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

    r31619 r31620  
    27092709
    27102710    $shortcode = wp_unslash( $_POST['shortcode'] );
    2711     $url = str_replace( '[embed]', '', str_replace( '[/embed]', '', $shortcode ) );
     2711
     2712    preg_match( '/' . get_shortcode_regex() . '/s', $shortcode, $matches );
     2713    $atts = shortcode_parse_atts( $matches[3] );
     2714    if ( ! empty( $atts[5] ) ) {
     2715        $url = $atts[5];
     2716    } elseif ( ! empty( $atts['src'] ) ) {
     2717        $url = $atts['src'];
     2718    }
     2719
    27122720    $parsed = false;
    27132721    setup_postdata( $post );
     
    27152723    $wp_embed->return_false_on_fail = true;
    27162724
    2717     if ( is_ssl() && preg_match( '%^\\[embed[^\\]]*\\]http://%i', $shortcode ) ) {
     2725    if ( is_ssl() && 0 === strpos( $url, 'http://' ) ) {
    27182726        // Admin is ssl and the user pasted non-ssl URL.
    27192727        // Check if the provider supports ssl embeds and use that for the preview.
     
    27682776
    27692777    wp_send_json_success( array(
    2770         'body' => $parsed
     2778        'body' => $parsed,
     2779        'attr' => $wp_embed->last_attr
    27712780    ) );
    27722781}
Note: See TracChangeset for help on using the changeset viewer.