Ticket #10954: 10954-3.patch
| File 10954-3.patch, 1.2 KB (added by , 16 years ago) |
|---|
-
wp-includes/widgets.php
126 126 127 127 function _register() { 128 128 $settings = $this->get_settings(); 129 $empty = true; 129 130 130 if ( empty($settings) ) { 131 // If there are none, we register the widget's existance with a 132 // generic template 133 $this->_set(1); 134 $this->_register_one(); 135 } elseif ( is_array($settings) ) { 131 if ( is_array($settings) ) { 136 132 foreach ( array_keys($settings) as $number ) { 137 133 if ( is_numeric($number) ) { 138 134 $this->_set($number); 139 135 $this->_register_one($number); 136 $empty = false; 140 137 } 141 138 } 142 139 } 140 141 if ( $empty ) { 142 // If there are none, we register the widget's existance with a 143 // generic template 144 $this->_set(1); 145 $this->_register_one(); 146 } 143 147 } 144 148 145 149 function _set($number) { … … 236 240 } 237 241 } 238 242 243 // housekeeping 244 foreach ( array_keys($all_instances) as $val ) { 245 if ( !is_numeric($val) ) 246 unset($all_instances[$val]); 247 248 } 249 239 250 $this->save_settings($all_instances); 240 251 $this->updated = true; 241 252 }