[ Index ]

MailPress 7.1

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

title

Body

[close]

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

(no description)

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

Defines 1 class

parseCSV:: (18 methods):
  __construct()
  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

__construct($input = null, $offset = null, $limit = null, $conditions = null, $keep_file_data = null)   X-Ref
Constructor
Class constructor

param: [string]  input      The CSV string or a direct filepath
param: [integer] offset     Number of rows to ignore from the beginning of  the data
param: [integer] limit      Limits the number of returned rows to specified amount
param: [string]  conditions Basic SQL-like conditions for row matching

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

param: [string]  input      The CSV string or a direct filepath
param: [integer] offset     Number of rows to ignore from the beginning of  the data
param: [integer] limit      Limits the number of returned rows to specified amount
param: [string]  conditions Basic SQL-like conditions for row matching
return: [bool]

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

param: [string] $file   File location to save to
param: [array]  $data   2D array of data
param: [bool]   $append Append current data to end of target CSV, if file exists
param: [array]  $fields Field names
return: [bool]

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

param: [string] $filename  If specified, headers and data will be output directly to browser as a downloable file
param: [array]  $data      2D array with data
param: [array]  $fields    Field names
param: [type]   $delimiter delimiter used to separate data
return: [string]

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

param: [string] $input  Input character encoding, uses default if left blank
param: [string] $output Output character encoding, uses default if left blank

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

param: [string] $file         Local CSV file
param: [bool]   $parse        True/false parse file directly
param: [int]    $search_depth Number of rows to analyze
param: [string] $preferred    Preferred delimiter characters
param: [string] $enclosure    Enclosure character, default is double quote (").
return: [string]

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

param: [string] $file Local CSV file
return: [array|bool]

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, $delimiter = 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

param: [type] $char      [description]
param: [type] $array     [description]
param: [type] $depth     [description]
param: [type] $preferred [description]
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: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1