PHP Class ICal\ICal

Afficher le fichier Open project: johngrogg/ics-parser Class Usage Examples

Méthodes publiques

Свойство Type Description
$cal array The parsed calendar
$defaultSpan integer The value in years to use for indefinite, recurring events
$defaultWeekStart
$eventCount integer How many events are in this iCal?
$freebusyCount integer How many freebusy are in this iCal?
$todoCount integer How many ToDos are in this iCal?

Protected Properties

Свойство Type Description
$alteredRecurrenceInstances array Event recurrence instances that have been altered
$dayOrdinals
$frequencyConversion
$monthNames
$weekdays

Méthodes publiques

Méthode Description
__construct ( mixed $filename = false, mixed $weekStart = false ) : void Creates the iCal Object
calendarDescription ( ) : calendar Returns the calendar description
calendarName ( ) : string Returns the calendar name
calendarTimeZone ( ) : calendar Returns the calendar timezone
events ( ) : array Returns an array of EventObjects. Every event is a class with the event details being properties within it.
eventsFromInterval ( string $interval ) : array Returns a sorted array of the events following a given string, or false if no events exist in the range.
eventsFromRange ( string $rangeStart = false, string $rangeEnd = false ) : array Returns a sorted array of the events in a given range, or false if no events exist in the range.
freeBusyEvents ( ) : array Returns an array of arrays with all free/busy events. Every event is an associative array and each property is an element it.
hasEvents ( ) : boolean Returns a boolean value whether the current calendar has events or not
iCalDateToUnixTimestamp ( string $icalDate ) : integer Return Unix timestamp from iCal date time format
iCalDateWithTimeZone ( array $event, string $key ) : string Return a date adapted to the calendar timezone depending on the event TZID
initLines ( array $lines ) : ICal Initialises lines from file
initString ( string $contents ) : ICal Initialises lines from a string
initURL ( string $url ) : ICal Initialises lines from a URL
isValidTimeZoneId ( string $timezone ) : boolean Check if a timezone is valid
processDateConversions ( ) : void Processes date conversions using the timezone
processEvents ( ) : void Performs some admin tasks on all events as taken straight from the ics file.
processRecurrences ( ) : void Processes recurrence rules
sortEventsWithOrder ( array $events, integer $sortOrder = SORT_ASC ) : sorted Sort events based on a given sort order

Méthodes protégées

Méthode Description
addCalendarComponentWithKeyAndValue ( string $component, string | boolean $keyword, string $value ) : void Add to $this->ical array one value and key.
keyValueFromString ( string $text ) : array Get a key-value pair of a string.

Method Details

__construct() public méthode

Creates the iCal Object
public __construct ( mixed $filename = false, mixed $weekStart = false ) : void
$filename mixed The path to the iCal-file or an array of lines from an iCal file
$weekStart mixed The default first day of the week (SU or MO, etc.)
Résultat void or false if no filename is provided

addCalendarComponentWithKeyAndValue() protected méthode

Add to $this->ical array one value and key.
protected addCalendarComponentWithKeyAndValue ( string $component, string | boolean $keyword, string $value ) : void
$component string This could be VTODO, VEVENT, VCALENDAR, ...
$keyword string | boolean The keyword, for example DTSTART
$value string The value, for example 20110105T090000Z
Résultat void

calendarDescription() public méthode

Returns the calendar description
public calendarDescription ( ) : calendar
Résultat calendar description

calendarName() public méthode

Returns the calendar name
public calendarName ( ) : string
Résultat string

calendarTimeZone() public méthode

Returns the calendar timezone
public calendarTimeZone ( ) : calendar
Résultat calendar timezone

events() public méthode

Returns an array of EventObjects. Every event is a class with the event details being properties within it.
public events ( ) : array
Résultat array of EventObjects

eventsFromInterval() public méthode

Returns a sorted array of the events following a given string, or false if no events exist in the range.
public eventsFromInterval ( string $interval ) : array
$interval string
Résultat array of EventObjects

eventsFromRange() public méthode

