PHP Класс Horde_Icalendar, horde

Автор: Mike Cochrane ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$type string The component type of this class.

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

Свойство Тип Описание
$_attributes array 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 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 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 string iCalendar format version (different behavior for 1.0 and 2.0 especially with recurring events).

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

Метод Описание
__construct ( $version = '2.0' ) Constructor.
_exportDateTime ( integer | object | array $value, boolean $floating = false ) : string Export a DateTime field.
_exportUtcOffset ( $value ) : TODO Export a UTC Offset field.
_parseDate ( $text ) : array Parses a Date field.
_parseDateTime ( $text, $tzid = false ) : TODO Parses a DateTime field and returns a unix timestamp. If the field cannot be parsed then the original text is returned unmodified.
addComponent ( $components ) Add a vCalendar component (eg vEvent, vTimezone, etc.).
clear ( ) Clears the iCalendar object (resets the components and attributes arrays).
exportvCalendar ( ) : TODO Export as vCalendar format.
findComponent ( $childclass ) : boolean | Horde_Icalendar_ Locates the first child component of the specified class, and returns a reference to it.
findComponentByAttribute ( string $childclass, string $attribute, string $value = null ) : boolean | Horde_Icalendar_ Locates the first matching child component of the specified class, and returns a reference to it.
getAllAttributes ( string $tag = false ) : array Get attributes for all tags or for a given tag.
getAttribute ( string $name, boolean $params = false ) : mixed Get the value of an attribute.
getAttributeDefault ( string $name, mixed $default = '' ) : mixed Returns the value of an attribute, or a specified default value if the attribute does not exist.
getAttributeSingle ( string $name ) : string Get a single value of an attribute.
getAttributeValues ( string $name ) : array Gets the values of an attribute as an array. Multiple values are possible due to:
getComponent ( integer $idx ) : mixed Retrieve a specific component.
getComponentClasses ( ) : array Return the classes (entry types) we have.
getComponentCount ( ) : integer Number of components in this container.
getComponents ( ) : array Retrieve all the components.
getType ( ) : TODO TODO
newComponent ( string $type, Horde_Icalendar $container ) : object Return a reference to a new component.
parsevCalendar ( string $text, string $base = 'VCALENDAR', boolean $clear = true ) : boolean Parses a string containing vCalendar data.
removeAttribute ( string $name ) Remove all occurences of an attribute.
setAttribute ( string $name, string $value, array $params = [], boolean $append = true, array $values = false ) Sets the value of an attribute.
setParameter ( string $name, array $params = [] ) : boolean Sets parameter(s) for an (already existing) attribute. The parameter set is merged into the existing set.
setVersion ( string $version ) Sets the version of this component.
toHash ( boolean $paramsInKeys = false ) : array Export this entry as a hash array with tag names as keys.
toString ( )

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

Метод Описание
_checkEndDate ( integer $t, array $times ) : boolean Utility method to aid in checking the end date of a transition.
_exportDate ( object | array $value, string $autoconvert = false ) : TODO Exports a date field.
_exportDuration ( $value ) Export a duration value.
_exportPeriod ( $value ) : TODO Export a Time Period field.
_exportvData ( string $base = 'VCALENDAR' ) : string Export this component in vCal format.
_parseDuration ( string $text ) : integer Parses a DURATION value field.
_parsePeriod ( $text ) : array Parse a Time Period field.
_parseTZID ( array $date, array $time, string $tzid ) : integer Groks the TZID and returns an offset in seconds from UTC for this date and time.
_parseTime ( $text ) : TODO Parses a Time field.
_parseUtcOffset ( $text ) : TODO Parse a UTC Offset field.

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

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

Constructor.
public __construct ( $version = '2.0' )

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

Utility method to aid in checking the end date of a transition.
protected _checkEndDate ( integer $t, array $times ) : boolean
$t integer The timestamp of the date we are checking.
$times array A transition array.
Результат boolean True if $t is before the end date of the transition otherwise false.

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

Exports a date field.
protected _exportDate ( object | array $value, string $autoconvert = false ) : TODO
$value object | array Date object or hash.
$autoconvert string If set, use this as time part to export the date as datetime when exporting to Vcalendar 1.0. Examples: '000000' or '235959'
Результат TODO

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

Export a DateTime field.
public _exportDateTime ( integer | object | array $value, boolean $floating = false ) : string
$value integer | object | array The time value to export (either a Horde_Date, array, or timestamp).
$floating boolean Whether to return a floating date-time (without time zone information).
Результат string The string representation of the datetime value.

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

Export a duration value.
protected _exportDuration ( $value )
$value TODO

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

Export a Time Period field.
protected _exportPeriod ( $value ) : TODO
$value TODO
Результат TODO

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

Export a UTC Offset field.
public _exportUtcOffset ( $value ) : TODO
$value TODO
Результат TODO

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

Export this component in vCal format.
protected _exportvData ( string $base = 'VCALENDAR' ) : string
$base string The type of the base object.
Результат string vCal format data.

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

