Changeset 19340
- Timestamp:
- 11/18/2011 07:50:17 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/widgets.php
r19333 r19340 1165 1165 global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets; 1166 1166 1167 $ _sidebars_widgets = array();1168 $sidebars = array_keys($wp_registered_sidebars); 1167 $registered_sidebar_keys = array_keys( $wp_registered_sidebars ); 1168 1169 1169 $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' ); 1170 1170 if ( is_array( $old_sidebars_widgets ) ) { 1171 1171 // time() that sidebars were stored is in $old_sidebars_widgets['time'] 1172 $old_sidebars = $old_sidebars_widgets['data']; 1173 1174 // make sure the saved sidebars match 1175 foreach ( $sidebars as $sidebar_id ) { 1176 $_sidebars_widgets[$sidebar_id] = isset($old_sidebars[$sidebar_id]) ? $old_sidebars[$sidebar_id] : array(); 1177 } 1178 1172 $_sidebars_widgets = $old_sidebars_widgets['data']; 1179 1173 remove_theme_mod( 'sidebars_widgets' ); 1174 1175 $orphaned = 0; 1176 1177 foreach ( $_sidebars_widgets as $sidebar => $widgets ) { 1178 if ( 'wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) 1179 continue; 1180 1181 if ( !in_array( $sidebar, $registered_sidebar_keys ) ) { 1182 $_sidebars_widgets['orphaned_widgets_' . ++$orphaned] = $widgets; 1183 unset( $_sidebars_widgets[$sidebar] ); 1184 } 1185 } 1180 1186 } else { 1181 1187 if ( empty( $sidebars_widgets ) ) … … 1186 1192 $old = array_keys($sidebars_widgets); 1187 1193 sort($old); 1188 sort($ sidebars);1189 1190 if ( $old == $ sidebars )1194 sort($registered_sidebar_keys); 1195 1196 if ( $old == $registered_sidebar_keys ) 1191 1197 return; 1192 1198
Note: See TracChangeset
for help on using the changeset viewer.