Changeset 4522
- Timestamp:
- 11/23/2006 05:56:53 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/general-template.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/general-template.php
r4495 r4522 423 423 global $wpdb, $m, $monthnum, $year, $timedifference, $wp_locale, $posts; 424 424 425 $key = md5( $m . $monthnum . $year ); 426 if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) { 427 if ( isset( $cache[ $key ] ) ) { 428 echo $cache; 429 return; 430 } 431 } 432 433 ob_start(); 425 434 // Quick check. If we have no posts at all, abort! 426 435 if ( !$posts ) { … … 472 481 WHERE post_date > '$thisyear-$thismonth-01' 473 482 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 474 AND post_type = 'post' AND post_status = 'publish' 483 AND post_type = 'post' AND post_status = 'publish' 475 484 ORDER BY post_date ASC 476 485 LIMIT 1"); … … 596 605 597 606 echo "\n\t</tr>\n\t</tbody>\n\t</table>"; 598 } 607 608 $output = ob_get_contents(); 609 ob_end_clean(); 610 echo $output; 611 $cache[ $key ] = $output; 612 wp_cache_set( 'get_calendar', $cache, 'calendar' ); 613 } 614 615 function delete_get_calendar_cache() { 616 wp_cache_delete( 'get_calendar', 'calendar' ); 617 } 618 add_action( 'save_post', 'delete_get_calendar_cache' ); 619 add_action( 'delete_post', 'delete_get_calendar_cache' ); 620 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' ); 621 add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' ); 622 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' ); 599 623 600 624
Note: See TracChangeset
for help on using the changeset viewer.