Parses a Date field.
public _parseDate ( $text ) : array
$text TODO
Результат array 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 ( $text, $tzid = false ) : TODO
$tzid TODO
Результат TODO

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

Parses a DURATION value field.
protected _parseDuration ( string $text ) : integer
$text string A DURATION value.
Результат integer The duration in seconds.

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

Parse a Time Period field.
protected _parsePeriod ( $text ) : array
$text TODO
Результат array TODO

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

Groks the TZID and returns an offset in seconds from UTC for this date and time.
protected _parseTZID ( array $date, array $time, string $tzid ) : integer
$date array A date hash.
$time array A time hash.
$tzid string A timezone ID.
Результат integer The offset from UTC in seconds for the provided timezone and date/time.

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

Parses a Time field.
protected _parseTime ( $text ) : TODO
$text TODO
Результат TODO

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

Parse a UTC Offset field.
protected _parseUtcOffset ( $text ) : TODO
$text TODO
Результат TODO

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

Add a vCalendar component (eg vEvent, vTimezone, etc.).
public addComponent ( $components )

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

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

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

Export as vCalendar format.
public exportvCalendar ( ) : TODO
Результат TODO

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

Locates the first child component of the specified class, and returns a reference to it.
public findComponent ( $childclass ) : boolean | Horde_Icalendar_
Результат boolean | Horde_Icalendar_

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 ) : boolean | Horde_Icalendar_
$childclass string The type of component to find.
$attribute string This attribute must be set in the component for it to match.
$value string Optional value that $attribute must match.
Результат boolean | Horde_Icalendar_

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

Get attributes for all tags or for a given tag.
public getAllAttributes ( string $tag = false ) : array
$tag string Return attributes for this tag, or all attributes if not given.
Результат array An array containing all the attributes and their types.

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

Get the value of an attribute.
public getAttribute ( string $name, boolean $params = false ) : mixed
$name string The name of the attribute.
$params boolean Return the parameters for this attribute instead of its value.
Результат 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
$name string The name of the attribute.
$default mixed What to return if the attribute specified by $name does not exist.
Результат mixed (mixed) The value of $name. (mixed) $default if $name does not exist.

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

If multiple values, is auto-determined by library which is preferred value to return.
С версии: 2.1.0
public getAttributeSingle ( string $name ) : string
$name string The name of the attribute.
Результат string The value of the attribute.

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

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').
public getAttributeValues ( string $name ) : array
$name string The name of the attribute.
Результат array Multiple values for an attribute.

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

Retrieve a specific component.
public getComponent ( integer $idx ) : mixed
$idx integer The index of the object to retrieve.
Результат 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
Результат array 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 ( ) : integer
Результат integer Number of components in this container.

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

Retrieve all the components.
public getComponents ( ) : array
Результат array Array of Horde_Icalendar objects.

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

TODO
public getType ( ) : TODO
Результат TODO

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

Return a reference to a new component.
public static newComponent ( string $type, Horde_Icalendar $container ) : object
$type string The type of component to return
$container Horde_Icalendar A container that this component will be associated with.
Результат object Reference to a Horde_Icalendar_* object as specified.

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

Parses a string containing vCalendar data.
public parsevCalendar ( string $text, string $base = 'VCALENDAR', boolean $clear = true ) : boolean
$text string The data to parse.
$base string The type of the base object.
$clear boolean If true clears this object before parsing.
Результат boolean True on successful import, false otherwise.

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

Remove all occurences of an attribute.
public removeAttribute ( string $name )
$name string The name of the attribute.

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

Sets the value of an attribute.
public setAttribute ( string $name, string $value, array $params = [], boolean $append = true, array $values = false )
$name string The name of the attribute.
$value string The value of the attribute.
$params array Array containing any addition parameters for this attribute.
$append boolean True to append the attribute, False to replace the first matching attribute found.
$values array Array representation of $value. For comma/semicolon seperated lists of values. If not set use $value as single array element.

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

Sets parameter(s) for an (already existing) attribute. The parameter set is merged into the existing set.
public setParameter ( string $name, array $params = [] ) : boolean
$name string The name of the attribute.
$params array Array containing any additional parameters for this attribute.
Результат boolean True on success, false if no attribute $name exists.

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

Sets the version of this component.
public setVersion ( string $version )
$version string A float-like version string.

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

Export this entry as a hash array with tag names as keys.
public toHash ( boolean $paramsInKeys = false ) : array
$paramsInKeys boolean 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'
Результат array A hash array with tag names as keys.

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

public toString ( )

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

$_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 $_attributes
Результат array

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

Any children (contained) iCalendar components of this object.
protected array $_components
Результат array

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

The parent (containing) iCalendar object.
protected Horde_Icalendar $_container
Результат Horde_Icalendar

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

According to RFC 2425, we should always use CRLF-terminated lines.
protected string $_newline
Результат string

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

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.
protected $_oldFormat

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

iCalendar format version (different behavior for 1.0 and 2.0 especially with recurring events).
protected string $_version
Результат string

$type публичное свойство

The component type of this class.
public string $type
Результат string