diff options
-rw-r--r-- | Zotlabs/Render/Comanche.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index a9ca023e5..8e36f52c2 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -131,7 +131,12 @@ class Comanche { // [if $config.system.foo ~= baz] which will check if get_config('system','foo') contains the string 'baz'; // [if $config.system.foo == baz] which will check if get_config('system','foo') is the string 'baz'; // [if $config.system.foo != baz] which will check if get_config('system','foo') is not the string 'baz'; - // You may check numeric entries, but these checks are evaluated as strings. + // [if $config.system.foo >= 3] which will check if get_config('system','foo') is greater than or equal to 3; + // [if $config.system.foo > 3] which will check if get_config('system','foo') is greater than 3; + + // [if $config.system.foo <= 3] which will check if get_config('system','foo') is less than or equal to 3; + // [if $config.system.foo < 3] which will check if get_config('system','foo') is less than 3; + // [if $config.system.foo {} baz] which will check if 'baz' is an array element in get_config('system','foo') // [if $config.system.foo {*} baz] which will check if 'baz' is an array key in get_config('system','foo') // [if $config.system.foo] which will check for a return of a true condition for get_config('system','foo'); @@ -158,6 +163,31 @@ class Comanche { return false; } + if(preg_match('/[\$](.*?)\s\>\=\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if($x >= trim($matches[2])) + return true; + return false; + } + if(preg_match('/[\$](.*?)\s\<\=\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if($x <= trim($matches[2])) + return true; + return false; + } + if(preg_match('/[\$](.*?)\s\>\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if($x > trim($matches[2])) + return true; + return false; + } + if(preg_match('/[\$](.*?)\s\>\s(.*?)$/',$s,$matches)) { + $x = $this->get_condition_var($matches[1]); + if($x < trim($matches[2])) + return true; + return false; + } + if(preg_match('/[\$](.*?)\s\{\}\s(.*?)$/',$s,$matches)) { $x = $this->get_condition_var($matches[1]); if(is_array($x) && in_array(trim($matches[2]),$x)) |