diff --git a/blocks/SG_iCal_VEvent.php b/blocks/SG_iCal_VEvent.php index e5ec782..434655d 100755 --- a/blocks/SG_iCal_VEvent.php +++ b/blocks/SG_iCal_VEvent.php @@ -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 diff --git a/helpers/SG_iCal_Line.php b/helpers/SG_iCal_Line.php index 32c6a92..f386cd7 100755 --- a/helpers/SG_iCal_Line.php +++ b/helpers/SG_iCal_Line.php @@ -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"..