923 | | $key = md5($query); |
924 | | $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
925 | | if ( !isset( $cache[ $key ] ) ) { |
926 | | $arcresults = $wpdb->get_results($query); |
927 | | $cache[ $key ] = $arcresults; |
928 | | wp_cache_set( 'wp_get_archives', $cache, 'general' ); |
929 | | } else { |
930 | | $arcresults = $cache[ $key ]; |
| 928 | $key = md5( $query ); |
| 929 | $key = "wp_get_archives:$key:$last_changed"; |
| 930 | if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
| 931 | $results = $wpdb->get_results( $query ); |
| 932 | wp_cache_set( $key, $results, 'posts' ); |
945 | | $key = md5($query); |
946 | | $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
947 | | if ( !isset( $cache[ $key ] ) ) { |
948 | | $arcresults = $wpdb->get_results($query); |
949 | | $cache[ $key ] = $arcresults; |
950 | | wp_cache_set( 'wp_get_archives', $cache, 'general' ); |
951 | | } else { |
952 | | $arcresults = $cache[ $key ]; |
| 947 | $key = md5( $query ); |
| 948 | $key = "wp_get_archives:$key:$last_changed"; |
| 949 | if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
| 950 | $results = $wpdb->get_results( $query ); |
| 951 | wp_cache_set( $key, $results, 'posts' ); |
966 | | $key = md5($query); |
967 | | $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
968 | | if ( !isset( $cache[ $key ] ) ) { |
969 | | $arcresults = $wpdb->get_results($query); |
970 | | $cache[ $key ] = $arcresults; |
971 | | wp_cache_set( 'wp_get_archives', $cache, 'general' ); |
972 | | } else { |
973 | | $arcresults = $cache[ $key ]; |
| 965 | $key = md5( $query ); |
| 966 | $key = "wp_get_archives:$key:$last_changed"; |
| 967 | if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
| 968 | $results = $wpdb->get_results( $query ); |
| 969 | $cache[ $key ] = $results; |
| 970 | wp_cache_set( $key, $results, 'posts' ); |
977 | | foreach ( (array) $arcresults as $arcresult ) { |
978 | | $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); |
979 | | $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth); |
| 974 | foreach ( (array) $results as $result ) { |
| 975 | $url = get_day_link($result->year, $result->month, $result->dayofmonth); |
| 976 | $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth); |
983 | 980 | $output .= get_archives_link($url, $text, $format, $before, $after); |
984 | 981 | } |
985 | 982 | } |
986 | 983 | } elseif ( 'weekly' == $type ) { |
987 | 984 | $week = _wp_mysql_week( '`post_date`' ); |
988 | 985 | $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit"; |
989 | | $key = md5($query); |
990 | | $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
991 | | if ( !isset( $cache[ $key ] ) ) { |
992 | | $arcresults = $wpdb->get_results($query); |
993 | | $cache[ $key ] = $arcresults; |
994 | | wp_cache_set( 'wp_get_archives', $cache, 'general' ); |
995 | | } else { |
996 | | $arcresults = $cache[ $key ]; |
| 986 | $key = md5( $query ); |
| 987 | $key = "wp_get_archives:$key:$last_changed"; |
| 988 | if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
| 989 | $results = $wpdb->get_results( $query ); |
| 990 | wp_cache_set( $key, $results, 'posts' ); |
1000 | | if ( $arcresults ) { |
1001 | | foreach ( (array) $arcresults as $arcresult ) { |
1002 | | if ( $arcresult->week != $arc_w_last ) { |
1003 | | $arc_year = $arcresult->yr; |
1004 | | $arc_w_last = $arcresult->week; |
1005 | | $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week')); |
| 994 | if ( $results ) { |
| 995 | foreach ( (array) $results as $result ) { |
| 996 | if ( $result->week != $arc_w_last ) { |
| 997 | $arc_year = $result->yr; |
| 998 | $arc_w_last = $result->week; |
| 999 | $arc_week = get_weekstartend($result->yyyymmdd, get_option('start_of_week')); |
1008 | | $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&', '=', $arcresult->week); |
| 1002 | $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&', '=', $result->week); |
1019 | | $key = md5($query); |
1020 | | $cache = wp_cache_get( 'wp_get_archives' , 'general'); |
1021 | | if ( !isset( $cache[ $key ] ) ) { |
1022 | | $arcresults = $wpdb->get_results($query); |
1023 | | $cache[ $key ] = $arcresults; |
1024 | | wp_cache_set( 'wp_get_archives', $cache, 'general' ); |
1025 | | } else { |
1026 | | $arcresults = $cache[ $key ]; |
| 1013 | $key = md5( $query ); |
| 1014 | $key = "wp_get_archives:$key:$last_changed"; |
| 1015 | if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
| 1016 | $results = $wpdb->get_results( $query ); |
| 1017 | wp_cache_set( $key, $results, 'posts' ); |
1028 | | if ( $arcresults ) { |
1029 | | foreach ( (array) $arcresults as $arcresult ) { |
1030 | | if ( $arcresult->post_date != '0000-00-00 00:00:00' ) { |
1031 | | $url = get_permalink( $arcresult ); |
1032 | | if ( $arcresult->post_title ) |
1033 | | $text = strip_tags( apply_filters( 'the_title', $arcresult->post_title, $arcresult->ID ) ); |
| 1019 | if ( $results ) { |
| 1020 | foreach ( (array) $results as $result ) { |
| 1021 | if ( $result->post_date != '0000-00-00 00:00:00' ) { |
| 1022 | $url = get_permalink( $result ); |
| 1023 | if ( $result->post_title ) |
| 1024 | $text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) ); |