Beispiel #1
0
     $tmp = join(" ", $tmp);
     if ($tmp) {
         $ret[] = $tmp;
     }
     $key = join(", ", $ret);
     $cards[$key] = $card;
     // MDH: Create new VCard to prevent overwriting previous one (PHP5)
     $card = new VCard();
 }
 ksort($cards);
 // extract the emails
 $contacts = array();
 $i = 0;
 foreach ($cards as $card_name => $card) {
     $emails = array();
     $properties = $card->getProperties('EMAIL');
     if ($properties) {
         $count = 0;
         foreach ($properties as $property) {
             $emails[$count] = array($property->value);
             $count++;
         }
     }
     if (count($emails) > 0) {
         $contacts[$i] = array('name' => $card_name, 'emails' => array('email' => $emails));
         $i++;
     }
 }
 unlink($vcard_file);
 $response = array('contacts' => array('contact' => sanitize($contacts)));
 $xml = $xml_dom->get_xml_from_array($response);