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. |
return | array | Multiple values for an attribute. |
/** * Parses the various exception related fields. Only deal with the EXDATE * field here. * * @param Horde_Icalendar $vEvent The vEvent part. */ protected function _handlevEventRecurrence($vEvent) { // Recurrence. try { $rrule = $vEvent->getAttribute('RRULE'); if (!is_array($rrule)) { $this->recurrence = new Horde_Date_Recurrence($this->start); if (strpos($rrule, '=') !== false) { $this->recurrence->fromRRule20($rrule); } else { $this->recurrence->fromRRule10($rrule); } // Exceptions. EXDATE represents deleted events, just add the // exception, no new event is needed. $exdates = $vEvent->getAttributeValues('EXDATE'); if (is_array($exdates)) { foreach ($exdates as $exdate) { if (is_array($exdate)) { $this->recurrence->addException((int) $exdate['year'], (int) $exdate['month'], (int) $exdate['mday']); } } } } } catch (Horde_Icalendar_Exception $e) { } }
/** * Handle parsing recurrence related fields. * * @param Horde_Icalendar $vEvent * @throws Kronolith_Exception */ protected function _handlevEventRecurrence($vEvent) { // Recurrence. try { $rrule = $vEvent->getAttribute('RRULE'); if (!is_array($rrule)) { $this->recurrence = new Horde_Date_Recurrence($this->start); if (strpos($rrule, '=') !== false) { $this->recurrence->fromRRule20($rrule); } else { $this->recurrence->fromRRule10($rrule); } /* Delete all existing exceptions to this event if it * already exists */ if (!empty($this->uid)) { $kronolith_driver = Kronolith::getDriver(null, $this->calendar); $search = new StdClass(); $search->start = $this->recurrence->getRecurStart(); $search->end = $this->recurrence->getRecurEnd(); $search->baseid = $this->uid; $results = $kronolith_driver->search($search); foreach ($results as $days) { foreach ($days as $exception) { $kronolith_driver->deleteEvent($exception->id); } } } // Exceptions. EXDATE represents deleted events, just add the // exception, no new event is needed. $exdates = $vEvent->getAttributeValues('EXDATE'); if (is_array($exdates)) { foreach ($exdates as $exdate) { if (is_array($exdate)) { $this->recurrence->addException((int) $exdate['year'], (int) $exdate['month'], (int) $exdate['mday']); } } } } } catch (Horde_Icalendar_Exception $e) { } // RECURRENCE-ID indicates that this event represents an exception try { $recurrenceid = $vEvent->getAttribute('RECURRENCE-ID'); $kronolith_driver = Kronolith::getDriver(null, $this->calendar); $originaldt = new Horde_Date($recurrenceid); $this->exceptionoriginaldate = $originaldt; $this->baseid = $this->uid; $this->uid = null; try { $originalEvent = $kronolith_driver->getByUID($this->baseid); $originalEvent->recurrence->addException($originaldt->format('Y'), $originaldt->format('m'), $originaldt->format('d')); $originalEvent->save(); } catch (Horde_Exception_NotFound $e) { throw new Kronolith_Exception(_("Unable to locate original event series.")); } } catch (Horde_Icalendar_Exception $e) { } }
/** * Handle parsing recurrence related fields. * * @param Horde_Icalendar $vEvent * @throws Kronolith_Exception */ protected function _handlevEventRecurrence($vEvent) { // Recurrence. try { $rrule = $vEvent->getAttribute('RRULE'); if (!is_array($rrule)) { $this->recurrence = new Horde_Date_Recurrence($this->start); if (strpos($rrule, '=') !== false) { $this->recurrence->fromRRule20($rrule); } else { $this->recurrence->fromRRule10($rrule); } // Exceptions. EXDATE represents deleted events, just add the // exception, no new event is needed. $exdates = $vEvent->getAttributeValues('EXDATE'); if (is_array($exdates)) { foreach ($exdates as $exdate) { if (is_array($exdate)) { $this->recurrence->addException((int) $exdate['year'], (int) $exdate['month'], (int) $exdate['mday']); } } } } } catch (Horde_Icalendar_Exception $e) { } // RECURRENCE-ID indicates that this event represents an exception try { $this->recurrenceid = $vEvent->getAttribute('RECURRENCE-ID'); $originaldt = new Horde_Date($this->recurrenceid); $this->exceptionoriginaldate = $originaldt; $this->baseid = $this->uid; $this->uid = null; try { $originalEvent = $this->getDriver()->getByUID($this->baseid); $originalEvent->recurrence->addException($originaldt->format('Y'), $originaldt->format('m'), $originaldt->format('d')); $originalEvent->save(); } catch (Horde_Exception_NotFound $e) { throw new Kronolith_Exception(_("Unable to locate original event series.")); } } catch (Horde_Icalendar_Exception $e) { } }