Ticket #22524: 22524.2.diff
File 22524.2.diff, 5.1 KB (added by , 12 years ago) |
---|
-
wp-includes/js/media-views.js
3403 3403 'change [data-setting]': 'updateSetting', 3404 3404 'change [data-setting] input': 'updateSetting', 3405 3405 'change [data-setting] select': 'updateSetting', 3406 'change [data-setting] textarea': 'updateSetting' 3406 'change [data-setting] textarea': 'updateSetting', 3407 'click .delete-attachment': 'deleteAttachment' 3408 }, 3409 3410 deleteAttachment: function(event) { 3411 event.preventDefault(); 3412 3413 if ( confirm( l10n.warnDelete ) ) 3414 this.model.destroy(); 3407 3415 } 3408 3416 }); 3409 3417 -
wp-includes/js/media-models.js
237 237 options.data = _.extend( options.data || {}, { 238 238 action: 'save-attachment', 239 239 id: this.id, 240 nonce : media.model.settings.saveAttachmentNonce240 nonce : this.get('nonces').update 241 241 }); 242 242 243 243 // Record the values of the changed attributes. … … 251 251 } 252 252 253 253 return media.ajax( options ); 254 } else if ( 'delete' === method ) { 255 options = options || {}; 256 options.context = this; 257 options.data = _.extend( options.data || {}, { 258 action: 'delete-post', 259 id: this.id, 260 _wpnonce: this.get('nonces')['delete'] 261 }); 262 return media.ajax( options ); 254 263 } 255 264 }, 256 265 … … 269 278 270 279 return media.post( 'save-attachment-compat', _.defaults({ 271 280 id: this.id, 272 nonce: media.model.settings.saveAttachmentNonce281 nonce: this.get('nonces').update 273 282 }, data ) ).done( function( resp, status, xhr ) { 274 283 model.set( model.parse( resp, xhr ), options ); 275 284 }); -
wp-includes/media.php
1327 1327 'subtype' => $subtype, 1328 1328 'icon' => wp_mime_type_icon( $attachment->ID ), 1329 1329 'dateFormatted' => mysql2date( get_option('date_format'), $attachment->post_date ), 1330 'nonces' => array( 1331 'update' => wp_create_nonce( 'update-post_' . $attachment->ID ), 1332 'delete' => wp_create_nonce( 'delete-post_' . $attachment->ID ), 1333 ), 1330 1334 ); 1331 1335 1332 1336 if ( $meta && 'image' === $type ) { … … 1452 1456 'allMediaItems' => __( 'All media items' ), 1453 1457 'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ), 1454 1458 'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ), 1459 'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ), 1455 1460 1456 1461 // Embed 1457 1462 'embedFromUrlTitle' => __( 'Embed From URL' ), … … 1642 1647 <# if ( 'image' === data.type && ! data.uploading ) { #> 1643 1648 <div class="dimensions">{{ data.width }} × {{ data.height }}</div> 1644 1649 <# } #> 1650 <div class="delete-attachment"> 1651 <a href="#"><?php _e( 'Delete Permanently' ); ?></a> 1652 </div> 1645 1653 </div> 1646 1654 <div class="compat-meta"> 1647 1655 <# if ( data.compat && data.compat.meta ) { #> -
wp-includes/css/media-views.css
1185 1185 float: left; 1186 1186 } 1187 1187 1188 .attachment-info .delete-attachment a { 1189 color: red; 1190 padding: 2px 4px; 1191 } 1192 1193 .attachment-info .delete-attachment a:hover { 1194 color: #fff; 1195 background: red; 1196 } 1197 1188 1198 /** 1189 1199 * Attachment Display Settings 1190 1200 */ -
wp-includes/script-loader.php
322 322 $scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'backbone', 'jquery' ), false, 1 ); 323 323 did_action( 'init' ) && $scripts->localize( 'media-models', '_wpMediaModelsL10n', array( 324 324 'settings' => array( 325 'saveAttachmentNonce' => wp_create_nonce( 'save-attachment' ), 326 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ), 325 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ) 327 326 ), 328 327 ) ); 329 328 -
wp-admin/includes/ajax-actions.php
1843 1843 if ( ! $id = absint( $_REQUEST['id'] ) ) 1844 1844 wp_send_json_error(); 1845 1845 1846 check_ajax_referer( ' save-attachment', 'nonce' );1846 check_ajax_referer( 'update-post_' . $id, 'nonce' ); 1847 1847 1848 1848 if ( ! current_user_can( 'edit_post', $id ) ) 1849 1849 wp_send_json_error(); … … 1889 1889 wp_send_json_error(); 1890 1890 $attachment_data = $_REQUEST['attachments'][ $id ]; 1891 1891 1892 check_ajax_referer( ' save-attachment', 'nonce' );1892 check_ajax_referer( 'update-post_' . $id, 'nonce' ); 1893 1893 1894 1894 if ( ! current_user_can( 'edit_post', $id ) ) 1895 1895 wp_send_json_error();