[dokuwiki] Re: [dokuwiki-i18n] Various Calendars

Thanks for your attention.

Your request attached.

I didn't test its functionality (but I think it is OK!), only send it to
check the new patch.
I didn't initiate classes, it's only functions, do you think we really need
to have classes or functions are enough?

I didn't prefer common libraries, because mostly a "Persian" developer
didn't develop a "Persian" calendar! (for example, the first link has Jalali
and Persian calendars, both are same!)
I can add another calendar (Hijri, Arabian calendar) to system, an Arab guy
developed it. ( http://www.ar-php.com/php/arabic/index.html#ArDate )

___

Omid Mottaghi
http://oxygenws.com/
PGP key: ‌http://tinyurl.com/66q5cy


On Wed, Mar 4, 2009 at 3:54 AM, Anika Henke <anika@xxxxxxxxxxxxxxx> wrote:

> Omid Mottaghi wrote:
>
>> Patch to add calendar feature to DW.
>>
>
> Wouldn't it be better to make this more flexible?
> Maybe instead of ./inc/calendars.php we should have a kind of library of
> different calendar conversion classes (similar to auth and geshi) in
> ./inc/calendars/<Calendar>.php (with your Persian.php at first).
> Then the Config Manager setting could come from just a loop over the
> contents of that folder and the switch in your strtime() function could be
> easier as well (and doesn't need to be a switch at all).
>
> If something like that will be established, it could be very easy to
> implement other calendrical systems. (Each one only needs to return one
> single string.) PHP has a few built-in ones:
> http://php.net/manual/en/ref.calendar.php
> And I have found a few other (more or less) open-source libraries that
> could be (re-)used:
> * http://joyds1.joensuu.fi/calendar/index.html (GPL2, Java)
> * http://emr.cs.uiuc.edu/home/reingold/calendar-book/Calendrica.html ("For
> permission to use the code in free software [...] contact the authors", also
> available in Java)
> * http://www.fourmilab.ch/documents/calendar/ (public domain, JavaScript)
>
> Does anyone know more similar or yet better libraries?
>
> I would even volunteer to implement a few. :)
>
>
> Anika
> --
> DokuWiki mailing list - more info at
> http://wiki.splitbrain.org/wiki:mailinglist
>
diff -uNr dokuwiki-2009-02-14/conf/dokuwiki.php 
dokuwiki-2009-02-14-calendar/conf/dokuwiki.php
--- dokuwiki-2009-02-14/conf/dokuwiki.php       2009-02-14 15:43:24.000000000 
+0330
+++ dokuwiki-2009-02-14-calendar/conf/dokuwiki.php      2009-03-04 
10:36:50.000000000 +0330
@@ -16,6 +16,7 @@
 $conf['fmode']       = 0644;              //set file creation mode
 $conf['dmode']       = 0755;              //set directory creation mode
 $conf['lang']        = 'en';              //your language
+$conf['calendar']    = 'gregorian';       //your calendar
 $conf['basedir']     = '';                //absolute dir from serveroot - 
blank for autodetection
 $conf['baseurl']     = '';                //URL to server including protocol - 
blank for autodetect
 $conf['savedir']     = './data';          //where to store all the files
