original_string: function FilterFields($array, $operation = 'where') {
  		if (!$array)
  			return;
  		$out = array();
  		foreach ($array as $field => $value) {
  			if ($operation == 'where' && $this->source == 'internal' && preg_match('/^(.*) (.*)$/', $field, $matches)) { // special CI syntax in key e.g. 'status !=' => 'something' (only for 'where' operations)
  				$key = $matches[1];
  				$cond = $matches[2];
  				$val = $value;
  			} elseif ($operation == 'where' && $this->source == 'controller' && is_string($value) && preg_match('/^([\<\>]=?)(.*)$/', $value, $matches)) { // CI syntax in value e.g. '>=value'
  				$key = $field;
  				$cond = $matches[1];
  				$val = $matches[2];
  			} elseif ($operation == 'where' && $this->source == 'controller' && is_array($value) && preg_match('/^([\<\>]=?)(.*)$/', $value[0], $matches)) { // CI syntax in value via array (e.g. ['>=value', '<=value'])
  				// Accept an array of where conditions - this works around the fact that PHP will always accept the LAST where condition in an URL
  				// e.g. ?foo=>1&foo=<10 (foo will == '<10')
  				// Use ?foo[]=>1&foo[]=<10 to work around this
  				$key = $field;
  				$cond = $matches[1];
  				$val = $matches[2];
  
  				array_shift($value); // Remove first element - which we've already taken care of
  				foreach ($value as $valIndex => $valArray) {
  					if (preg_match('/^([\<\>]=?)(.*)$/', $value[$valIndex], $matches))
  						$out[isset($matches[1]) && $matches[1] != '=' ? "$key {$matches[1]}" : $key] = $matches[2];
  				}
  			} else {
  				$key = $field;
  				$cond = '=';
  				$val = $value;
  			}
  
  			if (!isset($this->schema[$key])) // Field definition does not exist at all
  				continue;
  
  			if ( // Is read-only during a 'set'
  				$operation == 'set' &&
  				isset($this->schema[$key]['allowset']) &&
  				!$this->schema[$key]['allowset']
  			)
  				continue;
  
  			if ( // Is not filterable by
  				$operation == 'where' &&
  				isset($this->schema[$key]['allowquery']) &&
  				!$this->schema[$key]['allowquery']
  			)
  				continue;
  
  			// If we got this far its a valid field
  			$out[$cond && $cond != '=' ? "$key $cond" : $key] = $val;
  		}
  		return $out;
  	}
code: function FilterFields($array, $operation = 'where') {
  		if (!$array)
  			return;
  		$out = array();
  		foreach ($array as $field => $value) {
  			if ($operation == 'where' && $this->source == 'internal' && preg_match('/^(.*) (.*)$/', $field, $matches)) { // special CI syntax in key e.g. 'status !=' => 'something' (only for 'where' operations)
  				$key = $matches[1];
  				$cond = $matches[2];
  				$val = $value;
  			} elseif ($operation == 'where' && $this->source == 'controller' && is_string($value) && preg_match('/^([\<\>]=?)(.*)$/', $value, $matches)) { // CI syntax in value e.g. '>=value'
  				$key = $field;
  				$cond = $matches[1];
  				$val = $matches[2];
  			} elseif ($operation == 'where' && $this->source == 'controller' && is_array($value) && preg_match('/^([\<\>]=?)(.*)$/', $value[0], $matches)) { // CI syntax in value via array (e.g. ['>=value', '<=value'])
  				// Accept an array of where conditions - this works around the fact that PHP will always accept the LAST where condition in an URL
  				// e.g. ?foo=>1&foo=<10 (foo will == '<10')
  				// Use ?foo[]=>1&foo[]=<10 to work around this
  				$key = $field;
  				$cond = $matches[1];
  				$val = $matches[2];
  
  				array_shift($value); // Remove first element - which we've already taken care of
  				foreach ($value as $valIndex => $valArray) {
  					if (preg_match('/^([\<\>]=?)(.*)$/', $value[$valIndex], $matches))
  						$out[isset($matches[1]) && $matches[1] != '=' ? "$key {$matches[1]}" : $key] = $matches[2];
  				}
  			} else {
  				$key = $field;
  				$cond = '=';
  				$val = $value;
  			}
  
  			if (!isset($this->schema[$key])) // Field definition does not exist at all
  				continue;
  
  			if ( // Is read-only during a 'set'
  				$operation == 'set' &&
  				isset($this->schema[$key]['allowset']) &&
  				!$this->schema[$key]['allowset']
  			)
  				continue;
  
  			if ( // Is not filterable by
  				$operation == 'where' &&
  				isset($this->schema[$key]['allowquery']) &&
  				!$this->schema[$key]['allowquery']
  			)
  				continue;
  
  			// If we got this far its a valid field
  			$out[$cond && $cond != '=' ? "$key $cond" : $key] = $val;
  		}
  		return $out;
  	}
