Changeset 510 for trunk/b2-include/b2template.functions.php
- Timestamp:
- 11/03/2003 05:22:01 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/b2-include/b2template.functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r509 r510 229 229 } 230 230 231 function get_calendar( ) {232 global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $ tableposts;231 function get_calendar($daylength = 1) { 232 global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts; 233 233 // Quick check. If we have no posts at all, abort! 234 234 if (!$posts) { … … 269 269 FROM $tableposts 270 270 WHERE post_date < '$thisyear-$thismonth-01' 271 AND post_status = 'publish' 271 272 ORDER BY post_date DESC 272 273 LIMIT 1"); 273 274 $next = $wpdb->get_row("SELECT DISTINCT MONTH( post_date ) AS month, YEAR( post_date ) AS year 274 275 FROM $tableposts 275 WHERE post_date > '$thisyear-$thismonth-01' AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 276 WHERE post_date > '$thisyear-$thismonth-01' 277 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 278 AND post_status = 'publish' 276 279 ORDER BY post_date ASC 277 LIMIT 1 ");280 LIMIT 1"); 278 281 279 282 echo '<table id="wp-calendar"> 280 283 <caption>' . $month[zeroise($thismonth, 2)] . ' ' . date('Y', $unixmonth) . '</caption> 281 284 <thead> 282 <tr> 283 <th abbr="Sunday" scope="col" title="Sunday">Sun</th> 284 <th abbr="Monday" scope="col" title="Monday">Mon</th> 285 <th abbr="Tuesday" scope="col" title="Tuesday">Tue</th> 286 <th abbr="Wednesday" scope="col" title="Wednesday">Wed</th> 287 <th abbr="Thursday" scope="col" title="Thursday">Thu</th> 288 <th abbr="Friday" scope="col" title="Friday">Fri</th> 289 <th abbr="Saturday" scope="col" title="Saturday">Sat</th> 290 </tr> 285 <tr>'; 286 foreach ($weekday as $wd) { 287 echo "\n\t<th abbr='$wd' scope='col' title='$wd'>" . substr($wd, 0, $daylength) . '</th>'; 288 } 289 290 echo ' </tr> 291 291 </thead> 292 292 … … 295 295 296 296 if ($previous) { 297 echo '<thabbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' .297 echo "\n\t".'<td abbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' . 298 298 get_month_link($previous->year, $previous->month) . '" title="View posts for ' . $month[zeroise($previous->month, 2)] . ' ' . 299 date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">« ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a> ';299 date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">« ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a></td>'; 300 300 } else { 301 echo '<th colspan="3" id="prev">«</th>';302 } 303 304 echo '<th> </th>';301 echo "\n\t".'<td colspan="3" id="prev">«</td>'; 302 } 303 304 echo "\n\t".'<td> </td>'; 305 305 306 306 if ($next) { 307 echo '<thabbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' .307 echo "\n\t".'<td abbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' . 308 308 get_month_link($previous->year, $next->month) . '" title="View posts for ' . $month[zeroise($next->month, 2)] . ' ' . 309 date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . substr($month[zeroise($next->month, 2)], 0, 3) . ' »</a> ';309 date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . substr($month[zeroise($next->month, 2)], 0, 3) . ' »</a></td>'; 310 310 } else { 311 echo '<th colspan="3" id="next">»</th>'; 312 } 313 314 echo ' </tr> 311 echo "\n\t".'<td colspan="3" id="next">»</td>'; 312 } 313 314 echo ' 315 </tr> 315 316 </tfoot> 316 317 … … 324 325 AND post_status = 'publish' 325 326 AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."'", ARRAY_N); 326 foreach ($dayswithposts as $daywith) { 327 $daywithpost[] = $daywith[0]; 327 328 if ($dayswithposts) { 329 foreach ($dayswithposts as $daywith) { 330 $daywithpost[] = $daywith[0]; 331 } 332 } else { 333 $daywithpost = array(); 328 334 } 329 335 330 336 // See how much we should pad in the beginning 331 337 $pad = intval(date('w', $unixmonth)); 332 if (0 != $pad) echo "\n\t<td c lass='empty' colspan='$pad'> </td>";338 if (0 != $pad) echo "\n\t<td colspan='$pad'> </td>"; 333 339 334 340 $daysinmonth = intval(date('t', $unixmonth)); 335 341 for ($day = 1; $day <= $daysinmonth; ++$day) { 336 if ($newrow) echo "\n </tr>\n <tr>";342 if ($newrow) echo "\n </tr>\n <tr>\n\t"; 337 343 $newrow = false; 338 echo "\n\t<td>"; 344 345 if ($day == date('j', (time() + ($time_difference * 3600)))) echo '<td id="today">'; 346 else echo "<td>"; 339 347 340 348 if (in_array($day, $daywithpost)) {
Note: See TracChangeset
for help on using the changeset viewer.