diff -uNr dokuwiki-2009-02-14/inc/calendar/gregorian.php 
dokuwiki-2009-02-14-calendar/inc/calendar/gregorian.php
--- dokuwiki-2009-02-14/inc/calendar/gregorian.php      1970-01-01 
03:30:00.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/calendar/gregorian.php     2009-03-04 
10:39:52.000000000 +0330
@@ -0,0 +1,14 @@
+<?php
+
+/**
+ * Generate Gregorian date and time for DokuWiki
+ *
+ * This function will generate date and time according to Gregorian calendar
+ *
+ * @author Omid Mottaghi <omidmr@xxxxxxxxx>
+ */
+function strtime($format, $timestamp = null){
+    return strftime($format, $timestamp);
+}
+
+?>
\ No newline at end of file
diff -uNr dokuwiki-2009-02-14/inc/calendar/persian.php 
dokuwiki-2009-02-14-calendar/inc/calendar/persian.php
--- dokuwiki-2009-02-14/inc/calendar/persian.php        1970-01-01 
03:30:00.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/calendar/persian.php       2009-03-04 
10:39:28.000000000 +0330
@@ -0,0 +1,481 @@
+<?php
+
+/**
+ * Generate Persian date and time for DokuWiki
+ *
+ * This function will generate date and time according to Persian calendar
+ *
+ * @author Omid Mottaghi <omidmr@xxxxxxxxx>
+ */
+function strtime($format, $timestamp = null){
+    return persian_strftime_utf($format, $timestamp);
+}
+
+/**
+ * Gregorian to Persian Convertor
+ *
+ * @author farsiweb.info
+ * @access public
+ * @param   int year
+ * @param   int month
+ * @param   int day
+ * @return  array   converted time
+ */
+function g2p($g_y, $g_m, $g_d)
+{
+    $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+    $p_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
+
+    $gy = $g_y-1600;
+    $gm = $g_m-1;
+    $gd = $g_d-1;
+
+    $g_day_no = 
365*$gy+floor(($gy+3)/4)-floor(($gy+99)/100)+floor(($gy+399)/400);
+
+    for ($i=0; $i < $gm; ++$i){
+        $g_day_no += $g_days_in_month[$i];
+    }
+
+    if ($gm>1 && (($gy%4==0 && $gy%100!=0) || ($gy%400==0))){
+        /* leap and after Feb */
+        ++$g_day_no;
+    }
+
+    $g_day_no += $gd;
+    $p_day_no = $g_day_no-79;
+    $p_np = floor($p_day_no/12053);
+    $p_day_no %= 12053;
+    $py = 979+33*$p_np+4*floor($p_day_no/1461);
+    $p_day_no %= 1461;
+
+    if ($p_day_no >= 366) {
+        $py += floor(($p_day_no-1)/365);
+        $p_day_no = ($p_day_no-1)%365;
+    }
+    $p_all_days = $p_day_no+1;
+
+    for ($i = 0; $i < 11 && $p_day_no >= $p_days_in_month[$i]; ++$i) {
+        $p_day_no -= $p_days_in_month[$i];
+    }
+
+    $pm = $i+1;
+    $pd = $p_day_no+1;
+
+    return array($py, $pm, $pd, $p_all_days);
+}
+
+/**
+ * Persian to Gregorian Convertor
+ *
+ * @author farsiweb.info
+ * @access public
+ * @param   int year
+ * @param   int month
+ * @param   int day
+ * @return  array   converted time
+ */
+function p2g($p_y, $p_m, $p_d)
+{
+    $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+    $p_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
+    $py = $p_y-979;
+    $pm = $p_m-1;
+    $pd = $p_d-1;
+    $p_day_no = 365*$py + floor($py/33)*8 + floor(($py%33+3)/4);
+    for ($i=0; $i < $pm; ++$i){
+        $p_day_no += $p_days_in_month[$i];
+    }
+    $p_day_no += $pd;
+    $g_day_no = $p_day_no+79;
+    $gy = 1600 + 400*floor($g_day_no/146097);
+    $g_day_no = $g_day_no % 146097;
+    $leap = true;
+    if ($g_day_no >= 36525){
+        $g_day_no--;
+        $gy += 100*floor($g_day_no/36524);
+        $g_day_no = $g_day_no % 36524;
+        if ($g_day_no >= 365){
+            $g_day_no++;
+        }else{
+            $leap = false;
+        }
+    }
+    $gy += 4*floor($g_day_no/1461);
+    $g_day_no %= 1461;
+    if ($g_day_no >= 366){
+        $leap = false;
+        $g_day_no--;
+        $gy += floor($g_day_no/365);
+        $g_day_no = $g_day_no % 365;
+    }
+    for ($i = 0; $g_day_no >= $g_days_in_month[$i] + ($i == 1 && $leap); $i++){
+        $g_day_no -= $g_days_in_month[$i] + ($i == 1 && $leap);
+    }
+    $gm = $i+1;
+    $gd = $g_day_no+1;
+
+    return array($gy, $gm, $gd);
+}
+
+/**
+ * Format a string according to Persian calendar (UTF)
+ *
+ * @author  Omid Mottaghi
+ * @access public
+ * @param   string  Formatting string
+ * @param   int     Timestamp to format
+ * @return  string  Formatted local time/date according to locale settings
+ */
+function persian_strftime_utf($format, $timestamp='')
+{
+
+    if($timestamp==''){
+        $timestamp = mktime();
+    }
+
+    $g_d=date('j', $timestamp);
+    $g_m=date('n', $timestamp);
+    $g_y=date('Y', $timestamp);
+
+    list($py, $pm, $pd, $p_all_days) = g2p($g_y, $g_m, $g_d);
+
+    $p_month_name = array('', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر',
+    'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند');
+    $p_week_name = array('Saturday' => 'شنبه',
+    'Sunday' => 'یک شنبه',
+    'Monday' => 'دوشنبه',
+    'Tuesday' => 'سه شنبه',
+    'Wednesday' => 'چهارشنبه',
+    'Thursday' => 'پنج شنبه',
+    'Friday' => 'جمعه',
+    'Sat' => 'ش',
+    'Sun' => 'ی',
+    'Mon' => 'د',
+    'Tue' => 'س',
+    'Wed' => 'چ',
+    'Thu' => 'پ',
+    'Fri' => 'ج');
+    $p_week_number = array('Sat' => '1',
+    'Sun' => '2',
+    'Mon' => '3',
+    'Tue' => '4',
+    'Wed' => '5',
+    'Thu' => '6',
+    'Fri' => '7');
+
+    // calculate string
+    $output_str='';
+
+    for ($i=0; $i<strlen($format); $i++){
+
+        if($format[$i]=='%'){
+            $i++;
+            switch($format[$i]){
+                case 'a':
+                    $output_str.=$p_week_name[date('D', $timestamp)];
+                    break;
+                case 'A':
+                    $output_str.=$p_week_name[date('l', $timestamp)];
+                    break;
+                case 'b':
+                case 'B':
+                case 'h':
+                    $output_str.=$p_month_name[$pm];
+                    break;
+                case 'c':
+                    $output_str.=persian_strftime_utf('%y/%m/%d %I:%M:%S', 
$timestamp);
+                    break;
+                case 'C':
+                    $output_str.=floor($py/100);
+                    break;
+                case 'd':
+                    if($pd<10) $output_str.='0'.$pd; else $output_str.=$pd;
+                    break;
+                case 'D':
+                    $output_str.=$py.'/'.$pm.'/'.$pd;
+                    break;
+                case 'e':
+                    if($pd<10) $output_str.=' '.$pd; else $output_str.=$pd;
+                    break;
+                case 'H':
+                    $output_str.=date('H', $timestamp);
+                    break;
+                case 'I':
+                    $output_str.=date('h', $timestamp);
+                    break;
+                case 'j':
+                    $output_str.=sprintf('%03d', $p_all_days);
+                    break;
+                case 'm':
+                    if($pm<10) $output_str.='0'.$pm; else $output_str.=$pm;
+                    break;
+                case 'M':
+                    $output_str.=date('i', $timestamp);
+                    break;
+                case 'n':
+                    $output_str.="\n";
+                    break;
+                case 'r':
+                case 'p':
+                    if(date('a',$timestamp)=='pm') $output_str.='بعد از ظهر'; 
else $output_str.='قبل از ظهر';
+                    break;
+                case 'R':
+                    $output_str.=strftime('%R', $timestamp);
+                    break;
+                case 'S':
+                    $output_str.=date('s', $timestamp);
+                    break;
+                case 't':
+                    $output_str.="\t";
+                    break;
+                case 'U':
+                case 'V':
+                case 'W':
+                    $output_str.=sprintf('%02d', floor(($p_all_days+1)/7));
+                    break;
+                case 'u':
+                case 'w':
+                    $output_str.=$p_week_number[date('D', $timestamp)];
+                    break;
+                case 'x':
+                    $output_str.=persian_strftime_utf('%y/%m/%d', $timestamp);
+                    break;
+                case 'X':
+                    $output_str.=persian_strftime_utf('%I:%M:%S', $timestamp);
+                    break;
+                case 'g':
+                case 'y':
+                    $output_str.=$py-(floor($py/100)*100);
+                    break;
+                case 'G':
+                case 'Y':
+                    $output_str.=$py;
+                    break;
+                case 'z':
+                case 'Z':
+                    $output_str.=strftime('%z', $timestamp);
+                    break;
+                case '%':
+                    $output_str.='%';
+                    break;
+            }
+        }else{
+            $output_str.=$format[$i];
+        }
+    }
+
+    return persian_numbers($output_str);
+}
+
+/**
+ * Format a string according to Persian calendar (UTF)
+ *
+ * @author  Omid Mottaghi
+ * @access public
+ * @param   string  Formatting string
+ * @param   int     Timestamp to format
+ * @return  string  Formatted local time/date
+ */
+function persian_date_utf($format, $timestamp='')
+{
+
+    if($timestamp==''){
+        $timestamp = mktime();
+    }
+
+    $g_d=date('j', $timestamp);
+    $g_m=date('n', $timestamp);
+    $g_y=date('Y', $timestamp);
+
+    list($py, $pm, $pd, $p_all_days) = g2p($g_y, $g_m, $g_d);
+
+    $p_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 
29);
+    $leap = 0;
+    if ($g_m>1 && (($g_y%4==0 && $g_y%100!=0) || ($g_y%400==0))){
+        $p_days_in_month[12]++;
+        $leap = 1;
+    }
+
+    $p_month_name = array('', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر',
+    'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند');
+    $p_week_name = array('Saturday' => 'شنبه',
+    'Sunday' => 'یک شنبه',
+    'Monday' => 'دوشنبه',
+    'Tuesday' => 'سه شنبه',
+    'Wednesday' => 'چهارشنبه',
+    'Thursday' => 'پنج شنبه',
+    'Friday' => 'جمعه',
+    'Sat' => 'ش',
+    'Sun' => 'ی',
+    'Mon' => 'د',
+    'Tue' => 'س',
+    'Wed' => 'چ',
+    'Thu' => 'پ',
+    'Fri' => 'ج');
+    $p_week_number = array('Sat' => '1',
+    'Sun' => '2',
+    'Mon' => '3',
+    'Tue' => '4',
+    'Wed' => '5',
+    'Thu' => '6',
+    'Fri' => '7');
+
+    // calculate string
+    $output_str='';
+
+    for ($i=0; $i<strlen($format); $i++){
+
+        if($format[$i]!='\\'){
+            switch($format[$i]){
+                case 'd':
+                    if($pd<10) $output_str.='0'.$pd; else $output_str.=$pd;
+                    break;
+                case 'j':
+                    $output_str.=$pd;
+                    break;
+                case 'D':
+                case 'S':
+                    $output_str.=$p_week_name[date('D', $timestamp)];
+                    break;
+                case 'l':
+                    $output_str.=$p_week_name[date('l', $timestamp)];
+                    break;
+                case 'w':
+                case 'N':
+                    $output_str.=$p_week_number[date('D', $timestamp)];
+                    break;
+                case 'z':
+                    $output_str.=sprintf('%03d', $p_all_days);
+                    break;
+                case 'W':
+                    $output_str.=floor(($p_all_days+1)/7);
+                    break;
+                case 'F':
+                case 'M':
+                    $output_str.=$p_month_name[$pm];
+                    break;
+                case 'm':
+                    if($pm<10) $output_str.='0'.$pm; else $output_str.=$pm;
+                    break;
+                case 'n':
+                    $output_str.=$pm;
+                    break;
+                case 't':
+                    $output_str.=$p_days_in_month[$pm];
+                    break;
+                case 'L':
+                    $output_str.=$leap;
+                    break;
+                case 'o':
+                case 'Y':
+                    $output_str.=$py;
+                    break;
+                case 'y':
+                    $output_str.=$py-(floor($py/100)*100);
+                    break;
+                case 'a':
+                case 'A':
+                    if(date('a', $timestamp)=='pm') $output_str.='بعد از ظهر'; 
else $output_str.='قبل از ظهر';
+                    break;
+                case 'B':
+                    $output_str.=date('B', $timestamp);
+                    break;
+                case 'g':
+                    $output_str.=date('g', $timestamp);
+                    break;
+                case 'G':
+                    $output_str.=date('G', $timestamp);
+                    break;
+                case 'h':
+                    $output_str.=date('h', $timestamp);
+                    break;
+                case 'H':
+                    $output_str.=date('H', $timestamp);
+                    break;
+                case 'i':
+                    $output_str.=date('i', $timestamp);
+                    break;
+                case 's':
+                    $output_str.=date('s', $timestamp);
+                    break;
+                case 'e':
+                    $output_str.=date('e', $timestamp);
+                    break;
+                case 'I':
+                    $output_str.=date('I', $timestamp);
+                    break;
+                case 'O':
+                    $output_str.=date('O', $timestamp);
+                    break;
+                case 'Z':
+                    $output_str.=date('Z', $timestamp);
+                    break;
+                case 'c':
+                    $output_str.=persian_date_utf('d-m-Y\TH:i:sO', $timestamp);
+                    break;
+                case 'r':
+                    $output_str.=persian_date_utf('D، j F Y H:i:s O', 
$timestamp);
+                    break;
+                case 'U':
+                    $output_str.=date('U', $timestamp);
+                    break;
+                default:
+                    $output_str.=$format[$i];
+                    break;
+            }
+        }else{
+            $i++;
+            $output_str.=$format[$i];
+        }
+    }
+
+    return persian_numbers($output_str);
+}
+
+/**
+ * Create a Unix timestamp for a Persian date
+ * This function works only with day > 0
+ *
+ * @author Omid Mottaghi
+ * @access public
+ * @param   int hour
+ * @param   int minute
+ * @param   int second
+ * @param   int month
+ * @param   int day
+ * @param   int year
+ * @param   int is daylight savings time set?
+ * @return  int returned timestamp
+ */
+function persian_mktime($hour='', $min='', $sec='', $mon='', $day='', 
$year='', $is_dst=-1)
+{
+    $p_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
+
+    if ( (string) $hour == '' ) { $hour = persian_date_utf('H'); }
+    if ( (string) $min  == '' ) { $min  = persian_date_utf('i'); }
+    if ( (string) $sec  == '' ) { $sec  = persian_date_utf('s'); }
+    if ( (string) $day  == '' ) { $day  = persian_date_utf('j'); }
+    if ( (string) $mon  == '' ) { $mon  = persian_date_utf('n'); }
+    if ( (string) $year == '' ) { $year = persian_date_utf('Y'); }
+
+    // calculate days of years from 1349 till now
+    $leap_years     = floor(($year - 1349 - 2) / 4);
+    $normal_years   = $year - 1349 - $leap_years;
+    $years_days     = ($leap_years * 366) + ($normal_years * 365);
+
+    $secs = 0;
+    $secs += $sec;
+    $secs += $min   * 60;
+    $secs += $hour  * 3600;
+    $secs += $day   * 86400;
+
+    list($year, $mon, $day) = p2g($year, $mon, $day);
+    return mktime($hour, $min, $sec, $mon, $day, $year, $is_dst);
+}
+
+function persian_numbers($str)
+{
+    $fa_numbers = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
+    $en_numbers = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
+    return str_replace($en_numbers, $fa_numbers, $str);
+}
diff -uNr dokuwiki-2009-02-14/inc/common.php 
dokuwiki-2009-02-14-calendar/inc/common.php
--- dokuwiki-2009-02-14/inc/common.php  2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/common.php 2009-03-04 10:36:34.000000000 
+0330
@@ -14,6 +14,13 @@
 require_once(DOKU_INC.'inc/parserutils.php');
 require_once(DOKU_INC.'inc/infoutils.php');
 
