public function FrxSyntaxEngine::test in Forena Reports 7.4
Same name and namespace in other branches
- 6.2 FrxSyntaxEngine.inc \FrxSyntaxEngine::test()
- 7.3 FrxSyntaxEngine.inc \FrxSyntaxEngine::test()
Test for TRUE/FALSE for conditions that are able to be represented using bind parameters Note that | are used to separate the different conditions and these are to be OR'd together.
Parameters
string $condition: String data containing position
Return value
bool evaluated condittion.
File
- ./
FrxSyntaxEngine.inc, line 181 - FrXSytnaxEngine defines how regular expression procesing/token substitution takes place. It includes support for passing in a formatter oobject that will escape strings properly before substituting them.
Class
- FrxSyntaxEngine
- @file FrXSytnaxEngine defines how regular expression procesing/token substitution takes place. It includes support for passing in a formatter oobject that will escape strings properly before substituting them.
Code
public function test($condition) {
$eval = TRUE;
$tests = explode('&', $condition);
if ($tests) {
foreach ($tests as $test) {
$t = trim($test);
$res = $this
->replace($t, TRUE);
if (is_string($res)) {
$res = trim($res, ' !') ? TRUE : FALSE;
if (strpos($t, '!') === 0) {
$res = !$res;
}
}
else {
$res = $res ? TRUE : FALSE;
}
$eval = $eval && $res;
}
}
return $eval;
}