WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/14/2017 04:04:04 PM (4 years ago)
Author:
westonruter
Message:

REST API: Ensure maxwidth and maxheight params are forwarded to oEmbed provider in proxy requests.

Also correct phpdoc return tag on WP_oEmbed_Controller::get_proxy_item() and remove dead code in oEmbed controller phpunit tests.

Amends [40628].
See #40450.
Fixes #41299.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-oembed-controller.php

    r41035 r41047  
    154154     * @see WP_oEmbed::get_html()
    155155     * @param WP_REST_Request $request Full data about the request.
    156      * @return WP_Error|array oEmbed response data or WP_Error on failure.
     156     * @return object|WP_Error oEmbed response data or WP_Error on failure.
    157157     */
    158158    public function get_proxy_item( $request ) {
     
    170170        unset( $args['url'] );
    171171
     172        // Copy maxwidth/maxheight to width/height since WP_oEmbed::fetch() uses these arg names.
     173        if ( isset( $args['maxwidth'] ) ) {
     174            $args['width'] = $args['maxwidth'];
     175        }
     176        if ( isset( $args['maxheight'] ) ) {
     177            $args['height'] = $args['maxheight'];
     178        }
     179
    172180        $data = _wp_oembed_get_object()->get_data( $url, $args );
    173181
Note: See TracChangeset for help on using the changeset viewer.