aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Render/Comanche.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-01-07 16:14:04 -0800
committerzotlabs <mike@macgirvin.com>2017-01-07 16:14:04 -0800
commit91e0733e8ef0640df20c18e91c61564458b091d1 (patch)
tree1d63f8765d5e4fb9c17a88ee3a020fa55bc6a1b8 /Zotlabs/Render/Comanche.php
parentdd97d84c199bfc21c701a8fc2ea4222763e7b6e1 (diff)
downloadvolse-hubzilla-91e0733e8ef0640df20c18e91c61564458b091d1.tar.gz
volse-hubzilla-91e0733e8ef0640df20c18e91c61564458b091d1.tar.bz2
volse-hubzilla-91e0733e8ef0640df20c18e91c61564458b091d1.zip
Comanche: add greater/less than (plus greater/less than or equal) conditionals
Diffstat (limited to 'Zotlabs/Render/Comanche.php')
-rw-r--r--Zotlabs/Render/Comanche.php32
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))