コード例 #1
0
ファイル: vcard.php プロジェクト: netcon-source/apps
 /**
  * @brief Format property TYPE parameters for upgrading from v. 2.1
  * @param $property Reference to a Sabre_VObject_Property.
  * In version 2.1 e.g. a phone can be formatted like: TEL;HOME;CELL:123456789
  * This has to be changed to either TEL;TYPE=HOME,CELL:123456789 or TEL;TYPE=HOME;TYPE=CELL:123456789 - both are valid.
  */
 public static function formatPropertyTypes(&$property)
 {
     foreach ($property->parameters as $key => &$parameter) {
         $types = App::getTypesOfProperty($property->name);
         if (is_array($types) && in_array(strtoupper($parameter->name), array_keys($types)) || strtoupper($parameter->name) == 'PREF') {
             $property->parameters[] = new \Sabre\VObject\Parameter('TYPE', $parameter->name);
         }
         unset($property->parameters[$key]);
     }
 }