Changeset 8572
- Timestamp:
- 08/06/2008 08:31:54 PM (17 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/capabilities.php
r7701 r8572 29 29 $this->role_objects = array(); 30 30 $this->role_names = array(); 31 foreach ( $this->roles as $role => $data) {31 foreach ( (array) $this->roles as $role => $data) { 32 32 $this->role_objects[$role] = new WP_Role($role, $this->roles[$role]['capabilities']); 33 33 $this->role_names[$role] = $this->roles[$role]['name']; … … 208 208 209 209 function set_role($role) { 210 foreach( $this->roles as $oldrole)210 foreach( (array) $this->roles as $oldrole) 211 211 unset($this->caps[$oldrole]); 212 212 if ( !empty($role) ) { … … 266 266 // Must have ALL requested caps 267 267 $capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args); 268 foreach ( $caps as $cap) {268 foreach ( (array) $caps as $cap) { 269 269 //echo "Checking cap $cap<br />"; 270 270 if(empty($capabilities[$cap]) || !$capabilities[$cap]) -
trunk/wp-includes/category-template.php
r8569 r8572 8 8 // TODO: consult hierarchy 9 9 $cat_ids = get_all_category_ids(); 10 foreach ( $cat_ids as $cat_id ) {10 foreach ( (array) $cat_ids as $cat_id ) { 11 11 if ( $cat_id == $id ) 12 12 continue; … … 85 85 $categories = array(); 86 86 87 foreach( array_keys($categories) as $key) {87 foreach( (array) array_keys($categories) as $key) { 88 88 _make_cat_compat($categories[$key]); 89 89 } -
trunk/wp-includes/category.php
r8090 r8572 44 44 if ( 'link' == $args['type'] ) 45 45 $taxonomy = 'link_category'; 46 $categories = get_terms($taxonomy, $args);46 $categories = (array) get_terms($taxonomy, $args); 47 47 48 48 foreach ( array_keys($categories) as $k ) -
trunk/wp-includes/classes.php
r8510 r8572 91 91 // Look for matches. 92 92 $request_match = $request; 93 foreach ( $rewrite as $match => $query) {93 foreach ( (array) $rewrite as $match => $query) { 94 94 // Don't try to match against AtomPub calls 95 95 if ( $req_uri == 'wp-app.php' ) … … 172 172 } 173 173 174 foreach ( $this->private_query_vars as $var) {174 foreach ( (array) $this->private_query_vars as $var) { 175 175 if (isset($this->extra_query_vars[$var])) 176 176 $this->query_vars[$var] = $this->extra_query_vars[$var]; … … 243 243 function build_query_string() { 244 244 $this->query_string = ''; 245 foreach ( array_keys($this->query_vars) as $wpvar) {245 foreach ( (array) array_keys($this->query_vars) as $wpvar) { 246 246 if ( '' != $this->query_vars[$wpvar] ) { 247 247 $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; … … 262 262 global $wp_query; 263 263 // Extract updated query vars back into global namespace. 264 foreach ( $wp_query->query_vars as $key => $value) {264 foreach ( (array) $wp_query->query_vars as $key => $value) { 265 265 $GLOBALS[$key] = $value; 266 266 } … … 351 351 if ( empty($code) ) { 352 352 $all_messages = array(); 353 foreach ( $this->errors as $code => $messages )353 foreach ( (array) $this->errors as $code => $messages ) 354 354 $all_messages = array_merge($all_messages, $messages); 355 355 … … 528 528 * then we got orphans, which should be displayed regardless 529 529 */ 530 if ( ( $max_depth == 0 ) && sizeof( $children_elements ) > 0 ) {530 if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) { 531 531 $empty_array = array(); 532 532 foreach ( $children_elements as $orphans ) … … 751 751 $response = ''; 752 752 if ( is_wp_error($data) ) { 753 foreach ( $data->get_error_codes() as $code ) {753 foreach ( (array) $data->get_error_codes() as $code ) { 754 754 $response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message($code) . "]]></wp_error>"; 755 755 if ( !$error_data = $data->get_error_data($code) ) … … 777 777 778 778 $s = ''; 779 if ( (array) $supplemental) {779 if ( is_array($supplemental) ) { 780 780 foreach ( $supplemental as $k => $v ) 781 781 $s .= "<$k><![CDATA[$v]]></$k>"; … … 801 801 header('Content-Type: text/xml'); 802 802 echo "<?xml version='1.0' standalone='yes'?><wp_ajax>"; 803 foreach ( $this->responses as $response )803 foreach ( (array) $this->responses as $response ) 804 804 echo $response; 805 805 echo '</wp_ajax>'; -
trunk/wp-includes/comment.php
r8543 r8572 53 53 $words = explode("\n", $mod_keys ); 54 54 55 foreach ( $words as $word) {55 foreach ( (array) $words as $word) { 56 56 $word = trim($word); 57 57 … … 1236 1236 // We don't wanna ping first and second types, even if they have a valid <link/> 1237 1237 1238 foreach ( $post_links_temp[0] as $link_test ) :1238 foreach ( (array) $post_links_temp[0] as $link_test ) : 1239 1239 if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself 1240 1240 && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. -
trunk/wp-includes/cron.php
r8537 r8572 111 111 foreach ( $crons as $timestamp => $cronhooks ) { 112 112 if ( $timestamp > time() ) break; 113 foreach ( $cronhooks as $hook => $args ) {113 foreach ( (array) $cronhooks as $hook => $args ) { 114 114 if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) ) 115 115 continue; … … 169 169 $new_cron = array(); 170 170 171 foreach ( $cron as $timestamp => $hooks) {172 foreach ( $hooks as $hook => $args ) {171 foreach ( (array) $cron as $timestamp => $hooks) { 172 foreach ( (array) $hooks as $hook => $args ) { 173 173 $key = md5(serialize($args['args'])); 174 174 $new_cron[$timestamp][$hook][$key] = $args; -
trunk/wp-includes/feed.php
r8246 r8572 399 399 return; 400 400 401 foreach ( get_post_custom() as $key => $val) {401 foreach ( (array) get_post_custom() as $key => $val) { 402 402 if ($key == 'enclosure') { 403 foreach ( (array)$val as $enc) {403 foreach ( (array) $val as $enc ) { 404 404 $enclosure = split("\n", $enc); 405 405 echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); … … 431 431 return; 432 432 433 foreach ( get_post_custom() as $key => $val) {433 foreach ( (array) get_post_custom() as $key => $val ) { 434 434 if ($key == 'enclosure') { 435 foreach ( (array)$val as $enc) {435 foreach ( (array) $val as $enc ) { 436 436 $enclosure = split("\n", $enc); 437 437 echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); -
trunk/wp-includes/functions.php
r8570 r8572 422 422 $wpdb->show_errors($show); 423 423 424 foreach ( $options as $option ) {424 foreach ( (array) $options as $option ) { 425 425 // "When trying to design a foolproof system, 426 426 // never underestimate the ingenuity of the fools :)" -- Dougal … … 778 778 debug_fwrite( $log, $content . "\n" ); 779 779 780 foreach ( $post_links_temp[0] as $link_test ) {780 foreach ( (array) $post_links_temp[0] as $link_test ) { 781 781 if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already 782 782 $test = parse_url( $link_test ); … … 788 788 } 789 789 790 foreach ( $post_links as $url ) {790 foreach ( (array) $post_links as $url ) { 791 791 if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url . '%' ) ) ) { 792 792 if ( $headers = wp_get_http_headers( $url) ) { … … 1008 1008 } 1009 1009 1010 foreach ( $qs as $k => $v ) {1010 foreach ( (array) $qs as $k => $v ) { 1011 1011 if ( $v === false ) 1012 1012 unset( $qs[$k] ); … … 1032 1032 function remove_query_arg( $key, $query=false ) { 1033 1033 if ( is_array( $key ) ) { // removing multiple keys 1034 foreach ( (array)$key as $k )1034 foreach ( $key as $k ) 1035 1035 $query = add_query_arg( $k, false, $query ); 1036 1036 return $query; … … 1050 1050 global $wpdb; 1051 1051 1052 foreach ( $array as $k => $v ) {1052 foreach ( (array) $array as $k => $v ) { 1053 1053 if ( is_array( $v ) ) { 1054 1054 $array[$k] = add_magic_quotes( $v ); -
trunk/wp-includes/general-template.php
r8498 r8572 435 435 if ( $arcresults ) { 436 436 $afterafter = $after; 437 foreach ( $arcresults as $arcresult ) {437 foreach ( (array) $arcresults as $arcresult ) { 438 438 $url = get_month_link($arcresult->year, $arcresult->month); 439 439 $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year); … … 456 456 if ($arcresults) { 457 457 $afterafter = $after; 458 foreach ( $arcresults as $arcresult) {458 foreach ( (array) $arcresults as $arcresult) { 459 459 $url = get_year_link($arcresult->year); 460 460 $text = sprintf('%d', $arcresult->year); … … 477 477 if ( $arcresults ) { 478 478 $afterafter = $after; 479 foreach ( $arcresults as $arcresult ) {479 foreach ( (array) $arcresults as $arcresult ) { 480 480 $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); 481 481 $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth); … … 501 501 $afterafter = $after; 502 502 if ( $arcresults ) { 503 foreach ( $arcresults as $arcresult ) {503 foreach ( (array) $arcresults as $arcresult ) { 504 504 if ( $arcresult->week != $arc_w_last ) { 505 505 $arc_year = $arcresult->yr; … … 529 529 } 530 530 if ( $arcresults ) { 531 foreach ( $arcresults as $arcresult ) {531 foreach ( (array) $arcresults as $arcresult ) { 532 532 if ( $arcresult->post_date != '0000-00-00 00:00:00' ) { 533 533 $url = get_permalink($arcresult); … … 669 669 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N); 670 670 if ( $dayswithposts ) { 671 foreach ( $dayswithposts as $daywith ) {671 foreach ( (array) $dayswithposts as $daywith ) { 672 672 $daywithpost[] = $daywith[0]; 673 673 } … … 690 690 ); 691 691 if ( $ak_post_titles ) { 692 foreach ( $ak_post_titles as $ak_post_title ) {692 foreach ( (array) $ak_post_titles as $ak_post_title ) { 693 693 694 694 $post_title = apply_filters( "the_title", $ak_post_title->post_title ); … … 757 757 global $allowedtags; 758 758 $allowed = ''; 759 foreach ( $allowedtags as $tag => $attributes ) {759 foreach ( (array) $allowedtags as $tag => $attributes ) { 760 760 $allowed .= '<'.$tag; 761 761 if ( 0 < count($attributes) ) { … … 1067 1067 1068 1068 // Who knows what else people pass in $args 1069 $total 1069 $total = (int) $total; 1070 1070 if ( $total < 2 ) 1071 1071 return; -
trunk/wp-includes/kses.php
r8410 r8572 794 794 $outarray = array (); 795 795 796 foreach ( $inarray as $inkey => $inval) {796 foreach ( (array) $inarray as $inkey => $inval) { 797 797 $outkey = strtolower($inkey); 798 798 $outarray[$outkey] = array (); 799 799 800 foreach ( $inval as $inkey2 => $inval2) {800 foreach ( (array) $inval as $inkey2 => $inval2) { 801 801 $outkey2 = strtolower($inkey2); 802 802 $outarray[$outkey][$outkey2] = $inval2; -
trunk/wp-includes/locale.php
r6589 r8572 191 191 192 192 // Import global locale vars set during inclusion of $locale.php. 193 foreach ( $this->locale_vars as $var ) {193 foreach ( (array) $this->locale_vars as $var ) { 194 194 if ( isset($GLOBALS[$var]) ) 195 195 $this->$var = $GLOBALS[$var]; -
trunk/wp-includes/pluggable.php
r8564 r8572 281 281 if ( !empty( $tempheaders ) ) { 282 282 // Iterate through the raw headers 283 foreach ( $tempheaders as $header ) {283 foreach ( (array) $tempheaders as $header ) { 284 284 if ( strpos($header, ':') === false ) 285 285 continue; … … 364 364 // Add any CC and BCC recipients 365 365 if ( !empty($cc) ) { 366 foreach ( $cc as $recipient) {366 foreach ( (array) $cc as $recipient ) { 367 367 $phpmailer->AddCc( trim($recipient) ); 368 368 } 369 369 } 370 370 if ( !empty($bcc) ) { 371 foreach ( $bcc as $recipient) {371 foreach ( (array) $bcc as $recipient) { 372 372 $phpmailer->AddBcc( trim($recipient) ); 373 373 } … … 402 402 // Set custom headers 403 403 if ( !empty( $headers ) ) { 404 foreach ($headers as $name => $content ) {404 foreach( (array) $headers as $name => $content ) { 405 405 $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); 406 406 } … … 790 790 while($found) { 791 791 $found = false; 792 foreach( $strip as $val) {792 foreach( (array) $strip as $val ) { 793 793 while(strpos($location, $val) !== false) { 794 794 $found = true; -
trunk/wp-includes/plugin.php
r7999 r8572 91 91 return false; 92 92 93 foreach ( array_keys($wp_filter[$tag]) as $priority ) {93 foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) { 94 94 if ( isset($wp_filter[$tag][$priority][$idx]) ) 95 95 return $priority; -
trunk/wp-includes/post-template.php
r8547 r8572 256 256 if ( $keys = get_post_custom_keys() ) { 257 257 echo "<ul class='post-meta'>\n"; 258 foreach ( $keys as $key ) {258 foreach ( (array) $keys as $key ) { 259 259 $keyt = trim($key); 260 260 if ( '_' == $keyt{0} ) -
trunk/wp-includes/post.php
r8546 r8572 144 144 return $kids; 145 145 } elseif ( $output == ARRAY_A ) { 146 foreach ( $kids as $kid )146 foreach ( (array) $kids as $kid ) 147 147 $weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]); 148 148 return $weeuns; 149 149 } elseif ( $output == ARRAY_N ) { 150 foreach ( $kids as $kid )150 foreach ( (array) $kids as $kid ) 151 151 $babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID])); 152 152 return $babes; … … 1580 1580 1581 1581 // Update counts for the post's terms. 1582 foreach ( get_object_taxonomies('post') as $taxonomy ) {1582 foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { 1583 1583 $terms = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids'); 1584 1584 wp_update_term_count($terms, $taxonomy); … … 1846 1846 1847 1847 $trackback_urls = explode(',', $tb_list); 1848 foreach( $trackback_urls as $tb_url) {1848 foreach( (array) $trackback_urls as $tb_url) { 1849 1849 $tb_url = trim($tb_url); 1850 1850 trackback($tb_url, stripslashes($post_title), $excerpt, $post_id); … … 1927 1927 $leaf_path = sanitize_title(basename($page_paths)); 1928 1928 $page_paths = explode('/', $page_paths); 1929 foreach( $page_paths as $pathdir)1929 foreach( (array) $page_paths as $pathdir) 1930 1930 $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); 1931 1931 … … 1988 1988 function &get_page_children($page_id, $pages) { 1989 1989 $page_list = array(); 1990 foreach ( $pages as $page ) {1990 foreach ( (array) $pages as $page ) { 1991 1991 if ( $page->post_parent == $page_id ) { 1992 1992 $page_list[] = $page; … … 2014 2014 function get_page_hierarchy($posts, $parent = 0) { 2015 2015 $result = array ( ); 2016 if ($posts) { foreach ( $posts as $post) {2016 if ($posts) { foreach ( (array) $posts as $post) { 2017 2017 if ($post->post_parent == $parent) { 2018 2018 $result[$post->ID] = $post->post_name; … … 3029 3029 } 3030 3030 3031 foreach ( array_keys($cache) as $post)3031 foreach ( (array) array_keys($cache) as $post) 3032 3032 wp_cache_set($post, $cache[$post], 'post_meta'); 3033 3033 -
trunk/wp-includes/query.php
r8555 r8572 215 215 $page = (array) $page; 216 216 217 217 if ( in_array( $page_obj->ID, $page ) ) 218 218 return true; 219 219 elseif ( in_array( $page_obj->post_title, $page ) ) … … 991 991 $n = ($q['exact']) ? '' : '%'; 992 992 $searchand = ''; 993 foreach( (array)$q['search_terms'] as $term) {993 foreach( (array) $q['search_terms'] as $term) { 994 994 $term = addslashes_gpc($term); 995 995 $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))"; … … 1016 1016 $q['cat'] = ''; 1017 1017 $req_cats = array(); 1018 foreach ( $cat_array as $cat ) {1018 foreach ( (array) $cat_array as $cat ) { 1019 1019 $cat = intval($cat); 1020 1020 $req_cats[] = $cat; -
trunk/wp-includes/rewrite.php
r8510 r8572 158 158 parse_str($query, $query_vars); 159 159 $query = array(); 160 foreach ( $query_vars as $key => $value ) {160 foreach ( (array) $query_vars as $key => $value ) { 161 161 if ( in_array($key, $wp->public_query_vars) ) 162 162 $query[$key] = $value; … … 391 391 preg_match_all('/%.+?%/', $this->permalink_structure, $tokens); 392 392 $tok_index = 1; 393 foreach ( $tokens[0] as $token) {393 foreach ( (array) $tokens[0] as $token) { 394 394 if ( ($token == '%post_id%') && ($tok_index <= 3) ) { 395 395 $front = $front . 'date/'; … … 575 575 //build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/? 576 576 $feedregex2 = ''; 577 foreach ( $this->feeds as $feed_name) {577 foreach ( (array) $this->feeds as $feed_name) { 578 578 $feedregex2 .= $feed_name . '|'; 579 579 } … … 590 590 if ($endpoints) { 591 591 $ep_query_append = array (); 592 foreach ( $this->endpoints as $endpoint) {592 foreach ( (array) $this->endpoints as $endpoint) { 593 593 //match everything after the endpoint name, but allow for nothing to appear there 594 594 $epmatch = $endpoint[1] . '(/(.*))?/?$'; … … 689 689 //do endpoints 690 690 if ($endpoints) { 691 foreach ( $ep_query_append as $regex => $ep) {691 foreach ( (array) $ep_query_append as $regex => $ep) { 692 692 //add the endpoints on if the mask fits 693 693 if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) { … … 746 746 747 747 //do endpoints for attachments 748 if ( ! empty($endpoint) ) { foreach ($ep_query_append as $regex => $ep) {748 if ( !empty($endpoint) ) { foreach ( (array) $ep_query_append as $regex => $ep ) { 749 749 if ($ep[0] & EP_ATTACHMENT) { 750 750 $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2); … … 894 894 895 895 //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all) 896 foreach ( $this->non_wp_rules as $match => $query) {896 foreach ( (array) $this->non_wp_rules as $match => $query) { 897 897 // Apache 1.3 does not support the reluctant (non-greedy) modifier. 898 898 $match = str_replace('.+?', '.+', $match); … … 915 915 "RewriteRule ^.*$ - [S=$num_rules]\n"; 916 916 917 foreach ( $rewrite as $match => $query) {917 foreach ( (array) $rewrite as $match => $query) { 918 918 // Apache 1.3 does not support the reluctant (non-greedy) modifier. 919 919 $match = str_replace('.+?', '.+', $match); -
trunk/wp-includes/rss.php
r8503 r8572 535 535 536 536 // if RSS parsed successfully 537 if ( $rss and!$rss->ERROR) {537 if ( $rss && !$rss->ERROR) { 538 538 539 539 // find Etag, and Last-Modified 540 foreach( $resp->headers as $h) {540 foreach( (array) $resp->headers as $h) { 541 541 // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" 542 542 if (strpos($h, ": ")) { … … 844 844 } 845 845 846 foreach ( $rss->items as $item ) {846 foreach ( (array) $rss->items as $item ) { 847 847 printf( 848 848 '<li><a href="%1$s" title="%2$s">%3$s</a></li>', … … 865 865 if ( $rss ) { 866 866 $rss->items = array_slice($rss->items, 0, $num_items); 867 foreach ( $rss->items as $item ) {867 foreach ( (array) $rss->items as $item ) { 868 868 echo "<li>\n"; 869 869 echo "<a href='$item[link]' title='$item[description]'>"; -
trunk/wp-includes/taxonomy.php
r8433 r8572 50 50 51 51 $taxonomies = array(); 52 foreach ( $wp_taxonomies as $taxonomy ) {52 foreach ( (array) $wp_taxonomies as $taxonomy ) { 53 53 if ( array_intersect($object, (array) $taxonomy->object_type) ) 54 54 $taxonomies[] = $taxonomy->name; … … 231 231 $taxonomies = array($taxonomies); 232 232 233 foreach ( $taxonomies as $taxonomy ) {233 foreach ( (array) $taxonomies as $taxonomy ) { 234 234 if ( ! is_taxonomy($taxonomy) ) 235 235 return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); … … 426 426 $children = $terms[$term]; 427 427 428 foreach ( $terms[$term] as $child ) {428 foreach ( (array) $terms[$term] as $child ) { 429 429 if ( isset($terms[$child]) ) 430 430 $children = array_merge($children, get_term_children($child, $taxonomy)); … … 559 559 } 560 560 561 foreach ( $taxonomies as $taxonomy ) {561 foreach ( (array) $taxonomies as $taxonomy ) { 562 562 if ( ! is_taxonomy($taxonomy) ) 563 563 return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); … … 627 627 $interms = preg_split('/[\s,]+/',$include); 628 628 if ( count($interms) ) { 629 foreach ( $interms as $interm ) {629 foreach ( (array) $interms as $interm ) { 630 630 if (empty($inclusions)) 631 631 $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' '; … … 644 644 $exterms = preg_split('/[\s,]+/',$exclude); 645 645 if ( count($exterms) ) { 646 foreach ( $exterms as $exterm ) {646 foreach ( (array) $exterms as $exterm ) { 647 647 if (empty($exclusions)) 648 648 $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' '; … … 722 722 723 723 // Make sure we show empty categories that have children. 724 if ( $hierarchical && $hide_empty ) {724 if ( $hierarchical && $hide_empty && is_array($terms) ) { 725 725 foreach ( $terms as $k => $term ) { 726 726 if ( ! $term->count ) { 727 727 $children = _get_term_children($term->term_id, $terms, $taxonomies[0]); 728 foreach ( $children as $child ) 729 if ( $child->count ) 730 continue 2; 728 if( is_array($children) ) 729 foreach ( $children as $child ) 730 if ( $child->count ) 731 continue 2; 731 732 732 733 // It really is empty … … 825 826 $do_object = true; 826 827 827 foreach ( $fields as $field ) {828 foreach ( (array) $fields as $field ) { 828 829 if ( $do_object ) 829 830 $term->$field = sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context); … … 956 957 $taxonomies = array($taxonomies); 957 958 958 foreach ( $taxonomies as $taxonomy ) {959 foreach ( (array) $taxonomies as $taxonomy ) { 959 960 $terms = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); 960 961 $in_terms = "'" . implode("', '", $terms) . "'"; … … 1083 1084 $taxonomies = array($taxonomies); 1084 1085 1085 foreach ( $taxonomies as $taxonomy ) {1086 foreach ( (array) $taxonomies as $taxonomy ) { 1086 1087 if ( ! is_taxonomy($taxonomy) ) 1087 1088 return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); … … 1324 1325 $term_ids = array(); 1325 1326 1326 foreach ( $terms as $term) {1327 foreach ( (array) $terms as $term) { 1327 1328 if ( !strlen(trim($term)) ) 1328 1329 continue; … … 1588 1589 1589 1590 if ( $do_deferred ) { 1590 foreach ( array_keys($_deferred) as $tax ) {1591 foreach ( (array) array_keys($_deferred) as $tax ) { 1591 1592 wp_update_term_count_now( $_deferred[$tax], $tax ); 1592 1593 unset( $_deferred[$tax] ); … … 1629 1630 } else { 1630 1631 // Default count updater 1631 foreach ( $terms as $term) {1632 foreach ( (array) $terms as $term) { 1632 1633 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); 1633 1634 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); … … 1822 1823 */ 1823 1824 function update_term_cache($terms, $taxonomy = '') { 1824 foreach ( $terms as $term ) {1825 foreach ( (array) $terms as $term ) { 1825 1826 $term_taxonomy = $taxonomy; 1826 1827 if ( empty($term_taxonomy) ) … … 1897 1898 return $empty_array; 1898 1899 1899 foreach ( $terms as $term ) {1900 foreach ( (array) $terms as $term ) { 1900 1901 $use_id = false; 1901 1902 if ( !is_object($term) ) { … … 1957 1958 $term_items = array(); 1958 1959 1959 foreach ( $terms as $key => $term ) {1960 foreach ( (array) $terms as $key => $term ) { 1960 1961 $terms_by_id[$term->term_id] = & $terms[$key]; 1961 1962 $term_ids[$term->term_taxonomy_id] = $term->term_id; … … 2007 2008 global $wpdb; 2008 2009 2009 foreach ( $terms as $term ) {2010 foreach ( (array) $terms as $term ) { 2010 2011 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term ) ); 2011 2012 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); -
trunk/wp-includes/user.php
r8069 r8572 287 287 $output .= "\t<option value='-1'>$show_option_none</option>\n"; 288 288 289 foreach ( $users as $user ) {289 foreach ( (array) $users as $user ) { 290 290 $user->ID = (int) $user->ID; 291 291 $_selected = $user->ID == $selected ? " selected='selected'" : ''; … … 312 312 313 313 if ( $metavalues ) { 314 foreach ( $metavalues as $meta ) {314 foreach ( (array) $metavalues as $meta ) { 315 315 $value = maybe_unserialize($meta->meta_value); 316 316 $user->{$meta->meta_key} = $value; -
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']) ) -
trunk/wp-includes/wp-db.php
r8311 r8572 379 379 $this->prefix = $prefix; 380 380 381 foreach ( $this->tables as $table )381 foreach ( (array) $this->tables as $table ) 382 382 $this->$table = $this->prefix . $table; 383 383 … … 678 678 $data = add_magic_quotes($data); 679 679 $bits = $wheres = array(); 680 foreach ( array_keys($data) as $k )680 foreach ( (array) array_keys($data) as $k ) 681 681 $bits[] = "`$k` = '$data[$k]'"; 682 682 … … 806 806 if ( $this->last_result ) { 807 807 $i = 0; 808 foreach( $this->last_result as $row ) {808 foreach( (array) $this->last_result as $row ) { 809 809 if ( $output == ARRAY_N ) { 810 810 // ...integer-keyed row arrays … … 834 834 if ( $col_offset == -1 ) { 835 835 $i = 0; 836 foreach( $this->col_info as $col ) {836 foreach( (array) $this->col_info as $col ) { 837 837 $new_array[$i] = $col->{$info_type}; 838 838 $i++; … … 942 942 $caller = ''; 943 943 944 foreach ( $bt as $trace ) {944 foreach ( (array) $bt as $trace ) { 945 945 if ( @$trace['class'] == __CLASS__ ) 946 946 continue;
Note: See TracChangeset
for help on using the changeset viewer.