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

Class: File_IMC_Build_vCard

Source Location: /File_IMC-0.3/File/IMC/Build/vCard.php

Class Overview

File_IMC_Build
   |
   --File_IMC_Build_vCard

This class helps build files in the vCard and vCalendar formats.


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::File_IMC_Build_vCard()
Constructor
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::raiseError()
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 75]
This class helps build files in the vCard and vCalendar formats.

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

addAddress   [line 1218]

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 1472]

void addCategories( mixed $text, [mixed $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.

[ Top ]

addEmail   [line 1379]

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 1282]

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 1430]

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 1520]

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 1331]

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 1577]

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 1247]

mixed getAddress( int $iter)

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

Parameters:

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

[ Top ]

getAgent   [line 1130]

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 678]

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 1491]

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 940]

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 1402]

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 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 ]

getFormattedName   [line 396]

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 1173]

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 640]

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 1305]

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 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 ]

getLogo   [line 563]

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 752]

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 311]

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 1449]

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 789]

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 1544]

string getOrganization( )

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

[ Top ]

getPhoto   [line 522]

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 1016]

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 1056]

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 864]

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 978]

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 601]

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 431]

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 481]

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 1354]

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 826]

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 715]

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 1093]

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 903]

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 1112]

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 660]

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 922]

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 338]

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, or a PEAR_Error object on failure.
  • Access: public

Parameters:

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

[ Top ]

setGeo   [line 1154]

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 621]

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 544]

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 734]

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 289]

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 771]

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 503]

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 998]

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 1038]

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 846]

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 960]

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 583]

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 414]

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 452]

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, or a PEAR_Error object 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 808]

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 697]

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 1075]

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 885]

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 86]

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

Sets the version of the the vCard. Only one iteration.
  • Return: Void on success, or a PEAR_Error object 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 114]

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, or a PEAR_Error object if not.
  • Access: public

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 Sat, 1 May 2004 00:42:15 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.