Blesta Source Documentation

VCard extends Component

vCard component that creates vCard-formatted address book data

Table of Contents

Properties

$components
$helpers
$models
$vCard

Methods

__construct() Set default vCard data
create() Creates a vCard with the given data
addAddress() Set the address to the vCard
addCompany() Set the company and job title to the vCard
addEmail() Set the email to the vCard
addName() Set the name to the vCard
addPhone() Set the phone number to the vCard
removeDeprecatedFields() Updates the given data to remove deprecated fields in favor for of their alternative
setFileName() Set the filename for the vCard
Properties

$vCard

private A $vCard

class_vcard instance

Methods

__construct()

Set default vCard data

public __construct() : mixed

create()

Creates a vCard with the given data

public create(array<string|int, mixed> $data[, bool $stream = true ][, string $file_name = null ]) : string
Parameters
$data : array<string|int, mixed>

A list of fields to set in the vCard, including (all optional):

  • first_name The first name of the contact
  • last_name The last name of the contact
  • company The contact's company name
  • title The contact's title
  • email1 The contact's email address (@deprecated since v4.5.0, use 'email' instead)
  • email The contact's email address
  • home_address The contact's home street address
  • home_city The contact's home city
  • home_state The contact's home 2-character state
  • home_postal_code The contact's home zip/postal code
  • home_country The contact's home 2-character country
  • work_address The contact's work street address
  • work_city The contact's work city
  • work_state The contact's work 2-character state
  • work_postal_code The contact's work zip/postal code
  • work_country The contact's work 2-character country
  • home_tel The contact's home phone number
  • cell_tel The contact's cell phone number
  • fax_tel The contact's fax number
  • office_tel The contact's office phone number (@deprecated since v4.5.0, use 'work_tel' instead)
  • work_tel The contact's work phone number
$stream : bool = true

True to stream the vCard for download (optional)

$file_name : string = null

The name of the file to stream (optional)

Return values
string

A string representing the vCard

addAddress()

Set the address to the vCard

private addAddress(array<string|int, mixed> $data, string $type) : mixed
Parameters
$data : array<string|int, mixed>

The data to set

$type : string

The address type, one of:

  • home
  • work

addCompany()

Set the company and job title to the vCard

private addCompany(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

The data to set

addEmail()

Set the email to the vCard

private addEmail(array<string|int, mixed> $data[, string $type = null ]) : mixed
Parameters
$data : array<string|int, mixed>

The data to set

$type : string = null

The email type (optional) one of:

  • home
  • work

addName()

Set the name to the vCard

private addName(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

The data to set

addPhone()

Set the phone number to the vCard

private addPhone(array<string|int, mixed> $data, string $type) : mixed
Parameters
$data : array<string|int, mixed>

The data to set

$type : string

The phone type, one of:

  • home
  • cell
  • work
  • fax

removeDeprecatedFields()

Updates the given data to remove deprecated fields in favor for of their alternative

private removeDeprecatedFields(array<string|int, mixed> $data) : array<string|int, mixed>

since v4.5.0

Parameters
$data : array<string|int, mixed>

An array of data

Return values
array<string|int, mixed>

An updated array of data with deprecated fields removed

setFileName()

Set the filename for the vCard

private setFileName([null|string $fileName = null ]) : mixed
Parameters
$fileName : null|string = null

The name of the file to set, otherwise defaults to a generic name

Tags
subpackage

components.vcard

copyright

Copyright (c) 2010-2018, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results