Make WordPress Core


Ignore:
Timestamp:
05/26/2014 11:56:27 PM (12 years ago)
Author:
wonderboymusic
Message:

When adding a URL in the Insert from URL state in the media modal, attempt to show a preview of the content. Drop the unused width and height fields.

This will probably be iterated upon.

Props helen, jtsternberg, wonderboymusic.
See #15490.

File:
1 edited

Legend:

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

    r28580 r28581  
    23102310 */
    23112311function wp_ajax_send_link_to_editor() {
     2312    global $post, $wp_embed;
     2313
    23122314    check_ajax_referer( 'media-send-to-editor', 'nonce' );
    23132315
     
    23242326        $title = wp_basename( $src );
    23252327
    2326     $html = '';
    2327     if ( $title )
     2328    $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );
     2329    // ping WordPress for an embed
     2330    $check_embed = $wp_embed->run_shortcode( '[embed]'. $src .'[/embed]' );
     2331    // fallback that WordPress creates when no oEmbed was found
     2332    $fallback = $wp_embed->maybe_make_link( $src );
     2333
     2334    if ( $check_embed !== $fallback ) {
     2335        // TinyMCE view for [embed] will parse this
     2336        $html = '[embed]' . $src . '[/embed]';
     2337    } elseif ( $title ) {
    23282338        $html = '<a href="' . esc_url( $src ) . '">' . $title . '</a>';
     2339    } else {
     2340        $html = '';
     2341    }
    23292342
    23302343    // Figure out what filter to run:
Note: See TracChangeset for help on using the changeset viewer.