Introduced a debug option and a localization string for holidays.
[timetracker.git] / WEB-INF / lib / DateAndTime.class.php
index 4752e99..20f2742 100644 (file)
@@ -321,18 +321,17 @@ class DateAndTime {
    */
   function preprocessFormatString($format) {
     global $i18n;
-    if (isset($GLOBALS['i18n'])) {
-      // replace locale-dependent strings
-      $format = str_replace('%a', mb_substr($i18n->getWeekDayName($this->mDay), 0, 3, 'utf-8'), $format);
-      $format = str_replace('%A', $i18n->getWeekDayName($this->mDay), $format);
-      $abbrev_month = mb_substr($i18n->monthNames[$this->mMonth], 0, 3, 'utf-8');
-      $format = str_replace('%b', $abbrev_month, $format);
-      $format = str_replace('%h', $abbrev_month, $format);
-      $format = str_replace('%z', date('O'), $format);
-      $format = str_replace('%Z', date('O'), $format); // format as 'O' for consistency with JS strftime
-      if (strpos($format, '%c') !== false) {
-        $format = str_replace('%c', $this->preprocessFormatString('%a %d %b %Y %T %Z'), $format);
-      }
+
+    // replace locale-dependent strings
+    $format = str_replace('%a', mb_substr($i18n->getWeekDayName($this->mDay), 0, 3, 'utf-8'), $format);
+    $format = str_replace('%A', $i18n->getWeekDayName($this->mDay), $format);
+    $abbrev_month = mb_substr($i18n->monthNames[$this->mMonth], 0, 3, 'utf-8');
+    $format = str_replace('%b', $abbrev_month, $format);
+    $format = str_replace('%h', $abbrev_month, $format);
+    $format = str_replace('%z', date('O'), $format);
+    $format = str_replace('%Z', date('O'), $format); // format as 'O' for consistency with JS strftime
+    if (strpos($format, '%c') !== false) {
+      $format = str_replace('%c', $this->preprocessFormatString('%a %d %b %Y %T %Z'), $format);
     }
     return $format;
   }