Documentation

Horde_Icalendar_Vtimezone extends Horde_Icalendar
in package

Class representing vTimezones.

Tags
author

Mike Cochrane mike@graftonhall.co.nz

category

Horde

copyright

2003-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$type  : string
The component type of this class.
$_attributes  : array<string|int, mixed>
The name/value pairs of attributes for this object (UID, DTSTART, etc.). Which are present depends on the object and on what kind of component it is.
$_components  : array<string|int, mixed>
Any children (contained) iCalendar components of this object.
$_container  : Horde_Icalendar
The parent (containing) iCalendar object.
$_newline  : string
According to RFC 2425, we should always use CRLF-terminated lines.
$_oldFormat  : mixed
Whether entry is vcalendar 1.0, vcard 2.1 or vnote 1.1.
$_version  : string
iCalendar format version (different behavior for 1.0 and 2.0 especially with recurring events).
__construct()  : mixed
Constructor.
_exportDateTime()  : string
Export a DateTime field.
_exportUtcOffset()  : TODO
Export a UTC Offset field.
_getEndDifference()  : bool
Returns the difference between the datetime indicated by $a and the datetime indicated by $b after normalizing both values to a unix timestamp. Used when sorting timezone transitions that may contain mixed format end times.
_parseDate()  : array<string|int, mixed>
Parses a Date field.
_parseDateTime()  : int
Parses a DateTime field and returns a unix timestamp. If the field cannot be parsed then the original text is returned unmodified.
addComponent()  : mixed
Add a vCalendar component (eg vEvent, vTimezone, etc.).
clear()  : mixed
Clears the iCalendar object (resets the components and attributes arrays).
exportvCalendar()  : TODO
TODO
findComponent()  : mixed
Locates the first child component of the specified class, and returns a reference to it.
findComponentByAttribute()  : mixed
Locates the first matching child component of the specified class, and returns a reference to it.
getAllAttributes()  : array<string|int, mixed>
Get attributes for all tags or for a given tag.
getAttribute()  : mixed
Get the value of an attribute.
getAttributeDefault()  : mixed
Returns the value of an attribute, or a specified default value if the attribute does not exist.
getAttributeSingle()  : string
Get a single value of an attribute.
getAttributeValues()  : array<string|int, mixed>
Gets the values of an attribute as an array. Multiple values are possible due to:
getComponent()  : mixed
Retrieve a specific component.
getComponentClasses()  : array<string|int, mixed>
Return the classes (entry types) we have.
getComponentCount()  : int
Number of components in this container.
getComponents()  : array<string|int, mixed>
Retrieve all the components.
getType()  : TODO
TODO
newComponent()  : object
Return a reference to a new component.
parseChild()  : array<string|int, mixed>
Parses child components of vTimezone component.
parsevCalendar()  : bool
Parses a string containing vCalendar data.
removeAttribute()  : mixed
Remove all occurences of an attribute.
setAttribute()  : mixed
Sets the value of an attribute.
setParameter()  : bool
Sets parameter(s) for an (already existing) attribute. The parameter set is merged into the existing set.
setVersion()  : mixed
Sets the version of this component.
toHash()  : array<string|int, mixed>
Export this entry as a hash array with tag names as keys.
toString()  : mixed
_checkEndDate()  : bool
Utility method to aid in checking the end date of a transition.
_exportDate()  : TODO
Exports a date field.
_exportDuration()  : mixed
Export a duration value.
_exportPeriod()  : TODO
Export a Time Period field.
_exportvData()  : string
Export this component in vCal format.
_parseDuration()  : int
Parses a DURATION value field.
_parsePeriod()  : array<string|int, mixed>
Parse a Time Period field.
_parseTime()  : TODO
Parses a Time field.
_parseTZID()  : int
Groks the TZID and returns an offset in seconds from UTC for this date and time.
_parseUtcOffset()  : TODO
Parse a UTC Offset field.

Properties

$type

The component type of this class.

