File_IMC
[ class tree: File_IMC ] [ index: File_IMC ] [ all elements ]

Class: File_IMC_Build_Vcard

Source Location: /File_IMC-0.4.0/File/IMC/Build/Vcard.php

Class Overview

File_IMC_Build
   |
   --File_IMC_Build_Vcard

This class builds a single vCard (version 3.0 or 2.1).


Author(s):

Methods


Inherited Variables

Inherited Methods

Class: File_IMC_Build

File_IMC_Build::addParam()
Adds a parameter value for a given component and parameter name.
File_IMC_Build::addValue()
Generic, all-purpose method to add a repetition of a string or array in $this->value, in a way suitable for later output as a vCard element. This appends the value to be the passed text or array value, leaving any prior values in place.
File_IMC_Build::escape()
Prepares a string so it may be safely used as vCard values. DO NOT use this with binary encodings. Operates on text in-place; does not return a value. Recursively descends into arrays.
File_IMC_Build::fetch()
Fetches a full vCard/vCal text block based on $this->value and $this->param.
File_IMC_Build::getMeta()
Gets the left-side/prefix/before-the-colon (metadata) part of a vCard line, including the component identifier, the parameter list, and a colon.
File_IMC_Build::getParam()
Gets back the parameter string for a given component.
File_IMC_Build::getValue()
Generic, all-purpose method to get back the data stored in $this->value.
File_IMC_Build::getVersion()
Gets back the version of the the vCard. Only one iteration.
File_IMC_Build::reset()
Resets the vCard values and params to be blank.
File_IMC_Build::setFromArray()
Builds a vCard/vCal from a parser result array. Only send one vCard from the parse-results.
File_IMC_Build::setValue()
Generic, all-purpose method to store a string or array in $this->value, in a way suitable for later output as a vCard element. This forces the value to be the passed text or array value, overriding any prior values.
File_IMC_Build::setVersion()
Sets the version of the specification to use. Only one iteration.
File_IMC_Build::validateParam()
Validates parameter names and values

Class Details

[line 76]
This class builds a single vCard (version 3.0 or 2.1).

General note: we use the terms "set", "add", and "get" as function prefixes.

"Set" means there is only one iteration of a component, and it has only one value repetition, so you set the whole thing at once.

"Add" means eith multiple iterations of a component are allowed, or that there is only one iteration allowed but there can be multiple value repetitions, so you add iterations or repetitions to the current stack.

"Get" returns the full vCard line for a single iteration.



[ Top ]


Method Detail

__construct (Constructor)   [line 91]

void __construct( [string $version = '3.0'])

Constructor

Parameters:

string   $version   —  The vCard version to build; affects which parameters are allowed and which components are returned by fetch().

[ Top ]

addAddress   [line 1243]

void addAddress( mixed $pob, mixed $extend, mixed $street, mixed $locality, mixed $region, mixed $postcode, mixed $country)

Sets the value of one entire ADR iteration. There can be zero, one, or more ADR components in a vCard.
  • Access: public

Parameters:

mixed   $pob   —  String (one repetition) or array (multiple reptitions) of the p.o. box part of the ADR component iteration.
mixed   $extend   —  String (one repetition) or array (multiple reptitions) of the "extended address" part of the ADR component iteration.
mixed   $street   —  String (one repetition) or array (multiple reptitions) of the street address part of the ADR component iteration.
mixed   $locality   —  String (one repetition) or array (multiple reptitions) of the locailty (e.g., city) part of the ADR component iteration.
mixed   $region   —  String (one repetition) or array (multiple reptitions) of the region (e.g., state, province, or governorate) part of the ADR component iteration.
mixed   $postcode   —  String (one repetition) or array (multiple reptitions) of the postal code (e.g., ZIP code) part of the ADR component iteration.
mixed   $country   —  String (one repetition) or array (multiple reptitions) of the country-name part of the ADR component iteration.

