WordPress.org

Make WordPress Core

Changeset 7620


Ignore:
Timestamp:
04/07/08 21:40:32 (6 years ago)
Author:
ryan
Message:

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/widgets.js

    r7411 r7620  
    1212            var t = $(this); 
    1313            if ( t.is(':visible') ) { 
    14                 if ( disableFields ) { t.find( ':enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); } 
     14                if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); } 
    1515                li.css( 'marginLeft', 0 ); 
    1616                t.siblings('h4').children('a').text( widgetsL10n.edit ); 
     
    2626 
    2727            if ( t.is(':visible') ) { 
    28                 if ( disableFields ) { t.find( ':enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); } 
     28                if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); } 
    2929                if ( width > 250 ) 
    3030                    li.animate( { marginLeft: 0 } ); 
  • trunk/wp-includes/script-loader.php

    r7584 r7620  
    188188                'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.") 
    189189            ) ); 
    190             $this->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080319' ); 
     190            $this->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080407c' ); 
    191191            $this->localize( 'admin-widgets', 'widgetsL10n', array( 
    192192                'add' => __('Add'), 
  • 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.