+// include desired calendar, if there is no file, it will load Gregorian as 
default
+if(is_file(DOKU_INC.'inc/calendar/'.$conf['calendar'].'.php')){
+  require_once(DOKU_INC.'inc/calendar/'.$conf['calendar'].'.php');
+}else{
+  require_once(DOKU_INC.'inc/gregorian.php');
+}
+
 /**
  * These constants are used with the recents function
  */
@@ -859,7 +866,7 @@
                      ), $tpl);
 
   // we need the callback to work around strftime's char limit
-  $tpl = preg_replace_callback('/%./',create_function('$m','return 
strftime($m[0]);'),$tpl);
+  $tpl = preg_replace_callback('/%./',create_function('$m','return 
strtime($m[0]);'),$tpl);
 
   return $tpl;
 }
@@ -1072,7 +1079,7 @@
   }
 
   $ip   = clientIP();
-  $text = str_replace('@DATE@',strftime($conf['dformat']),$text);
+  $text = str_replace('@DATE@',strtime($conf['dformat']),$text);
   $text = str_replace('@BROWSER@',$_SERVER['HTTP_USER_AGENT'],$text);
   $text = str_replace('@IPADDRESS@',$ip,$text);
   $text = str_replace('@HOSTNAME@',gethostsbyaddrs($ip),$text);
diff -uNr dokuwiki-2009-02-14/inc/html.php 
dokuwiki-2009-02-14-calendar/inc/html.php
--- dokuwiki-2009-02-14/inc/html.php    2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/html.php   2009-03-03 23:48:22.000000000 
+0330
@@ -250,7 +250,7 @@
   $form->addHidden('date', $draft['date']);
   $form->addElement(form_makeWikiText($text, array('readonly'=>'readonly')));
   $form->addElement(form_makeOpenTag('div', array('id'=>'draft__status')));
-  $form->addElement($lang['draftdate'].' '. 
strftime($conf['dformat'],filemtime($INFO['draft'])));
+  $form->addElement($lang['draftdate'].' '. 
strtime($conf['dformat'],filemtime($INFO['draft'])));
   $form->addElement(form_makeCloseTag('div'));
   $form->addElement(form_makeButton('submit', 'recover', $lang['btn_recover'], 
array('tabindex'=>'1')));
   $form->addElement(form_makeButton('submit', 'draftdel', 
$lang['btn_draftdel'], array('tabindex'=>'2')));
@@ -385,7 +385,7 @@
   global $INFO;
 
   $locktime = filemtime(wikiLockFN($ID));
-  $expire = @strftime($conf['dformat'], $locktime + $conf['locktime'] );
+  $expire = @strtime($conf['dformat'], $locktime + $conf['locktime'] );
   $min    = round(($conf['locktime'] - (time() - $locktime) )/60);
 
   print p_locale_xhtml('locked');
@@ -421,7 +421,7 @@
     array_pop($revisions); // remove extra log entry
   }
 
-  $date = @strftime($conf['dformat'],$INFO['lastmod']);
+  $date = @strtime($conf['dformat'],$INFO['lastmod']);
 
   print p_locale_xhtml('revisions');
 
@@ -469,7 +469,7 @@
   }
 
   foreach($revisions as $rev){
-    $date   = strftime($conf['dformat'],$rev);
+    $date   = strtime($conf['dformat'],$rev);
     $info   = getRevisionInfo($ID,$rev,true);
     $exists = page_exists($ID,$rev);
 
@@ -596,7 +596,7 @@
   $form->addElement(form_makeOpenTag('ul'));
 
   foreach($recents as $recent){
-    $date = strftime($conf['dformat'],$recent['date']);
+    $date = strtime($conf['dformat'],$recent['date']);
     if ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
       $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
     else
@@ -881,7 +881,7 @@
     $l_rev   = '';
     $l_text  = rawWiki($ID,'');
     $l_head  = '<a class="wikilink1" href="'.wl($ID).'">'.
-               $ID.' 
'.strftime($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '.
+               $ID.' '.strtime($conf['dformat'],@filemtime(wikiFN($ID))).'</a> 
'.
                $lang['current'];
 
     $r_rev   = '';
@@ -927,7 +927,7 @@
       if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 
'class="minor"';
 
       $l_head = '<a class="wikilink1" href="'.wl($ID,"rev=$l_rev").'">'.
-                $ID.' ['.strftime($conf['dformat'],$l_rev).']</a>'.
+                $ID.' ['.strtime($conf['dformat'],$l_rev).']</a>'.
                 '<br />'.$l_user.' '.$l_sum;
     }
 
@@ -941,7 +941,7 @@
       if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 
'class="minor"';
 
       $r_head = '<a class="wikilink1" href="'.wl($ID,"rev=$r_rev").'">'.
-                $ID.' ['.strftime($conf['dformat'],$r_rev).']</a>'.
+                $ID.' ['.strtime($conf['dformat'],$r_rev).']</a>'.
                 '<br />'.$r_user.' '.$r_sum;
     }elseif($_rev = @filemtime(wikiFN($ID))){
       $_info   = getRevisionInfo($ID,$_rev,true);
@@ -953,7 +953,7 @@
       if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 
'class="minor"';
 
       $r_head  = '<a class="wikilink1" href="'.wl($ID).'">'.
-               $ID.' ['.strftime($conf['dformat'],$_rev).']</a> '.
+               $ID.' ['.strtime($conf['dformat'],$_rev).']</a> '.
                '('.$lang['current'].')'.
                 '<br />'.$_user.' '.$_sum;
     }else{
@@ -1175,7 +1175,7 @@
   <div style="width:99%;">
 
    <div class="toolbar">
-      <div id="draft__status"><?php if(!empty($INFO['draft'])) echo 
$lang['draftdate'].' '.strftime($conf['dformat']);?></div>
+      <div id="draft__status"><?php if(!empty($INFO['draft'])) echo 
$lang['draftdate'].' '.strtime($conf['dformat']);?></div>
       <div id="tool__bar"><?php if($wr){?><a href="<?php echo 
DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>"
       target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div>
 
diff -uNr dokuwiki-2009-02-14/inc/media.php 
dokuwiki-2009-02-14-calendar/inc/media.php
--- dokuwiki-2009-02-14/inc/media.php   2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/media.php  2009-03-03 23:48:22.000000000 
+0330
@@ -402,7 +402,7 @@
     if(empty($conf['notify'])) return; //notify enabled?
 
     $text = rawLocale('uploadmail');
-    $text = str_replace('@DATE@',strftime($conf['dformat']),$text);
+    $text = str_replace('@DATE@',strtime($conf['dformat']),$text);
     $text = str_replace('@BROWSER@',$_SERVER['HTTP_USER_AGENT'],$text);
     $text = str_replace('@IPADDRESS@',$_SERVER['REMOTE_ADDR'],$text);
     $text = 
str_replace('@HOSTNAME@',gethostbyaddr($_SERVER['REMOTE_ADDR']),$text);
@@ -528,7 +528,7 @@
         $info .= (int) $item['meta']->getField('File.Height');
         $info .= ' ';
     }
-    $info .= '<i>'.strftime($conf['dformat'],$item['mtime']).'</i>';
+    $info .= '<i>'.strtime($conf['dformat'],$item['mtime']).'</i>';
     $info .= ' ';
     $info .= filesize_h($item['size']);
 
diff -uNr dokuwiki-2009-02-14/inc/template.php 
dokuwiki-2009-02-14-calendar/inc/template.php
--- dokuwiki-2009-02-14/inc/template.php        2009-02-14 15:43:25.000000000 
+0330
+++ dokuwiki-2009-02-14-calendar/inc/template.php       2009-03-03 
23:48:22.000000000 +0330
@@ -941,7 +941,7 @@
     }
   }
   $fn = utf8_decodeFN($fn);
