PHP Класс Horde_Timezone, horde
This class is the central point to fetch timezone information from the
timezone (Olson) database, parse it, cache it, and generate VTIMEZONE
objects.
Usage:
$tz = new Horde_Timezone();
$tz->getZone('America/New_York')->toVtimezone()->exportVcalendar();
Documentation on the database file formats can be found at
ftp://ftp.iana.org/tz/tz-how-to.html
Показать файл
Открыть проект
Примеры использования класса
Защищенные свойства (Protected)
Свойство |
Тип |
Описание |
|
$_links |
array |
Alias map of all Link entries. |
|
$_months |
array |
List to map month descriptions used in the timezone database. |
|
$_params |
array |
Any configuration parameters for this class. |
|
$_rules |
array |
List of all Rule entries parsed into Horde_Timezone_Rule objects. |
|
$_tmpfile |
string |
File location of the downloaded timezone database. |
|
$_zones |
array |
List of all Zone entries parsed into Horde_Timezone_Zone objects. |
|
Открытые методы
Метод |
Описание |
|
__construct ( array $params = [] ) |
Constructor. |
|
getMonth ( string $month ) : integer |
Returns the month number of a month name. |
|
getRule ( string $rule ) : Horde_Timezone_Rule |
Returns an object representing a set of named transition rules. |
|
getZone ( string $zone ) : Horde_Timezone_Zone |
Returns an object representing an invidual timezone. |
|
Защищенные методы
Метод |
Описание |
|
_download ( ) |
Downloads a timezone database. |
|
_extractAndParse ( ) |
Unpacks the downloaded timezone database and parses all files. |
|
_parse ( string $file ) |
Parses a file from the timezone database. |
|
Описание методов
__construct()
публичный Метод
public __construct ( array $params = [] ) |
$params |
array |
List of optional class parameters. Possible
options:
- location: (string) Location of the timezone
database, defaults to
ftp.iana.org/tz/tzdata-latest.tar.gz.
- client: (Horde_Http_Client) A preconfigured
HTTP client for downloading via HTTP.
- temp: (string) Temporary directory.
- cache: (Horde_Cache) A cache object.
- cachettl: (integer) Cache lifetime in seconds,
defaults to 7 days. |
_download()
защищенный Метод
Downloads a timezone database.
_extractAndParse()
защищенный Метод
Unpacks the downloaded timezone database and parses all files.
_parse()
защищенный Метод
Parses a file from the timezone database.
getMonth()
публичный статический Метод
Returns the month number of a month name.
getRule()
публичный Метод
Maps to a list Rule entries of the same name in the timezone database.
public getRule ( string $rule ) : Horde_Timezone_Rule |
$rule |
string |
A rule name. |
Результат |
Horde_Timezone_Rule |
A rule object. |
getZone()
публичный Метод
Maps to a "Zone" entry in the timezone database. Works with
zone aliases and other common timezone names too.
public getZone ( string $zone ) : Horde_Timezone_Zone |
$zone |
string |
A timezone name. |
Результат |
Horde_Timezone_Zone |
A timezone object. |
Описание свойств
$_links защищенное свойство
Alias map of all Link entries.
protected array $_links |
Результат |
array |
|
$_months защищенное статическое свойство
List to map month descriptions used in the timezone database.
protected static array $_months |
Результат |
array |
|
$_params защищенное свойство
Any configuration parameters for this class.
protected array $_params |
Результат |
array |
|
$_rules защищенное свойство
List of all Rule entries parsed into Horde_Timezone_Rule objects.
protected array $_rules |
Результат |
array |
|
$_tmpfile защищенное свойство
File location of the downloaded timezone database.
protected string $_tmpfile |
Результат |
string |
|
$_zones защищенное свойство
List of all Zone entries parsed into Horde_Timezone_Zone objects.
protected array $_zones |
Результат |
array |
|