[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/options/import/importers/parsecsv/ -> parsecsv.lib.php (summary)

(no description)

File Size: 771 lines (25 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

parseCSV:: (18 methods):
  parseCSV()
  parse()
  save()
  output()
  encoding()
  auto()
  parse_file()
  parse_string()
  unparse()
  load_data()
  _validate_row_conditions()
  _validate_row_condition()
  _validate_offset()
  _enclose_value()
  _check_data()
  _check_count()
  _rfile()
  _wfile()


Class: parseCSV  - X-Ref

parseCSV($input = null, $offset = null, $limit = null, $conditions = null)   X-Ref
Constructor

param: input   CSV file or string
return: nothing

parse($input = null, $offset = null, $limit = null, $conditions = null)   X-Ref
Parse CSV file or string

param: input   CSV file or string
return: nothing

save($file = null, $data = array()   X-Ref
Save changes, or new file and/or data

param: file     file to save to
param: data     2D array with data
param: append   append current data to end of target CSV if exists
param: fields   field names
return: true or false

output($filename = null, $data = array()   X-Ref
Generate CSV based string for output

param: filename    if specified, headers and data will be output directly to browser as a downloable file
param: data        2D array with data
param: fields      field names
param: delimiter   delimiter used to separate data
return: CSV data using delimiter of choice, or default

encoding($input = null, $output = null)   X-Ref
Convert character encoding

param: input    input character encoding, uses default if left blank
param: output   output character encoding, uses default if left blank
return: nothing

auto($file = null, $parse = true, $search_depth = null, $preferred = null, $enclosure = null)   X-Ref
Auto-Detect Delimiter: Find delimiter by analyzing a specific number of
rows to determine most probable delimiter character

param: file           local CSV file
param: parse          true/false parse file directly
param: search_depth   number of rows to analyze
param: preferred      preferred delimiter characters
param: enclosure      enclosure character, default is double quote (").
return: delimiter character

parse_file($file = null)   X-Ref
Read file to string and call parse_string()

param: file   local CSV file
return: 2D array with CSV data, or false on failure

parse_string($data = null)   X-Ref
Parse CSV strings to arrays

param: data   CSV string
return: 2D array with CSV data, or false on failure

unparse( $data = array()   X-Ref
Create CSV data from array

param: data        2D array with data
param: fields      field names
param: append      if true, field names will not be output
param: is_php      if a php die() call should be put on the first
param: delimiter   field delimiter to use
return: CSV data (text string)

load_data($input = null)   X-Ref
Load local file or string

param: input   local CSV file
return: true or false

_validate_row_conditions($row = array()   X-Ref
Validate a row against specified conditions

param: row          array with values from a row
param: conditions   specified conditions that the row must match
return: true of false

_validate_row_condition($row, $condition)   X-Ref
Validate a row against a single condition

param: row          array with values from a row
param: condition   specified condition that the row must match
return: true of false

_validate_offset($current_row)   X-Ref
Validates if the row is within the offset or not if sorting is disabled

param: current_row   the current row number being processed
return: true of false

_enclose_value($value = null)   X-Ref
Enclose values if needed
- only used by unparse()

param: value   string to process
return: Processed value

_check_data($file = null)   X-Ref
Check file data

param: file   local filename
return: true or false

_check_count($char, $array, $depth, $preferred)   X-Ref
Check if passed info might be delimiter
- only used by find_delimiter()

return: special string used for delimiter selection, or false

_rfile($file = null)   X-Ref
Read local file

param: file   local filename
return: Data from file, or false on failure

_wfile($file, $string = '', $mode = 'wb', $lock = 2)   X-Ref
Write to local file

param: file     local filename
param: string   data to write to file
param: mode     fopen() mode
param: lock     flock() mode
return: true or false



Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1