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

Class: Contact_Vcard_Parse

Source Location: /Contact_Vcard_Parse-1.31.0/Contact_Vcard_Parse.php

Class Overview


Parser for vCards.


Author(s):

Version:

  • 1.31

Methods


Inherited Variables

Inherited Methods


Class Details

[line 57]
Parser for vCards.

This class parses vCard 2.1 and 3.0 sources from file or text into a structured array.

Usage:

  1.      // include this class file
  2.      require_once 'Contact_Vcard_Parse.php';
  3.  
  4.      // instantiate a parser object
  5.      $parse = new Contact_Vcard_Parse();
  6.  
  7.      // parse a vCard file and store the data
  8.      // in $cardinfo
  9.      $cardinfo $parse->fromFile('sample.vcf');
  10.  
  11.      // view the card info array
  12.      echo '<pre>';
  13.      print_r($cardinfo);
  14.      echo '</pre>';



[ Top ]


Method Detail

convertLineEndings   [line 187]

void convertLineEndings( &$text, string $text)

Converts line endings in text.

Takes any text block and converts all line endings to UNIX standard. DOS line endings are \r\n, Mac are \r, and UNIX is \n.

NOTE: Acts on the text block in-place; does not return a value.

  • Access: public

Parameters:

string   $text   —  The string on which to convert line endings.
   &$text   — 

[ Top ]

fileGetContents   [line 106]

string|bool fileGetContents( array $filename)

Reads the contents of a file. Included for users whose PHP < 4.3.0.

Parameters:

array   $filename   —  The filename to read for vCard information.

[ Top ]

fromFile   [line 78]

array fromFile( array $filename, [ $decode_qp = true])

Reads a file for parsing, then sends it to $this->fromText() and returns the results.
  • Return: An array of of vCard information extracted from the file.
  • See: Contact_Vcard_Parse::_fromArray()
  • See: Contact_Vcard_Parse::fromText()
  • Access: public

Parameters:

array   $filename   —  The filename to read for vCard information.
   $decode_qp   — 

[ Top ]

fromText   [line 146]

array fromText( array $text, [ $decode_qp = true])

Prepares a block of text for parsing, then sends it through and returns the results from $this->fromArray().
  • Return: An array of vCard information extracted from the source text.
  • See: Contact_Vcard_Parse::_fromArray()
  • Access: public

Parameters:

array   $text   —  A block of text to read for vCard information.
   $decode_qp   — 

[ Top ]

splitByComma   [line 251]

mixed splitByComma( string $text, [bool $convertSingle = false])

Splits a string into an array at commas. Honors backslash- escaped commas (i.e., splits at ',' not '\,').
  • Return: An array of values, or a single string.
  • Access: public

Parameters:

string   $text   —  The string to split into an array.
bool   $convertSingle   —  If splitting the string results in a single array element, return a string instead of a one-element array.

[ Top ]

splitBySemi   [line 214]

mixed splitBySemi( string $text, [bool $convertSingle = false])

Splits a string into an array at semicolons. Honors backslash- escaped semicolons (i.e., splits at ';' not '\;').
  • Return: An array of values, or a single string.
  • Access: public

Parameters:

string   $text   —  The string to split into an array.
bool   $convertSingle   —  If splitting the string results in a single array element, return a string instead of a one-element array.

[ Top ]

unescape   [line 289]

void unescape( &$text, mixed $text)

Used to make string human-readable after being a vCard value.

Converts... \: => : \; => ; \, => , literal \n => newline

  • Access: public

Parameters:

mixed   $text   —  The text to unescape.
   &$text   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:19:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.