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++) {
58 $linlen = strlen($line);
60 for ($i = 0; $i < $linlen; $i++) {
61 $c = substr($line, $i, 1);
63 if (($dec == 32) && ($i == ($linlen - 1))) {
65 } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) {
66 $h2 = floor($dec / 16);
67 $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) {
78 $output .= $linebreak;
103 public $encoding =
"ISO-8859-1;ENCODING=QUOTED-PRINTABLE";
120 $key .=
";CHARSET=".$this->encoding;
121 $this->properties[$key] =
encode($number);
135 $this->properties[
"PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
146 $this->properties[
"FN;CHARSET=".$this->encoding] =
encode($name);
159 public function setName($family =
"", $first =
"", $additional =
"", $prefix =
"", $suffix =
"")
161 $this->properties[
"N;CHARSET=".$this->encoding] =
encode($family).
";".
encode($first).
";".
encode($additional).
";".
encode($prefix).
";".
encode($suffix);
162 $this->filename =
"$first%20$family.vcf";
163 if (empty($this->properties[
"FN"])) {
164 $this->
setFormattedName(trim(
"$prefix $first $additional $family $suffix"));
193 public function setAddress($postoffice =
"", $extended =
"", $street =
"", $city =
"", $region =
"", $zip =
"", $country =
"", $type =
"HOME;POSTAL")
200 $key .=
";CHARSET=".$this->encoding;
221 public function setLabel($postoffice =
"", $extended =
"", $street =
"", $city =
"", $region =
"", $zip =
"", $country =
"", $type =
"HOME;POSTAL")
224 if ($postoffice !=
"") {
225 $label .=
"$postoffice\r\n";
227 if ($extended !=
"") {
228 $label .=
"$extended\r\n";
231 $label .=
"$street\r\n";
237 $label .=
"$city\r\n";
240 $label .=
"$region\r\n";
242 if ($country !=
"") {
243 $country .=
"$country\r\n";
246 $this->properties[
"LABEL;$type;CHARSET=".$this->encoding] =
encode($label);
256 public function setEmail($address, $type =
"TYPE=INTERNET;PREF")
262 $this->properties[$key] = $address;
273 $this->properties[
"NOTE;CHARSET=".$this->encoding] =
encode($note);
284 $this->properties[
"TITLE;CHARSET=".$this->encoding] =
encode($title);
296 $this->properties[
"ORG;CHARSET=".$this->encoding] =
encode($org);
308 $this->properties[
"PRODID;CHARSET=".$this->encoding] =
encode($prodid);
320 $this->properties[
"UID;CHARSET=".$this->encoding] =
encode($uid);
338 $this->properties[$key] = $url;
348 $text =
"BEGIN:VCARD\r\n";
349 $text .=
"VERSION:3.0\r\n";
351 foreach ($this->properties as $key => $value) {
352 $text .=
"$key:$value\r\n";
354 $text .=
"REV:".date(
"Y-m-d").
"T".date(
"H:i:s").
"Z\r\n";
355 $text .=
"MAILER: Dolibarr\r\n";
356 $text .=
"END:VCARD\r\n";
367 return $this->filename;
Class to buld vCard files.
setEmail($address, $type="TYPE=INTERNET;PREF")
Add a e-mail address to this vCard.
setTitle($title)
mise en forme de la fonction
setPhoneNumber($number, $type="")
mise en forme du numero de telephone
setPhoto($type, $photo)
mise en forme de la photo warning NON TESTE !
setBirthday($date)
mise en forme de l'anniversaire
setUID($uid)
mise en forme du logiciel generateur
getFileName()
permet d'obtenir le nom de fichier
setOrg($org)
mise en forme de la societe
setProdId($prodid)
mise en forme du logiciel generateur
setFormattedName($name)
mise en forme du nom formate
setName($family="", $first="", $additional="", $prefix="", $suffix="")
mise en forme du nom complet
getVCard()
permet d'obtenir une vcard
setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL")
mise en forme du label
setNote($note)
mise en forme de la note
setAddress($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL")
mise en forme de l'adresse
setURL($url, $type="")
mise en forme de l'url
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
encode($string)
Encode a string for vCard.
dol_quoted_printable_encode($input, $line_max=76)
Taken from php documentation comments No more used.