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

Class: Contact_Vcard_Parse

Source Location: /Contact_Vcard_Parse-1.32.0/Contact/Vcard/Parse.php

Class Overview


Parser for vCards.


Author(s):

Version:

  • Release: 1.31.0

Copyright:

  • 1997-2007 The PHP Group

Methods


Inherited Variables

Inherited Methods


Class Details

[line 55]
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 160]

void convertLineEndings( 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.

[ Top ]

fileGetContents   [line 92]

string|bool fileGetContents( array $filename)

Reads the contents of a file. Included for users whose PHP < 4.3.0.
  • Return: The contents of the file if it exists and is readable, or boolean false if not.
  • See: self::fromFile()
  • Access: public

Parameters:

array   $filename     The filename to read for vCard information.

[ Top ]

fromFile   [line 71]

array fromFile( array $filename, [boolean $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: self::_fromArray()
  • See: self::fromText()
  • Access: public

Parameters:

array   $filename     The filename to read for vCard information.
boolean   $decode_qp     Optional; Decode quoted printable if true. This is the default.

[ Top ]

fromText   [line 124]

array fromText( array $text, [boolean $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: self::_fromArray()
  • Access: public

Parameters:

array   $text     A block of text to read for vCard information.
boolean   $decode_qp     Optional; Decode quoted printable if true. This is the default.

[ Top ]

splitByComma   [line 211]

mixed splitByComma( string $text, [boolean $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.
boolean   $convertSingle     If splitting the string results in a single array element, return a string instead of a one- element array. Optional - defaults to false.

[ Top ]

splitBySemi   [line 181]

mixed splitBySemi( string $text, [boolean $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.
boolean   $convertSingle     If splitting the string results in a single array element, return a string instead of a one- element array. Optional - defaults to false

[ Top ]

unescape   [line 243]

void unescape( 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.

[ Top ]


Documentation generated on Mon, 21 Sep 2009 16:30:02 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.