WordPress.org

Make WordPress Core

Ticket #20151: 20151.2.diff

File 20151.2.diff, 2.1 KB (added by jacobdubail, 6 years ago)
  • src/wp-includes/class-oembed.php

    diff --git a/src/wp-includes/class-oembed.php b/src/wp-includes/class-oembed.php
    index 363b7c9..381d3d0 100644
    a b class WP_oEmbed { 
    277277         * @return bool|object False on failure, otherwise the result in the form of an object.
    278278         */
    279279        public function fetch( $provider, $url, $args = '' ) {
    280                 $args = wp_parse_args( $args, wp_embed_defaults() );
     280                $args = wp_parse_args( $args, wp_embed_defaults( $url ) );
    281281
    282282                $provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider );
    283283                $provider = add_query_arg( 'maxheight', (int) $args['height'], $provider );
  • src/wp-includes/class-wp-embed.php

    diff --git a/src/wp-includes/class-wp-embed.php b/src/wp-includes/class-wp-embed.php
    index fbcd517..cfaa73b 100644
    a b class WP_Embed { 
    150150                        return '';
    151151
    152152                $rawattr = $attr;
    153                 $attr = wp_parse_args( $attr, wp_embed_defaults() );
     153                $attr = wp_parse_args( $attr, wp_embed_defaults( $url ) );
    154154
    155155                // kses converts & into & and we need to undo this
    156156                // See http://core.trac.wordpress.org/ticket/11311
  • src/wp-includes/media.php

    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 2edfc1a..6c679f9 100644
    a b function wp_embed_unregister_handler( $id, $priority = 10 ) { 
    20592059 *
    20602060 * @since 2.9.0
    20612061 *
     2062 * @param string $url Optional. The URL that should be embedded. Default empty.
     2063 *
    20622064 * @return array Default embed parameters.
    20632065 */
    2064 function wp_embed_defaults() {
     2066function wp_embed_defaults( $url = '' ) {
    20652067        if ( ! empty( $GLOBALS['content_width'] ) )
    20662068                $width = (int) $GLOBALS['content_width'];
    20672069
    function wp_embed_defaults() { 
    20772079         *
    20782080         * @param int $width  Width of the embed in pixels.
    20792081         * @param int $height Height of the embed in pixels.
     2082         * @param string $url The URL that should be embedded by default.
    20802083         */
    2081         return apply_filters( 'embed_defaults', compact( 'width', 'height' ) );
     2084        return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url );
    20822085}
    20832086
    20842087/**