Make WordPress Core

Changeset 9333


Ignore:
Timestamp:
10/24/2008 08:47:12 PM (18 years ago)
Author:
ryan
Message:

Move echo/return outside of loops. Props DD32. fixes #7749

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r9243 r9333  
    740740        $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
    741741        $join = apply_filters('getarchives_join', "", $r);
     742
     743        $output = '';
    742744
    743745        if ( 'monthly' == $type ) {
     
    759761                                if ( $show_post_count )
    760762                                        $after = ' ('.$arcresult->posts.')' . $afterafter;
    761                                 $output = get_archives_link($url, $text, $format, $before, $after);
    762                                 if ( $echo )
    763                                         echo $output;
    764                                 else
    765                                         return $output;
     763                                $output .= get_archives_link($url, $text, $format, $before, $after);
    766764                        }
    767765                }
     
    784782                                if ($show_post_count)
    785783                                        $after = ' ('.$arcresult->posts.')' . $afterafter;
    786                                 $output = get_archives_link($url, $text, $format, $before, $after);
    787                                 if ( $echo )
    788                                         echo $output;
    789                                 else
    790                                         return $output;         
     784                                $output .= get_archives_link($url, $text, $format, $before, $after);
    791785                        }
    792786                }
     
    810804                                if ($show_post_count)
    811805                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    812                                 $output = get_archives_link($url, $text, $format, $before, $after);
    813                                 if ( $echo )
    814                                         echo $output;
    815                                 else
    816                                         return $output;
     806                                $output .= get_archives_link($url, $text, $format, $before, $after);
    817807                        }
    818808                }
     
    843833                                                if ($show_post_count)
    844834                                                        $after = ' ('.$arcresult->posts.')'.$afterafter;
    845                                                 $output = get_archives_link($url, $text, $format, $before, $after);
    846                                                 if ( $echo )
    847                                                         echo $output;
    848                                                 else
    849                                                         return $output;
     835                                                $output .= get_archives_link($url, $text, $format, $before, $after);
    850836                                        }
    851837                                }
    852838                }
    853839        } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
    854                 ('alpha' == $type) ? $orderby = "post_title ASC " : $orderby = "post_date DESC ";
     840                $orderby = ('alpha' == $type) ? "post_title ASC " : "post_date DESC ";
    855841                $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
    856842                $key = md5($query);
     
    872858                                        else
    873859                                                $text = $arcresult->ID;
    874                                         $output = get_archives_link($url, $text, $format, $before, $after);
    875                                         if ( $echo )
    876                                                 echo $output;
    877                                         else
    878                                                 return $output;
     860                                        $output .= get_archives_link($url, $text, $format, $before, $after);
    879861                                }
    880862                        }
    881863                }
    882864        }
     865        if ( $echo )
     866                echo $output;
     867        else
     868                return $output;
    883869}
    884870
Note: See TracChangeset for help on using the changeset viewer.