add support for EXDATE arrays : EXDATE;VALUE=DATE:20100909,20100910

master
Tanguy Pruvot 2010-10-31 17:19:19 +01:00
rodzic b04943334a
commit 8079db3ac3
2 zmienionych plików z 24 dodań i 8 usunięć

Wyświetl plik

@ -45,14 +45,6 @@ class SG_iCal_VEvent {
if ( isset($data['rrule']) ) {
$this->recurrence = new SG_iCal_Recurrence($data['rrule']);
unset($data['rrule']);
//exclusions
if ( isset($data['exdate']) ) {
foreach ($data['exdate'] as $exdate) {
$this->excluded[] = $this->getTimestamp($exdate, $ical);
}
unset($data['exdate']);
}
}
if( isset($data['dtstart']) ) {
@ -72,6 +64,18 @@ class SG_iCal_VEvent {
//google cal set dtend as end of initial event (duration)
if ( isset($this->recurrence) ) {
//if there is a recurrence rule
//exclusions
if ( isset($data['exdate']) ) {
foreach ($data['exdate'] as $exdate) {
//$this->excluded[] = $this->getTimestamp($exdate, $ical);
foreach ($exdate->getDataAsArray() as $ts) {
$this->excluded[] = strtotime($ts);
}
}
unset($data['exdate']);
}
$until = $this->recurrence->getUntil();
$count = $this->recurrence->getCount();
//check if there is either 'until' or 'count' set

Wyświetl plik

@ -75,6 +75,18 @@ class SG_iCal_Line implements ArrayAccess, Countable, IteratorAggregate {
return $this->data;
}
/**
* Returns the content of the line
* @return string
*/
public function getDataAsArray() {
if (strpos($this->data,",") !== false) {
return explode(",",$this->data);
}
else
return array($this->data);
}
/**
* A static helper to get a array of SG_iCal_Line's, and calls
* getData() on each of them to lay the data "bare"..