Horde_Icalendar::getAttributeValues PHP Метод

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.
    public function getAttributeValues($name)
    {
        $result = array();
        foreach ($this->_attributes as $attribute) {
            if ($attribute['name'] == $name) {
                $result = array_merge($attribute['values'], $result);
            }
        }
        if (!count($result)) {
            throw new Horde_Icalendar_Exception('Attribute "' . $name . '" Not Found');
        }
        return $result;
    }

Usage Example

Пример #1
0
 /**
  * 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) {
     }
 }
All Usage Examples Of Horde_Icalendar::getAttributeValues