Make WordPress Core

Changeset 29681


Ignore:
Timestamp:
09/03/2014 12:39:05 AM (12 years ago)
Author:
nacin
Message:

Ensure oEmbed previews listen to [embed] width/height attributes.

props azaozz.
fixes #29474.

File:
1 edited

Legend:

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

    r29615 r29681  
    26392639        global $post, $wp_embed;
    26402640
    2641         if ( ! $post = get_post( (int) $_REQUEST['post_ID'] ) ) {
     2641        if ( ! $post = get_post( (int) $_POST['post_ID'] ) ) {
    26422642                wp_send_json_error();
    26432643        }
    … …  
    26472647        }
    26482648
    2649         $shortcode = $_POST['shortcode'];
     2649        $shortcode = wp_unslash( $_POST['shortcode'] );
    26502650        $url = str_replace( '[embed]', '', str_replace( '[/embed]', '', $shortcode ) );
    26512651        $parsed = false;
    … …  
    26542654        $wp_embed->return_false_on_fail = true;
    26552655
    2656         if ( is_ssl() && preg_match( '%^\\[embed\\]http://%i', $shortcode ) ) {
     2656        if ( is_ssl() && preg_match( '%^\\[embed[^\\]]*\\]http://%i', $shortcode ) ) {
    26572657                // Admin is ssl and the user pasted non-ssl URL.
    26582658                // Check if the provider supports ssl embeds and use that for the preview.
    2659                 $ssl_shortcode = preg_replace( '%^\\[embed\\]http://%i', '[embed]https://', $shortcode );
     2659                $ssl_shortcode = preg_replace( '%^(\\[embed[^\\]]*\\])http://%i', '$1https://', $shortcode );
    26602660                $parsed = $wp_embed->run_shortcode( $ssl_shortcode );
    26612661
    … …  
    27142714        global $post, $wp_scripts;
    27152715
    2716         if ( ! $post = get_post( (int) $_REQUEST['post_ID'] ) ) {
     2716        if ( ! $post = get_post( (int) $_POST['post_ID'] ) ) {
    27172717                wp_send_json_error();
    27182718        }
    … …  
    27232723
    27242724        setup_postdata( $post );
    2725         $shortcode = do_shortcode( wp_unslash( $_REQUEST['shortcode'] ) );
     2725        $shortcode = do_shortcode( wp_unslash( $_POST['shortcode'] ) );
    27262726
    27272727        if ( empty( $shortcode ) ) {
Note: See TracChangeset for help on using the changeset viewer.