public string $type = 'vTimeZone'

$_attributes

The name/value pairs of attributes for this object (UID, DTSTART, etc.). Which are present depends on the object and on what kind of component it is.

protected array<string|int, mixed> $_attributes = array()

$_components

Any children (contained) iCalendar components of this object.

protected array<string|int, mixed> $_components = array()

$_newline

According to RFC 2425, we should always use CRLF-terminated lines.

protected string $_newline = "\r\n"

$_oldFormat

Whether entry is vcalendar 1.0, vcard 2.1 or vnote 1.1.

protected mixed $_oldFormat = \true

These 'old' formats are defined by www.imc.org. The 'new' (non-old) formats icalendar 2.0 and vcard 3.0 are defined in rfc2426 and rfc2445 respectively.

$_version

iCalendar format version (different behavior for 1.0 and 2.0 especially with recurring events).

protected string $_version

Methods

__construct()

Constructor.

public __construct([mixed $version = '2.0' ]) : mixed
Parameters
$version : mixed = '2.0'
Return values
mixed

_exportDateTime()

Export a DateTime field.

public _exportDateTime(int|object|array<string|int, mixed> $value[, bool $floating = false ]) : string
Parameters
$value : int|object|array<string|int, mixed>

The time value to export (either a Horde_Date, array, or timestamp).

$floating : bool = false

Whether to return a floating date-time (without time zone information).

Tags
todo

A bunch of code calls this function outside this class, so it needs to be marked public for now.

Return values
string

The string representation of the datetime value.

_exportUtcOffset()

Export a UTC Offset field.

public _exportUtcOffset( $value) : TODO
Parameters
$value :

TODO

Return values
TODO

_getEndDifference()

Returns the difference between the datetime indicated by $a and the datetime indicated by $b after normalizing both values to a unix timestamp. Used when sorting timezone transitions that may contain mixed format end times.

public static _getEndDifference(mixed $a, mixed $b) : bool
Parameters
$a : mixed
$b : mixed
Tags
todo

This needs to be public/static due to it being called from a anonymous function. See PR: 213. This can be removed once we no longer support PHP 5.3.

Return values
bool

True if $a < $b otherwise false.

_parseDate()

Parses a Date field.

public _parseDate( $text) : array<string|int, mixed>
Parameters
$text :

TODO

Return values
array<string|int, mixed>

TODO

_parseDateTime()

Parses a DateTime field and returns a unix timestamp. If the field cannot be parsed then the original text is returned unmodified.

public _parseDateTime(string $text[, string $tzid = false ]) : int
Parameters
$text : string

The Icalendar datetime field value.

$tzid : string = false

A timezone identifier.

Tags
todo

This function should be moved to Horde_Date and made public.

Return values
int

A unix timestamp.

addComponent()

Add a vCalendar component (eg vEvent, vTimezone, etc.).

public addComponent(mixed $components) : mixed
Parameters
$components : mixed
Return values
mixed

clear()

Clears the iCalendar object (resets the components and attributes arrays).

public clear() : mixed
Return values
mixed

exportvCalendar()

TODO

public exportvCalendar() : TODO
Return values
TODO

findComponent()

Locates the first child component of the specified class, and returns a reference to it.

public findComponent(mixed $childclass) : mixed
Parameters
$childclass : mixed
Return values
mixed

findComponentByAttribute()

Locates the first matching child component of the specified class, and returns a reference to it.

public findComponentByAttribute(string $childclass, string $attribute[, string $value = null ]) : mixed
Parameters
$childclass : string

The type of component to find.

$attribute : string

This attribute must be set in the component for it to match.

$value : string = null

Optional value that $attribute must match.

Return values
mixed

getAllAttributes()

Get attributes for all tags or for a given tag.

public getAllAttributes([string $tag = false ]) : array<string|int, mixed>
Parameters
$tag : string = false

Return attributes for this tag, or all attributes if not given.

Return values
array<string|int, mixed>

