You are here

function _node_import_tsv_get_row in Node import 5

Get one row from the TSV file and return it as an array of columns/fields.

1 string reference to '_node_import_tsv_get_row'
_node_import_errors in ./node_import.module

File

./node_import.module, line 890
This modules provides a wizard at "administer >> content >> import" to import a CSV file with nodes.

Code

function _node_import_tsv_get_row($filepath, $reset = FALSE) {
  static $lines;
  static $line_no;
  $separator = variable_get('node_import_tsv_separator', "\t");
  if ($filepath == '') {
    unset($lines);
    return FALSE;
  }
  if (!isset($lines) || $reset) {
    $line_no = 0;
    $lines = file($filepath);
  }
  while ($line_no < count($lines)) {
    $line = rtrim($lines[$line_no], "\n\r ");
    $line_no++;
    if ($line != '') {
      return explode($separator, $line);
    }
  }
  return FALSE;
}