[ Top ]

addCategories   [line 1493]

void addCategories( mixed $text, [ $append = true])

Sets the full value of the CATEGORIES component. There is only one component iteration allowed per vCard, but there may be multiple value repetitions in the iteration.
  • Access: public

Parameters:

mixed   $text   —  String (one repetition) or array (multiple reptitions) of the component iteration value.
   $append   — 

[ Top ]

addEmail   [line 1402]

void addEmail( string $text)

Sets the value of one EMAIL component iteration. There can be zero, one, or more component iterations in a vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

addLabel   [line 1306]

void addLabel( string $text)

Sets the value of one LABEL component iteration. There can be zero, one, or more component iterations in a vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

addNickname   [line 1452]

void addNickname( mixed $text)

Sets the full value of the NICKNAME component. There is only one component iteration allowed per vCard, but there may be multiple value repetitions in the iteration.
  • Access: public

Parameters:

mixed   $text   —  String (one repetition) or array (multiple reptitions) of the component iteration value.

[ Top ]

addOrganization   [line 1541]

void addOrganization( mixed $text)

Sets the full value of the ORG component. There can be only one ORG component in a vCard.

The ORG component can have one or more parts (as opposed to repetitions of values within those parts). The first part is the highest-level organization, the second part is the next-highest, the third part is the third-highest, and so on. There can by any number of parts in one ORG iteration. (This is different from other components, such as NICKNAME, where an iteration has only one part but may have many repetitions within that part.)

  • Access: public

Parameters:

mixed   $text   —  String (one ORG part) or array (of ORG parts) to use as the value for the component iteration.

[ Top ]

addTelephone   [line 1354]

void addTelephone( string $text)

Sets the value of one TEL component iteration. There can be zero, one, or more component iterations in a vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

fetch   [line 1596]

string fetch( )

Fetches a full vCard text block based on $this->value and

$this->param. The order of the returned components is similar to their order in RFC 2426. Honors the value of $this->value['VERSION'] to determine which vCard components are returned (2.1- or 3.0-compliant).

  • Return: A properly formatted vCard text block.
  • Access: public

Overrides File_IMC_Build::fetch() (Fetches a full vCard/vCal text block based on $this->value and $this->param.)
[ Top ]

getAddress   [line 1272]

mixed getAddress( int $iter)

Gets back the value of one ADR component iteration.
  • Return: The value of this component iteration, or ...
  • Throws: File_IMC_Exception ... if the iteration is not valid.
  • Access: public

Parameters:

int   $iter   —  The component iteration-number to get the value for.

[ Top ]

getAgent   [line 1154]

string getAgent( )

Gets back the value of the AGENT component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getBirthday   [line 702]

string getBirthday( )

Gets back the value of the BDAY component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getCategories   [line 1512]

string getCategories( )

Gets back the value of the CATEGORIES component. There is only one component allowed per vCard, but there may be multiple value repetitions in the iteration.
  • Return: The value of this component.
  • Access: public

[ Top ]

getClass   [line 964]

string getClass( )

Gets back the value of the CLASS component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getEmail   [line 1425]

mixed getEmail( int $iter)

Gets back the value of one iteration of the EMAIL component. There can be zero, one, or more component iterations in a vCard.
  • Return: The value of this component, or ...
  • Throws: File_IMC_Exception ... if the iteration number is not valid.
  • Access: public

Parameters:

int   $iter   —  The component iteration-number to get the value for.

[ Top ]

getFormattedName   [line 419]

string getFormattedName( )

Gets back the full FN component value. Only ever returns iteration zero, because only one FN component is allowed per vCard.
  • Return: The FN value of the vCard.
  • Access: public

[ Top ]

getGeo   [line 1197]

string getGeo( )

Gets back the value of the GEO component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getKey   [line 664]

string getKey( )

Gets back the value of the KEY component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getLabel   [line 1329]

