Beispiel #1
0
 public static function decode(Vpdi_Property $FREEBUSY) {
   $fbs = array();
   $periods = Vpdi::decodeTextList($FREEBUSY->value());
   foreach ($periods as $p) {
     list($start, $end) = Vpdi::decodePeriod($p);
     $fbs[] = new Vpdi_Icalendar_Freebusy($start, $end);
   }
   if (count($fbs) == 1) return $fbs[0];
   return $fbs;
 }
Beispiel #2
0
 public static function decode(Vpdi_Property $N, Vpdi_Property $FN = null) {
   $N = Vpdi::decodeTextList($N->rawValue(), ';');
   
   $name = new Vpdi_Vcard_Name;
 
   $name->family     = (isset($N[0])) ? $N[0] : '';
   $name->given      = (isset($N[1])) ? $N[1] : '';
   $name->additional = (isset($N[2])) ? $N[2] : '';
   $name->prefixes   = (isset($N[3])) ? $N[3] : '';
   $name->suffixes   = (isset($N[4])) ? $N[4] : '';
   
   if ($FN !== null) {
     $name->fullname = $FN->rawValue();
   }
   return $name;
 }
Beispiel #3
0
 public static function decode(Vpdi_Property $IMPP) {
   $im = new Vpdi_Vcard_Impp($IMPP->value());
   $im->addTypes($IMPP->getParam('TYPE'));
   return $im;
 }
Beispiel #4
0
 public function decodeParameters(Vpdi_Property $prop) {
   foreach ($this->paramMapping as $k => $v) {
     list($name, $type) = $v;
     if (($param = $prop->getParam($name)) !== false) {
       $decodeMethod = 'decode'.$type;
       if (method_exists('Vpdi', $decodeMethod)) {
         $param = Vpdi::$decodeMethod($param);
       }
       $this->{$k} = $param;
     }
   }
 }
Beispiel #5
0
 /**
  * Returns the value for a property
  * 
  * @param Vpdi_Property $property
  * @access private
  * @return mixed
  */
 protected function decodeProperty($property) {
   return Vpdi::decodeText($property->value());
 }
Beispiel #6
0
 public static function decode(Vpdi_Property $ADR) {
   $parts = Vpdi::decodeTextList($ADR->value(), ';');
   $add = new Vpdi_Vcard_Address;
   foreach (self::$addr_parts as $i => $part) {
     $add->{$part} = (isset($parts[$i])) ? $parts[$i] : '';
   }
   $add->addTypes($ADR->getParam('TYPE'));
   return $add;
 }
Beispiel #7
0
 public static function decode(Vpdi_Property $EMAIL) {
   $em = new Vpdi_Vcard_Email($EMAIL->value());
   $em->addTypes($EMAIL->getParam('TYPE'));
   return $em;
 }
Beispiel #8
0
 public static function decode(Vpdi_Property $ATTENDEE) {
   $org = new Vpdi_Icalendar_Attendee($ATTENDEE->value());
   $org->decodeParameters($ATTENDEE);
   return $org;
 }
Beispiel #9
0
 /**
  * Decodes a string into an array of Vpdi_Property objects
  * 
  * @param string $string
  * @access public
  * @return array
  */
 public static function decodeProperties($string) {
   $string = self::convertLineEndings($string);
   $string = self::unfoldLines($string);
   
   $properties = array();
   $lines = explode("\n", $string);
   foreach ($lines as $line) {
     if (empty($line)) {
       continue;
     }
     $properties[] = Vpdi_Property::decode($line);
   }
   return $properties;
 }