Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784

git-svn-id: https://develop.svn.wordpress.org/trunk@8572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2008-08-06 20:31:54 +00:00
parent 3937bd9530
commit 3cab99fbd2
22 changed files with 125 additions and 124 deletions
+9 -9
View File
@@ -434,7 +434,7 @@ function wp_get_archives($args = '') {
}
if ( $arcresults ) {
$afterafter = $after;
foreach ( $arcresults as $arcresult ) {
foreach ( (array) $arcresults as $arcresult ) {
$url = get_month_link($arcresult->year, $arcresult->month);
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
if ( $show_post_count )
@@ -455,7 +455,7 @@ function wp_get_archives($args = '') {
}
if ($arcresults) {
$afterafter = $after;
foreach ($arcresults as $arcresult) {
foreach ( (array) $arcresults as $arcresult) {
$url = get_year_link($arcresult->year);
$text = sprintf('%d', $arcresult->year);
if ($show_post_count)
@@ -476,7 +476,7 @@ function wp_get_archives($args = '') {
}
if ( $arcresults ) {
$afterafter = $after;
foreach ( $arcresults as $arcresult ) {
foreach ( (array) $arcresults as $arcresult ) {
$url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
$date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
$text = mysql2date($archive_day_date_format, $date);
@@ -500,7 +500,7 @@ function wp_get_archives($args = '') {
$arc_w_last = '';
$afterafter = $after;
if ( $arcresults ) {
foreach ( $arcresults as $arcresult ) {
foreach ( (array) $arcresults as $arcresult ) {
if ( $arcresult->week != $arc_w_last ) {
$arc_year = $arcresult->yr;
$arc_w_last = $arcresult->week;
@@ -528,7 +528,7 @@ function wp_get_archives($args = '') {
$arcresults = $cache[ $key ];
}
if ( $arcresults ) {
foreach ( $arcresults as $arcresult ) {
foreach ( (array) $arcresults as $arcresult ) {
if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
$url = get_permalink($arcresult);
$arc_title = $arcresult->post_title;
@@ -668,7 +668,7 @@ function get_calendar($initial = true) {
AND post_type = 'post' AND post_status = 'publish'
AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
if ( $dayswithposts ) {
foreach ( $dayswithposts as $daywith ) {
foreach ( (array) $dayswithposts as $daywith ) {
$daywithpost[] = $daywith[0];
}
} else {
@@ -689,7 +689,7 @@ function get_calendar($initial = true) {
."AND post_type = 'post' AND post_status = 'publish'"
);
if ( $ak_post_titles ) {
foreach ( $ak_post_titles as $ak_post_title ) {
foreach ( (array) $ak_post_titles as $ak_post_title ) {
$post_title = apply_filters( "the_title", $ak_post_title->post_title );
$post_title = str_replace('"', '&quot;', wptexturize( $post_title ));
@@ -756,7 +756,7 @@ add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
function allowed_tags() {
global $allowedtags;
$allowed = '';
foreach ( $allowedtags as $tag => $attributes ) {
foreach ( (array) $allowedtags as $tag => $attributes ) {
$allowed .= '<'.$tag;
if ( 0 < count($attributes) ) {
foreach ( $attributes as $attribute => $limits ) {
@@ -1066,7 +1066,7 @@ function paginate_links( $args = '' ) {
extract($args, EXTR_SKIP);
// Who knows what else people pass in $args
$total = (int) $total;
$total = (int) $total;
if ( $total < 2 )
return;
$current = (int) $current;