mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
Embeds: Filter HTML response in oEmbed proxy controller.
Adapts the response from `WP_oEmbed_Controller::get_proxy_item()` so that the response is correctly filtered and embeds work properly in JavaSccript editors. Introduces new `get_oembed_response_data_for_url()` function for preparing internal oEmbed responses. Merges [43810] from the 5.0 branch to trunk. Props danielbachhuber, imath, swissspidy. Fixes #45142. git-svn-id: https://develop.svn.wordpress.org/trunk@44154 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -181,12 +181,22 @@ final class WP_oEmbed_Controller {
|
||||
$args['height'] = $args['maxheight'];
|
||||
}
|
||||
|
||||
// Short-circuit process for URLs belonging to the current site.
|
||||
$data = get_oembed_response_data_for_url( $url, $args );
|
||||
|
||||
if ( $data ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$data = _wp_oembed_get_object()->get_data( $url, $args );
|
||||
|
||||
if ( false === $data ) {
|
||||
return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/class-oembed.php */
|
||||
$data->html = apply_filters( 'oembed_result', _wp_oembed_get_object()->data2html( (object) $data, $url ), $url, $args );
|
||||
|
||||
/**
|
||||
* Filters the oEmbed TTL value (time to live).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user