EGOCMS  24.0
EGOTEC Content-Managament-System
VCard.php
gehe zur Dokumentation dieser Datei
1 <?php
2 
7 class VCard
8 {
9  private $content;
10  private $version;
11  private $fields = array(
12  'n_d_P' => 'N',
13  'full_name' => 'FN',
14  'funktion' => 'TITLE',
15  'qualification' => 'CATEGORIES',
16  'phone' => 'TEL;type=WORK;type=VOICE',
17  'other' => 'TEL;type=OTHER;type=VOICE',
18  'fax' => 'TEL;type=WORK;type=FAX',
19  'pieper' => 'TEL;type=OTHER;type=VOICE',
20  'mobile' => 'TEL;type=CELL;type=VOICE',
21  'website' => 'item1.URL;type=pref',
22  'note' => 'NOTE',
23  'mail' => 'EMAIL;type=INTERNET;type=WORK;type=pref',
24  'mail2' => 'item2.EMAIL;type=INTERNET',
25  'org' => 'ORG',
26  'adresse' => 'item3.ADR;type=WORK',
27  'id' => 'UID:urn:uuid'
28  );
29 
30  public function __construct($v='3.0')
31  {
32  $this->content = '';
33  $this->version = $v;
34  }
35 
36  private function addEntry($name, $value)
37  {
38  $this->content .= mb_strtoupper($name) . ':' . (is_string($value) ? trim($value) : '') . "\r\n";
39  }
40 
41  public function addContact($data = array())
42  {
43  $this->addEntry('BEGIN', 'VCARD');
44  $this->addEntry('VERSION', $this->version);
45 
46  foreach ($this->fields as $key => $value) {
47  if (isset($data[$key])) {
48  $this->addEntry($value, $data[$key]);
49  }
50  }
51 
52  $this->addEntry('END','VCARD');
53  }
54 
55  public function getContacts() {
56  return $this->content;
57  }
58 }
Definition: VCard.php:8
getContacts()
Definition: VCard.php:55
addContact($data=array())
Definition: VCard.php:41
__construct($v='3.0')
Definition: VCard.php:30