aboutsummaryrefslogtreecommitdiffstats
path: root/include/template.class.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-06-14 14:15:05 +0000
committermistic100 <mistic@piwigo.org>2014-06-14 14:15:05 +0000
commit84d94906d2cb2bac8052400c9ffd76ed9b6a1eba (patch)
tree84178b090cf92fc3ac95fcd80eb109a66bfeb032 /include/template.class.php
parent296ae7021e75f555da9066232faa8da3a1225f4b (diff)
add dark selectize theme + "ternary" template modifier
git-svn-id: http://piwigo.org/svn/trunk@28703 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/template.class.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/template.class.php b/include/template.class.php
index d0387b138..056d54102 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -121,6 +121,7 @@ class Template
$this->smarty->registerPlugin('modifiercompiler', 'translate', array('Template', 'modcompiler_translate') );
$this->smarty->registerPlugin('modifiercompiler', 'translate_dec', array('Template', 'modcompiler_translate_dec') );
$this->smarty->registerPlugin('modifier', 'explode', array('Template', 'mod_explode') );
+ $this->smarty->registerPlugin('modifier', 'ternary', array('Template', 'mod_ternary') );
$this->smarty->registerPlugin('modifier', 'get_extent', array($this, 'get_extent') );
$this->smarty->registerPlugin('block', 'html_head', array($this, 'block_html_head') );
$this->smarty->registerPlugin('block', 'html_style', array($this, 'block_html_style') );
@@ -665,7 +666,7 @@ class Template
/**
* "explode" variable modifier.
* Usage :
- * - {assign var=valueExploded value=$value|@explode:','}
+ * - {assign var=valueExploded value=$value|explode:','}
*
* @param string $text
* @param string $delimiter
@@ -675,6 +676,21 @@ class Template
{
return explode($delimiter, $text);
}
+
+ /**
+ * ternary variable modifier.
+ * Usage :
+ * - {$variable|ternary:'yes':'no'}
+ *
+ * @param mixed $param
+ * @param mixed $true
+ * @param mixed $false
+ * @return mixed
+ */
+ static function mod_ternary($param, $true, $false)
+ {
+ return $param ? $true : $false;
+ }
/**
* The "html_head" block allows to add content just before