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

Class: File_IMC_Parse

Source Location: /File_IMC-0.3/File/IMC/Parse.php

Class Overview


Common parser for IMC files (vCard, vCalendar, iCalendar)


Author(s):

Variables

Methods


Child classes:

File_IMC_Parse_vCard
Common parser for IMC files (vCard, vCalendar, iCalendar)
File_IMC_Parse_vCalendar
Common parser for IMC files (vCard, vCalendar, iCalendar)

Inherited Variables

Inherited Methods


Class Details

[line 32]
Common parser for IMC files (vCard, vCalendar, iCalendar)

This class provides the methods to parse a file into an array. By extending the class, you are able to define functions to handle specific elements that need special decoding. For an example, see File_IMC_Parse_vCard.



[ Top ]


Class Variables

$count =  -1

[line 43]

Keeps track of the current line being parsed

Starts at -1 so that the first line parsed is 0, since _parseBlock() advances the counter by 1 at the beginning

  • See: _parseBlock()

Type:   int


[ Top ]



Method Detail

convertLineEndings   [line 109]

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. As a side-effect, all double-newlines (\n\n) are converted to a single-newline.

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 ]

fromFile   [line 56]

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

Reads a file for parsing, then sends it to $this->fromText() and returns the results.

Parameters:

array   $filename     The name of the file to read

[ Top ]

fromText   [line 75]

array fromText( array $text, [mixed $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 information extracted from the source text.
  • Access: public
  • See: _fromArray()

Parameters:

array   $text     A block of text to read for information.

[ Top ]

splitByComma   [line 165]

string|array 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 133]

string|array 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 197]

void unescape( string|array &$text)

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

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

  • Access: public

Parameters:

string|array   $text     The text to unescape.

[ Top ]


Documentation generated on Sat, 1 May 2004 00:42:15 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.