You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
773 B
PHTML
36 lines
773 B
PHTML
11 years ago
|
<?php
|
||
|
/**
|
||
|
* Smarty plugin
|
||
|
*
|
||
10 years ago
|
* @package Smarty
|
||
11 years ago
|
* @subpackage PluginsModifierCompiler
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Smarty default modifier plugin
|
||
7 years ago
|
* Type: modifier
|
||
|
* Name: default
|
||
11 years ago
|
* Purpose: designate default value for empty variables
|
||
|
*
|
||
10 years ago
|
* @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
|
||
11 years ago
|
* @author Uwe Tews
|
||
10 years ago
|
*
|
||
11 years ago
|
* @param array $params parameters
|
||
10 years ago
|
*
|
||
11 years ago
|
* @return string with compiled code
|
||
|
*/
|
||
10 years ago
|
function smarty_modifiercompiler_default($params)
|
||
11 years ago
|
{
|
||
7 years ago
|
$output = $params[ 0 ];
|
||
|
if (!isset($params[ 1 ])) {
|
||
|
$params[ 1 ] = "''";
|
||
11 years ago
|
}
|
||
|
|
||
|
array_shift($params);
|
||
|
foreach ($params as $param) {
|
||
|
$output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
|
||
|
}
|
||
|
|
||
|
return $output;
|
||
|
}
|