Ticket #15133: dA_oembed.patch

File dA_oembed.patch, 1.7 KB (added by PotterSys, 3 years ago)

First patch attempt

  • wp-includes/class-oembed.php

     
    5454                        'http://wordpress.tv/*'                         => array( 'http://wordpress.tv/oembed/',              false ), 
    5555                        '#http://(answers|surveys)\.polldaddy.com/.*#i' => array( 'http://polldaddy.com/oembed/',             true  ), 
    5656                        '#http://(www\.)?funnyordie\.com/videos/.*#i'   => array( 'http://www.funnyordie.com/oembed',         true  ), 
     57                        '#http://(.+)\.deviantart\.com/art/.*#i'   => array( 'http://backend.deviantart.com/oembed',         true  ), 
     58                        '#http://(.+)\.deviantart\.com/(.+)/[\d]*#i'   => array( 'http://backend.deviantart.com/oembed',         true  ), 
     59                        'http://fav.me/*'   => array( 'http://backend.deviantart.com/oembed',         false  ), 
    5760                ) ); 
    5861 
    5962                // Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop(). 
     
    242245                                        return false; 
    243246 
    244247                                $title = ( !empty($data->title) ) ? $data->title : ''; 
    245                                 $return = '<img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" />'; 
     248                                 
     249                                if ( ! empty($data->thumbnail_url) ){ 
     250                                        $return = '<img src="' . esc_url( $data->thumbnail_url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->thumbnail_width) . '" height="' . esc_attr($data->thumbnail_height) . '" />'; 
     251                                } else { 
     252                                        $return = '<img src="' . esc_url( $data->url  ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" />'; 
     253                                } 
    246254                                break; 
    247255 
    248256                        case 'video':