48 $hex = array(
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
'D',
'E',
'F');
49 $lines = preg_split(
"/(\?:\r\n|\r|\n)/", $input);
51 $linebreak =
"=0D=0A";
56 for ($j = 0; $j < $num; $j++)
59 $linlen = strlen($line);
61 for ($i = 0; $i < $linlen; $i++) {
62 $c = substr($line, $i, 1);
64 if (($dec == 32) && ($i == ($linlen - 1))) {
66 } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) {
67 $h2 = floor($dec / 16); $h1 = floor($dec % 16);
68 $c = $escape.$hex[
"$h2"].$hex[
"$h1"];
70 if ((strlen($newline) + strlen($c)) >= $line_max) {
71 $output .= $newline.$escape.$eol;
77 if ($j < count($lines) - 1) $output .= $linebreak;
101 public $encoding =
"ISO-8859-1;ENCODING=QUOTED-PRINTABLE";
115 if ($type !=
"") $key .=
";".$type;
116 $key .=
";CHARSET=".$this->encoding;
117 $this->properties[$key] =
encode($number);
131 $this->properties[
"PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
142 $this->properties[
"FN;CHARSET=".$this->encoding] =
encode($name);
155 public function setName($family =
"", $first =
"", $additional =
"", $prefix =
"", $suffix =
"")
157 $this->properties[
"N;CHARSET=".$this->encoding] =
encode($family).
";".
encode($first).
";".
encode($additional).
";".
encode($prefix).
";".
encode($suffix);
158 $this->filename =
"$first%20$family.vcf";
159 if (empty($this->properties[
"FN"])) $this->
setFormattedName(trim(
"$prefix $first $additional $family $suffix"));
187 public function setAddress($postoffice =
"", $extended =
"", $street =
"", $city =
"", $region =
"", $zip =
"", $country =
"", $type =
"HOME;POSTAL")
191 if ($type !=
"") $key .=
";$type";
192 $key .=
";CHARSET=".$this->encoding;
195 if ($this->properties[
"LABEL;$type;CHARSET=".$this->encoding] ==
"")
214 public function setLabel($postoffice =
"", $extended =
"", $street =
"", $city =
"", $region =
"", $zip =
"", $country =
"", $type =
"HOME;POSTAL")
217 if ($postoffice !=
"") $label .=
"$postoffice\r\n";
218 if ($extended !=
"") $label .=
"$extended\r\n";
219 if ($street !=
"") $label .=
"$street\r\n";
220 if ($zip !=
"") $label .=
"$zip ";
221 if ($city !=
"") $label .=
"$city\r\n";
222 if ($region !=
"") $label .=
"$region\r\n";
223 if ($country !=
"") $country .=
"$country\r\n";
225 $this->properties[
"LABEL;$type;CHARSET=".$this->encoding] =
encode($label);
235 public function setEmail($address, $type =
"TYPE=INTERNET;PREF")
238 if ($type !=
"") $key .=
";".$type;
239 $this->properties[$key] = $address;
250 $this->properties[
"NOTE;CHARSET=".$this->encoding] =
encode($note);
261 $this->properties[
"TITLE;CHARSET=".$this->encoding] =
encode($title);
273 $this->properties[
"ORG;CHARSET=".$this->encoding] =
encode($org);
285 $this->properties[
"PRODID;CHARSET=".$this->encoding] =
encode($prodid);
297 $this->properties[
"UID;CHARSET=".$this->encoding] =
encode($uid);
312 if ($type !=
"") $key .=
";$type";
313 $this->properties[$key] = $url;
323 $text =
"BEGIN:VCARD\r\n";
324 $text .=
"VERSION:3.0\r\n";
326 foreach ($this->properties as $key => $value)
328 $text .=
"$key:$value\r\n";
330 $text .=
"REV:".date(
"Y-m-d").
"T".date(
"H:i:s").
"Z\r\n";
331 $text .=
"MAILER: Dolibarr\r\n";
332 $text .=
"END:VCARD\r\n";
343 return $this->filename;
setBirthday($date)
mise en forme de l'anniversaire
dol_quoted_printable_encode($input, $line_max=76)
Taken from php documentation comments No more used.
setEmail($address, $type="TYPE=INTERNET;PREF")
Add a e-mail address to this vCard.
setName($family="", $first="", $additional="", $prefix="", $suffix="")
mise en forme du nom complet
setOrg($org)
mise en forme de la societe
encode($string)
Encode a string for vCard.
setPhoto($type, $photo)
mise en forme de la photo warning NON TESTE !
Class to buld vCard files.
setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL")
mise en forme du label
getVCard()
permet d'obtenir une vcard
setPhoneNumber($number, $type="")
mise en forme du numero de telephone
setURL($url, $type="")
mise en forme de l'url
setProdId($prodid)
mise en forme du logiciel generateur
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getFileName()
permet d'obtenir le nom de fichier
setTitle($title)
mise en forme de la fonction
setUID($uid)
mise en forme du logiciel generateur
setAddress($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL")
mise en forme de l'adresse
setFormattedName($name)
mise en forme du nom formate
setNote($note)
mise en forme de la note