code_tokens: function FilterFields ( $ array , $ operation = 'where' ) { if ( ! $ array ) return ; $ out = array ( ) ; foreach ( $ array as $ field => $ value ) { if ( $ operation == 'where' && $ this -> source == 'internal' && preg_match ( '/^(.*) (.*)$/' , $ field , $ matches ) ) { // special CI syntax in key e.g. 'status !=' => 'something' (only for 'where' operations) $ key = $ matches [ 1 ] ; $ cond = $ matches [ 2 ] ; $ val = $ value ; } elseif ( $ operation == 'where' && $ this -> source == 'controller' && is_string ( $ value ) && preg_match ( '/^([\<\>]=?)(.*)$/' , $ value , $ matches ) ) { // CI syntax in value e.g. '>=value' $ key = $ field ; $ cond = $ matches [ 1 ] ; $ val = $ matches [ 2 ] ; } elseif ( $ operation == 'where' && $ this -> source == 'controller' && is_array ( $ value ) && preg_match ( '/^([\<\>]=?)(.*)$/' , $ value [ 0 ] , $ matches ) ) { // CI syntax in value via array (e.g. ['>=value', '<=value']) // Accept an array of where conditions - this works around the fact that PHP will always accept the LAST where condition in an URL // e.g. ?foo=>1&foo=<10 (foo will == '<10') // Use ?foo[]=>1&foo[]=<10 to work around this $ key = $ field ; $ cond = $ matches [ 1 ] ; $ val = $ matches [ 2 ] ; array_shift ( $ value ) ; // Remove first element - which we've already taken care of foreach ( $ value as $ valIndex => $ valArray ) { if ( preg_match ( '/^([\<\>]=?)(.*)$/' , $ value [ $ valIndex ] , $ matches ) ) $ out [ isset ( $ matches [ 1 ] ) && $ matches [ 1 ] != '=' ? "$key {$matches[1]}" : $ key ] = $ matches [ 2 ] ; } } else { $ key = $ field ; $ cond = '=' ; $ val = $ value ; } if ( ! isset ( $ this -> schema [ $ key ] ) ) // Field definition does not exist at all continue ; if ( // Is read-only during a 'set' $ operation == 'set' && isset ( $ this -> schema [ $ key ] [ 'allowset' ] ) && ! $ this -> schema [ $ key ] [ 'allowset' ] ) continue ; if ( // Is not filterable by $ operation == 'where' && isset ( $ this -> schema [ $ key ] [ 'allowquery' ] ) && ! $ this -> schema [ $ key ] [ 'allowquery' ] ) continue ; // If we got this far its a valid field $ out [ $ cond && $ cond != '=' ? "$key $cond" : $ key ] = $ val ; } return $ out ; }
docstring: Return an input array filtered by fields we are allowed to perform an operation on
  @param array $array The incomming hash of field values to filter
  @param string $operation The operation to perform. Can be: where, set, get
docstring_tokens: Return an input array filtered by fields we are allowed to perform an operation on