WordPress.org

Make WordPress Core

Ticket #24660: 24660_patch.diff

File 24660_patch.diff, 1.2 KB (added by fahmiadib, 5 years ago)

Patch added

  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index 43b5aab..b9d8a5d 100644
    function wp_maybe_load_embeds() { 
    21832183        if ( ! apply_filters( 'load_default_embeds', true ) ) {
    21842184                return;
    21852185        }
     2186       
     2187        wp_embed_register_handler( 'youtubevideo', '#^.*\.youtube\.com/(embed/|watch\?v=|\#/watch\?v=)([^\#\&\?]*)#i', 'wp_embed_handler_youtubevideo' );
    21862188
    21872189        wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
    21882190
    function wp_maybe_load_embeds() { 
    22052207        wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
    22062208}
    22072209
     2210function wp_embed_handler_youtubevideo( $matches, $attr, $url, $rawattr ) {
     2211        $video_url = sprintf( 'http://www.youtube.com/watch?v=%s', esc_attr( $matches[2] ) );
     2212       
     2213        return apply_filters( 'embed_youtubevideo', wp_oembed_get( $video_url ), $attr, $url, $rawattr );
     2214}
     2215
    22082216/**
    22092217 * The Google Video embed handler callback. Google Video does not support oEmbed.
    22102218 *