Make sure get_calendar cache is an array

git-svn-id: https://develop.svn.wordpress.org/trunk@10228 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-12-19 07:05:00 +00:00
parent bf2cfefdff
commit 12035893fc
1 changed files with 5 additions and 1 deletions

View File

@ -902,14 +902,18 @@ function calendar_week_mod($num) {
function get_calendar($initial = true) {
global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
$cache = array();
$key = md5( $m . $monthnum . $year );
if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
if ( isset( $cache[ $key ] ) ) {
if ( is_array($cache) && isset( $cache[ $key ] ) ) {
echo $cache[ $key ];
return;
}
}
if ( !is_array($cache) )
$cache = array();
ob_start();
// Quick check. If we have no posts at all, abort!
if ( !$posts ) {