Changeset 10781 for trunk/wp-includes/widgets.php
- Timestamp:
- 03/13/2009 10:27:38 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/widgets.php
r10774 r10781 656 656 657 657 return $defaults; 658 } 659 660 /** 661 * Convert the widget settings from single to multi-widget format. 662 * 663 * @since 2.8.0 664 * 665 * @return array 666 */ 667 function wp_convert_widget_settings($base_name, $option_name, $settings) { 668 // This test may need expanding. 669 $single = false; 670 foreach ( array_keys($settings) as $number ) { 671 if ( !is_numeric($number) ) { 672 $single = true; 673 break; 674 } 675 } 676 677 if ( $single ) { 678 $settings = array( 2 => $settings ); 679 680 $sidebars_widgets = get_option('sidebars_widgets'); 681 foreach ( (array) $sidebars_widgets as $index => $sidebar ) { 682 if ( is_array($sidebar) ) { 683 foreach ( $sidebar as $i => $name ) { 684 if ( $base_name == $name ) { 685 $sidebars_widgets[$index][$i] = "$name-2"; 686 break 2; 687 } 688 } 689 } 690 } 691 692 update_option('sidebars_widgets', $sidebars_widgets); 693 } 694 695 $settings['_multiwidget'] = 1; 696 update_option( $option_name, $settings ); 697 698 return $settings; 658 699 } 659 700 … … 768 809 return false; 769 810 770 return $new_instance; 811 $new_instance = (array) $new_instance; 812 $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0); 813 foreach ( $instance as $field => $val ) { 814 if ( isset($new_instance[$field]) ) 815 $instance[$field] = 1; 816 } 817 818 return $instance; 771 819 } 772 820 … … 775 823 //Defaults 776 824 $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false) ); 777 /*778 if ( isset($_POST['links-submit']) ) {779 $newoptions = array();780 $newoptions['description'] = isset($_POST['links-description']);781 $newoptions['name'] = isset($_POST['links-name']);782 $newoptions['rating'] = isset($_POST['links-rating']);783 $newoptions['images'] = isset($_POST['links-images']);784 785 if ( $instance != $newoptions ) {786 $instance = $newoptions;787 update_option('widget_links', $instance);788 }789 }790 */791 825 ?> 792 826 <p> … … 1976 2010 $widget_ops = array('description' => __( "Your blogroll" ) ); 1977 2011 $wp_widget_links = new WP_Widget_Links('links', __('Links'), $widget_ops); 1978 $wp_widget_links->register();2012 //$wp_widget_links->register(); 1979 2013 1980 2014 $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
Note: See TracChangeset
for help on using the changeset viewer.