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])
Exibir arquivo Open project: horde/horde Class Usage Examples

Protected Properties

Property 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.

Public Methods

Method 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.

Protected Methods

Method 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 method

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 method

Downloads a timezone database.
protected _download ( )

_extractAndParse() protected method

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

_parse() protected method

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

getMonth() public static method

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

getRule() public method

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.
return Horde_Timezone_Rule A rule object.

getZone() public method

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.
return 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
return array

$_params protected_oe property

Any configuration parameters for this class.
protected array $_params
return array

$_rules protected_oe property

List of all Rule entries parsed into Horde_Timezone_Rule objects.
protected array $_rules
return array

$_tmpfile protected_oe property

File location of the downloaded timezone database.
protected string $_tmpfile
return string

$_zones protected_oe property

List of all Zone entries parsed into Horde_Timezone_Zone objects.
protected array $_zones
return array