Utitily class for importing of CSV files.
More...
|
| __construct ($iid, $type) |
| Contructor.
|
|
| __destruct () |
| Make sure the file is closed when this object is discarded.
|
|
object | cleanup ($full=false) |
| Cleanup temporary data.
|
|
| close () |
| Release iteration related resources.
|
|
| get_columns () |
| Returns list of columns.
|
|
| get_error () |
| Get last error.
|
|
object | init () |
| Init iterator.
|
|
| load_csv_content ($content, $encoding, $delimiter_name, $column_validation=null, $enclosure='"') |
| Parse this content.
|
|
| next () |
| Get next line.
|
|
Utitily class for importing of CSV files.
- Copyright
- Petr Skoda
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
csv_import_reader::__construct |
( |
| $iid, |
|
|
| $type ) |
Contructor.
- Parameters
-
int | $iid | import identifier |
string | $type | which script imports? |
◆ cleanup()
object csv_import_reader::cleanup |
( |
| $full = false | ) |
|
Cleanup temporary data.
@global object
- Parameters
-
boolean | $full | true means do a full cleanup - all sessions for current user, false only the active iid |
◆ close()
csv_import_reader::close |
( |
| ) |
|
Release iteration related resources.
- Return values
-
◆ get_columns()
csv_import_reader::get_columns |
( |
| ) |
|
Returns list of columns.
- Return values
-
◆ get_delimiter()
static csv_import_reader::get_delimiter |
( |
| $delimiter_name | ) |
|
|
static |
Get delimiter character.
- Parameters
-
- Return values
-
◆ get_delimiter_list()
static csv_import_reader::get_delimiter_list |
( |
| ) |
|
|
static |
Get list of cvs delimiters.
- Return values
-
array | suitable for selection box |
◆ get_encoded_delimiter()
static object csv_import_reader::get_encoded_delimiter |
( |
| $delimiter_name | ) |
|
|
static |
Get encoded delimiter character.
- Parameters
-
- Return values
-
string | encoded delimiter char |
◆ get_error()
csv_import_reader::get_error |
( |
| ) |
|
Get last error.
- Return values
-
string | error text of null if none |
◆ get_new_iid()
static object csv_import_reader::get_new_iid |
( |
| $type | ) |
|
|
static |
Create new import id.
- Parameters
-
- Return values
-
◆ init()
object csv_import_reader::init |
( |
| ) |
|
Init iterator.
@global object
- Return values
-
◆ load_csv_content()
csv_import_reader::load_csv_content |
( |
| $content, |
|
|
| $encoding, |
|
|
| $delimiter_name, |
|
|
| $column_validation = null, |
|
|
| $enclosure = '"' ) |
Parse this content.
- Parameters
-
string | $content | the content to parse. |
string | $encoding | content encoding |
string | $delimiter_name | separator (comma, semicolon, colon, cfg) |
string | $column_validation | name of function for columns validation, must have one param $columns |
string | $enclosure | field wrapper. One character only. |
- Return values
-
bool | false if error, count of data lines if ok; use get_error() to get error string |
◆ next()
csv_import_reader::next |
( |
| ) |
|
Get next line.
- Return values
-
mixed | false, or an array of values |
The documentation for this class was generated from the following file: