コード例 #1
0
ファイル: Date.php プロジェクト: horde/horde
 /**
  * Returns the normalized (Olson) timezone name of a timezone alias.
  *
  * We currently support Windows and Lotus timezone names, and timezone
  * abbreviations.
  *
  * @since Horde_Date 2.3.0
  *
  * @param string $timezone  Some timezone alias.
  *
  * @return string  The Olson timezone name, or the original value, if no
  *                 alias found.
  */
 public static function getTimezoneAlias($timezone)
 {
     if (empty(self::$_timezoneIdentifiers)) {
         self::$_timezoneIdentifiers = array_flip(DateTimeZone::listIdentifiers());
     }
     if (isset(self::$_timezoneIdentifiers[$timezone])) {
         return $timezone;
     }
     /* Workaround for standard cases of bug #11688 */
     if (isset(self::$_timezoneAliases[$timezone])) {
         $timezone = self::$_timezoneAliases[$timezone];
     }
     if (empty(self::$_timezoneAbbreviations)) {
         self::$_timezoneAbbreviations = DateTimeZone::listAbbreviations();
     }
     $lower = Horde_String::lower($timezone);
     if (isset(self::$_timezoneAbbreviations[$lower])) {
         $timezone = reset(self::$_timezoneAbbreviations[$lower]);
         $timezone = $timezone['timezone_id'];
     }
     return $timezone;
 }