PHP Class JeroenDesloovere\VCard\VCard

Author: Jeroen Desloovere ([email protected])
Show file Open project: jeroendesloovere/vcard Class Usage Examples

Public Properties

Property Type Description
$charset string Default Charset

Public Methods

Method Description
addAddress ( $name = '', $extended = '', $street = '', $city = '', $region = '', $zip = '', $country = '', $type = 'WORK;POSTAL' ) Add address
addBirthday ( string $date ) Add birthday
addCompany ( string $company ) Add company
addEmail ( string $address, $type = '' ) Add email
addJobtitle ( string $jobtitle ) Add jobtitle
addLogo ( string $url, boolean $include = true ) Add Logo
addName ( $lastName = '', $firstName = '', $additional = '', $prefix = '', $suffix = '' ) Add name
addNote ( string $note ) Add note
addPhoneNumber ( string $number, $type = '' ) Add phone number
addPhoto ( string $url, boolean $include = true ) Add Photo
addRole ( string $role ) Add role
addURL ( string $url, $type = '' ) Add URL
buildVCalendar ( ) : string Build VCalender (.ics) - Safari (< iOS 8) can not open .vcf files, so we have build a workaround.
buildVCard ( ) : string Build VCard (.vcf)
download ( ) Download a vcard or vcal file to the browser.
get ( ) : string Get output as string
getCharset ( ) : string Get charset
getCharsetString ( ) : string Get charset string
getContentType ( ) : string Get content type
getFileExtension ( ) : string Get file extension
getFilename ( ) : string Get filename
getHeaders ( boolean $asAssociative ) : array Get headers
getOutput ( ) : string Get output as string iOS devices (and safari < iOS 8 in particular) can not read .vcf (= vcard) files.
getProperties ( ) : array Get properties
hasProperty ( string $key ) : boolean Has property
isIOS ( ) : boolean Is iOS - Check if the user is using an iOS-device
isIOS7 ( ) : boolean Is iOS less than 7 (should cal wrapper be returned)
save ( ) : void Save to a file
setCharset ( mixed $charset ) : void Set charset
setFilename ( mixed $value, boolean $overwrite = true, string $separator = '_' ) : void Set filename

Protected Methods

Method Description
escape ( string $text ) : string Escape newline characters according to RFC2425 section 5.8.4.
fold ( string $text ) : mixed Fold a line according to RFC2425 section 5.8.1.
getUserAgent ( ) : string Returns the browser user agent string.
shouldAttachmentBeCal ( ) : boolean Checks if we should return vcard in cal wrapper

Private Methods

Method Description
addMedia ( string $property, string $url, boolean $include = true, $element ) Add a photo or logo (depending on property name)
decode ( string $value ) : string Decode
setProperty ( string $element, string $key, string $value ) : void Set property

Method Details

addAddress() public method

Add address
public addAddress ( $name = '', $extended = '', $street = '', $city = '', $region = '', $zip = '', $country = '', $type = 'WORK;POSTAL' )

addBirthday() public method

Add birthday
public addBirthday ( string $date )
$date string Format is YYYY-MM-DD

addCompany() public method

Add company
public addCompany ( string $company )
$company string

addEmail() public method

Add email
public addEmail ( string $address, $type = '' )
$address string The e-mail address

addJobtitle() public method

Add jobtitle
public addJobtitle ( string $jobtitle )
$jobtitle string The jobtitle for the person.

addName() public method

Add name
public addName ( $lastName = '', $firstName = '', $additional = '', $prefix = '', $suffix = '' )

addNote() public method

Add note
public addNote ( string $note )
$note string

addPhoneNumber() public method

Add phone number
public addPhoneNumber ( string $number, $type = '' )
$number string

addPhoto() public method

Add Photo
public addPhoto ( string $url, boolean $include = true )
$url string image url or filename
$include boolean Include the image in our vcard?

addRole() public method

Add role
public addRole ( string $role )
$role string The role for the person.

addURL() public method

Add URL
public addURL ( string $url, $type = '' )
$url string

buildVCalendar() public method

Build VCalender (.ics) - Safari (< iOS 8) can not open .vcf files, so we have build a workaround.
public buildVCalendar ( ) : string
return string

buildVCard() public method

Build VCard (.vcf)
public buildVCard ( ) : string
return string

download() public method

Download a vcard or vcal file to the browser.
public download ( )

escape() protected method

Escape newline characters according to RFC2425 section 5.8.4.
protected escape ( string $text ) : string
$text string
return string

fold() protected method

Fold a line according to RFC2425 section 5.8.1.
protected fold ( string $text ) : mixed
$text string
return mixed

get() public method

Get output as string
Deprecation: in the future
public get ( ) : string
return string

getCharset() public method

Get charset
public getCharset ( ) : string
return string

getCharsetString() public method

Get charset string
public getCharsetString ( ) : string
return string

getContentType() public method

Get content type
public getContentType ( ) : string
return string

getFileExtension() public method

Get file extension
public getFileExtension ( ) : string
return string

getFilename() public method

Get filename
public getFilename ( ) : string
return string

getHeaders() public method

Get headers
public getHeaders ( boolean $asAssociative ) : array
$asAssociative boolean
return array

getOutput() public method

So I build a workaround to build a .ics (= vcalender) file.
public getOutput ( ) : string
return string

getProperties() public method

Get properties
public getProperties ( ) : array
return array

getUserAgent() protected method

Returns the browser user agent string.
protected getUserAgent ( ) : string
return string

hasProperty() public method

Has property
public hasProperty ( string $key ) : boolean
$key string
return boolean

isIOS() public method

Is iOS - Check if the user is using an iOS-device
public isIOS ( ) : boolean
return boolean

isIOS7() public method

Is iOS less than 7 (should cal wrapper be returned)
public isIOS7 ( ) : boolean
return boolean

save() public method

Save to a file
public save ( ) : void
return void

setCharset() public method

Set charset
public setCharset ( mixed $charset ) : void
$charset mixed
return void

setFilename() public method

Set filename
public setFilename ( mixed $value, boolean $overwrite = true, string $separator = '_' ) : void
$value mixed
$overwrite boolean [optional] Default overwrite is true
$separator string [optional] Default separator is an underscore '_'
return void

shouldAttachmentBeCal() protected method

Checks if we should return vcard in cal wrapper
protected shouldAttachmentBeCal ( ) : boolean
return boolean

Property Details

$charset public property

Default Charset
public string $charset
return string