Back compat $_REQUEST['post_id'] for media XHR requests.
Props koopersmith, nacin. fixes #22588 git-svn-id: https://develop.svn.wordpress.org/trunk@22865 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
31c86e27c2
commit
b1f07f0ae1
@ -459,10 +459,11 @@
|
|||||||
|
|
||||||
link: function( embed ) {
|
link: function( embed ) {
|
||||||
return media.post( 'send-link-to-editor', {
|
return media.post( 'send-link-to-editor', {
|
||||||
nonce: wp.media.view.settings.nonce.sendToEditor,
|
nonce: wp.media.view.settings.nonce.sendToEditor,
|
||||||
src: embed.linkUrl,
|
src: embed.linkUrl,
|
||||||
title: embed.title,
|
title: embed.title,
|
||||||
html: wp.media.string.link( embed )
|
html: wp.media.string.link( embed ),
|
||||||
|
post_id: wp.media.view.settings.postId
|
||||||
}).done( function( resp ) {
|
}).done( function( resp ) {
|
||||||
wp.media.editor.insert( resp );
|
wp.media.editor.insert( resp );
|
||||||
});
|
});
|
||||||
|
@ -235,9 +235,10 @@ window.wp = window.wp || {};
|
|||||||
|
|
||||||
// Set the action and ID.
|
// Set the action and ID.
|
||||||
options.data = _.extend( options.data || {}, {
|
options.data = _.extend( options.data || {}, {
|
||||||
action: 'save-attachment',
|
action: 'save-attachment',
|
||||||
id: this.id,
|
id: this.id,
|
||||||
nonce: media.model.settings.saveAttachmentNonce
|
nonce: media.model.settings.saveAttachmentNonce,
|
||||||
|
post_id: media.model.settings.postId
|
||||||
});
|
});
|
||||||
|
|
||||||
// Record the values of the changed attributes.
|
// Record the values of the changed attributes.
|
||||||
@ -268,8 +269,9 @@ window.wp = window.wp || {};
|
|||||||
var model = this;
|
var model = this;
|
||||||
|
|
||||||
return media.post( 'save-attachment-compat', _.defaults({
|
return media.post( 'save-attachment-compat', _.defaults({
|
||||||
id: this.id,
|
id: this.id,
|
||||||
nonce: media.model.settings.saveAttachmentNonce
|
nonce: media.model.settings.saveAttachmentNonce,
|
||||||
|
post_id: media.model.settings.postId
|
||||||
}, data ) ).done( function( resp, status, xhr ) {
|
}, data ) ).done( function( resp, status, xhr ) {
|
||||||
model.set( model.parse( resp, xhr ), options );
|
model.set( model.parse( resp, xhr ), options );
|
||||||
});
|
});
|
||||||
@ -609,7 +611,8 @@ window.wp = window.wp || {};
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
options.context = this;
|
options.context = this;
|
||||||
options.data = _.extend( options.data || {}, {
|
options.data = _.extend( options.data || {}, {
|
||||||
action: 'query-attachments'
|
action: 'query-attachments',
|
||||||
|
post_id: media.model.settings.postId
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clone the args so manipulation is non-destructive.
|
// Clone the args so manipulation is non-destructive.
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
media.view.settings = l10n.settings || {};
|
media.view.settings = l10n.settings || {};
|
||||||
delete l10n.settings;
|
delete l10n.settings;
|
||||||
|
|
||||||
|
// Copy the `postId` setting over to the model settings.
|
||||||
|
media.model.settings.postId = media.view.settings.postId;
|
||||||
|
|
||||||
// Check if the browser supports CSS 3.0 transitions
|
// Check if the browser supports CSS 3.0 transitions
|
||||||
$.support.transition = (function(){
|
$.support.transition = (function(){
|
||||||
var style = document.documentElement.style,
|
var style = document.documentElement.style,
|
||||||
|
@ -324,6 +324,7 @@ function wp_default_scripts( &$scripts ) {
|
|||||||
'settings' => array(
|
'settings' => array(
|
||||||
'saveAttachmentNonce' => wp_create_nonce( 'save-attachment' ),
|
'saveAttachmentNonce' => wp_create_nonce( 'save-attachment' ),
|
||||||
'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
|
'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
|
||||||
|
'postId' => 0,
|
||||||
),
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user