Ticket #19159: 19159.3.diff
| File 19159.3.diff, 4.9 KB (added by , 13 years ago) |
|---|
-
wp-admin/admin-ajax.php
53 53 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax', 54 54 'menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink', 55 55 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', 56 'save-widget', ' set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',57 'wp- remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',58 ' query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',59 'send- attachment-to-editor', 'save-attachment-order',56 'save-widget', 'delete-inactive-widgets', 'set-post-thumbnail', 'date_format', 'time_format', 57 'wp-fullscreen-save-post', 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 58 'get-attachment', 'query-attachments', 'save-attachment', 'save-attachment-compat', 59 'send-link-to-editor', 'send-attachment-to-editor', 'save-attachment-order', 60 60 ); 61 61 62 62 // Register core Ajax calls. -
wp-admin/includes/ajax-actions.php
1581 1581 wp_die(); 1582 1582 } 1583 1583 1584 function wp_ajax_delete_inactive_widgets() { 1585 check_ajax_referer( 'remove-inactive-widgets', 'removeinactivewidgets' ); 1586 1587 if ( ! current_user_can( 'edit_theme_options' ) ) 1588 wp_die( -1 ); 1589 1590 unset( $_POST['removeinactivewidgets'], $_POST['action'] ); 1591 1592 do_action( 'load-widgets.php' ); 1593 do_action( 'widgets.php' ); 1594 do_action( 'sidebar_admin_setup' ); 1595 1596 $sidebars_widgets = wp_get_sidebars_widgets(); 1597 $sidebars_widgets['wp_inactive_widgets'] = array(); 1598 wp_set_sidebars_widgets( $sidebars_widgets ); 1599 1600 wp_die(); 1601 } 1602 1584 1603 function wp_ajax_upload_attachment() { 1585 1604 check_ajax_referer( 'media-form' ); 1586 1605 -
wp-admin/js/widgets.js
63 63 } else if ( target.hasClass('widget-control-close') ) { 64 64 wpWidgets.close( target.closest('div.widget') ); 65 65 e.preventDefault(); 66 } else if ( target.attr( 'id' ) == 'inactive-widgets-control-remove' ) { 67 wpWidgets.removeInactiveWidgets(); 68 e.preventDefault(); 66 69 } 67 70 }); 68 71 … … 247 250 }); 248 251 }, 249 252 253 removeInactiveWidgets : function() { 254 var sb = $( '.inactive-sidebar' ), a, data; 255 256 $( '.spinner', sb ).css( 'display', 'inline-block' ); 257 258 a = { 259 action : 'delete-inactive-widgets', 260 removeinactivewidgets : $( '#_wpnonce_remove_inactive_widgets' ).val() 261 }; 262 263 data = $.param( a ); 264 265 $.post( ajaxurl, data, function() { 266 $( '.spinner', sb ).hide(); 267 $( '#wp_inactive_widgets .widget' ).remove(); 268 } ); 269 }, 270 250 271 appendTitle : function(widget) { 251 272 var title = $('input[id*="-title"]', widget).val() || ''; 252 273 -
wp-admin/css/wp-admin.css
8265 8265 margin: 5px 15px 10px; 8266 8266 } 8267 8267 8268 .inactive .remove-inactive-widgets { 8269 clear: both; 8270 margin: 0 15px 15px; 8271 } 8272 8268 8273 #available-widgets p.description { 8269 8274 margin: 0 12px 12px; 8270 8275 } -
wp-admin/widgets.php
176 176 exit; 177 177 } 178 178 179 // Remove inactive widgets without js 180 if ( isset( $_POST['removeinactivewidgets'] ) ) { 181 check_admin_referer( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); 182 183 if ( $_POST['removeinactivewidgets'] ) { 184 $sidebars_widgets['wp_inactive_widgets'] = array(); 185 wp_set_sidebars_widgets( $sidebars_widgets ); 186 } 187 188 wp_redirect( admin_url( 'widgets.php?message=0' ) ); 189 exit; 190 } 191 179 192 // Output the widget form without js 180 193 if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) { 181 194 $widget_id = $_GET['editwidget']; … … 350 363 </div> 351 364 <div class="widget-holder inactive"> 352 365 <?php wp_list_widget_controls( $registered_sidebar['id'] ); ?> 353 <div class="clear"></div> 366 <div class="remove-inactive-widgets"> 367 <form action="" method="post"> 368 <?php submit_button( __( 'Clear Inactive Widgets' ), 'delete', 'removeinactivewidgets', false, array( 'id' => 'inactive-widgets-control-remove' ) ); ?> 369 <span class="description"><?php _e( 'This will clear all items from the inactive widgets list. You will not be able to restore any customizations.' ); ?></span> 370 <?php wp_nonce_field( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); ?> 371 </form> 372 </div> 354 373 </div> 355 374 </div> 356 375 <?php