Changeset 8572 for trunk/wp-includes/widgets.php
- Timestamp:
- 08/06/2008 08:31:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/widgets.php
r8567 r8572 209 209 } else { 210 210 $index = sanitize_title($index); 211 foreach ( $wp_registered_sidebars as $key => $value ) {211 foreach ( (array) $wp_registered_sidebars as $key => $value ) { 212 212 if ( sanitize_title($value['name']) == $index ) { 213 213 $index = $key; … … 225 225 226 226 $did_one = false; 227 foreach ( $sidebars_widgets[$index] as $id ) {227 foreach ( (array) $sidebars_widgets[$index] as $id ) { 228 228 $params = array_merge( 229 229 array( array_merge( $sidebar, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']) ) ), … … 275 275 global $wp_registered_widgets, $wp_registered_sidebars; 276 276 $sidebars_widgets = get_option('sidebars_widgets'); 277 foreach ( $wp_registered_sidebars as $index => $sidebar ) {277 foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) { 278 278 if ( count($sidebars_widgets[$index]) ) { 279 foreach ( $sidebars_widgets[$index] as $widget )279 foreach ( (array) $sidebars_widgets[$index] as $widget ) 280 280 if ( array_key_exists($widget, $wp_registered_widgets) ) 281 281 return true; … … 298 298 switch ( $sidebars_widgets['array_version'] ) { 299 299 case 1 : 300 foreach ( $sidebars_widgets as $index => $sidebar )300 foreach ( (array) $sidebars_widgets as $index => $sidebar ) 301 301 if ( is_array($sidebar) ) 302 foreach ( $sidebar as $i => $name ) {302 foreach ( (array) $sidebar as $i => $name ) { 303 303 $id = strtolower($name); 304 304 if ( isset($wp_registered_widgets[$id]) ) { … … 339 339 if ( !empty( $sidebars ) ) { 340 340 // Move the known-good ones first 341 foreach ( $sidebars as $id ) {341 foreach ( (array) $sidebars as $id ) { 342 342 if ( array_key_exists( $id, $sidebars_widgets ) ) { 343 343 $_sidebars_widgets[$id] = $sidebars_widgets[$id]; … … 374 374 $defaults = array(); 375 375 376 foreach ( $wp_registered_sidebars as $index => $sidebar )376 foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) 377 377 $defaults[$index] = array(); 378 378 … … 636 636 $this_sidebar = array(); 637 637 638 foreach ( $this_sidebar as $_widget_id ) {638 foreach ( (array) $this_sidebar as $_widget_id ) { 639 639 if ( 'wp_widget_text' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { 640 640 $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; … … 684 684 685 685 $id = false; 686 foreach ( array_keys($options) as $o ) {686 foreach ( (array) array_keys($options) as $o ) { 687 687 // Old widgets can have null values for some reason 688 688 if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) ) … … 730 730 <script type='text/javascript'> 731 731 /* <![CDATA[ */ 732 733 732 var dropdown = document.getElementById("cat"); 733 function onCatChange() { 734 734 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { 735 735 location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; 736 736 } 737 738 737 } 738 dropdown.onchange = onCatChange; 739 739 /* ]]> */ 740 740 </script> … … 778 778 $this_sidebar = array(); 779 779 780 foreach ( $this_sidebar as $_widget_id ) {780 foreach ( (array) $this_sidebar as $_widget_id ) { 781 781 if ( 'wp_widget_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { 782 782 $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; … … 853 853 854 854 $id = false; 855 foreach ( array_keys($options) as $o ) {855 foreach ( (array) array_keys($options) as $o ) { 856 856 // Old widgets can have null values for some reason 857 857 if ( !isset($options[$o]['title']) ) … … 987 987 <?php echo $before_title . $title . $after_title; ?> 988 988 <ul id="recentcomments"><?php 989 if ( $comments ) : foreach ( $comments as $comment) :989 if ( $comments ) : foreach ( (array) $comments as $comment) : 990 990 echo '<li class="recentcomments">' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>'; 991 991 endforeach; endif;?></ul> … … 1118 1118 $rss->items = array_slice($rss->items, 0, $items); 1119 1119 echo '<ul>'; 1120 foreach ( $rss->items as $item ) {1120 foreach ( (array) $rss->items as $item ) { 1121 1121 while ( strstr($item['link'], 'http') != $item['link'] ) 1122 1122 $item['link'] = substr($item['link'], 1); … … 1185 1185 1186 1186 $urls = array(); 1187 foreach ( $options as $option )1187 foreach ( (array) $options as $option ) 1188 1188 if ( isset($option['url']) ) 1189 1189 $urls[$option['url']] = true; … … 1198 1198 $this_sidebar = array(); 1199 1199 1200 foreach ( $this_sidebar as $_widget_id ) {1200 foreach ( (array) $this_sidebar as $_widget_id ) { 1201 1201 if ( 'wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { 1202 1202 $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; … … 1343 1343 1344 1344 $id = false; 1345 foreach ( array_keys($options) as $o ) {1345 foreach ( (array) array_keys($options) as $o ) { 1346 1346 // Old widgets can have null values for some reason 1347 1347 if ( !isset($options[$o]['url']) || !isset($options[$o]['title']) || !isset($options[$o]['items']) )
Note: See TracChangeset
for help on using the changeset viewer.