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

Class: File_IMC_Parse

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

Class Overview


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


Author(s):

Variables

Methods


Child classes:

File_IMC_Parse_Vcard
This class is a parser for vCards.
File_IMC_Parse_Vcalendar
Common parser for IMC files (vCard, vCalendar, iCalendar)

Inherited Variables

Inherited Methods


Class Details

[line 60]
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 75]

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

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. 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.
   &$text   — 

[ Top ]

fromFile   [line 94]

array fromFile( array $filename, [ $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
   $decode_qp   — 

[ Top ]

fromText   [line 119]

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 information extracted from the source text.
  • See: _fromArray()
  • Access: public

Parameters:

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

[ Top ]

splitByColon   [line 344]

array splitByColon( string $text, [bool $recurse = false])

Splits the line into types/parameters and values.
  • Return: The first element contains types and parameters (before the colon). The second element contains the line's value (after the colon).
  • Todo: A parameter w/ 1 quote will break everything. Try to come up with a good way to fix this.
  • Access: public

Parameters:

string   $text   —  The string to split into an array.
bool   $recurse   —  If true, recursively parse the entire text for all occurrences of the delimiter; if false, only parse for the first occurrence. Defaults to false (this is different from splitByCommon and splitBySemi).

[ Top ]

splitByComma   [line 316]

string|array splitByComma( string $text, [bool $recurse = true])

Splits a string into an array at commas.

Parameters:

string   $text   —  The string to split into an array.
bool   $recurse   —  If true, recursively parse the entire text for all occurrences of the delimiter; if false, only parse for the first occurrence. Defaults to true.

[ Top ]

splitByDelim   [line 191]

string|array splitByDelim( string $text, string $delim, [bool $recurse = true])

Splits a string into an array. Honors backslash-escaped delimiters, (i.e., splits at ';' not '\;') and double-quotes (will not break inside double-quotes ("")).
  • Return: An array of values, or a single string.
  • Access: public

Parameters:

string   $text   —  The string to split into an array.
string   $delim   —  Character to split string at.
bool   $recurse   —  If true, recursively parse the entire text for all occurrences of the delimiter; if false, only parse for the first occurrence. Defaults to true.

[ Top ]

splitBySemi   [line 292]

string|array splitBySemi( string $text, [bool $recurse = true], bool $convertSingle)

Splits a string into an array at semicolons.

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.
bool   $recurse   —  If true, recursively parse the entire text for all occurrences of the delimiter; if false, only parse for the first occurrence. Defaults to true.

[ Top ]

unescape   [line 367]

void unescape( &$text, 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.
   &$text   — 

[ Top ]


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