Back compat $_REQUEST['post_id'] for media XHR requests.

Props koopersmith, nacin.
fixes #22588


git-svn-id: http://core.svn.wordpress.org/trunk@22865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-11-27 14:58:08 +00:00
parent 1afc32e84a
commit 555a87db2f
4 changed files with 18 additions and 10 deletions

View File

@ -462,7 +462,8 @@
nonce: wp.media.view.settings.nonce.sendToEditor,
src: embed.linkUrl,
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 ) {
wp.media.editor.insert( resp );
});

View File

@ -237,7 +237,8 @@ window.wp = window.wp || {};
options.data = _.extend( options.data || {}, {
action: 'save-attachment',
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.
@ -269,7 +270,8 @@ window.wp = window.wp || {};
return media.post( 'save-attachment-compat', _.defaults({
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 ) {
model.set( model.parse( resp, xhr ), options );
});
@ -609,7 +611,8 @@ window.wp = window.wp || {};
options = options || {};
options.context = this;
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.

View File

@ -12,6 +12,9 @@
media.view.settings = 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
$.support.transition = (function(){
var style = document.documentElement.style,

View File

@ -324,6 +324,7 @@ function wp_default_scripts( &$scripts ) {
'settings' => array(
'saveAttachmentNonce' => wp_create_nonce( 'save-attachment' ),
'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
'postId' => 0,
),
) );