From 110ba159d2f26c98194740b7b33f350b08964fce Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Tue, 10 Jul 2012 08:30:34 +0200 Subject: [PATCH] Implement isempty operation --- class.templater.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/class.templater.php b/class.templater.php index 6d4801c..2bf9010 100644 --- a/class.templater.php +++ b/class.templater.php @@ -742,6 +742,30 @@ class TemplateIfElement extends TemplateSyntaxElement return ""; } } + elseif($this->operation == "isempty") + { + $a = $this->FetchVariable($this->left, $data); + + $empty = empty($a); + + if($this->right == "false") + { + $desired = false; + } + else + { + $desired = true; + } + + if($empty == $desired) + { + return parent::Evaluate($data); + } + else + { + return ""; + } + } } }