Fix: Removed warnings
This commit is contained in:
parent
e82923b525
commit
c4650c6e01
@ -30,7 +30,8 @@
|
|||||||
/**
|
/**
|
||||||
* Encode a string for vCard
|
* Encode a string for vCard
|
||||||
*
|
*
|
||||||
* @param string String to encode
|
* @param string $string String to encode
|
||||||
|
* @return string String encoded
|
||||||
*/
|
*/
|
||||||
function encode($string)
|
function encode($string)
|
||||||
{
|
{
|
||||||
@ -42,10 +43,11 @@ function encode($string)
|
|||||||
* Taken from php documentation comments
|
* Taken from php documentation comments
|
||||||
* No more used
|
* No more used
|
||||||
*
|
*
|
||||||
* @param input String
|
* @param string $input String
|
||||||
* @param line_max Max length of lines
|
* @param int $line_max Max length of lines
|
||||||
|
* @return string Encoded string
|
||||||
*/
|
*/
|
||||||
function dol_quoted_printable_encode($input, $line_max = 76)
|
function dol_quoted_printable_encode($input, $line_max=76)
|
||||||
{
|
{
|
||||||
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
|
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
|
||||||
$lines = preg_split("/(\?:\r\n|\r|\n)/", $input);
|
$lines = preg_split("/(\?:\r\n|\r|\n)/", $input);
|
||||||
@ -98,10 +100,12 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme du numero de telephone
|
* mise en forme du numero de telephone
|
||||||
*
|
*
|
||||||
* @param number numero de telephone
|
* @param int $number numero de telephone
|
||||||
* @param type
|
* @param string $type Type
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setPhoneNumber($number, $type="") {
|
function setPhoneNumber($number, $type="")
|
||||||
|
{
|
||||||
// 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"
|
// 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 = "TEL";
|
$key = "TEL";
|
||||||
if ($type!="") $key .= ";".$type;
|
if ($type!="") $key .= ";".$type;
|
||||||
@ -113,32 +117,38 @@ class vCard
|
|||||||
* mise en forme de la photo
|
* mise en forme de la photo
|
||||||
* warning NON TESTE !
|
* warning NON TESTE !
|
||||||
*
|
*
|
||||||
* @param type
|
* @param string $type Type
|
||||||
* @param photo
|
* @param string $photo Photo
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setPhoto($type, $photo) { // $type = "GIF" | "JPEG"
|
function setPhoto($type, $photo)
|
||||||
|
{ // $type = "GIF" | "JPEG"
|
||||||
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
|
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mise en forme du nom formate
|
* mise en forme du nom formate
|
||||||
*
|
*
|
||||||
* @param name
|
* @param string $name Name
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setFormattedName($name) {
|
function setFormattedName($name)
|
||||||
|
{
|
||||||
$this->properties["FN;CHARSET=".$this->encoding] = encode($name);
|
$this->properties["FN;CHARSET=".$this->encoding] = encode($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mise en forme du nom complet
|
* mise en forme du nom complet
|
||||||
*
|
*
|
||||||
* @param family
|
* @param string $family Family
|
||||||
* @param first
|
* @param string $first First
|
||||||
* @param additional
|
* @param string $additional Additionnal
|
||||||
* @param prefix
|
* @param string $prefix Prefix
|
||||||
* @param suffix
|
* @param string $suffix Suffix
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setName($family="", $first="", $additional="", $prefix="", $suffix="") {
|
function setName($family="", $first="", $additional="", $prefix="", $suffix="")
|
||||||
|
{
|
||||||
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
|
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
|
||||||
$this->filename = "$first%20$family.vcf";
|
$this->filename = "$first%20$family.vcf";
|
||||||
if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
|
if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
|
||||||
@ -147,32 +157,37 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme de l'anniversaire
|
* mise en forme de l'anniversaire
|
||||||
*
|
*
|
||||||
* @param date
|
* @param timestamp $date Date
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setBirthday($date) { // $date format is YYYY-MM-DD
|
function setBirthday($date)
|
||||||
|
{ // $date format is YYYY-MM-DD
|
||||||
$this->properties["BDAY"] = $date;
|
$this->properties["BDAY"] = $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mise en forme de l'adresse
|
* mise en forme de l'adresse
|
||||||
*
|
*
|
||||||
* @param postoffice
|
* @param string $postoffice Postoffice
|
||||||
* @param extended
|
* @param string $extended Extended
|
||||||
* @param street
|
* @param string $street Street
|
||||||
* @param city
|
* @param string $city City
|
||||||
* @param region
|
* @param string $region Region
|
||||||
* @param zip
|
* @param string $zip Zip
|
||||||
* @param country
|
* @param string $country Country
|
||||||
* @param type
|
* @param string $type Type
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setAddress($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
|
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"
|
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
|
||||||
$key = "ADR";
|
$key = "ADR";
|
||||||
if ($type!="") $key.= ";$type";
|
if ($type!="") $key.= ";$type";
|
||||||
$key.= ";CHARSET=".$this->encoding;
|
$key.= ";CHARSET=".$this->encoding;
|
||||||
$this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
|
$this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
|
||||||
|
|
||||||
if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "") {
|
if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "")
|
||||||
|
{
|
||||||
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
|
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,14 +195,15 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme du label
|
* mise en forme du label
|
||||||
*
|
*
|
||||||
* @param postoffice
|
* @param string $postoffice Postoffice
|
||||||
* @param extended
|
* @param string $extended Extended
|
||||||
* @param street
|
* @param string $street Street
|
||||||
* @param city
|
* @param string $city City
|
||||||
* @param region
|
* @param string $region Region
|
||||||
* @param zip
|
* @param string $zip Zip
|
||||||
* @param country
|
* @param string $country Country
|
||||||
* @param type
|
* @param string $type Type
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
|
function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
|
||||||
$label = "";
|
$label = "";
|
||||||
@ -205,28 +221,34 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme de l'email
|
* mise en forme de l'email
|
||||||
*
|
*
|
||||||
* @param address EMail
|
* @param string $address EMail
|
||||||
* @param type Vcard type
|
* @param string $type Vcard type
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setEmail($address,$type="internet,pref") {
|
function setEmail($address,$type="internet,pref")
|
||||||
|
{
|
||||||
$this->properties["EMAIL;TYPE=".$type] = $address;
|
$this->properties["EMAIL;TYPE=".$type] = $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mise en forme de la note
|
* mise en forme de la note
|
||||||
*
|
*
|
||||||
* @param note
|
* @param string $note Note
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setNote($note) {
|
function setNote($note)
|
||||||
|
{
|
||||||
$this->properties["NOTE;CHARSET=".$this->encoding] = encode($note);
|
$this->properties["NOTE;CHARSET=".$this->encoding] = encode($note);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mise en forme de la fonction
|
* mise en forme de la fonction
|
||||||
*
|
*
|
||||||
* @param title
|
* @param string $title Title
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setTitle($title) {
|
function setTitle($title)
|
||||||
|
{
|
||||||
$this->properties["TITLE;CHARSET=".$this->encoding] = encode($title);
|
$this->properties["TITLE;CHARSET=".$this->encoding] = encode($title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,9 +256,11 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme de la societe
|
* mise en forme de la societe
|
||||||
*
|
*
|
||||||
* @param org
|
* @param string $org Org
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setOrg($org) {
|
function setOrg($org)
|
||||||
|
{
|
||||||
$this->properties["ORG;CHARSET=".$this->encoding] = encode($org);
|
$this->properties["ORG;CHARSET=".$this->encoding] = encode($org);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,9 +268,11 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme du logiciel generateur
|
* mise en forme du logiciel generateur
|
||||||
*
|
*
|
||||||
* @param prodid
|
* @param string $prodid Prodid
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setProdId($prodid) {
|
function setProdId($prodid)
|
||||||
|
{
|
||||||
$this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid);
|
$this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,9 +280,11 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme du logiciel generateur
|
* mise en forme du logiciel generateur
|
||||||
*
|
*
|
||||||
* @param uid
|
* @param string $uid Uid
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setUID($uid) {
|
function setUID($uid)
|
||||||
|
{
|
||||||
$this->properties["UID;CHARSET=".$this->encoding] = encode($uid);
|
$this->properties["UID;CHARSET=".$this->encoding] = encode($uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,10 +292,12 @@ class vCard
|
|||||||
/**
|
/**
|
||||||
* mise en forme de l'url
|
* mise en forme de l'url
|
||||||
*
|
*
|
||||||
* @param url
|
* @param string $url URL
|
||||||
* @param type
|
* @param string $type Type
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setURL($url, $type="") {
|
function setURL($url, $type="")
|
||||||
|
{
|
||||||
// $type may be WORK | HOME
|
// $type may be WORK | HOME
|
||||||
$key = "URL";
|
$key = "URL";
|
||||||
if ($type!="") $key.= ";$type";
|
if ($type!="") $key.= ";$type";
|
||||||
@ -276,12 +306,16 @@ class vCard
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* permet d'obtenir une vcard
|
* permet d'obtenir une vcard
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function getVCard() {
|
function getVCard()
|
||||||
|
{
|
||||||
$text = "BEGIN:VCARD\r\n";
|
$text = "BEGIN:VCARD\r\n";
|
||||||
//$text.= "VERSION:3.0\r\n";
|
//$text.= "VERSION:3.0\r\n";
|
||||||
$text.= "VERSION:2.1\r\n";
|
$text.= "VERSION:2.1\r\n";
|
||||||
foreach($this->properties as $key => $value) {
|
foreach($this->properties as $key => $value)
|
||||||
|
{
|
||||||
$text.= "$key:$value\r\n";
|
$text.= "$key:$value\r\n";
|
||||||
}
|
}
|
||||||
$text.= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
|
$text.= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
|
||||||
@ -292,9 +326,13 @@ class vCard
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* permet d'obtenir le nom de fichier
|
* permet d'obtenir le nom de fichier
|
||||||
|
*
|
||||||
|
* @return string Filename
|
||||||
*/
|
*/
|
||||||
function getFileName() {
|
function getFileName()
|
||||||
|
{
|
||||||
return $this->filename;
|
return $this->filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user