[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/File/ -> CSV.php (sommaire)

(pas de description)

Poids: 498 lignes (17 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

File_CSV:: (9 méthodes):
  discoverFormat()
  read()
  readQuoted()
  write()
  unquote()
  _line()
  warning()
  getPointer()
  _checkConfig()


Classe: File_CSV  - X-Ref

The File_CSV package allows reading and creating of CSV data and files.

$Horde: framework/File_CSV/CSV.php,v 1.4.2.7 2006/03/30 10:15:29 selsky Exp $

Copyright 2002-2003 Tomas Von Veschler Cox <cox@idecnet.com>
Copyright 2005-2006 Jan Schneider <jan@horde.org>

This source file is subject to version 2.0 of the PHP license, that is
bundled with this package in the file LICENSE, and is available at through
the world-wide-web at http://www.php.net/license/2_02.txt.  If you did not
receive a copy of the PHP license and are unable to obtain it through the
world-wide-web, please send a note to license@php.net so we can mail you a
copy immediately.

discoverFormat($file, $extraSeps = array()   X-Ref
Discovers the format of a CSV file (the number of fields, the separator,
the quote string, and the line break).

We can't use the auto_detect_line_endings PHP setting, because it's not
supported by fgets() contrary to what the manual says.

param: string  The CSV file name
param: array   Extra separators that should be checked for.
return: array  The format hash.

read($file, &$conf)   X-Ref
Reads a row from a CSV file and returns it as an array.

param: string $file  The name of the CSV file.
param: array $conf   The configuration for the CSV file.
return: array|boolean  The CSV data or false if no more data available.

readQuoted($file, &$conf)   X-Ref
Reads a row from a CSV file and returns it as an array.
This method is able to read fields with multiline data and normalizes
linebreaks to single newline characters (0x0a).

param: string $file  The name of the CSV file.
param: array $conf   The configuration for the CSV file.
return: array|boolean  The CSV data or false if no more data available.

write($file, $fields, &$conf)   X-Ref
Writes a hash into a CSV file.

param: string $file   The name of the CSV file.
param: array $fields  The CSV data.
param: array $conf    The configuration for the CSV file.
return: boolean  True on success, PEAR_Error on failure.

unquote($field, $quote, $crlf)   X-Ref
Removes surrounding quotes from a string and normalizes linebreaks.

param: string $field  The string to unquote.
param: string $quote  The quote character.
param: string $crlf   The linebreak character.
return: string  The unquoted data.

_line($line = null)   X-Ref
Sets or gets the current line being parsed.

param: integer $line  If specified, the current line.
return: integer  The current line.

warning($warning = null)   X-Ref
Adds a warning to or retrieves and resets the warning stack.

param: string  A warning string.  If not specified, the existing
return: array  If no parameter has been specified, the list of existing

getPointer($file, &$conf, $mode = FILE_MODE_READ)   X-Ref
Returns or creates the file descriptor associated with a file.

param: string $file  The name of the file
param: array $conf   The configuration
param: string $mode  The open mode. FILE_MODE_READ or FILE_MODE_WRITE.
return: resource  The file resource or PEAR_Error on error.

_checkConfig(&$conf)   X-Ref
Checks the configuration given by the user.

param: array $conf    The configuration assoc array
param: string $error  The error will be written here if any



Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7