Source code for file /bitfolge/vcard.php
Documentation is available at vcard.php
* @version $Id: vcard.php 2906 2006-03-25 15:41:01Z Jinx $
* Modified PHP vCard class v2.0
/*************************************************************************
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
***************************************************************************/
// taken from PHP documentation comments
$hex =
array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
for ($j=
0;$j<
count($lines);$j++
) {
for($i =
0; $i <
$linlen; $i++
) {
if ( ($dec ==
32) &&
($i ==
($linlen -
1)) ) { // convert space at eol only
} elseif ( ($dec ==
61) ||
($dec <
32 ) ||
($dec >
126) ) { // always encode "\t", which is *not* required
$c =
$escape.
$hex["$h2"] .
$hex["$h1"];
if ( (strlen($newline) +
strlen($c)) >=
$line_max ) { // CRLF is not counted
$output .=
$newline.
$escape.
$eol; // soft line break; " =\r\n" is okay
if ($j<
count($lines)-
1) {
// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
$key.=
';ENCODING=QUOTED-PRINTABLE';
function setPhoto($type, $photo) { // $type = "GIF" | "JPEG"
function setName($family=
'', $first=
'', $additional=
'', $prefix=
'', $suffix=
'') {
$this->properties['N'] =
"$family;$first;$additional;$prefix;$suffix";
$this->filename =
"$first%20$family.vcf";
function setBirthday($date) { // $date format is YYYY-MM-DD
function setAddress($postoffice=
'', $extended=
'', $street=
'', $city=
'', $region=
'', $zip=
'', $country=
'', $type=
'HOME;POSTAL') {
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
$key.=
';ENCODING=QUOTED-PRINTABLE';
if ($this->properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] ==
'') {
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
function setLabel($postoffice=
'', $extended=
'', $street=
'', $city=
'', $region=
'', $zip=
'', $country=
'', $type=
'HOME;POSTAL') {
function setURL($url, $type=
'') {
// $type may be WORK | HOME
$text.=
"$key:$value\r\n";
$text.=
'REV:'.
date('Y-m-d') .
'T'.
date('H:i:s') .
'Z';
$text.=
'MAILER:PHP vCard class by Kai Blankenhorn';