WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/06/2008 11:01:22 PM (12 years ago)
Author:
ryan
Message:

Make cancel mean cancel. Props mdawaffe. see #5886

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/widgets.php

    r7130 r7176  
    609609            if ( 'wp_widget_text' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
    610610                $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
    611                 unset($options[$widget_number]);
     611                if ( !in_array( "text-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
     612                    unset($options[$widget_number]);
    612613            }
    613614        }
     
    744745            if ( 'wp_widget_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
    745746                $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
    746                 unset($options[$widget_number]);
     747                if ( !in_array( "categories-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
     748                    unset($options[$widget_number]);
    747749            }
    748750        }
     
    11631165            if ( 'wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
    11641166                $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
    1165                 unset($options[$widget_number]);
     1167                if ( !in_array( "rss-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
     1168                    unset($options[$widget_number]);
    11661169            }
    11671170        }
     
    14511454            if ( 'widget_many' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
    14521455                $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
    1453                 unset($options[$widget_number]);
     1456                if ( !in_array( "many-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed. "many-$widget_number" is "{id_base}-{widget_number}
     1457                    unset($options[$widget_number]);
    14541458            }
    14551459        }
Note: See TracChangeset for help on using the changeset viewer.