OSDN Git Service

Convert character code of the source code to UTF-8 from EUC-JP
[pukiwiki/pukiwiki.git] / plugin / calendar_viewer.inc.php
index 0184185..3b82823 100644 (file)
@@ -63,33 +63,33 @@ function plugin_calendar_viewer_convert()
        $func_args = func_get_args();
 
        // Default values
-       $pagename    = $func_args[0];   // ´ð½à¤È¤Ê¤ë¥Ú¡¼¥¸Ì¾
-       $page_YM     = '';      // °ìÍ÷ɽ¼¨¤¹¤ëǯ·î
-       $limit_base  = 0;       // ÀèƬ¤«¤é¿ô¤¨¤Æ²¿¥Ú¡¼¥¸Ìܤ«¤éɽ¼¨¤¹¤ë¤« (ÀèƬ)
-       $limit_pitch = 0;       // ²¿·ï¤Å¤Äɽ¼¨¤¹¤ë¤«
-       $limit_page  = 0;       // ¥µ¡¼¥Á¤¹¤ë¥Ú¡¼¥¸¿ô
-       $mode        = 'past';  // Æ°ºî¥â¡¼¥É
-       $date_sep    = '-';     // ÆüÉդΥ»¥Ñ¥ì¡¼¥¿ calendar2¤Ê¤é '-', calendar¤Ê¤é ''
+       $pagename    = $func_args[0];   // 基準となるページ名
+       $page_YM     = '';      // 一覧表示する年月
+       $limit_base  = 0;       // 先頭から数えて何ページ目から表示するか (先頭)
+       $limit_pitch = 0;       // 何件づつ表示するか
+       $limit_page  = 0;       // サーチするページ数
+       $mode        = 'past';  // 動作モード
+       $date_sep    = '-';     // 日付のセパレータ calendar2なら '-', calendarなら ''
 
        // Check $func_args[1]
        $matches = array();
        if (preg_match('/[0-9]{4}' . $date_sep . '[0-9]{2}/', $func_args[1])) {
-               // »ØÄêǯ·î¤Î°ìÍ÷ɽ¼¨
+               // 指定年月の一覧表示
                $page_YM     = $func_args[1];
                $limit_page  = 31;
        } else if (preg_match('/this/si', $func_args[1])) {
-               // º£·î¤Î°ìÍ÷ɽ¼¨
+               // 今月の一覧表示
                $page_YM     = get_date('Y' . $date_sep . 'm');
                $limit_page  = 31;
        } else if (preg_match('/^[0-9]+$/', $func_args[1])) {
-               // nÆüʬɽ¼¨
+               // n日分表示
                $limit_pitch = $func_args[1];
                $limit_page  = $func_args[1];
        } else if (preg_match('/(-?[0-9]+)\*([0-9]+)/', $func_args[1], $matches)) {
-               // ÀèƬ¤è¤ê¿ô¤¨¤Æ x ¥Ú¡¼¥¸Ìܤ«¤é¡¢y·ï¤Å¤Äɽ¼¨
+               // 先頭より数えて x ページ目から、y件づつ表示
                $limit_base  = $matches[1];
                $limit_pitch = $matches[2];
-               $limit_page  = $matches[1] + $matches[2]; // ÆɤßÈô¤Ð¤¹ + É½¼¨¤¹¤ë
+               $limit_page  = $matches[1] + $matches[2]; // 読み飛ばす + 表示する
        } else {
                return '#calendar_viewer(): ' . $_err_calendar_viewer_param2 . '<br />' . "\n";
        }
@@ -109,9 +109,9 @@ function plugin_calendar_viewer_convert()
                $viewed[$pagename] = TRUE; // Valid
        }
 
-       // °ìÍ÷ɽ¼¨¤¹¤ë¥Ú¡¼¥¸Ì¾¤È¥Õ¥¡¥¤¥ë̾¤Î¥Ñ¥¿¡¼¥ó¡¡¥Õ¥¡¥¤¥ë̾¤Ë¤Ïǯ·î¤ò´Þ¤à
+       // 一覧表示するページ名とファイル名のパターン ファイル名には年月を含む
        if ($pagename == '') {
-               // pagename̵¤·¤Îyyyy-mm-dd¤ËÂбþ¤¹¤ë¤¿¤á¤Î½èÍý
+               // pagename無しのyyyy-mm-ddに対応するための処理
                $pagepattern     = '';
                $pagepattern_len = 0;
                $filepattern     = encode($page_YM);
@@ -123,7 +123,7 @@ function plugin_calendar_viewer_convert()
                $filepattern_len = strlen($filepattern);
        }
 
