]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/template-functions-general.php
Wordpress 2.0.11
[autoinstalls/wordpress.git] / wp-includes / template-functions-general.php
index 84d83175aeb8e8d691b6a9317460b6aef452c52b..bc7ee04d2d06fb78dfd84f57eab255ea219ab6fe 100644 (file)
@@ -63,6 +63,8 @@ function bloginfo($show='') {
                !strstr($show, 'home')) {
                $info = apply_filters('bloginfo', $info, $show);
                $info = convert_chars($info);
+       } else {
+               $info = apply_filters('bloginfo_url', $info, $show);
        }
 
        echo $info;
@@ -135,8 +137,7 @@ function get_bloginfo($show='') {
 
 
 function wp_title($sep = '»', $display = true) {
-       global $wpdb;
-       global $m, $year, $monthnum, $day, $category_name, $month, $posts;
+       global $wpdb, $posts, $month;
 
        $cat = get_query_var('cat');
        $p = get_query_var('p');
@@ -144,14 +145,18 @@ function wp_title($sep = '»', $display = true) {
        $category_name = get_query_var('category_name');
        $author = get_query_var('author');
        $author_name = get_query_var('author_name');
+       $m = (int) get_query_var('m');
+       $year = (int) get_query_var('year');
+       $monthnum = (int) get_query_var('monthnum');
+       $day = (int) get_query_var('day');
+       $title = '';
 
        // If there's a category
        if ( !empty($cat) ) {
                        // category exclusion
                        if ( !stristr($cat,'-') )
-                               $title = get_the_category_by_ID($cat);
-       }
-       if ( !empty($category_name) ) {
+                               $title = apply_filters('single_cat_title', get_the_category_by_ID($cat));
+       } elseif ( !empty($category_name) ) {
                if ( stristr($category_name,'/') ) {
                                $category_name = explode('/',$category_name);
                                if ( $category_name[count($category_name)-1] )
@@ -160,6 +165,7 @@ function wp_title($sep = '»', $display = true) {
                                        $category_name = $category_name[count($category_name)-2]; // there was a trailling slash
                }
                $title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'");
+               $title = apply_filters('single_cat_title', $title);
        }
 
        // If there's an author
@@ -194,7 +200,7 @@ function wp_title($sep = '»', $display = true) {
        }
 
        $prefix = '';
-       if ( isset($title) )
+       if ( !empty($title) )
                $prefix = " $sep ";
 
        $title = $prefix . $title;
@@ -242,7 +248,12 @@ function single_cat_title($prefix = '', $display = true ) {
 
 
 function single_month_title($prefix = '', $display = true ) {
-       global $m, $monthnum, $month, $year;
+       global $month;
+
+       $m = (int) get_query_var('m');
+       $year = (int) get_query_var('year');
+       $monthnum = (int) get_query_var('monthnum');
+
        if ( !empty($monthnum) && !empty($year) ) {
                $my_year = $year;
                $my_month = $month[str_pad($monthnum, 2, '0', STR_PAD_LEFT)];
@@ -261,7 +272,7 @@ function single_month_title($prefix = '', $display = true ) {
 /* link navigation hack by Orien http://icecode.com/ */
 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
        $text = wptexturize($text);
-       $title_text = wp_specialchars($text, 1);
+       $title_text = attribute_escape($text);
 
        if ('link' == $format)
                return "\t<link rel='archives' title='$title_text' href='$url' />\n";
@@ -334,10 +345,10 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
                        foreach ( $arcresults as $arcresult ) {
                                $url    = get_month_link($arcresult->year,      $arcresult->month);
                                if ( $show_post_count ) {
-                                       $text = sprintf('%s %d', $month[zeroise($arcresult->month,2)], $arcresult->year);
+                                       $text = sprintf(__('%1$s %2$d'), $month[zeroise($arcresult->month,2)], $arcresult->year);
                                        $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
                                } else {
-                                       $text = sprintf('%s %d', $month[zeroise($arcresult->month,2)], $arcresult->year);
+                                       $text = sprintf(__('%1$s %2$d'), $month[zeroise($arcresult->month,2)], $arcresult->year);
                                }
                                echo get_archives_link($url, $text, $format, $before, $after);
                        }
@@ -347,7 +358,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
                if ( $arcresults ) {
                        foreach ( $arcresults as $arcresult ) {
                                $url    = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
-                               $date = sprintf("%d-%02d-%02d 00:00:00", $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
+                               $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
                                $text = mysql2date($archive_day_date_format, $date);
                                echo get_archives_link($url, $text, $format, $before, $after);
                        }
@@ -364,7 +375,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
                                                $arc_week = get_weekstartend($arcresult->yyyymmdd, get_settings('start_of_week'));
                                                $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
                                                $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
-                                               $url  = sprintf('%s/%s%sm%s%s%sw%s%d', get_settings('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
+                                               $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_settings('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week);
                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end;
                                                echo get_archives_link($url, $text, $format, $before, $after);
                                        }
@@ -433,8 +444,8 @@ function get_calendar($daylength = 1) {
                else
                                $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2);
        } else {
-               $thisyear = gmdate('Y', current_time('timestamp') + get_settings('gmt_offset') * 3600);
-               $thismonth = gmdate('m', current_time('timestamp') + get_settings('gmt_offset') * 3600);
+               $thisyear = gmdate('Y', current_time('timestamp'));
+               $thismonth = gmdate('m', current_time('timestamp'));
        }
 
        $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);