Make WordPress Core


Ignore:
Timestamp:
04/07/2008 09:40:32 PM (17 years ago)
Author:
ryan
Message:

Avoid data-loss when editing multi-widgets. Props mdawaffe. fixes #6636 for trunk

File:
1 edited

Legend:

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

    r7548 r7620  
    615615
    616616        foreach ( (array) $_POST['widget-text'] as $widget_number => $widget_text ) {
     617            if ( !isset($widget_text['text']) && isset($options[$widget_number]) ) // user clicked cancel
     618                continue;
    617619            $title = strip_tags(stripslashes($widget_text['title']));
    618620            if ( current_user_can('unfiltered_html') )
     
    751753
    752754        foreach ( (array) $_POST['widget-categories'] as $widget_number => $widget_cat ) {
     755            if ( !isset($widget_cat['title']) && isset($options[$widget_number]) ) // user clicked cancel
     756                continue;
    753757            $title = trim(strip_tags(stripslashes($widget_cat['title'])));
    754758            $count = isset($widget_cat['count']);
     
    11711175
    11721176        foreach( (array) $_POST['widget-rss'] as $widget_number => $widget_rss ) {
     1177            if ( !isset($widget_rss['url']) && isset($options[$widget_number]) ) // user clicked cancel
     1178                continue;
    11731179            $widget_rss = stripslashes_deep( $widget_rss );
    11741180            $url = sanitize_url(strip_tags($widget_rss['url']));
     
    14611467        foreach ( (array) $_POST['widget-many'] as $widget_number => $widget_many_instance ) {
    14621468            // compile data from $widget_many_instance
     1469            if ( !isset($widget_many_instance['something']) && isset($options[$widget_number]) ) // user clicked cancel
     1470                continue;
    14631471            $something = wp_specialchars( $widget_many_instance['something'] );
    14641472            $options[$widget_number] = array( 'something' => $something );  // Even simple widgets should store stuff in array, rather than in scalar
Note: See TracChangeset for help on using the changeset viewer.