PHP Class 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
Author: Jan Schneider ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Protected Properties

Свойство Type Description
$_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.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
_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.

Method Details

__construct() public méthode

Constructor.
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() protected méthode

Downloads a timezone database.
protected _download ( )

_extractAndParse() protected méthode

Unpacks the downloaded timezone database and parses all files.
protected _extractAndParse ( )

_parse() protected méthode

Parses a file from the timezone database.
protected _parse ( string $file )
$file string A file location.

getMonth() public static méthode

Returns the month number of a month name.
public static getMonth ( string $month ) : integer
$month string A month name.
Résultat integer The month's number.

getRule() public méthode

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.
Résultat Horde_Timezone_Rule A rule object.

getZone() public méthode

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.
Résultat Horde_Timezone_Zone A timezone object.

Property Details

$_months protected_oe static_oe property

List to map month descriptions used in the timezone database.
protected static array $_months
Résultat array

$_params protected_oe property

Any configuration parameters for this class.
protected array $_params
Résultat array

$_rules protected_oe property

List of all Rule entries parsed into Horde_Timezone_Rule objects.
protected array $_rules
Résultat array

$_tmpfile protected_oe property

File location of the downloaded timezone database.
protected string $_tmpfile
Résultat string

$_zones protected_oe property

List of all Zone entries parsed into Horde_Timezone_Zone objects.
protected array $_zones
Résultat array