From 84d94906d2cb2bac8052400c9ffd76ed9b6a1eba Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 14 Jun 2014 14:15:05 +0000 Subject: add dark selectize theme + "ternary" template modifier git-svn-id: http://piwigo.org/svn/trunk@28703 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/template.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include/template.class.php') 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 -- cgit v1.2.3