-       // ¥Ú¡¼¥¸¥ê¥¹¥È¤Î¼èÆÀ
+       // ページリストの取得
        $pagelist = array();
        if ($dir = @opendir(DATA_DIR)) {
                $_date = get_date('Y' . $date_sep . 'm' . $date_sep . 'd');
@@ -158,7 +158,7 @@ function plugin_calendar_viewer_convert()
        $tmppage     = $vars['page'];
        $return_body = '';
 
-       // $limit_page ¤Î·ï¿ô¤Þ¤Ç¥¤¥ó¥¯¥ë¡¼¥É
+       // $limit_page の件数までインクルード
        $tmp = max($limit_base, 0); // Skip minus
        while ($tmp < $limit_page) {
                if (! isset($pagelist[$tmp])) break;
@@ -166,7 +166,7 @@ function plugin_calendar_viewer_convert()
                $page = $pagelist[$tmp];
                $get['page'] = $post['page'] = $vars['page'] = $page;
 
-               // ¸½¾õ¤Ç±ÜÍ÷µö²Ä¤¬¤¢¤ë¾ì¹ç¤À¤±É½¼¨¤¹¤ë
+               // 現状で閲覧許可がある場合だけ表示する
                if (check_readable($page, FALSE, FALSE)) {
                        $body = convert_html(get_source($page));
                } else {
@@ -204,17 +204,17 @@ function plugin_calendar_viewer_convert()
                ++$tmp;
        }
 
-       // ¤³¤³¤Ç¡¢Á°¸å¤Î¥ê¥ó¥¯¤òɽ¼¨
-       // ?plugin=calendar_viewer&file=¥Ú¡¼¥¸Ì¾&date=yyyy-mm
+       // ここで、前後のリンクを表示
+       // ?plugin=calendar_viewer&file=ページ名&date=yyyy-mm
        $enc_pagename = rawurlencode(substr($pagepattern, 0, $pagepattern_len - 1));
 
        if ($page_YM != '') {
-               // Ç¯·îɽ¼¨»þ
+               // 年月表示時
                $date_sep_len = strlen($date_sep);
                $this_year    = substr($page_YM, 0, 4);
                $this_month   = substr($page_YM, 4 + $date_sep_len, 2);
 
-               // ¼¡·î
+               // 次月
                $next_year  = $this_year;
                $next_month = $this_month + 1;
                if ($next_month > 12) {
@@ -223,7 +223,7 @@ function plugin_calendar_viewer_convert()
                }
                $next_YM = sprintf('%04d%s%02d', $next_year, $date_sep, $next_month);
 
-               // Á°·î
+               // 前月
                $prev_year  = $this_year;
                $prev_month = $this_month - 1;
                if ($prev_month < 1) {
@@ -243,23 +243,23 @@ function plugin_calendar_viewer_convert()
                        $right_text = $next_YM . '&gt;&gt;'; // >>
                }
        } else {
-               // n·ïɽ¼¨»þ
+               // n件表示時
                if ($limit_base <= 0) {
-                       $left_YM = ''; // É½¼¨¤·¤Ê¤¤ (¤½¤ì¤è¤êÁ°¤Î¹àÌܤϤʤ¤)
+                       $left_YM = ''; // 表示しない (それより前の項目はない)
                } else {
                        $left_YM   = $limit_base - $limit_pitch . '*' . $limit_pitch;
                        $left_text = sprintf($_msg_calendar_viewer_left, $limit_pitch);
 
                }
                if ($limit_base + $limit_pitch >= count($pagelist)) {
-                       $right_YM = ''; // É½¼¨¤·¤Ê¤¤ (¤½¤ì¤è¤ê¸å¤Î¹àÌܤϤʤ¤)
+                       $right_YM = ''; // 表示しない (それより後の項目はない)
                } else {
                        $right_YM   = $limit_base + $limit_pitch . '*' . $limit_pitch;
                        $right_text = sprintf($_msg_calendar_viewer_right, $limit_pitch);
                }
        }
 
-       // ¥Ê¥Ó¥²¡¼¥ÈÍѤΥê¥ó¥¯¤òËöÈø¤ËÄɲÃ
+       // ナビゲート用のリンクを末尾に追加
        if ($left_YM != '' || $right_YM != '') {
                $s_date_sep = htmlsc($date_sep);
                $left_link = $right_link = '';
@@ -271,7 +271,7 @@ function plugin_calendar_viewer_convert()
                if ($right_YM != '')
                        $right_link = '<a href="' . $link .
                                'date=' . $right_YM . '">' . $right_text . '</a>';
-               // past mode¤Ï<<¿· µì>> Â¾¤Ï<<µì ¿·>>
+               // past modeは<<新 旧>> 他は<<旧 新>>
                $return_body .=
                        '<div class="calendar_viewer">' .
                        '<span class="calendar_viewer_left">'  . $left_link  . '</span>' .
@@ -309,7 +309,7 @@ function plugin_calendar_viewer_action()
        $return_vars_array['msg'] = 'calendar_viewer ' . htmlsc($vars['page']);
        if ($vars['page'] != '') $return_vars_array['msg'] .= '/';
        if (preg_match('/\*/', $page_YM)) {
-               // ¤¦¡¼¤ó¡¢n·ïɽ¼¨¤Î»þ¤Ï¤Ê¤ó¤Æ¥Ú¡¼¥¸Ì¾¤Ë¤·¤¿¤é¤¤¤¤¡©
+               // うーん、n件表示の時はなんてページ名にしたらいい?
        } else {
                $return_vars_array['msg'] .= htmlsc($page_YM);
        }
@@ -322,7 +322,7 @@ function plugin_calendar_viewer_isValidDate($aStr, $aSepList = '-/ .')
 {
        $matches = array();
        if ($aSepList == '') {
-               // yyymmdd¤È¤·¤Æ¥Á¥§¥Ã¥¯¡Ê¼êÈ´¤­(^^;¡Ë
+               // yyymmddとしてチェック(手抜き(^^;)
                return checkdate(substr($aStr, 4, 2), substr($aStr, 6, 2), substr($aStr, 0, 4));
        } else if (ereg("^([0-9]{2,4})[$aSepList]([0-9]{1,2})[$aSepList]([0-9]{1,2})$", $aStr, $matches) ) {
                return checkdate($matches[2], $matches[3], $matches[1]);