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