Changeset 273
- Timestamp:
- 07/25/2003 11:07:38 PM (23 years ago)
- File:
-
- 1 edited
-
trunk/b2-include/b2template.functions.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r272 r273 111 111 } 112 112 113 function get_archives($type='', $limit='') { 113 function get_archives_link( $url, $text, $format ) { 114 if ('link' == $format) { 115 echo " <link rel='Archives' title='$text' href='$url' />\n"; 116 } else { 117 echo "<li><a href='$url'>"; 118 echo $text; 119 echo "</a></li>\n"; 120 } 121 } 122 123 function get_archives($type='', $limit='',$format='html') { 114 124 global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename; 115 125 GLOBAL $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week; … … 153 163 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month` FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 154 164 foreach ($arcresults as $arcresult) { 155 echo "<li><a href=\"$archive_link_m$arcresult->year".zeroise($arcresult->month, 2).'">';156 echo $month[zeroise($arcresult->month, 2)].' '.$arcresult->year;157 echo "</a></li>\n";165 $url = sprintf("%s%d%02d", $archive_link_m, $arcresult->year, $arcresult->month); 166 $text = sprintf("%s %d", $month[zeroise($arcresult->month,2)], $arcresult->year); 167 get_archives_link($url, $text, $format); 158 168 } 159 169 } elseif ('daily' == $type) { … … 161 171 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 162 172 foreach ($arcresults as $arcresult) { 163 echo "<li><a href=\"$archive_link_m$arcresult->year".zeroise($arcresult->month, 2).zeroise($arcresult->dayofmonth, 2).'">'; 164 echo mysql2date($archive_day_date_format, $arcresult->year.'-'.zeroise($arcresult->month,2).'-'.zeroise($arcresult->dayofmonth,2).' 00:00:00'); 165 echo "</a></li>\n"; 173 $url = sprintf("%s%d%02d%02d", $archive_link_m, $arcresult->year, $arcresult->month, $arcresult->dayofmonth); 174 $date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth); 175 $text = mysql2date($archive_day_date_format, $date); 176 get_archives_link($url, $text, $format); 166 177 } 167 178 } elseif ('weekly' == $type) { … … 179 190 $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); 180 191 $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); 181 echo "<li><a href='$siteurl/$blogfilename$querystring_start"."m$querystring_equal$arc_year$querystring_separator"."w$querystring_equal$arcresult->week'>"; 182 echo $arc_week_start.$archive_week_separator.$arc_week_end; 183 echo "</a></li>\n"; 192 $url = sprintf("%s/%s%sm%s%s%sw%s%d", $siteurl, $blogfilename, $querystring_start, 193 $querystring_equal, $arc_year, $querystring_separator, 194 $querystring_equal, $arcresult->week); 195 $text = $arc_week_start . $archive_week_separator . $arc_week_end; 196 get_archives_link($url, $text, $format); 184 197 } 185 198 } … … 189 202 foreach ($arcresults as $arcresult) { 190 203 if ($arcresult->post_date != '0000-00-00 00:00:00') { 191 echo "<li><a href=\"$archive_link_p".$arcresult->ID.'">';204 $url = $archive_link_p . $arcresult->ID; 192 205 $arc_title = stripslashes($arcresult->post_title); 193 206 if ($arc_title) { 194 echostrip_tags($arc_title);207 $text = strip_tags($arc_title); 195 208 } else { 196 echo$arcresult->ID;209 $text = $arcresult->ID; 197 210 } 198 echo "</a></li>\n";211 get_archives_link($url, $text, $format); 199 212 } 200 213 }
Note: See TracChangeset
for help on using the changeset viewer.