Ticket #6636: 6636.diff

File 6636.diff, 3.7 KB (added by mdawaffe, 4 years ago)
  • wp-includes/widgets.php

     
    614614                } 
    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') ) 
    619621                                $text = stripslashes( $widget_text['text'] ); 
     
    750752                } 
    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']); 
    755759                        $hierarchical = isset($widget_cat['hierarchical']); 
     
    11701174                } 
    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'])); 
    11751181                        $options[$widget_number] = wp_widget_rss_process( $widget_rss, !isset($urls[$url]) ); 
     
    14601466 
    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 
    14651473                } 
  • wp-includes/script-loader.php

     
    187187                                'saveText' => attribute_escape(__('Save »')), 
    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'), 
    193193                                'edit' => __('Edit'), 
  • wp-admin/js/widgets.js

     
    1111                var widgetAnim = $.browser.msie ? function() { 
    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 ); 
    1717                        } else { 
     
    2525                        var t = $(this); 
    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 } ); 
    3131                                t.siblings('h4').children('a').text( widgetsL10n.edit );