| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
function get_header() { |
|---|
| 6 |
if ( file_exists( TEMPLATEPATH . '/header.php') ) |
|---|
| 7 |
load_template( TEMPLATEPATH . '/header.php'); |
|---|
| 8 |
else |
|---|
| 9 |
load_template( ABSPATH . 'wp-content/themes/default/header.php'); |
|---|
| 10 |
} |
|---|
| 11 |
|
|---|
| 12 |
function get_footer() { |
|---|
| 13 |
if ( file_exists( TEMPLATEPATH . '/footer.php') ) |
|---|
| 14 |
load_template( TEMPLATEPATH . '/footer.php'); |
|---|
| 15 |
else |
|---|
| 16 |
load_template( ABSPATH . 'wp-content/themes/default/footer.php'); |
|---|
| 17 |
} |
|---|
| 18 |
|
|---|
| 19 |
function get_sidebar() { |
|---|
| 20 |
if ( file_exists( TEMPLATEPATH . '/sidebar.php') ) |
|---|
| 21 |
load_template( TEMPLATEPATH . '/sidebar.php'); |
|---|
| 22 |
else |
|---|
| 23 |
load_template( ABSPATH . 'wp-content/themes/default/sidebar.php'); |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
function wp_loginout() { |
|---|
| 28 |
global $user_ID; |
|---|
| 29 |
get_currentuserinfo(); |
|---|
| 30 |
|
|---|
| 31 |
if ('' == $user_ID) : |
|---|
| 32 |
$link = '<a href="' . get_settings('siteurl') . '/wp-login.php">' . __('Login') . '</a>'; |
|---|
| 33 |
else : |
|---|
| 34 |
$link = '<a href="' . get_settings('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>'; |
|---|
| 35 |
endif; |
|---|
| 36 |
|
|---|
| 37 |
echo apply_filters('loginout', $link); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
function wp_register( $before = '<li>', $after = '</li>' ) { |
|---|
| 41 |
global $user_ID; |
|---|
| 42 |
|
|---|
| 43 |
get_currentuserinfo(); |
|---|
| 44 |
|
|---|
| 45 |
if ('' == $user_ID && get_settings('users_can_register') ) : |
|---|
| 46 |
$link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after; |
|---|
| 47 |
elseif ('' == $user_ID && !get_settings('users_can_register') ) : |
|---|
| 48 |
$link = ''; |
|---|
| 49 |
else : |
|---|
| 50 |
$link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after; |
|---|
| 51 |
endif; |
|---|
| 52 |
|
|---|
| 53 |
echo apply_filters('register', $link); |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
function wp_meta() { |
|---|
| 57 |
do_action('wp_meta'); |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
function bloginfo($show='') { |
|---|
| 61 |
$info = get_bloginfo($show); |
|---|
| 62 |
$info = apply_filters('bloginfo', $info, $show); |
|---|
| 63 |
echo convert_chars($info); |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
function get_bloginfo($show='') { |
|---|
| 67 |
|
|---|
| 68 |
switch($show) { |
|---|
| 69 |
case 'url' : |
|---|
| 70 |
case 'home' : |
|---|
| 71 |
case 'siteurl' : |
|---|
| 72 |
$output = get_settings('home'); |
|---|
| 73 |
break; |
|---|
| 74 |
case 'wpurl' : |
|---|
| 75 |
$output = get_settings('siteurl'); |
|---|
| 76 |
break; |
|---|
| 77 |
case 'description': |
|---|
| 78 |
$output = get_settings('blogdescription'); |
|---|
| 79 |
break; |
|---|
| 80 |
case 'rdf_url': |
|---|
| 81 |
$output = get_feed_link('rdf'); |
|---|
| 82 |
break; |
|---|
| 83 |
case 'rss_url': |
|---|
| 84 |
$output = get_feed_link('rss'); |
|---|
| 85 |
break; |
|---|
| 86 |
case 'rss2_url': |
|---|
| 87 |
$output = get_feed_link('rss2'); |
|---|
| 88 |
break; |
|---|
| 89 |
case 'atom_url': |
|---|
| 90 |
$output = get_feed_link('atom'); |
|---|
| 91 |
break; |
|---|
| 92 |
case 'comments_rss2_url': |
|---|
| 93 |
$output = get_feed_link('comments_rss2'); |
|---|
| 94 |
break; |
|---|
| 95 |
case 'pingback_url': |
|---|
| 96 |
$output = get_settings('siteurl') .'/xmlrpc.php'; |
|---|
| 97 |
break; |
|---|
| 98 |
case 'stylesheet_url': |
|---|
| 99 |
$output = get_stylesheet_uri(); |
|---|
| 100 |
break; |
|---|
| 101 |
case 'stylesheet_directory': |
|---|
| 102 |
$output = get_stylesheet_directory_uri(); |
|---|
| 103 |
break; |
|---|
| 104 |
case 'template_directory': |
|---|
| 105 |
case 'template_url': |
|---|
| 106 |
$output = get_template_directory_uri(); |
|---|
| 107 |
break; |
|---|
| 108 |
case 'admin_email': |
|---|
| 109 |
$output = get_settings('admin_email'); |
|---|
| 110 |
break; |
|---|
| 111 |
case 'charset': |
|---|
| 112 |
$output = get_settings('blog_charset'); |
|---|
| 113 |
if ('' == $output) $output = 'UTF-8'; |
|---|
| 114 |
break; |
|---|
| 115 |
case 'html_type' : |
|---|
| 116 |
$output = get_option('html_type'); |
|---|
| 117 |
break; |
|---|
| 118 |
case 'version': |
|---|
| 119 |
global $wp_version; |
|---|
| 120 |
$output = $wp_version; |
|---|
| 121 |
break; |
|---|
| 122 |
case 'name': |
|---|
| 123 |
default: |
|---|
| 124 |
$output = get_settings('blogname'); |
|---|
| 125 |
break; |
|---|
| 126 |
} |
|---|
| 127 |
return $output; |
|---|
| 128 |
} |
|---|
| 129 |
|
|---|
| 130 |
function wp_title($sep = '»', $display = true) { |
|---|
| 131 |
global $wpdb; |
|---|
| 132 |
global $m, $year, $monthnum, $day, $category_name, $month, $posts; |
|---|
| 133 |
|
|---|
| 134 |
$cat = get_query_var('cat'); |
|---|
| 135 |
$p = get_query_var('p'); |
|---|
| 136 |
$name = get_query_var('name'); |
|---|
| 137 |
$category_name = get_query_var('category_name'); |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
if(!empty($cat)) { |
|---|
| 141 |
if (!stristr($cat,'-')) { |
|---|
| 142 |
$title = get_the_category_by_ID($cat); |
|---|
| 143 |
} |
|---|
| 144 |
} |
|---|
| 145 |
if (!empty($category_name)) { |
|---|
| 146 |
if (stristr($category_name,'/')) { |
|---|
| 147 |
$category_name = explode('/',$category_name); |
|---|
| 148 |
if ($category_name[count($category_name)-1]) { |
|---|
| 149 |
$category_name = $category_name[count($category_name)-1]; |
|---|
| 150 |
} else { |
|---|
| 151 |
$category_name = $category_name[count($category_name)-2]; |
|---|
| 152 |
} |
|---|
| 153 |
} |
|---|
| 154 |
$title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'"); |
|---|
| 155 |
} |
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
if(!empty($m)) { |
|---|
| 159 |
$my_year = substr($m, 0, 4); |
|---|
| 160 |
$my_month = $month[substr($m, 4, 2)]; |
|---|
| 161 |
$title = "$my_year $sep $my_month"; |
|---|
| 162 |
|
|---|
| 163 |
} |
|---|
| 164 |
if (!empty($year)) { |
|---|
| 165 |
$title = $year; |
|---|
| 166 |
if (!empty($monthnum)) { |
|---|
| 167 |
$title .= " $sep ".$month[zeroise($monthnum, 2)]; |
|---|
| 168 |
} |
|---|
| 169 |
if (!empty($day)) { |
|---|
| 170 |
$title .= " $sep ".zeroise($day, 2); |
|---|
| 171 |
} |
|---|
| 172 |
} |
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
if (is_single() || is_page()) { |
|---|
| 176 |
$title = strip_tags($posts[0]->post_title); |
|---|
| 177 |
$title = apply_filters('single_post_title', $title); |
|---|
| 178 |
} |
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
if ($display && isset($title)) { |
|---|
| 182 |
echo " $sep $title"; |
|---|
| 183 |
} elseif (!$display && isset($title)) { |
|---|
| 184 |
return " $sep $title"; |
|---|
| 185 |
} |
|---|
| 186 |
} |
|---|
| 187 |
|
|---|
| 188 |
function single_post_title($prefix = '', $display = true) { |
|---|
| 189 |
global $wpdb; |
|---|
| 190 |
$p = get_query_var('p'); |
|---|
| 191 |
$name = get_query_var('name'); |
|---|
| 192 |
if (intval($p) || '' != $name) { |
|---|
| 193 |
if (!$p) { |
|---|
| 194 |
$p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'"); |
|---|
| 195 |
} |
|---|
| 196 |
$post = & get_post($p); |
|---|
| 197 |
$title = $post->post_title; |
|---|
| 198 |
$title = apply_filters('single_post_title', $title); |
|---|
| 199 |
if ($display) { |
|---|
| 200 |
echo $prefix.strip_tags($title); |
|---|
| 201 |
} else { |
|---|
| 202 |
return strip_tags($title); |
|---|
| 203 |
} |
|---|
| 204 |
} |
|---|
| 205 |
} |
|---|
| 206 |
|
|---|
| 207 |
function single_cat_title($prefix = '', $display = true ) { |
|---|
| 208 |
$cat = intval( get_query_var('cat') ); |
|---|
| 209 |
if( !empty($cat) && !(strtoupper($cat) == 'ALL') ) { |
|---|
| 210 |
$my_cat_name = get_the_category_by_ID($cat); |
|---|
| 211 |
if( !empty($my_cat_name) ) { |
|---|
| 212 |
if ($display) |
|---|
| 213 |
echo $prefix.strip_tags($my_cat_name); |
|---|
| 214 |
else |
|---|
| 215 |
return strip_tags($my_cat_name); |
|---|
| 216 |
} |
|---|
| 217 |
} |
|---|
| 218 |
} |
|---|
| 219 |
|
|---|
| 220 |
function single_month_title($prefix = '', $display = true ) { |
|---|
| 221 |
global $m, $monthnum, $month, $year; |
|---|
| 222 |
if(!empty($monthnum) && !empty($year)) { |
|---|
| 223 |
$my_year = $year; |
|---|
| 224 |
$my_month = $month[str_pad($monthnum, 2, '0', STR_PAD_LEFT)]; |
|---|
| 225 |
} elseif(!empty($m)) { |
|---|
| 226 |
$my_year = substr($m, 0, 4); |
|---|
| 227 |
$my_month = $month[substr($m, 4, 2)]; |
|---|
| 228 |
} |
|---|
| 229 |
|
|---|
| 230 |
if (!empty($my_month) && $display) { |
|---|
| 231 |
echo $prefix . $my_month . $prefix . $my_year; |
|---|
| 232 |
} else { |
|---|
| 233 |
return $monthnum; |
|---|
| 234 |
} |
|---|
| 235 |
} |
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') { |
|---|
| 239 |
$text = wptexturize($text); |
|---|
| 240 |
$title_text = wp_specialchars($text, 1); |
|---|
| 241 |
|
|---|
| 242 |
if ('link' == $format) { |
|---|
| 243 |
return "\t<link rel='archives' title='$title_text' href='$url' />\n"; |
|---|
| 244 |
} elseif ('option' == $format) { |
|---|
| 245 |
return "\t<option value='$url'>$before $text $after</option>\n"; |
|---|
| 246 |
} elseif ('html' == $format) { |
|---|
| 247 |
return "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n"; |
|---|
| 248 |
} else { |
|---|
| 249 |
return "\t$before<a href='$url' title='$title_text'>$text</a>$after\n"; |
|---|
| 250 |
} |
|---|
| 251 |
} |
|---|
| 252 |
|
|---|
| 253 |
function wp_get_archives($args = '') { |
|---|
| 254 |
parse_str($args, $r); |
|---|
| 255 |
if (!isset($r['type'])) $r['type'] = ''; |
|---|
| 256 |
if (!isset($r['limit'])) $r['limit'] = ''; |
|---|
| 257 |
if (!isset($r['format'])) $r['format'] = 'html'; |
|---|
| 258 |
if (!isset($r['before'])) $r['before'] = ''; |
|---|
| 259 |
if (!isset($r['after'])) $r['after'] = ''; |
|---|
| 260 |
if (!isset($r['show_post_count'])) $r['show_post_count'] = false; |
|---|
| 261 |
get_archives($r['type'], $r['limit'], $r['format'], $r['before'], $r['after'], $r['show_post_count']); |
|---|
| 262 |
} |
|---|
| 263 |
|
|---|
| 264 |
function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { |
|---|
| 265 |
global $month, $wpdb; |
|---|
| 266 |
|
|---|
| 267 |
if ('' == $type) { |
|---|
| 268 |
$type = 'monthly'; |
|---|
| 269 |
} |
|---|
| 270 |
|
|---|
| 271 |
if ('' != $limit) { |
|---|
| 272 |
$limit = (int) $limit; |
|---|
| 273 |
$limit = ' LIMIT '.$limit; |
|---|
| 274 |
} |
|---|
| 275 |
|
|---|
| 276 |
$archive_week_separator = '–'; |
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 |
$archive_date_format_over_ride = 0; |
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
$archive_day_date_format = 'Y/m/d'; |
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
$archive_week_start_date_format = 'Y/m/d'; |
|---|
| 286 |
$archive_week_end_date_format = 'Y/m/d'; |
|---|
| 287 |
|
|---|
| 288 |
if (!$archive_date_format_over_ride) { |
|---|
| 289 |
$archive_day_date_format = get_settings('date_format'); |
|---|
| 290 |
$archive_week_start_date_format = get_settings('date_format'); |
|---|
| 291 |
$archive_week_end_date_format = get_settings('date_format'); |
|---|
| 292 |
} |
|---|
| 293 |
|
|---|
| 294 |
$add_hours = intval(get_settings('gmt_offset')); |
|---|
| 295 |
$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); |
|---|
| 296 |
|
|---|
| 297 |
$now = current_time('mysql'); |
|---|
| 298 |
|
|---|
| 299 |
if ('monthly' == $type) { |
|---|
| 300 |
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); |
|---|
| 301 |
if ($arcresults) { |
|---|
| 302 |
$afterafter = $after; |
|---|
| 303 |
foreach ($arcresults as $arcresult) { |
|---|
| 304 |
$url = get_month_link($arcresult->year, $arcresult->month); |
|---|
| 305 |
if ($show_post_count) { |
|---|
| 306 |
$text = sprintf('%s %d', $month[zeroise($arcresult->month,2)], $arcresult->year); |
|---|
| 307 |
$after = ' ('.$arcresult->posts.')' . $afterafter; |
|---|
| 308 |
} else { |
|---|
| 309 |
$text = sprintf('%s %d', $month[zeroise($arcresult->month,2)], $arcresult->year); |
|---|
| 310 |
} |
|---|
| 311 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 312 |
} |
|---|
| 313 |
} |
|---|
| 314 |
} elseif ('daily' == $type) { |
|---|
| 315 |
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); |
|---|
| 316 |
if ($arcresults) { |
|---|
| 317 |
foreach ($arcresults as $arcresult) { |
|---|
| 318 |
$url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); |
|---|
| 319 |
$date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth); |
|---|
| 320 |
$text = mysql2date($archive_day_date_format, $date); |
|---|
| 321 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 322 |
} |
|---|
| 323 |
} |
|---|
| 324 |
} elseif ('weekly' == $type) { |
|---|
| 325 |
$start_of_week = get_settings('start_of_week'); |
|---|
| 326 |
$arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); |
|---|
| 327 |
$arc_w_last = ''; |
|---|
| 328 |
if ($arcresults) { |
|---|
| 329 |
foreach ($arcresults as $arcresult) { |
|---|
| 330 |
if ($arcresult->week != $arc_w_last) { |
|---|
| 331 |
$arc_year = $arcresult->yr; |
|---|
| 332 |
$arc_w_last = $arcresult->week; |
|---|
| 333 |
$arc_week = get_weekstartend($arcresult->yyyymmdd, get_settings('start_of_week')); |
|---|
| 334 |
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); |
|---|
| 335 |
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); |
|---|
| 336 |
$url = sprintf('%s/%s%sm%s%s%sw%s%d', get_settings('home'), '', '?', |
|---|
| 337 |
'=', $arc_year, '&', |
|---|
| 338 |
'=', $arcresult->week); |
|---|
| 339 |
$text = $arc_week_start . $archive_week_separator . $arc_week_end; |
|---|
| 340 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 341 |
} |
|---|
| 342 |
} |
|---|
| 343 |
} |
|---|
| 344 |
} elseif ('postbypost' == $type) { |
|---|
| 345 |
$arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); |
|---|
| 346 |
if ($arcresults) { |
|---|
| 347 |
foreach ($arcresults as $arcresult) { |
|---|
| 348 |
if ($arcresult->post_date != '0000-00-00 00:00:00') { |
|---|
| 349 |
$url = get_permalink($arcresult); |
|---|
| 350 |
$arc_title = $arcresult->post_title; |
|---|
| 351 |
if ($arc_title) { |
|---|
| 352 |
$text = strip_tags($arc_title); |
|---|
| 353 |
} else { |
|---|
| 354 |
$text = $arcresult->ID; |
|---|
| 355 |
} |
|---|
| 356 |
echo get_archives_link($url, $text, $format, $before, $after); |
|---|
| 357 |
} |
|---|
| 358 |
} |
|---|
| 359 |
} |
|---|
| 360 |
} |
|---|
| 361 |
} |
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 |
function calendar_week_mod($num) { |
|---|
| 365 |
$base = 7; |
|---|
| 366 |
return ($num - $base*floor($num/$base)); |
|---|
| 367 |
} |
|---|
| 368 |
|
|---|
| 369 |
function get_calendar($daylength = 1) { |
|---|
| 370 |
global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $posts; |
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
if (!$posts) { |
|---|
| 374 |
$gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); |
|---|
| 375 |
if (!$gotsome) |
|---|
| 376 |
return; |
|---|
| 377 |
} |
|---|
| 378 |
|
|---|
| 379 |
if (isset($_GET['w'])) { |
|---|
| 380 |
$w = ''.intval($_GET['w']); |
|---|
| 381 |
} |
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 |
$week_begins = intval(get_settings('start_of_week')); |
|---|
| 385 |
$add_hours = intval(get_settings('gmt_offset')); |
|---|
| 386 |
$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); |
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 |
if (!empty($monthnum) && !empty($year)) { |
|---|
| 390 |
$thismonth = ''.zeroise(intval($monthnum), 2); |
|---|
| 391 |
$thisyear = ''.intval($year); |
|---|
| 392 |
} elseif (!empty($w)) { |
|---|
| 393 |
|
|---|
| 394 |
$thisyear = ''.intval(substr($m, 0, 4)); |
|---|
| 395 |
$d = (($w - 1) * 7) + 6; |
|---|
| 396 |
$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')"); |
|---|
| 397 |
} elseif (!empty($m)) { |
|---|
| 398 |
$calendar = substr($m, 0, 6); |
|---|
| 399 |
$thisyear = ''.intval(substr($m, 0, 4)); |
|---|
| 400 |
if (strlen($m) < 6) { |
|---|
| 401 |
$thismonth = '01'; |
|---|
| 402 |
} else { |
|---|
| 403 |
$thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); |
|---|
| 404 |
} |
|---|
| 405 |
} else { |
|---|
| 406 |
$thisyear = gmdate('Y', current_time('timestamp') + get_settings('gmt_offset') * 3600); |
|---|
| 407 |
$thismonth = gmdate('m', current_time('timestamp') + get_settings('gmt_offset') * 3600); |
|---|
| 408 |
} |
|---|
| 409 |
|
|---|
| 410 |
$unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); |
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 |
$previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year |
|---|
| 414 |
FROM $wpdb->posts |
|---|
| 415 |
WHERE post_date < '$thisyear-$thismonth-01' |
|---|
| 416 |
AND post_status = 'publish' |
|---|
| 417 |
ORDER BY post_date DESC |
|---|
| 418 |
LIMIT 1"); |
|---|
| 419 |
$next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year |
|---|
| 420 |
FROM $wpdb->posts |
|---|
| 421 |
WHERE post_date > '$thisyear-$thismonth-01' |
|---|
| 422 |
AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) |
|---|
| 423 |
AND post_status = 'publish' |
|---|
| 424 |
ORDER BY post_date ASC |
|---|
| 425 |
LIMIT 1"); |
|---|
| 426 |
|
|---|
| 427 |
echo '<table id="wp-calendar"> |
|---|
| 428 |
<caption>' . $month[zeroise($thismonth, 2)] . ' ' . date('Y', $unixmonth) . '</caption> |
|---|
| 429 |
<thead> |
|---|
| 430 |
<tr>'; |
|---|
| 431 |
|
|---|
| 432 |
$day_abbrev = $weekday_initial; |
|---|
| 433 |
if ($daylength > 1) { |
|---|
| 434 |
$day_abbrev = $weekday_abbrev; |
|---|
| 435 |
} |
|---|
| 436 |
|
|---|
| 437 |
$myweek = array(); |
|---|
| 438 |
|
|---|
| 439 |
for ($wdcount=0; $wdcount<=6; $wdcount++) { |
|---|
| 440 |
$myweek[]=$weekday[($wdcount+$week_begins)%7]; |
|---|
| 441 |
} |
|---|
| 442 |
|
|---|
| 443 |
foreach ($myweek as $wd) { |
|---|
| 444 |
echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">" . $day_abbrev[$wd] . '</th>'; |
|---|
| 445 |
} |
|---|
| 446 |
|
|---|
| 447 |
echo ' |
|---|
|
|---|