Ticket #19159: 19159.4.diff
| File 19159.4.diff, 4.9 KB (added by , 11 years ago) |
|---|
-
wp-admin/admin-ajax.php
56 56 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax', 57 57 'menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink', 58 58 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', 59 'save-widget', ' set-post-thumbnail', 'date_format', 'time_format',59 'save-widget', 'delete-inactive-widgets', 'set-post-thumbnail', 'date_format', 'time_format', 60 60 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 61 61 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', 62 62 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', -
wp-admin/css/widgets.css
203 203 margin-top: 40px; 204 204 } 205 205 206 #widgets-left .inactive-sidebar .remove-inactive-widgets { 207 clear: both; 208 } 209 206 210 /* Not sure what this is for... */ 207 211 div#widgets-left .inactive-sidebar .widget.expanded { 208 212 left: auto; … … 346 350 347 351 .js .widgets-holder-wrap.closed .widget, 348 352 .js .widgets-holder-wrap.closed .sidebar-description, 353 .js .widgets-holder-wrap.closed .remove-inactive-widgets, 349 354 .js .closed br.clear { 350 355 display: none; 351 356 } -
wp-admin/includes/ajax-actions.php
1892 1892 $wp_customize->widgets->wp_ajax_update_widget(); 1893 1893 } 1894 1894 1895 function wp_ajax_delete_inactive_widgets() { 1896 check_ajax_referer( 'remove-inactive-widgets', 'removeinactivewidgets' ); 1897 1898 if ( ! current_user_can( 'edit_theme_options' ) ) 1899 wp_die( -1 ); 1900 1901 unset( $_POST['removeinactivewidgets'], $_POST['action'] ); 1902 1903 do_action( 'load-widgets.php' ); 1904 do_action( 'widgets.php' ); 1905 do_action( 'sidebar_admin_setup' ); 1906 1907 $sidebars_widgets = wp_get_sidebars_widgets(); 1908 $sidebars_widgets['wp_inactive_widgets'] = array(); 1909 wp_set_sidebars_widgets( $sidebars_widgets ); 1910 1911 wp_die(); 1912 } 1913 1895 1914 /** 1896 1915 * Ajax handler for uploading attachments 1897 1916 * -
wp-admin/js/widgets.js
80 80 widget.removeClass( 'open' ); 81 81 wpWidgets.close( widget ); 82 82 e.preventDefault(); 83 } else if ( target.attr( 'id' ) == 'inactive-widgets-control-remove' ) { 84 wpWidgets.removeInactiveWidgets(); 85 e.preventDefault(); 83 86 } 84 87 }); 85 88 … … 445 448 }); 446 449 }, 447 450 451 removeInactiveWidgets : function() { 452 var sb = $( '.inactive-sidebar' ), a, data; 453 454 $( '.spinner', sb ).addClass( 'is-active' ); 455 456 a = { 457 action : 'delete-inactive-widgets', 458 removeinactivewidgets : $( '#_wpnonce_remove_inactive_widgets' ).val() 459 }; 460 461 data = $.param( a ); 462 463 $.post( ajaxurl, data, function() { 464 $( '.spinner', sb ).removeClass(' is-active' ); 465 $( '#wp_inactive_widgets .widget' ).remove(); 466 } ); 467 }, 468 448 469 appendTitle : function(widget) { 449 470 var title = $('input[id*="-title"]', widget).val() || ''; 450 471 -
wp-admin/widgets.php
187 187 exit; 188 188 } 189 189 190 // Remove inactive widgets without js 191 if ( isset( $_POST['removeinactivewidgets'] ) ) { 192 check_admin_referer( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); 193 194 if ( $_POST['removeinactivewidgets'] ) { 195 $sidebars_widgets['wp_inactive_widgets'] = array(); 196 wp_set_sidebars_widgets( $sidebars_widgets ); 197 } 198 199 wp_redirect( admin_url( 'widgets.php?message=0' ) ); 200 exit; 201 } 202 190 203 // Output the widget form without js 191 204 if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) { 192 205 $widget_id = $_GET['editwidget']; … … 381 394 <div class="<?php echo esc_attr( $wrap_class ); ?>"> 382 395 <div class="widget-holder inactive"> 383 396 <?php wp_list_widget_controls( $registered_sidebar['id'], $registered_sidebar['name'] ); ?> 384 <div class="clear"></div> 397 <div class="remove-inactive-widgets"> 398 <form action="" method="post"> 399 <p><?php submit_button( __( 'Clear Inactive Widgets' ), 'delete', 'removeinactivewidgets', false, array( 'id' => 'inactive-widgets-control-remove' ) ); ?></p> 400 <p class="description"><?php _e( 'This will clear all items from the inactive widgets list. You will not be able to restore any customizations.' ); ?></p> 401 <?php wp_nonce_field( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); ?> 402 </form> 403 </div> 385 404 </div> 386 405 </div> 387 406 <?php