Widgets: Utilize WP REST API oEmbed proxy endpoint in media widgets.
Props timmydcrawford. See #32417, #40450. git-svn-id: https://develop.svn.wordpress.org/trunk@40641 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
da32c2f630
commit
42487a5b23
|
@ -111,15 +111,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
control.fetchEmbedDfd = jQuery.ajax({
|
control.fetchEmbedDfd = jQuery.ajax({
|
||||||
url: 'https://noembed.com/embed',
|
url: wp.media.view.settings.oEmbedProxyUrl,
|
||||||
data: {
|
data: {
|
||||||
url: control.model.get( 'url' ),
|
url: control.model.get( 'url' ),
|
||||||
maxwidth: control.model.get( 'width' ),
|
maxwidth: control.model.get( 'width' ),
|
||||||
maxheight: control.model.get( 'height' )
|
maxheight: control.model.get( 'height' ),
|
||||||
|
_wpnonce: wp.media.view.settings.nonce.wpRestApi,
|
||||||
|
discover: false
|
||||||
},
|
},
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
crossDomain: true,
|
dataType: 'json',
|
||||||
dataType: 'json'
|
context: control
|
||||||
});
|
});
|
||||||
|
|
||||||
control.fetchEmbedDfd.done( function( response ) {
|
control.fetchEmbedDfd.done( function( response ) {
|
||||||
|
|
|
@ -182,15 +182,17 @@ wp.mediaWidgets = ( function( $ ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
embedLinkView.dfd = $.ajax({
|
embedLinkView.dfd = $.ajax({
|
||||||
url: 'https://noembed.com/embed', // @todo Replace with core proxy endpoint once committed.
|
url: wp.media.view.settings.oEmbedProxyUrl,
|
||||||
data: {
|
data: {
|
||||||
url: embedLinkView.model.get( 'url' ),
|
url: embedLinkView.model.get( 'url' ),
|
||||||
maxwidth: embedLinkView.model.get( 'width' ),
|
maxwidth: embedLinkView.model.get( 'width' ),
|
||||||
maxheight: embedLinkView.model.get( 'height' )
|
maxheight: embedLinkView.model.get( 'height' ),
|
||||||
|
_wpnonce: wp.media.view.settings.nonce.wpRestApi,
|
||||||
|
discover: false
|
||||||
},
|
},
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
crossDomain: true,
|
dataType: 'json',
|
||||||
dataType: 'json'
|
context: embedLinkView
|
||||||
});
|
});
|
||||||
|
|
||||||
embedLinkView.dfd.done( function( response ) {
|
embedLinkView.dfd.done( function( response ) {
|
||||||
|
|
Loading…
Reference in New Issue