-  $date = strftime($conf['dformat'],$INFO['lastmod']);
+  $date = strtime($conf['dformat'],$INFO['lastmod']);
 
   // print it
   if($INFO['exists']){
diff -uNr dokuwiki-2009-02-14/inc/toolbar.php 
dokuwiki-2009-02-14-calendar/inc/toolbar.php
--- dokuwiki-2009-02-14/inc/toolbar.php 2009-02-14 15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/inc/toolbar.php        2009-03-03 
23:48:22.000000000 +0330
@@ -196,7 +196,7 @@
   $sig = str_replace('@USER@',$_SERVER['REMOTE_USER'],$sig);
   $sig = str_replace('@NAME@',$INFO['userinfo']['name'],$sig);
   $sig = str_replace('@MAIL@',$INFO['userinfo']['mail'],$sig);
-  $sig = str_replace('@DATE@',strftime($conf['dformat']),$sig);
+  $sig = str_replace('@DATE@',strtime($conf['dformat']),$sig);
   $sig = str_replace('\\\\n','\\n',addslashes($sig));
   return $sig;
 }
diff -uNr dokuwiki-2009-02-14/lib/plugins/config/settings/config.metadata.php 
dokuwiki-2009-02-14-calendar/lib/plugins/config/settings/config.metadata.php
--- dokuwiki-2009-02-14/lib/plugins/config/settings/config.metadata.php 
2009-02-14 15:43:25.000000000 +0330
+++ 
dokuwiki-2009-02-14-calendar/lib/plugins/config/settings/config.metadata.php    
    2009-03-04 10:32:52.000000000 +0330
