Ticket #22588: 22588.diff
File 22588.diff, 4.6 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
1780 1780 * @since 3.5.0 1781 1781 */ 1782 1782 function wp_ajax_get_attachment() { 1783 if ( ! isset( $_REQUEST[' id'] ) )1783 if ( ! isset( $_REQUEST['post_id'] ) ) 1784 1784 wp_send_json_error(); 1785 1785 1786 if ( ! $id = absint( $_REQUEST[' id'] ) )1786 if ( ! $id = absint( $_REQUEST['post_id'] ) ) 1787 1787 wp_send_json_error(); 1788 1788 1789 1789 if ( ! current_user_can( 'read_post', $id ) ) … … 1826 1826 * @since 3.5.0 1827 1827 */ 1828 1828 function wp_ajax_save_attachment() { 1829 if ( ! isset( $_REQUEST[' id'] ) || ! isset( $_REQUEST['changes'] ) )1829 if ( ! isset( $_REQUEST['post_id'] ) || ! isset( $_REQUEST['changes'] ) ) 1830 1830 wp_send_json_error(); 1831 1831 1832 if ( ! $id = absint( $_REQUEST[' id'] ) )1832 if ( ! $id = absint( $_REQUEST['post_id'] ) ) 1833 1833 wp_send_json_error(); 1834 1834 1835 1835 check_ajax_referer( 'save-attachment', 'nonce' ); … … 1868 1868 * @since 3.5.0 1869 1869 */ 1870 1870 function wp_ajax_save_attachment_compat() { 1871 if ( ! isset( $_REQUEST[' id'] ) )1871 if ( ! isset( $_REQUEST['post_id'] ) ) 1872 1872 wp_send_json_error(); 1873 1873 1874 if ( ! $id = absint( $_REQUEST[' id'] ) )1874 if ( ! $id = absint( $_REQUEST['post_id'] ) ) 1875 1875 wp_send_json_error(); 1876 1876 1877 1877 if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) ) -
wp-includes/js/media-editor.js
448 448 return media.post( 'send-attachment-to-editor', { 449 449 nonce: wp.media.view.settings.nonce.sendToEditor, 450 450 attachment: options, 451 html: html 451 html: html, 452 post_id: wp.media.view.settings.postId 452 453 }).done( function( resp ) { 453 454 wp.media.editor.insert( resp ); 454 455 }); … … 456 457 457 458 link: function( embed ) { 458 459 return media.post( 'send-link-to-editor', { 459 nonce: wp.media.view.settings.nonce.sendToEditor, 460 src: embed.linkUrl, 461 title: embed.title, 462 html: wp.media.string.link( embed ) 460 nonce: wp.media.view.settings.nonce.sendToEditor, 461 src: embed.linkUrl, 462 title: embed.title, 463 html: wp.media.string.link( embed ), 464 post_id: wp.media.view.settings.postId 463 465 }).done( function( resp ) { 464 466 wp.media.editor.insert( resp ); 465 467 }); -
wp-includes/js/media-models.js
223 223 options = options || {}; 224 224 options.context = this; 225 225 options.data = _.extend( options.data || {}, { 226 action: 'get-attachment',227 id: this.id226 action: 'get-attachment', 227 post_id: this.id 228 228 }); 229 229 return media.ajax( options ); 230 230 … … 235 235 236 236 // Set the action and ID. 237 237 options.data = _.extend( options.data || {}, { 238 action: 'save-attachment',239 id:this.id,240 nonce: media.model.settings.saveAttachmentNonce238 action: 'save-attachment', 239 post_id: this.id, 240 nonce: media.model.settings.saveAttachmentNonce 241 241 }); 242 242 243 243 // Record the values of the changed attributes. … … 268 268 var model = this; 269 269 270 270 return media.post( 'save-attachment-compat', _.defaults({ 271 id:this.id,272 nonce: l10n.saveAttachmentNonce271 post_id: this.id, 272 nonce: l10n.saveAttachmentNonce 273 273 }, data ) ).done( function( resp, status, xhr ) { 274 274 model.set( model.parse( resp, xhr ), options ); 275 275 }); … … 619 619 if ( -1 !== args.posts_per_page ) 620 620 args.paged = Math.floor( this.length / args.posts_per_page ) + 1; 621 621 622 // Check if a post ID has been specified as a context. 623 if ( args.context ) 624 options.data.post_id = args.context; 625 delete args.context; 626 622 627 options.data.query = args; 623 628 return media.ajax( options ); 624 629 -
wp-includes/js/media-views.js
12 12 media.view.settings = l10n.settings || {}; 13 13 delete l10n.settings; 14 14 15 // Set the post ID as the default context of attachment queries. 16 if ( ! _.isUndefined( media.view.settings.postId ) ) 17 media.model.Query.defaultProps.context = media.view.settings.postId; 18 15 19 // Check if the browser supports CSS 3.0 transitions 16 20 $.support.transition = (function(){ 17 21 var style = document.documentElement.style,