mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-08 16:41:44 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@41047 git-svn-id: http://core.svn.wordpress.org/trunk@40897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ecec228c50
commit
93637a5729
@ -153,7 +153,7 @@ final class WP_oEmbed_Controller {
|
|||||||
*
|
*
|
||||||
* @see WP_oEmbed::get_html()
|
* @see WP_oEmbed::get_html()
|
||||||
* @param WP_REST_Request $request Full data about the request.
|
* @param WP_REST_Request $request Full data about the request.
|
||||||
* @return WP_Error|array oEmbed response data or WP_Error on failure.
|
* @return object|WP_Error oEmbed response data or WP_Error on failure.
|
||||||
*/
|
*/
|
||||||
public function get_proxy_item( $request ) {
|
public function get_proxy_item( $request ) {
|
||||||
$args = $request->get_params();
|
$args = $request->get_params();
|
||||||
@ -169,6 +169,14 @@ final class WP_oEmbed_Controller {
|
|||||||
$url = $request['url'];
|
$url = $request['url'];
|
||||||
unset( $args['url'] );
|
unset( $args['url'] );
|
||||||
|
|
||||||
|
// Copy maxwidth/maxheight to width/height since WP_oEmbed::fetch() uses these arg names.
|
||||||
|
if ( isset( $args['maxwidth'] ) ) {
|
||||||
|
$args['width'] = $args['maxwidth'];
|
||||||
|
}
|
||||||
|
if ( isset( $args['maxheight'] ) ) {
|
||||||
|
$args['height'] = $args['maxheight'];
|
||||||
|
}
|
||||||
|
|
||||||
$data = _wp_oembed_get_object()->get_data( $url, $args );
|
$data = _wp_oembed_get_object()->get_data( $url, $args );
|
||||||
|
|
||||||
if ( false === $data ) {
|
if ( false === $data ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-41046';
|
$wp_version = '4.9-alpha-41047';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user