@@ -87,6 +87,7 @@
 $meta['title']    = array('string');
 $meta['start']    = array('string','_pattern' => '!^[^:;/]+$!'); // don't 
accept namespaces
 $meta['lang']     = array('dirchoice','_dir' => DOKU_INC.'inc/lang/');
+$meta['calendar'] = array('dirchoice','_dir' => DOKU_INC.'inc/calendar/');
 $meta['template'] = array('dirchoice','_dir' => DOKU_INC.'lib/tpl/','_pattern' 
=> '/^[\w-]+$/');
 $meta['license']  = array('license');
 $meta['savedir']  = array('savedir');
diff -uNr dokuwiki-2009-02-14/lib/plugins/revert/admin.php 
dokuwiki-2009-02-14-calendar/lib/plugins/revert/admin.php
--- dokuwiki-2009-02-14/lib/plugins/revert/admin.php    2009-02-14 
15:43:25.000000000 +0330
+++ dokuwiki-2009-02-14-calendar/lib/plugins/revert/admin.php   2009-03-03 
23:48:22.000000000 +0330
@@ -146,7 +146,7 @@
             }
 
             $cnt++;
-            $date = strftime($conf['dformat'],$recent['date']);
+            $date = strtime($conf['dformat'],$recent['date']);
 
             echo ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li 
class="minor">' : '<li>';
             echo '<div class="li">';

Other related posts: