mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
_validate_row_conditions
This commit is contained in:
@@ -933,27 +933,27 @@ class parseCSV {
|
|||||||
* @return true of false
|
* @return true of false
|
||||||
*/
|
*/
|
||||||
protected 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);
|
||||||
$or = '';
|
$or = '';
|
||||||
foreach( $conditions as $key => $value ) {
|
foreach ($conditions as $key => $value) {
|
||||||
if ( strpos($value, ' AND ') !== false ) {
|
if (strpos($value, ' AND ') !== false) {
|
||||||
$value = explode(' AND ', $value);
|
$value = explode(' AND ', $value);
|
||||||
$and = '';
|
$and = '';
|
||||||
|
|
||||||
foreach( $value as $k => $v ) {
|
foreach ($value as $k => $v) {
|
||||||
$and .= $this->_validate_row_condition($row, $v);
|
$and .= $this->_validate_row_condition($row, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
$or .= (strpos($and, '0') !== false) ? '0' : '1' ;
|
$or .= (strpos($and, '0') !== false) ? '0' : '1';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$or .= $this->_validate_row_condition($row, $value);
|
$or .= $this->_validate_row_condition($row, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (strpos($or, '1') !== false) ? true : false ;
|
return (strpos($or, '1') !== false) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user