function date_i18n($dateformatstring, $unixtimestamp, $charset = "")
 {
     if (!empty($GLOBALS['month']) && !empty($GLOBALS['weekday'])) {
         $datemonth = $GLOBALS['month'][date('m', $unixtimestamp)];
         $dateweekday = $GLOBALS['weekday'][date('w', $unixtimestamp)];
         $dateformatstring = ' ' . $dateformatstring;
         $dateformatstring = preg_replace("/([^\\\\])D/", "\\1" . backslashit(mb_substring($dateweekday, 0, $GLOBALS['s_weekday_length'], $charset)), $dateformatstring);
         $dateformatstring = preg_replace("/([^\\\\])F/", "\\1" . backslashit($datemonth), $dateformatstring);
         $dateformatstring = preg_replace("/([^\\\\])l/", "\\1" . backslashit($dateweekday), $dateformatstring);
         $dateformatstring = preg_replace("/([^\\\\])M/", "\\1" . backslashit(mb_substring($datemonth, 0, $GLOBALS['s_month_length'], $charset)), $dateformatstring);
         $dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
     }
     $j = @date($dateformatstring, $unixtimestamp);
     return $j;
 }
function archive_header(&$post, $before = '', $after = '')
{
    static $previous = '';
    if (test_param('orderby')) {
        $orderby = explode(' ', get_param('orderby'));
        $orderby = $orderby[0];
    } else {
        $orderby = '';
    }
    switch ($orderby) {
        case 'title':
            if (_LANGCODE == 'ja') {
                $thisletter = ucfirst(mb_substring($post->yomi, 0, 1, $GLOBALS['blog_charset']));
                if ($thisletter > "¤ó") {
                    $thisletter = "´Á»ú";
                }
            } else {
                $thisletter = ucfirst(substr($post->yomi, 0, 1));
            }
            if ($thisletter == "") {
                $thisletter = _WP_POST_NOTITLE;
            }
            if ($previous === '' || $thisletter !== $previous) {
                $output = "<br/>" . $thisletter;
            }
            $previous = $thisletter;
            break;
        case 'category':
            $thiscategory = $post->cat_ID;
            if ($thiscategory != $previous) {
                $output = '<br/><strong><a href="' . get_category_link(false, $thiscategory) . '">' . get_catname($thiscategory) . '</a></strong>';
            }
            $previous = $thiscategory;
            break;
        case 'author':
            $thisauthor = $post->post_author;
            if ($thisauthor != $previous) {
                $output = '<br/><strong><a href="' . get_author_link(false, $thisauthor) . '">' . the_author('', false) . '</a></strong>';
            }
            $previous = $thisauthor;
            break;
        case 'date':
        case '':
            $thismonth = mysql2date('m', $post->post_date);
            $thisyear = mysql2date('Y', $post->post_date);
            $thisdate = $thisyear . $thismonth;
            if ($thisdate != $previous) {
                $monthstr = format_month(sprintf("%d", $thisyear), $GLOBALS['month'][zeroise($thismonth, 2)]);
                $output = '<strong><br/><a href="' . get_month_link($thisyear, $thismonth) . '">' . $monthstr . '</a></strong>';
            }
            $previous = $thisdate;
            break;
    }
    if (!empty($output)) {
        $output = $before . $output . $after . "\n";
        echo $output;
    }
}