]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/general-template.php
Wordpress 2.5.1
[autoinstalls/wordpress.git] / wp-includes / general-template.php
1 <?php
2
3 /* Note: these tags go anywhere in the template */
4
5 function get_header() {
6         do_action( 'get_header' );
7         if ( file_exists( TEMPLATEPATH . '/header.php') )
8                 load_template( TEMPLATEPATH . '/header.php');
9         else
10                 load_template( ABSPATH . 'wp-content/themes/default/header.php');
11 }
12
13
14 function get_footer() {
15         do_action( 'get_footer' );
16         if ( file_exists( TEMPLATEPATH . '/footer.php') )
17                 load_template( TEMPLATEPATH . '/footer.php');
18         else
19                 load_template( ABSPATH . 'wp-content/themes/default/footer.php');
20 }
21
22
23 function get_sidebar( $name = null ) {
24         do_action( 'get_sidebar' );
25         if ( isset($name) && file_exists( TEMPLATEPATH . "/sidebar-{$name}.php") )
26                 load_template( TEMPLATEPATH . "/sidebar-{$name}.php");
27         elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') )
28                 load_template( TEMPLATEPATH . '/sidebar.php');
29         else
30                 load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
31 }
32
33
34 function wp_loginout() {
35         if ( ! is_user_logged_in() )
36                 $link = '<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Log in') . '</a>';
37         else
38                 $link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Log out') . '</a>';
39
40         echo apply_filters('loginout', $link);
41 }
42
43
44 function wp_register( $before = '<li>', $after = '</li>' ) {
45
46         if ( ! is_user_logged_in() ) {
47                 if ( get_option('users_can_register') )
48                         $link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
49                 else
50                         $link = '';
51         } else {
52                 $link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
53         }
54
55         echo apply_filters('register', $link);
56 }
57
58
59 function wp_meta() {
60         do_action('wp_meta');
61 }
62
63
64 function bloginfo($show='') {
65         echo get_bloginfo($show, 'display');
66 }
67
68 /**
69  * Note: some of these values are DEPRECATED. Meaning they could be
70  * taken out at any time and shouldn't be relied upon. Options
71  * without "// DEPRECATED" are the preferred and recommended ways
72  * to get the information.
73  */
74 function get_bloginfo($show = '', $filter = 'raw') {
75
76         switch($show) {
77                 case 'url' :
78                 case 'home' : // DEPRECATED
79                 case 'siteurl' : // DEPRECATED
80                         $output = get_option('home');
81                         break;
82                 case 'wpurl' :
83                         $output = get_option('siteurl');
84                         break;
85                 case 'description':
86                         $output = get_option('blogdescription');
87                         break;
88                 case 'rdf_url':
89                         $output = get_feed_link('rdf');
90                         break;
91                 case 'rss_url':
92                         $output = get_feed_link('rss');
93                         break;
94                 case 'rss2_url':
95                         $output = get_feed_link('rss2');
96                         break;
97                 case 'atom_url':
98                         $output = get_feed_link('atom');
99                         break;
100                 case 'comments_atom_url':
101                         $output = get_feed_link('comments_atom');
102                         break;
103                 case 'comments_rss2_url':
104                         $output = get_feed_link('comments_rss2');
105                         break;
106                 case 'pingback_url':
107                         $output = get_option('siteurl') .'/xmlrpc.php';
108                         break;
109                 case 'stylesheet_url':
110                         $output = get_stylesheet_uri();
111                         break;
112                 case 'stylesheet_directory':
113                         $output = get_stylesheet_directory_uri();
114                         break;
115                 case 'template_directory':
116                 case 'template_url':
117                         $output = get_template_directory_uri();
118                         break;
119                 case 'admin_email':
120                         $output = get_option('admin_email');
121                         break;
122                 case 'charset':
123                         $output = get_option('blog_charset');
124                         if ('' == $output) $output = 'UTF-8';
125                         break;
126                 case 'html_type' :
127                         $output = get_option('html_type');
128                         break;
129                 case 'version':
130                         global $wp_version;
131                         $output = $wp_version;
132                         break;
133                 case 'language':
134                         $output = get_locale();
135                         $output = str_replace('_', '-', $output);
136                         break;
137                 case 'text_direction':
138                         global $wp_locale;
139                         $output = $wp_locale->text_direction;
140                         break;
141                 case 'name':
142                 default:
143                         $output = get_option('blogname');
144                         break;
145         }
146
147         $url = true;
148         if (strpos($show, 'url') === false &&
149                 strpos($show, 'directory') === false &&
150                 strpos($show, 'home') === false)
151                 $url = false;
152
153         if ( 'display' == $filter ) {
154                 if ( $url )
155                         $output = apply_filters('bloginfo_url', $output, $show);
156                 else
157                         $output = apply_filters('bloginfo', $output, $show);
158         }
159
160         return $output;
161 }
162
163
164 function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
165         global $wpdb, $wp_locale, $wp_query;
166
167         $cat = get_query_var('cat');
168         $tag = get_query_var('tag_id');
169         $category_name = get_query_var('category_name');
170         $author = get_query_var('author');
171         $author_name = get_query_var('author_name');
172         $m = get_query_var('m');
173         $year = get_query_var('year');
174         $monthnum = get_query_var('monthnum');
175         $day = get_query_var('day');
176         $title = '';
177
178         // If there's a category
179         if ( !empty($cat) ) {
180                         // category exclusion
181                         if ( !stristr($cat,'-') )
182                                 $title = apply_filters('single_cat_title', get_the_category_by_ID($cat));
183         } elseif ( !empty($category_name) ) {
184                 if ( stristr($category_name,'/') ) {
185                                 $category_name = explode('/',$category_name);
186                                 if ( $category_name[count($category_name)-1] )
187                                         $category_name = $category_name[count($category_name)-1]; // no trailing slash
188                                 else
189                                         $category_name = $category_name[count($category_name)-2]; // there was a trailling slash
190                 }
191                 $cat = get_term_by('slug', $category_name, 'category', OBJECT, 'display');
192                 if ( $cat )
193                         $title = apply_filters('single_cat_title', $cat->name);
194         }
195
196         if ( !empty($tag) ) {
197                 $tag = get_term($tag, 'post_tag', OBJECT, 'display');
198                 if ( is_wp_error( $tag ) )
199                         return $tag;
200                 if ( ! empty($tag->name) )
201                         $title = apply_filters('single_tag_title', $tag->name);
202         }
203
204         // If there's an author
205         if ( !empty($author) ) {
206                 $title = get_userdata($author);
207                 $title = $title->display_name;
208         }
209         if ( !empty($author_name) ) {
210                 // We do a direct query here because we don't cache by nicename.
211                 $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name));
212         }
213
214         // If there's a month
215         if ( !empty($m) ) {
216                 $my_year = substr($m, 0, 4);
217                 $my_month = $wp_locale->get_month(substr($m, 4, 2));
218                 $my_day = intval(substr($m, 6, 2));
219                 $title = "$my_year" . ($my_month ? "$sep $my_month" : "") . ($my_day ? "$sep $my_day" : "");
220         }
221
222         if ( !empty($year) ) {
223                 $title = $year;
224                 if ( !empty($monthnum) )
225                         $title .= " $sep " . $wp_locale->get_month($monthnum);
226                 if ( !empty($day) )
227                         $title .= " $sep " . zeroise($day, 2);
228         }
229
230         // If there is a post
231         if ( is_single() || is_page() ) {
232                 $post = $wp_query->get_queried_object();
233                 $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
234         }
235
236         $prefix = '';
237         if ( !empty($title) )
238                 $prefix = " $sep ";
239
240         // Determines position of the separator
241         if ( 'right' == $seplocation )
242                 $title = $title . $prefix;
243         else
244                 $title = $prefix . $title;
245
246         $title = apply_filters('wp_title', $title, $sep);
247
248         // Send it out
249         if ( $display )
250                 echo $title;
251         else
252                 return $title;
253
254 }
255
256
257 function single_post_title($prefix = '', $display = true) {
258         global $wpdb;
259         $p = get_query_var('p');
260         $name = get_query_var('name');
261
262         if ( intval($p) || '' != $name ) {
263                 if ( !$p )
264                         $p = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s", $name));
265                 $post = & get_post($p);
266                 $title = $post->post_title;
267                 $title = apply_filters('single_post_title', $title);
268                 if ( $display )
269                         echo $prefix.strip_tags($title);
270                 else
271                         return strip_tags($title);
272         }
273 }
274
275
276 function single_cat_title($prefix = '', $display = true ) {
277         $cat = intval( get_query_var('cat') );
278         if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
279                 $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat));
280                 if ( !empty($my_cat_name) ) {
281                         if ( $display )
282                                 echo $prefix.strip_tags($my_cat_name);
283                         else
284                                 return strip_tags($my_cat_name);
285                 }
286         } else if ( is_tag() ) {
287                 return single_tag_title($prefix, $display);
288         }
289 }
290
291
292 function single_tag_title($prefix = '', $display = true ) {
293         if ( !is_tag() )
294                 return;
295
296         $tag_id = intval( get_query_var('tag_id') );
297
298         if ( !empty($tag_id) ) {
299                 $my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display');
300                 if ( is_wp_error( $my_tag ) )
301                         return false;
302                 $my_tag_name = apply_filters('single_tag_title', $my_tag->name);
303                 if ( !empty($my_tag_name) ) {
304                         if ( $display )
305                                 echo $prefix . $my_tag_name;
306                         else
307                                 return $my_tag_name;
308                 }
309         }
310 }
311
312
313 function single_month_title($prefix = '', $display = true ) {
314         global $wp_locale;
315
316         $m = get_query_var('m');
317         $year = get_query_var('year');
318         $monthnum = get_query_var('monthnum');
319
320         if ( !empty($monthnum) && !empty($year) ) {
321                 $my_year = $year;
322                 $my_month = $wp_locale->get_month($monthnum);
323         } elseif ( !empty($m) ) {
324                 $my_year = substr($m, 0, 4);
325                 $my_month = $wp_locale->get_month(substr($m, 4, 2));
326         }
327
328         if ( empty($my_month) )
329                 return false;
330
331         $result = $prefix . $my_month . $prefix . $my_year;
332
333         if ( !$display )
334                 return $result;
335         echo $result;
336 }
337
338
339 /* link navigation hack by Orien http://icecode.com/ */
340 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
341         $text = wptexturize($text);
342         $title_text = attribute_escape($text);
343         $url = clean_url($url);
344
345         if ('link' == $format)
346                 return "\t<link rel='archives' title='$title_text' href='$url' />\n";
347         elseif ('option' == $format)
348                 return "\t<option value='$url'>$before $text $after</option>\n";
349         elseif ('html' == $format)
350                 return "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
351         else // custom
352                 return "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
353 }
354
355
356 function wp_get_archives($args = '') {
357         global $wpdb, $wp_locale;
358
359         $defaults = array(
360                 'type' => 'monthly', 'limit' => '',
361                 'format' => 'html', 'before' => '',
362                 'after' => '', 'show_post_count' => false
363         );
364
365         $r = wp_parse_args( $args, $defaults );
366         extract( $r, EXTR_SKIP );
367
368         if ( '' == $type )
369                 $type = 'monthly';
370
371         if ( '' != $limit ) {
372                 $limit = absint($limit);
373                 $limit = ' LIMIT '.$limit;
374         }
375
376         // this is what will separate dates on weekly archive links
377         $archive_week_separator = '&#8211;';
378
379         // over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride
380         $archive_date_format_over_ride = 0;
381
382         // options for daily archive (only if you over-ride the general date format)
383         $archive_day_date_format = 'Y/m/d';
384
385         // options for weekly archive (only if you over-ride the general date format)
386         $archive_week_start_date_format = 'Y/m/d';
387         $archive_week_end_date_format   = 'Y/m/d';
388
389         if ( !$archive_date_format_over_ride ) {
390                 $archive_day_date_format = get_option('date_format');
391                 $archive_week_start_date_format = get_option('date_format');
392                 $archive_week_end_date_format = get_option('date_format');
393         }
394
395         //filters
396         $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
397         $join = apply_filters('getarchives_join', "", $r);
398
399         if ( 'monthly' == $type ) {
400                 $query = "SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit";
401                 $key = md5($query);
402                 $cache = wp_cache_get( 'wp_get_archives' , 'general');
403                 if ( !isset( $cache[ $key ] ) ) {
404                         $arcresults = $wpdb->get_results($query);
405                         $cache[ $key ] = $arcresults;
406                         wp_cache_add( 'wp_get_archives', $cache, 'general' );
407                 } else {
408                         $arcresults = $cache[ $key ];
409                 }
410                 if ( $arcresults ) {
411                         $afterafter = $after;
412                         foreach ( $arcresults as $arcresult ) {
413                                 $url    = get_month_link($arcresult->year,      $arcresult->month);
414                                 $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
415                                 if ( $show_post_count )
416                                         $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
417                                 echo get_archives_link($url, $text, $format, $before, $after);
418                         }
419                 }
420         } elseif ('yearly' == $type) {
421                 $query = "SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC $limit";
422                 $key = md5($query);
423                 $cache = wp_cache_get( 'wp_get_archives' , 'general');
424                 if ( !isset( $cache[ $key ] ) ) {
425                         $arcresults = $wpdb->get_results($query);
426                         $cache[ $key ] = $arcresults;
427                         wp_cache_add( 'wp_get_archives', $cache, 'general' );
428                 } else {
429                         $arcresults = $cache[ $key ];
430                 }
431                 if ($arcresults) {
432                         $afterafter = $after;
433                         foreach ($arcresults as $arcresult) {
434                                 $url = get_year_link($arcresult->year);
435                                 $text = sprintf('%d', $arcresult->year);
436                                 if ($show_post_count)
437                                         $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
438                                 echo get_archives_link($url, $text, $format, $before, $after);
439                         }
440                 }
441         } elseif ( 'daily' == $type ) {
442                 $query = "SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC $limit";
443                 $key = md5($query);
444                 $cache = wp_cache_get( 'wp_get_archives' , 'general');
445                 if ( !isset( $cache[ $key ] ) ) {
446                         $arcresults = $wpdb->get_results($query);
447                         $cache[ $key ] = $arcresults;
448                         wp_cache_add( 'wp_get_archives', $cache, 'general' );
449                 } else {
450                         $arcresults = $cache[ $key ];
451                 }
452                 if ( $arcresults ) {
453                         $afterafter = $after;
454                         foreach ( $arcresults as $arcresult ) {
455                                 $url    = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
456                                 $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
457                                 $text = mysql2date($archive_day_date_format, $date);
458                                 if ($show_post_count)
459                                         $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
460                                 echo get_archives_link($url, $text, $format, $before, $after);
461                         }
462                 }
463         } elseif ( 'weekly' == $type ) {
464                 $start_of_week = get_option('start_of_week');
465                 $query = "SELECT DISTINCT WEEK(post_date, $start_of_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(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC $limit";
466                 $key = md5($query);
467                 $cache = wp_cache_get( 'wp_get_archives' , 'general');
468                 if ( !isset( $cache[ $key ] ) ) {
469                         $arcresults = $wpdb->get_results($query);
470                         $cache[ $key ] = $arcresults;
471                         wp_cache_add( 'wp_get_archives', $cache, 'general' );
472                 } else {
473                         $arcresults = $cache[ $key ];
474                 }
475                 $arc_w_last = '';
476                 $afterafter = $after;
477                 if ( $arcresults ) {
478                                 foreach ( $arcresults as $arcresult ) {
479                                         if ( $arcresult->week != $arc_w_last ) {
480                                                 $arc_year = $arcresult->yr;
481                                                 $arc_w_last = $arcresult->week;
482                                                 $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week'));
483                                                 $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
484                                                 $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
485                                                 $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
486                                                 $text = $arc_week_start . $archive_week_separator . $arc_week_end;
487                                                 if ($show_post_count)
488                                                         $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
489                                                 echo get_archives_link($url, $text, $format, $before, $after);
490                                         }
491                                 }
492                 }
493         } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
494                 ('alpha' == $type) ? $orderby = "post_title ASC " : $orderby = "post_date DESC ";
495                 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
496                 $key = md5($query);
497                 $cache = wp_cache_get( 'wp_get_archives' , 'general');
498                 if ( !isset( $cache[ $key ] ) ) {
499                         $arcresults = $wpdb->get_results($query);
500                         $cache[ $key ] = $arcresults;
501                         wp_cache_add( 'wp_get_archives', $cache, 'general' );
502                 } else {
503                         $arcresults = $cache[ $key ];
504                 }
505                 if ( $arcresults ) {
506                         foreach ( $arcresults as $arcresult ) {
507                                 if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
508                                         $url  = get_permalink($arcresult);
509                                         $arc_title = $arcresult->post_title;
510                                         if ( $arc_title )
511                                                 $text = strip_tags(apply_filters('the_title', $arc_title));
512                                         else
513                                                 $text = $arcresult->ID;
514                                         echo get_archives_link($url, $text, $format, $before, $after);
515                                 }
516                         }
517                 }
518         }
519 }
520
521
522 // Used in get_calendar
523 function calendar_week_mod($num) {
524         $base = 7;
525         return ($num - $base*floor($num/$base));
526 }
527
528
529 function get_calendar($initial = true) {
530         global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
531
532         $key = md5( $m . $monthnum . $year );
533         if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
534                 if ( isset( $cache[ $key ] ) ) {
535                         echo $cache[ $key ];
536                         return;
537                 }
538         }
539
540         ob_start();
541         // Quick check. If we have no posts at all, abort!
542         if ( !$posts ) {
543                 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
544                 if ( !$gotsome )
545                         return;
546         }
547
548         if ( isset($_GET['w']) )
549                 $w = ''.intval($_GET['w']);
550
551         // week_begins = 0 stands for Sunday
552         $week_begins = intval(get_option('start_of_week'));
553
554         // Let's figure out when we are
555         if ( !empty($monthnum) && !empty($year) ) {
556                 $thismonth = ''.zeroise(intval($monthnum), 2);
557                 $thisyear = ''.intval($year);
558         } elseif ( !empty($w) ) {
559                 // We need to get the month from MySQL
560                 $thisyear = ''.intval(substr($m, 0, 4));
561                 $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
562                 $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
563         } elseif ( !empty($m) ) {
564                 $thisyear = ''.intval(substr($m, 0, 4));
565                 if ( strlen($m) < 6 )
566                                 $thismonth = '01';
567                 else
568                                 $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2);
569         } else {
570                 $thisyear = gmdate('Y', current_time('timestamp'));
571                 $thismonth = gmdate('m', current_time('timestamp'));
572         }
573
574         $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
575
576         // Get the next and previous month and year with at least one post
577         $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
578                 FROM $wpdb->posts
579                 WHERE post_date < '$thisyear-$thismonth-01'
580                 AND post_type = 'post' AND post_status = 'publish'
581                         ORDER BY post_date DESC
582                         LIMIT 1");
583         $next = $wpdb->get_row("SELECT  DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
584                 FROM $wpdb->posts
585                 WHERE post_date >       '$thisyear-$thismonth-01'
586                 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
587                 AND post_type = 'post' AND post_status = 'publish'
588                         ORDER   BY post_date ASC
589                         LIMIT 1");
590
591         echo '<table id="wp-calendar" summary="' . __('Calendar') . '">
592         <caption>' . sprintf(_c('%1$s %2$s|Used as a calendar caption'), $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
593         <thead>
594         <tr>';
595
596         $myweek = array();
597
598         for ( $wdcount=0; $wdcount<=6; $wdcount++ ) {
599                 $myweek[] = $wp_locale->get_weekday(($wdcount+$week_begins)%7);
600         }
601
602         foreach ( $myweek as $wd ) {
603                 $day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
604                 echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>";
605         }
606
607         echo '
608         </tr>
609         </thead>
610
611         <tfoot>
612         <tr>';
613
614         if ( $previous ) {
615                 echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($previous->month) . '" colspan="3" id="prev"><a href="' .
616                 get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month),
617                         date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
618         } else {
619                 echo "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
620         }
621
622         echo "\n\t\t".'<td class="pad">&nbsp;</td>';
623
624         if ( $next ) {
625                 echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($next->month) . '" colspan="3" id="next"><a href="' .
626                 get_month_link($next->year, $next->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($next->month),
627                         date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
628         } else {
629                 echo "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
630         }
631
632         echo '
633         </tr>
634         </tfoot>
635
636         <tbody>
637         <tr>';
638
639         // Get days with posts
640         $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
641                 FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth'
642                 AND YEAR(post_date) = '$thisyear'
643                 AND post_type = 'post' AND post_status = 'publish'
644                 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
645         if ( $dayswithposts ) {
646                 foreach ( $dayswithposts as $daywith ) {
647                         $daywithpost[] = $daywith[0];
648                 }
649         } else {
650                 $daywithpost = array();
651         }
652
653         if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
654                 $ak_title_separator = "\n";
655         else
656                 $ak_title_separator = ', ';
657
658         $ak_titles_for_day = array();
659         $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom "
660                 ."FROM $wpdb->posts "
661                 ."WHERE YEAR(post_date) = '$thisyear' "
662                 ."AND MONTH(post_date) = '$thismonth' "
663                 ."AND post_date < '".current_time('mysql')."' "
664                 ."AND post_type = 'post' AND post_status = 'publish'"
665         );
666         if ( $ak_post_titles ) {
667                 foreach ( $ak_post_titles as $ak_post_title ) {
668
669                                 $post_title = apply_filters( "the_title", $ak_post_title->post_title );
670                                 $post_title = str_replace('"', '&quot;', wptexturize( $post_title ));
671
672                                 if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
673                                         $ak_titles_for_day['day_'.$ak_post_title->dom] = '';
674                                 if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one
675                                         $ak_titles_for_day["$ak_post_title->dom"] = $post_title;
676                                 else
677                                         $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title;
678                 }
679         }
680
681
682         // See how much we should pad in the beginning
683         $pad = calendar_week_mod(date('w', $unixmonth)-$week_begins);
684         if ( 0 != $pad )
685                 echo "\n\t\t".'<td colspan="'.$pad.'" class="pad">&nbsp;</td>';
686
687         $daysinmonth = intval(date('t', $unixmonth));
688         for ( $day = 1; $day <= $daysinmonth; ++$day ) {
689                 if ( isset($newrow) && $newrow )
690                         echo "\n\t</tr>\n\t<tr>\n\t\t";
691                 $newrow = false;
692
693                 if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) )
694                         echo '<td id="today">';
695                 else
696                         echo '<td>';
697
698                 if ( in_array($day, $daywithpost) ) // any posts today?
699                                 echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>";
700                 else
701                         echo $day;
702                 echo '</td>';
703
704                 if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) )
705                         $newrow = true;
706         }
707
708         $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins);
709         if ( $pad != 0 && $pad != 7 )
710                 echo "\n\t\t".'<td class="pad" colspan="'.$pad.'">&nbsp;</td>';
711
712         echo "\n\t</tr>\n\t</tbody>\n\t</table>";
713
714         $output = ob_get_contents();
715         ob_end_clean();
716         echo $output;
717         $cache[ $key ] = $output;
718         wp_cache_set( 'get_calendar', $cache, 'calendar' );
719 }
720
721 function delete_get_calendar_cache() {
722         wp_cache_delete( 'get_calendar', 'calendar' );
723 }
724 add_action( 'save_post', 'delete_get_calendar_cache' );
725 add_action( 'delete_post', 'delete_get_calendar_cache' );
726 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
727 add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
728 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
729
730
731 function allowed_tags() {
732         global $allowedtags;
733         $allowed = '';
734         foreach ( $allowedtags as $tag => $attributes ) {
735                 $allowed .= '<'.$tag;
736                 if ( 0 < count($attributes) ) {
737                         foreach ( $attributes as $attribute => $limits ) {
738                                 $allowed .= ' '.$attribute.'=""';
739                         }
740                 }
741                 $allowed .= '> ';
742         }
743         return htmlentities($allowed);
744 }
745
746
747 /***** Date/Time tags *****/
748
749
750 function the_date_xml() {
751         global $post;
752         echo mysql2date('Y-m-d', $post->post_date);
753         //echo ""+$post->post_date;
754 }
755
756
757 function the_date($d='', $before='', $after='', $echo = true) {
758         global $post, $day, $previousday;
759         $the_date = '';
760         if ( $day != $previousday ) {
761                 $the_date .= $before;
762                 if ( $d=='' )
763                         $the_date .= mysql2date(get_option('date_format'), $post->post_date);
764                 else
765                         $the_date .= mysql2date($d, $post->post_date);
766                 $the_date .= $after;
767                 $previousday = $day;
768         }
769         $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
770         if ( $echo )
771                 echo $the_date;
772         else
773                 return $the_date;
774 }
775
776
777 function the_modified_date($d = '') {
778         echo apply_filters('the_modified_date', get_the_modified_date($d), $d);
779 }
780
781
782 function get_the_modified_date($d = '') {
783         if ( '' == $d )
784                 $the_time = get_post_modified_time(get_option('date_format'));
785         else
786                 $the_time = get_post_modified_time($d);
787         return apply_filters('get_the_modified_date', $the_time, $d);
788 }
789
790
791 function the_time( $d = '' ) {
792         echo apply_filters('the_time', get_the_time( $d ), $d);
793 }
794
795
796 function get_the_time( $d = '' ) {
797         if ( '' == $d )
798                 $the_time = get_post_time(get_option('time_format'));
799         else
800                 $the_time = get_post_time($d);
801         return apply_filters('get_the_time', $the_time, $d);
802 }
803
804
805 function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
806         global $post;
807         if ( $gmt )
808                 $time = $post->post_date_gmt;
809         else
810                 $time = $post->post_date;
811
812         $time = mysql2date($d, $time);
813         return apply_filters('get_the_time', $time, $d, $gmt);
814 }
815
816
817 function the_modified_time($d = '') {
818         echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
819 }
820
821
822 function get_the_modified_time($d = '') {
823         if ( '' == $d )
824                 $the_time = get_post_modified_time(get_option('time_format'));
825         else
826                 $the_time = get_post_modified_time($d);
827         return apply_filters('get_the_modified_time', $the_time, $d);
828 }
829
830
831 function get_post_modified_time( $d = 'U', $gmt = false ) { // returns timestamp
832         global $post;
833
834         if ( $gmt )
835                 $time = $post->post_modified_gmt;
836         else
837                 $time = $post->post_modified;
838         $time = mysql2date($d, $time);
839
840         return apply_filters('get_the_modified_time', $time, $d, $gmt);
841 }
842
843
844 function the_weekday() {
845         global $wp_locale, $post;
846         $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date));
847         $the_weekday = apply_filters('the_weekday', $the_weekday);
848         echo $the_weekday;
849 }
850
851
852 function the_weekday_date($before='',$after='') {
853         global $wp_locale, $post, $day, $previousweekday;
854         $the_weekday_date = '';
855         if ( $day != $previousweekday ) {
856                 $the_weekday_date .= $before;
857                 $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date));
858                 $the_weekday_date .= $after;
859                 $previousweekday = $day;
860         }
861         $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after);
862         echo $the_weekday_date;
863 }
864
865 function wp_head() {
866         do_action('wp_head');
867 }
868
869 function wp_footer() {
870         do_action('wp_footer');
871 }
872
873 function rsd_link() {
874         echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
875 }
876
877 function wlwmanifest_link() {
878         echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="'
879                 . get_bloginfo('wpurl') . '/wp-includes/wlwmanifest.xml" /> ' . "\n";
880 }
881
882 function noindex() {
883         // If the blog is not public, tell robots to go away.
884         if ( '0' == get_option('blog_public') )
885                 echo "<meta name='robots' content='noindex,nofollow' />\n";
886 }
887
888 function rich_edit_exists() {
889         global $wp_rich_edit_exists;
890         if ( !isset($wp_rich_edit_exists) )
891                 $wp_rich_edit_exists = file_exists(ABSPATH . WPINC . '/js/tinymce/tiny_mce.js');
892         return $wp_rich_edit_exists;
893 }
894
895 function user_can_richedit() {
896         global $wp_rich_edit, $pagenow;
897
898         if ( !isset( $wp_rich_edit) ) {
899                 if ( get_user_option( 'rich_editing' ) == 'true' &&
900                         ( ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval($match[1]) >= 420 ) ||
901                                 !preg_match( '!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT'] ) )
902                                 && 'comment.php' != $pagenow ) {
903                         $wp_rich_edit = true;
904                 } else {
905                         $wp_rich_edit = false;
906                 }
907         }
908
909         return apply_filters('user_can_richedit', $wp_rich_edit);
910 }
911
912 function wp_default_editor() {
913         $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
914         if ( $user = wp_get_current_user() ) { // look for cookie
915                 if ( isset($_COOKIE['wordpress_editor_' . $user->ID]) && in_array($_COOKIE['wordpress_editor_' . $user->ID], array('tinymce', 'html', 'test') ) )
916                         $r = $_COOKIE['wordpress_editor_' . $user->ID];
917         }
918         return apply_filters( 'wp_default_editor', $r ); // filter
919 }
920
921 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2) {
922         $rows = get_option('default_post_edit_rows');
923         if (($rows < 3) || ($rows > 100))
924                 $rows = 12;
925
926         $rows = "rows='$rows'"; ?>
927         <div id="editor-toolbar">
928         <?php if ( user_can_richedit() ) {
929                 $wp_default_editor = wp_default_editor(); ?>
930                 <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
931                 <?php if ( 'tinymce' == $wp_default_editor ) {
932                         add_filter('the_editor_content', 'wp_richedit_pre'); ?>
933                         <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('HTML'); ?></a>
934                         <a id="edButtonPreview" class="active"><?php _e('Visual'); ?></a>
935                 <?php } elseif ( 'html' == $wp_default_editor ) {
936                         add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
937                         <a id="edButtonHTML" class="active"><?php _e('HTML'); ?></a>
938                         <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
939                 <?php }
940         }
941
942         if ( $media_buttons ) { ?>
943                 <div id="media-buttons" class="hide-if-no-js">
944                 <?php do_action( 'media_buttons' ); ?>
945                 </div>
946         <?php } ?>
947         </div>
948
949         <div id="quicktags">
950         <?php wp_print_scripts( 'quicktags' ); ?>
951         <script type="text/javascript">edToolbar()</script>
952         </div>
953
954     <?php if ( 'html' != $wp_default_editor ) : ?>
955     <script type="text/javascript">
956     // <![CDATA[
957         if ( typeof tinyMCE != "undefined" )
958             document.getElementById("quicktags").style.display="none";
959     // ]]>
960     </script>
961     <?php endif; // 'html' != $wp_default_editor
962
963         $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $rows cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
964         $the_editor_content = apply_filters('the_editor_content', $content);
965
966         printf($the_editor, $the_editor_content);
967
968         ?>
969     <script type="text/javascript">
970     // <![CDATA[
971     edCanvas = document.getElementById('<?php echo $id; ?>');
972     <?php if ( $prev_id && user_can_richedit() ) : ?>
973     // If tinyMCE is defined.
974     if ( typeof tinyMCE != 'undefined' ) {
975     // This code is meant to allow tabbing from Title to Post (TinyMCE).
976         document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
977             e = e || window.event;
978             if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
979                 if ( tinyMCE.activeEditor ) {
980                     if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
981                     e = null;
982                     if ( tinyMCE.activeEditor.isHidden() ) return true;
983                     tinyMCE.activeEditor.focus();
984                     return false;
985                 }
986                 return true;
987             }
988         }
989     }
990     <?php endif; ?>
991     // ]]>
992     </script>
993     <?php
994 }
995
996 function get_search_query() {
997         return apply_filters( 'get_search_query', stripslashes( get_query_var( 's' ) ) );
998 }
999
1000 function the_search_query() {
1001         echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
1002 }
1003
1004 function language_attributes($doctype = 'html') {
1005         $attributes = array();
1006         $output = '';
1007
1008         if ( $dir = get_bloginfo('text_direction') )
1009                 $attributes[] = "dir=\"$dir\"";
1010
1011         if ( $lang = get_bloginfo('language') ) {
1012                 if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' )
1013                         $attributes[] = "lang=\"$lang\"";
1014
1015                 if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
1016                         $attributes[] = "xml:lang=\"$lang\"";
1017         }
1018
1019         $output = implode(' ', $attributes);
1020         $output = apply_filters('language_attributes', $output);
1021         echo $output;
1022 }
1023
1024 function paginate_links( $args = '' ) {
1025         $defaults = array(
1026                 'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
1027                 'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
1028                 'total' => 1,
1029                 'current' => 0,
1030                 'show_all' => false,
1031                 'prev_next' => true,
1032                 'prev_text' => __('&laquo; Previous'),
1033                 'next_text' => __('Next &raquo;'),
1034                 'end_size' => 1, // How many numbers on either end including the end
1035                 'mid_size' => 2, // How many numbers to either side of current not including current
1036                 'type' => 'plain',
1037                 'add_args' => false // array of query args to aadd
1038         );
1039
1040         $args = wp_parse_args( $args, $defaults );
1041         extract($args, EXTR_SKIP);
1042
1043         // Who knows what else people pass in $args
1044         $total    = (int) $total;
1045         if ( $total < 2 )
1046                 return;
1047         $current  = (int) $current;
1048         $end_size = 0  < (int) $end_size ? (int) $end_size : 1; // Out of bounds?  Make it the default.
1049         $mid_size = 0 <= (int) $mid_size ? (int) $mid_size : 2;
1050         $add_args = is_array($add_args) ? $add_args : false;
1051         $r = '';
1052         $page_links = array();
1053         $n = 0;
1054         $dots = false;
1055
1056         if ( $prev_next && $current && 1 < $current ) :
1057                 $link = str_replace('%_%', 2 == $current ? '' : $format, $base);
1058                 $link = str_replace('%#%', $current - 1, $link);
1059                 if ( $add_args )
1060                         $link = add_query_arg( $add_args, $link );
1061                 $page_links[] = "<a class='prev page-numbers' href='" . clean_url($link) . "'>$prev_text</a>";
1062         endif;
1063         for ( $n = 1; $n <= $total; $n++ ) :
1064                 if ( $n == $current ) :
1065                         $page_links[] = "<span class='page-numbers current'>$n</span>";
1066                         $dots = true;
1067                 else :
1068                         if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
1069                                 $link = str_replace('%_%', 1 == $n ? '' : $format, $base);
1070                                 $link = str_replace('%#%', $n, $link);
1071                                 if ( $add_args )
1072                                         $link = add_query_arg( $add_args, $link );
1073                                 $page_links[] = "<a class='page-numbers' href='" . clean_url($link) . "'>$n</a>";
1074                                 $dots = true;
1075                         elseif ( $dots && !$show_all ) :
1076                                 $page_links[] = "<span class='page-numbers dots'>...</span>";
1077                                 $dots = false;
1078                         endif;
1079                 endif;
1080         endfor;
1081         if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) :
1082                 $link = str_replace('%_%', $format, $base);
1083                 $link = str_replace('%#%', $current + 1, $link);
1084                 if ( $add_args )
1085                         $link = add_query_arg( $add_args, $link );
1086                 $page_links[] = "<a class='next page-numbers' href='" . clean_url($link) . "'>$next_text</a>";
1087         endif;
1088         switch ( $type ) :
1089                 case 'array' :
1090                         return $page_links;
1091                         break;
1092                 case 'list' :
1093                         $r .= "<ul class='page-numbers'>\n\t<li>";
1094                         $r .= join("</li>\n\t<li>", $page_links);
1095                         $r .= "</li>\n</ul>\n";
1096                         break;
1097                 default :
1098                         $r = join("\n", $page_links);
1099                         break;
1100         endswitch;
1101         return $r;
1102 }
1103
1104 function wp_admin_css_color($key, $name, $url, $colors = array()) {
1105         global $_wp_admin_css_colors;
1106
1107         if ( !isset($_wp_admin_css_colors) )
1108                 $_wp_admin_css_colors = array();
1109
1110         $_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors);
1111 }
1112
1113 function wp_admin_css_uri( $file = 'wp-admin' ) {
1114         if ( defined('WP_INSTALLING') ) {
1115                 $_file = "./$file.css";
1116         } else {
1117                 if ( 'css/colors' == $file || 'css/colors-rtl' == $file ) {
1118                         global $_wp_admin_css_colors;
1119                         $color = get_user_option('admin_color');
1120                         if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
1121                                 $color = 'fresh';
1122                         $color = $_wp_admin_css_colors[$color];
1123                         $_file = $color->url;
1124                         $_file = ('css/colors-rtl' == $file) ? str_replace('.css','-rtl.css',$_file) : $_file;
1125                 } else {
1126                         $_file = get_option( 'siteurl' ) . "/wp-admin/$file.css";
1127                 }
1128         }
1129         $_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );
1130
1131         return apply_filters( 'wp_admin_css_uri', $_file, $file );
1132 }
1133
1134 function wp_admin_css( $file = 'wp-admin' ) {
1135
1136         echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $file ) . "' type='text/css' />\n", $file );
1137         if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
1138                 $rtl = ( 'wp-admin' == $file ) ? 'rtl' : "$file-rtl";
1139                 echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $rtl ) . "' type='text/css' />\n", $rtl );
1140         }
1141 }
1142
1143 /**
1144  * Outputs the XHTML generator that is generated on the wp_head hook.
1145  */
1146 function wp_generator()
1147 {
1148         the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
1149 }
1150
1151 /**
1152  * Outputs the generator XML or Comment for RSS, ATOM, etc.
1153  * @param {String} $type The type of generator to return.
1154  */
1155 function the_generator ( $type ) {
1156         echo apply_filters('the_generator',get_the_generator($type),$type) . "\n";
1157 }
1158
1159 /**
1160  * Creates the generator XML or Comment for RSS, ATOM, etc.
1161  * @param {String} $type The type of generator to return.
1162  */
1163 function get_the_generator ( $type ) {
1164         switch ($type) {
1165                 case 'html':
1166                         $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">' . "\n";
1167                         break;
1168                 case 'xhtml':
1169                         $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />' . "\n";
1170                         break;
1171                 case 'atom':
1172                         $gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
1173                         break;
1174                 case 'rss2':
1175                         $gen = '<generator>http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
1176                         break;
1177                 case 'rdf':
1178                         $gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
1179                         break;
1180                 case 'comment':
1181                         $gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
1182                         break;
1183                 case 'export':
1184                         $gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '"-->';
1185                         break;
1186         }
1187         return apply_filters( "get_the_generator_{$type}", $gen, $type );
1188 }
1189 ?>