An array containing all the attributes and their types.

getAttribute()

Get the value of an attribute.

public getAttribute(string $name[, bool $params = false ]) : mixed
Parameters
$name : string

The name of the attribute.

$params : bool = false

Return the parameters for this attribute instead of its value.

Tags
throws
Horde_Icalendar_Exception
Return values
mixed

(string) The value of the attribute. (array) The parameters for the attribute or multiple values for an attribute.

getAttributeDefault()

Returns the value of an attribute, or a specified default value if the attribute does not exist.

public getAttributeDefault(string $name[, mixed $default = '' ]) : mixed
Parameters
$name : string

The name of the attribute.

$default : mixed = ''

What to return if the attribute specified by $name does not exist.

Return values
mixed

(mixed) The value of $name. (mixed) $default if $name does not exist.

getAttributeSingle()

Get a single value of an attribute.

public getAttributeSingle(string $name) : string

If multiple values, is auto-determined by library which is preferred value to return.

Parameters
$name : string

The name of the attribute.

Tags
since
2.1.0
throws
Horde_Icalendar_Exception
Return values
string

The value of the attribute.

getAttributeValues()

Gets the values of an attribute as an array. Multiple values are possible due to:

public getAttributeValues(string $name) : array<string|int, mixed>

a) multiple occurences of 'name' b) (unsecapd) comma seperated lists.

So for a vcard like "KEY:a,b\nKEY:c" getAttributesValues('KEY') will return array('a', 'b', 'c').

Parameters
$name : string

The name of the attribute.

Tags
throws
Horde_Icalendar_Exception
Return values
array<string|int, mixed>

Multiple values for an attribute.

getComponent()

Retrieve a specific component.

public getComponent(int $idx) : mixed
Parameters
$idx : int

The index of the object to retrieve.

Return values
mixed

(boolean) False if the index does not exist. (Horde_Icalendar_*) The requested component.

getComponentClasses()

Return the classes (entry types) we have.

public getComponentClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

Hash with class names Horde_Icalendar_xxx as keys and number of components of this class as value.

getComponentCount()

Number of components in this container.

public getComponentCount() : int
Return values
int

Number of components in this container.

getComponents()

Retrieve all the components.

public getComponents() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of Horde_Icalendar objects.

getType()

TODO

public getType() : TODO
Return values
TODO

newComponent()

Return a reference to a new component.

public static newComponent(string $type, Horde_Icalendar $container) : object
Parameters
$type : string

The type of component to return

$container : Horde_Icalendar

A container that this component will be associated with.

Return values
object

Reference to a Horde_Icalendar_* object as specified.

parseChild()

Parses child components of vTimezone component.

public parseChild(Horde_Icalendar_Standard|Horde_Icalendar_Daylight $child, int $year) : array<string|int, mixed>

Returns an array with the exact time of the time change as well as the 'from' and 'to' offsets around the change. Time is arbitrarily based on UTC for comparison.

Parameters
$child : Horde_Icalendar_Standard|Horde_Icalendar_Daylight

A timezone component.

$year : int

The latest year we are interested in.

Return values
array<string|int, mixed>

A list of hashes with "time", "from", and "to" elements.

parsevCalendar()

Parses a string containing vCalendar data.

public parsevCalendar(string $text[, string $base = 'VCALENDAR' ][, bool $clear = true ]) : bool
Parameters
$text : string

The data to parse.

$base : string = 'VCALENDAR'

The type of the base object.

$clear : bool = true

If true clears this object before parsing.

Tags
todo

This method doesn't work well at all, if $base is VCARD.

throws
Horde_Icalendar_Exception
Return values
bool

True on successful import, false otherwise.

removeAttribute()

Remove all occurences of an attribute.

public removeAttribute(string $name) : mixed
Parameters
$name : string

The name of the attribute.

Return values
mixed

setAttribute()

Sets the value of an attribute.

