PHP Класс Horde_Mapi_Timezone, horde

Copyright 2009-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21. Code dealing with searching for a timezone identifier from an AS timezone blob inspired by code in the Tine20 Project (http://tine20.org).
Автор: Michael J Rubinsky ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_startDate Horde_Date Date to use as start date when iterating through offsets looking for a transition.

Открытые методы

Метод Описание
getListOfTimezones ( array | string $offsets, string $expectedTimezone = null ) : array Get the list of timezone identifiers that match the given offsets, having a preference for $expectedTimezone if it's present in the results.
getOffsetsFromDate ( Horde_Date $date ) : array Create a offset hash suitable for use in ActiveSync transactions
getOffsetsFromSyncTZ ( $data ) : array Convert a timezone from the MAPI base64 structure to a TZ offset hash.
getSyncTZFromOffsets ( array $offsets ) : string Build an MAPI TZ blob given a TZ Offset hash.
getTimezone ( array | string $offsets, string $expectedTimezone = null ) : string Attempt to guess the timezone identifier from the $offsets array.

Защищенные методы

Метод Описание
_checkTimezone ( DateTimeZone $timezone, array $offsets ) : array | boolean Check if the given timezone matches the offsets and also evaluate the daylight saving time transitions for this timezone if necessary.
_checkTransition ( array $std, array $dst, array $offsets ) : boolean Check if the given standardTransition and daylightTransition match to the given offsets.
_generateOffsetsForTransition ( array $offsets, array $transition, string $type ) : array Calculate the offsets for the specified transition
_getTransitions ( DateTimeZone $timezone, Horde_Date $date ) : array Get the transition data for moving from DST to STD time.
_isNthOcurrenceOfWeekdayInMonth ( integer $timestamp, integer $occurence ) : boolean Test if the weekday of the given timestamp is the nth occurence of this weekday within its month, where '5' indicates the last occurrence even if there is less than five occurrences.
_setDefaultStartDate ( array $offsets = null ) Set default value for $_startDate.

Описание методов

_checkTimezone() защищенный Метод

Check if the given timezone matches the offsets and also evaluate the daylight saving time transitions for this timezone if necessary.
protected _checkTimezone ( DateTimeZone $timezone, array $offsets ) : array | boolean
$timezone DateTimeZone The timezone to check.
$offsets array The offsets to check.
Результат array | boolean An array of transition data or false if timezone does not match offset.

_checkTransition() защищенный Метод

Check if the given standardTransition and daylightTransition match to the given offsets.
protected _checkTransition ( array $std, array $dst, array $offsets ) : boolean
$std array The Standard transition date.
$dst array The DST transition date.
$offsets array The offsets to check.
Результат boolean

_generateOffsetsForTransition() защищенный статический Метод

Calculate the offsets for the specified transition
protected static _generateOffsetsForTransition ( array $offsets, array $transition, string $type ) : array
$offsets array A TZ offset hash
$transition array A transition hash
$type string Transition type - dst or std
Результат array A populated offset hash

_getTransitions() защищенный статический Метод

Get the transition data for moving from DST to STD time.
protected static _getTransitions ( DateTimeZone $timezone, Horde_Date $date ) : array
$timezone DateTimeZone The timezone to get the transition for
$date Horde_Date The date to start from. Really only the year we are interested in is needed.
Результат array An array containing the the STD and DST transitions

_isNthOcurrenceOfWeekdayInMonth() защищенный статический Метод

Test if the weekday of the given timestamp is the nth occurence of this weekday within its month, where '5' indicates the last occurrence even if there is less than five occurrences.
protected static _isNthOcurrenceOfWeekdayInMonth ( integer $timestamp, integer $occurence ) : boolean
$timestamp integer The timestamp to check.
$occurence integer 1 to 5, where 5 indicates the final occurrence during the month if that day of the week does not occur 5 times
Результат boolean

_setDefaultStartDate() защищенный Метод

Tries to guess the correct startDate depending on object property. Falls back to current date.
protected _setDefaultStartDate ( array $offsets = null )
$offsets array Offsets may be avaluated for a given start year

getListOfTimezones() публичный Метод

Get the list of timezone identifiers that match the given offsets, having a preference for $expectedTimezone if it's present in the results.
public getListOfTimezones ( array | string $offsets, string $expectedTimezone = null ) : array
$offsets array | string Either an offset array, or a AS timezone structure.
$expectedTimezone string The expected timezone.
Результат array An array of timezone identifiers

getOffsetsFromDate() публичный статический Метод

Create a offset hash suitable for use in ActiveSync transactions
public static getOffsetsFromDate ( Horde_Date $date ) : array
$date Horde_Date A date object representing the date to base the the tz data on.
Результат array An offset hash.

getOffsetsFromSyncTZ() публичный статический Метод

Convert a timezone from the MAPI base64 structure to a TZ offset hash.
public static getOffsetsFromSyncTZ ( $data ) : array
Результат array Hash of offset information

getSyncTZFromOffsets() публичный статический Метод

Build an MAPI TZ blob given a TZ Offset hash.
public static getSyncTZFromOffsets ( array $offsets ) : string
$offsets array A TZ offset hash
Результат string A base64_encoded MAPI Timezone structure suitable for transmitting via wbxml.

getTimezone() публичный Метод

Since it's impossible to know exactly which olson timezone name a specific set of offsets represent (multiple timezone names may be described by the same offsets for any given year) we allow passing an expected timezone. If this matches one of the timezones that matches the offsets, we return that. Otherwise, we attempt to get the full timezone name from Horde_Date and if that fails, return the abbreviated timezone name of the first timezone that matches the provided offsets.
public getTimezone ( array | string $offsets, string $expectedTimezone = null ) : string
$offsets array | string The timezone to check. Either an array of offsets or an activesynz tz blob.
$expectedTimezone string The expected timezone. If not empty, and present in the results, will return.
Результат string The timezone identifier.

Описание свойств

$_startDate защищенное свойство

Date to use as start date when iterating through offsets looking for a transition.
protected Horde_Date $_startDate
Результат Horde_Date