Make WordPress Core

Ticket #10954: clipboard.txt

File clipboard.txt, 972 bytes (added by hakre, 17 years ago)

Fix

Line 
1### Eclipse Workspace Patch 1.0
2#P wordpress-trunk
3Index: wp-includes/widgets.php
4===================================================================
5--- wp-includes/widgets.php (revision 12132)
6+++ wp-includes/widgets.php (working copy)
7@@ -133,11 +133,23 @@
8 $this->_set(1);
9 $this->_register_one();
10 } elseif ( is_array($settings) ) {
11+ // If there is an array, first assume it contains a numerically
12+ // indexed set of options but that's just an assumption
13+ $count = 0;
14 foreach ( array_keys($settings) as $number ) {
15 if ( is_numeric($number) ) {
16+ $count++;
17 $this->_set($number);
18 $this->_register_one($number);
19 }
20+ }
21+ // fallback in case the assumption what the array was for
22+ // was wrong
23+ if ($count == 0) {
24+ // If there are none, we register the widget's existance with a
25+ // generic template (see if ( empty($settings) ) )
26+ $this->_set(1);
27+ $this->_register_one();
28 }
29 }
30 }