<?php
// PukiWiki - Yet another WikiWikiWeb clone
-// $Id: calendar_viewer.inc.php,v 1.32 2005/06/04 04:08:57 henoheno Exp $
+// $Id: calendar_viewer.inc.php,v 1.33 2005/06/05 12:39:55 henoheno Exp $
//
// Calendar viewer plugin - List pages that calendar/calnedar2 plugin created
// (Based on calendar and recent plugin)
-// Use 'pagename/2004-12-30' => '2004/12/30' for page title
-define('PLUGIN_CALENDAR_VIEWER_SHOW_DATE_ONLY', 1); // 1 = Shorten
+// Page title's date format
+// * See PHP date() manual for detail
+// * '$\w' = weeklabel defined in $_msg_week
+define('PLUGIN_CALENDAR_VIEWER_DATE_FORMAT',
+ // FALSE // 'pagename/2004-02-09' -- As is
+ // 'D, d M, Y' // 'Mon, 09 Feb, 2004'
+ // 'F d, Y' // 'February 09, 2004'
+ // '[Y-m-d]' // '[2004-02-09]'
+ 'Y/n/j ($\w)' // '2004/2/9 (Mon)'
+ );
// ----
function plugin_calendar_viewer_convert()
{
- global $vars, $get, $post, $script;
+ global $vars, $get, $post, $script, $weeklabels;
global $_msg_calendar_viewer_right, $_msg_calendar_viewer_left;
global $_msg_calendar_viewer_restrict, $_err_calendar_viewer_param2;
$r_page = rawurlencode($page);
- if (PLUGIN_CALENDAR_VIEWER_SHOW_DATE_ONLY) {
- $s_page = htmlspecialchars(strtr(basename($page), $date_sep, '/'));
+ if (PLUGIN_CALENDAR_VIEWER_DATE_FORMAT !== FALSE) {
+ $time = strtotime(basename($page)); // $date_sep must be assumed '-' or ''!
+ if ($time == -1) {
+ $s_page = htmlspecialchars($page); // Failed. Why?
+ } else {
+ $week = $weeklabels[date('w', $time)];
+ $s_page = htmlspecialchars(str_replace(
+ array('$w' ),
+ array($week),
+ date(PLUGIN_CALENDAR_VIEWER_DATE_FORMAT, $time)
+ ));
+ }
} else {
$s_page = htmlspecialchars($page);
}
return FALSE;
}
}
-
?>