public setAttribute(string $name, string $value[, array<string|int, mixed> $params = array() ][, bool $append = true ][, array<string|int, mixed> $values = false ]) : mixed
Parameters
$name : string

The name of the attribute.

$value : string

The value of the attribute.

$params : array<string|int, mixed> = array()

Array containing any addition parameters for this attribute.

$append : bool = true

True to append the attribute, False to replace the first matching attribute found.

$values : array<string|int, mixed> = false

Array representation of $value. For comma/semicolon seperated lists of values. If not set use $value as single array element.

Return values
mixed

setParameter()

Sets parameter(s) for an (already existing) attribute. The parameter set is merged into the existing set.

public setParameter(string $name[, array<string|int, mixed> $params = array() ]) : bool
Parameters
$name : string

The name of the attribute.

$params : array<string|int, mixed> = array()

Array containing any additional parameters for this attribute.

Return values
bool

True on success, false if no attribute $name exists.

setVersion()

Sets the version of this component.

public setVersion(string $version) : mixed
Parameters
$version : string

A float-like version string.

Tags
see

$version

see

$oldFormat

Return values
mixed

toHash()

Export this entry as a hash array with tag names as keys.

public toHash([bool $paramsInKeys = false ]) : array<string|int, mixed>
Parameters
$paramsInKeys : bool = false

If false, the operation can be quite lossy as the parameters are ignored when building the array keys. So if you export a vcard with LABEL;TYPE=WORK:foo LABEL;TYPE=HOME:bar the resulting hash contains only one label field! If set to true, array keys look like 'LABEL;TYPE=WORK'

Return values
array<string|int, mixed>

A hash array with tag names as keys.

toString()

public toString() : mixed
Return values
mixed

_checkEndDate()

Utility method to aid in checking the end date of a transition.

protected _checkEndDate(int $t, array<string|int, mixed> $times) : bool
Parameters
$t : int

The timestamp of the date we are checking.

$times : array<string|int, mixed>

A transition array.

Return values
bool

True if $t is before the end date of the transition otherwise false.

_exportDate()

Exports a date field.

protected _exportDate(object|array<string|int, mixed> $value[, string $autoconvert = false ]) : TODO
Parameters
$value : object|array<string|int, mixed>

Date object or hash.

$autoconvert : string = false

If set, use this as time part to export the date as datetime when exporting to Vcalendar 1.0. Examples: '000000' or '235959'

Return values
TODO

_exportDuration()

Export a duration value.

protected _exportDuration( $value) : mixed
Parameters
$value :

TODO

Return values
mixed

_exportPeriod()

Export a Time Period field.

protected _exportPeriod( $value) : TODO
Parameters
$value :

TODO

Return values
TODO

_exportvData()

Export this component in vCal format.

protected _exportvData([string $base = 'VCALENDAR' ]) : string
Parameters
$base : string = 'VCALENDAR'

The type of the base object.

Return values
string

vCal format data.

_parseDuration()

Parses a DURATION value field.

protected _parseDuration(string $text) : int
Parameters
$text : string

A DURATION value.

Return values
int

The duration in seconds.

_parsePeriod()

Parse a Time Period field.

protected _parsePeriod( $text) : array<string|int, mixed>
Parameters
$text :

TODO

Return values
array<string|int, mixed>

TODO

_parseTime()

Parses a Time field.

protected _parseTime( $text) : TODO
Parameters
$text :

TODO

Return values
TODO

_parseTZID()

Groks the TZID and returns an offset in seconds from UTC for this date and time.

protected _parseTZID(array<string|int, mixed> $date, array<string|int, mixed> $time, string $tzid) : int
Parameters
$date : array<string|int, mixed>

A date hash.

$time : array<string|int, mixed>

A time hash.

$tzid : string

A timezone ID.

Return values
int

The offset from UTC in seconds for the provided timezone and date/time.

_parseUtcOffset()

Parse a UTC Offset field.

protected _parseUtcOffset( $text) : TODO
Parameters
$text :

TODO

Return values
TODO

Search results