Events will be returned if the start or end date is contained within the range (inclusive), or if the event starts before and end after the range. If a start date is not specified or of a valid format, then the start of the range will default to the current time and date of the server. If an end date is not specified or of a valid format, the the end of the range will default to the current time and date of the server, plus 20 years. Note that this function makes use of UNIX timestamps. This might be a problem for events on, during, or after January the 29th, 2038. See http://en.wikipedia.org/wiki/Unix_time#Representing_the_number
public eventsFromRange ( string $rangeStart = false, string $rangeEnd = false ) : array
$rangeStart string Start date of the search range.
$rangeEnd string End date of the search range.
Résultat array of EventObjects

freeBusyEvents() public méthode

Returns an array of arrays with all free/busy events. Every event is an associative array and each property is an element it.
public freeBusyEvents ( ) : array
Résultat array

hasEvents() public méthode

Returns a boolean value whether the current calendar has events or not
public hasEvents ( ) : boolean
Résultat boolean

iCalDateToUnixTimestamp() public méthode

Return Unix timestamp from iCal date time format
public iCalDateToUnixTimestamp ( string $icalDate ) : integer
$icalDate string A Date in the format YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS or TZID=Timezone:YYYYMMDD[T]HHMMSS
Résultat integer

iCalDateWithTimeZone() public méthode

Return a date adapted to the calendar timezone depending on the event TZID
public iCalDateWithTimeZone ( array $event, string $key ) : string
$event array an event
$key string an event parameter (DTSTART or DTEND)
Résultat string Ymd\THis date

initLines() public méthode

Initialises lines from file
public initLines ( array $lines ) : ICal
$lines array The lines to initialise
Résultat ICal

initString() public méthode

Initialises lines from a string
public initString ( string $contents ) : ICal
$contents string The contents of the ical file to initialise
Résultat ICal

initURL() public méthode

Initialises lines from a URL
public initURL ( string $url ) : ICal
$url string The url of the ical file to download and initialise
Résultat ICal

isValidTimeZoneId() public méthode

Check if a timezone is valid
public isValidTimeZoneId ( string $timezone ) : boolean
$timezone string A timezone
Résultat boolean

keyValueFromString() protected méthode

Get a key-value pair of a string.
protected keyValueFromString ( string $text ) : array
$text string which is like "VCALENDAR:Begin" or "LOCATION:"
Résultat array

processDateConversions() public méthode

Add fields DTSTART_tz and DTEND_tz to each event These fields contain dates adapted to the calendar timezone depending on the event TZID
public processDateConversions ( ) : void
Résultat void or false if no Events exist

processEvents() public méthode

Adds a unix timestamp to all DT{START|END|RECURRENCE-ID}_array arrays Makes a note of modified recurrence-instances
public processEvents ( ) : void
Résultat void or false if no Events exist

processRecurrences() public méthode

Processes recurrence rules
public processRecurrences ( ) : void
Résultat void or false if no Events exist

sortEventsWithOrder() public méthode

Sort events based on a given sort order
public sortEventsWithOrder ( array $events, integer $sortOrder = SORT_ASC ) : sorted
$events array An array of EventObjects
$sortOrder integer Either SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
Résultat sorted array of EventObjects

Property Details

$alteredRecurrenceInstances protected_oe property

Event recurrence instances that have been altered
protected array $alteredRecurrenceInstances
Résultat array

$cal public_oe property

The parsed calendar
public array $cal
Résultat array

$dayOrdinals protected_oe property

protected $dayOrdinals

$defaultSpan public_oe property

The value in years to use for indefinite, recurring events
public int $defaultSpan
Résultat integer

$defaultWeekStart public_oe property

public $defaultWeekStart

$eventCount public_oe property

How many events are in this iCal?
public int $eventCount
Résultat integer

$freebusyCount public_oe property

How many freebusy are in this iCal?
public int $freebusyCount
Résultat integer

$frequencyConversion protected_oe property

protected $frequencyConversion

$monthNames protected_oe property

protected $monthNames

$todoCount public_oe property

How many ToDos are in this iCal?
public int $todoCount
Résultat integer

$weekdays protected_oe property

protected $weekdays