mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
@@ -926,13 +926,13 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Validate a row against specified conditions
|
* Validate a row against specified conditions
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param row array with values from a row
|
* @param row array with values from a row
|
||||||
* @param conditions specified conditions that the row must match
|
* @param conditions specified conditions that the row must match
|
||||||
*
|
*
|
||||||
* @return true of false
|
* @return true of false
|
||||||
*/
|
*/
|
||||||
public function _validate_row_conditions ($row = array(), $conditions = null) {
|
protected function _validate_row_conditions ($row = array(), $conditions = null) {
|
||||||
if ( !empty($row) ) {
|
if ( !empty($row) ) {
|
||||||
if ( !empty($conditions) ) {
|
if ( !empty($conditions) ) {
|
||||||
$conditions = (strpos($conditions, ' OR ') !== false) ? explode(' OR ', $conditions) : array($conditions) ;
|
$conditions = (strpos($conditions, ' OR ') !== false) ? explode(' OR ', $conditions) : array($conditions) ;
|
||||||
@@ -965,13 +965,13 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Validate a row against a single condition
|
* Validate a row against a single condition
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param row array with values from a row
|
* @param row array with values from a row
|
||||||
* @param condition specified condition that the row must match
|
* @param condition specified condition that the row must match
|
||||||
*
|
*
|
||||||
* @return true of false
|
* @return true of false
|
||||||
*/
|
*/
|
||||||
public function _validate_row_condition ($row, $condition) {
|
protected function _validate_row_condition ($row, $condition) {
|
||||||
$operators = array(
|
$operators = array(
|
||||||
'=', 'equals', 'is',
|
'=', 'equals', 'is',
|
||||||
'!=', 'is not',
|
'!=', 'is not',
|
||||||
@@ -1043,12 +1043,12 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Validates if the row is within the offset or not if sorting is disabled
|
* Validates if the row is within the offset or not if sorting is disabled
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param current_row the current row number being processed
|
* @param current_row the current row number being processed
|
||||||
*
|
*
|
||||||
* @return true of false
|
* @return true of false
|
||||||
*/
|
*/
|
||||||
public function _validate_offset ($current_row) {
|
protected function _validate_offset ($current_row) {
|
||||||
if ( $this->sort_by === null && $this->offset !== null && $current_row < $this->offset ) {
|
if ( $this->sort_by === null && $this->offset !== null && $current_row < $this->offset ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1060,12 +1060,12 @@ class parseCSV {
|
|||||||
* Enclose values if needed
|
* Enclose values if needed
|
||||||
* - only used by unparse()
|
* - only used by unparse()
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param value string to process
|
* @param value string to process
|
||||||
*
|
*
|
||||||
* @return Processed value
|
* @return Processed value
|
||||||
*/
|
*/
|
||||||
public function _enclose_value ($value = null, $delimiter = null) {
|
protected function _enclose_value ($value = null, $delimiter = null) {
|
||||||
if ( $delimiter === null ) {
|
if ( $delimiter === null ) {
|
||||||
$delimiter = $this->delimiter;
|
$delimiter = $this->delimiter;
|
||||||
}
|
}
|
||||||
@@ -1084,12 +1084,12 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Check file data
|
* Check file data
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param file local filename
|
* @param file local filename
|
||||||
*
|
*
|
||||||
* @return true or false
|
* @return true or false
|
||||||
*/
|
*/
|
||||||
public function _check_data ($file = null) {
|
protected function _check_data ($file = null) {
|
||||||
if ( empty($this->file_data) ) {
|
if ( empty($this->file_data) ) {
|
||||||
if ( $file === null ) $file = $this->file;
|
if ( $file === null ) $file = $this->file;
|
||||||
|
|
||||||
@@ -1103,7 +1103,7 @@ class parseCSV {
|
|||||||
* Check if passed info might be delimiter
|
* Check if passed info might be delimiter
|
||||||
* Only used by find_delimiter
|
* Only used by find_delimiter
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param [type] $char [description]
|
* @param [type] $char [description]
|
||||||
* @param [type] $array [description]
|
* @param [type] $array [description]
|
||||||
* @param [type] $depth [description]
|
* @param [type] $depth [description]
|
||||||
@@ -1111,7 +1111,7 @@ class parseCSV {
|
|||||||
*
|
*
|
||||||
* @return special string used for delimiter selection, or false
|
* @return special string used for delimiter selection, or false
|
||||||
*/
|
*/
|
||||||
public function _check_count ($char, $array, $depth, $preferred) {
|
protected function _check_count ($char, $array, $depth, $preferred) {
|
||||||
if ( $depth == count($array) ) {
|
if ( $depth == count($array) ) {
|
||||||
$first = null;
|
$first = null;
|
||||||
$equal = null;
|
$equal = null;
|
||||||
@@ -1148,12 +1148,12 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Read local file
|
* Read local file
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param file local filename
|
* @param file local filename
|
||||||
*
|
*
|
||||||
* @return Data from file, or false on failure
|
* @return Data from file, or false on failure
|
||||||
*/
|
*/
|
||||||
public function _rfile ($file = null) {
|
protected function _rfile ($file = null) {
|
||||||
if ( is_readable($file) ) {
|
if ( is_readable($file) ) {
|
||||||
if ( !($fh = fopen($file, 'r')) ) {
|
if ( !($fh = fopen($file, 'r')) ) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1170,7 +1170,7 @@ class parseCSV {
|
|||||||
/**
|
/**
|
||||||
* Write to local file
|
* Write to local file
|
||||||
*
|
*
|
||||||
* @access public
|
* @access protected
|
||||||
* @param file local filename
|
* @param file local filename
|
||||||
* @param string data to write to file
|
* @param string data to write to file
|
||||||
* @param mode fopen() mode
|
* @param mode fopen() mode
|
||||||
@@ -1178,7 +1178,7 @@ class parseCSV {
|
|||||||
*
|
*
|
||||||
* @return true or false
|
* @return true or false
|
||||||
*/
|
*/
|
||||||
public function _wfile ($file, $string = '', $mode = 'wb', $lock = 2) {
|
protected function _wfile ($file, $string = '', $mode = 'wb', $lock = 2) {
|
||||||
if ( $fp = fopen($file, $mode) ) {
|
if ( $fp = fopen($file, $mode) ) {
|
||||||
flock($fp, $lock);
|
flock($fp, $lock);
|
||||||
$re = fwrite($fp, $string);
|
$re = fwrite($fp, $string);
|
||||||
|
|||||||
Reference in New Issue
Block a user