mixed getLabel( int $iter)

Gets back the value of one iteration of the LABEL component.

There can be zero, one, or more component iterations in a vCard.

  • Return: The value of this component, or ...
  • Throws: File_IMC_Exception ... if the iteration number is not valid.
  • Access: public

Parameters:

int   $iter   —  The component iteration-number to get the value for.

[ Top ]

getLogo   [line 587]

string getLogo( )

Gets back the value of the LOGO component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getMailer   [line 776]

string getMailer( )

Gets back the value of the MAILER component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getName   [line 333]

string getName( )

Gets back the full N component (first iteration only, since there can only be one N component per vCard).
  • Return: The first N component-interation of the vCard.
  • Access: public

[ Top ]

getNickname   [line 1471]

string getNickname( )

Gets back the value of the NICKNAME component. There is only one component allowed per vCard, but there may be multiple value repetitions in the iteration.
  • Return: The value of this component.
  • Access: public

[ Top ]

getNote   [line 813]

string getNote( )

Gets back the value of the NOTE component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getOrganization   [line 1565]

string getOrganization( )

Gets back the value of the ORG component.
  • Return: The value of this component.

[ Top ]

getPhoto   [line 546]

string getPhoto( )

Gets back the value of the PHOTO component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getProductID   [line 1040]

string getProductID( )

Gets back the value of the PRODID component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getRevision   [line 1080]

string getRevision( )

Gets back the value of the REV component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getRole   [line 888]

string getRole( )

Gets back the value of the ROLE component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getSortString   [line 1002]

string getSortString( )

Gets back the value of the SORT-STRING component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getSound   [line 625]

string getSound( )

Gets back the value of the SOUND component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getSource   [line 454]

string getSource( )

Gets back the data-source of the the vCard. Only one iteration.
  • Return: The data-source of the vCard.
  • Access: public

[ Top ]

getSourceName   [line 505]

string getSourceName( )

Gets back the displayed data-source name of the the vCard. Only one iteration.
  • Return: The data-source name of the vCard.
  • Access: public

[ Top ]

getTelephone   [line 1377]

mixed getTelephone( int $iter)

Gets back the value of one iteration of the TEL component. There can be zero, one, or more component iterations in a vCard.
  • Return: The value of this component, or a PEAR_Error if the iteration number is not valid.
  • Access: public

Parameters:

int   $iter   —  The component iteration-number to get the value for.

[ Top ]

getTitle   [line 850]

string getTitle( )

Gets back the value of the TITLE component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getTZ   [line 739]

string getTZ( )

Gets back the value of the TZ component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getUniqueID   [line 1117]

string getUniqueID( )

Gets back the value of the UID component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

getURL   [line 927]

string getURL( )

Gets back the value of the URL component. There is only one allowed per vCard.
  • Return: The value of this component.
  • Access: public

[ Top ]

setAgent   [line 1136]

void setAgent( string $text)

Sets the value of the AGENT component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setBirthday   [line 684]

void setBirthday( string $text)

Sets the value of the BDAY component. There is only one allowed per vCard. Date format is "yyyy-mm-dd[Thh:ii[:ss[Z|-06:00]]]".
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setClass   [line 946]

void setClass( string $text)

Sets the value of the CLASS component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setFormattedName   [line 361]

mixed setFormattedName( [string $text = null])

Sets the FN component of the card. If no text is passed as the FN value, constructs an FN automatically from N components. There is only one FN iteration per vCard.
  • Return: Void on success
  • Throws: File_IMC_Exception ... on failure.
  • Access: public

Parameters:

string   $text   —  Override the automatic generation of FN from N elements with the specified text.

[ Top ]

setGeo   [line 1178]

void setGeo( string $lat, string $lon)

Sets the value of both parts of the GEO component. There is only one GEO component allowed per vCard.
  • Access: public

Parameters:

string   $lat   —  The value to set for the longitude part (decimal, + or -).
string   $lon   —  The value to set for the latitude part (decimal, + or -).

[ Top ]

setKey   [line 645]

void setKey( string $text)

Sets the value of the KEY component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setLogo   [line 568]

void setLogo( string $text)

Sets the value of the LOGO component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setMailer   [line 758]

void setMailer( string $text)

Sets the value of the MAILER component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setName   [line 311]

void setName( mixed $family, mixed $given, mixed $addl, mixed $prefix, mixed $suffix)

Sets the full N component of the vCard. Will replace all other values. There can only be one N component per vCard.
  • Access: public

Parameters:

mixed   $family   —  Single (string) or multiple (array) family/last name.
mixed   $given   —  Single (string) or multiple (array) given/first name.
mixed   $addl   —  Single (string) or multiple (array) additional/middle name.
mixed   $prefix   —  Single (string) or multiple (array) honorific prefix such as Mr., Miss, etc.
mixed   $suffix   —  Single (string) or multiple (array) honorific suffix such as III, Jr., Ph.D., etc.

[ Top ]

setNote   [line 795]

void setNote( string $text)

Sets the value of the NOTE component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setPhoto   [line 527]

void setPhoto( string $text)

Sets the value of the PHOTO component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setProductID   [line 1022]

void setProductID( string $text)

Sets the value of the PRODID component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setRevision   [line 1062]

void setRevision( string $text)

Sets the value of the REV component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setRole   [line 870]

void setRole( string $text)

Sets the value of the ROLE component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setSortString   [line 984]

void setSortString( string $text)

Sets the value of the SORT-STRING component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setSound   [line 607]

void setSound( string $text)

Sets the value of the SOUND component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setSource   [line 437]

void setSource( string $text)

Sets the data-source of the the vCard. Only one iteration.
  • Access: public

Parameters:

string   $text   —  The text value of the data-source text.

[ Top ]

setSourceName   [line 476]

mixed setSourceName( [string $text = null])

Sets the displayed name of the vCard data-source. Only one iteration.

If no name is specified, copies the value of SOURCE.

  • Return: Void on success
  • Throws: File_IMC_Exception ... on failure.
  • Access: public

Parameters:

string   $text   —  The text value of the displayed data-source name. If null, copies the value of SOURCE.

[ Top ]

setTitle   [line 832]

void setTitle( string $text)

Sets the value of the TITLE component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setTZ   [line 721]

void setTZ( string $text)

Sets the value of the TZ component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setUniqueID   [line 1099]

void setUniqueID( string $text)

Sets the value of the UID component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setURL   [line 909]

void setURL( string $text)

Sets the value of the URL component. There is only one allowed per vCard.
  • Access: public

Parameters:

string   $text   —  The value to set for this component.

[ Top ]

setVersion   [line 109]

mixed setVersion( [string $text = '3.0'])

Sets the version of the the vCard. Only one iteration.
  • Return: Void on success
  • Throws: File_IMC_Exception on failure.
  • Access: public

Overrides File_IMC_Build::setVersion() (Sets the version of the specification to use. Only one iteration.)

Parameters:

string   $text   —  The text value of the verson text ('3.0' or '2.1').

[ Top ]

validateParam   [line 140]

mixed validateParam( string $name, string $text, [string $comp = null], [string $iter = null])

Validates parameter names and values based on the vCard version (2.1 or 3.0).
  • Return: Boolean true if the parameter is valid
  • Throws: File_IMC_Exception ... if not.

Overrides File_IMC_Build::validateParam() (Validates parameter names and values)

Parameters:

string   $name   —  The parameter name (e.g., TYPE or ENCODING).
string   $text   —  The parameter value (e.g., HOME or BASE64).
string   $comp   —  Optional, the component name (e.g., ADR or PHOTO). Only used for error messaging.
string   $iter   —  Optional, the iteration of the component. Only used for error messaging.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:32:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.