first commit
This commit is contained in:
36
class/smarty_plugins/function.get_greeting.php
Normal file
36
class/smarty_plugins/function.get_greeting.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* Type: function
|
||||
* Name: get_greeting
|
||||
* Purpose: get a greeting for given name/surname
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @param array $params
|
||||
* @param Smarty $smarty
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function smarty_function_get_greeting($params, &$smarty)
|
||||
{
|
||||
$name = null;
|
||||
$surname = null;
|
||||
$prioritize = 'name';
|
||||
|
||||
extract($params);
|
||||
|
||||
if (empty($name) && empty($surname)) {
|
||||
echo 'Chybí jméno/příjmení';
|
||||
}
|
||||
|
||||
$ret = User::getGreeting($name, $surname, $prioritize);
|
||||
|
||||
if (!empty($assign)) {
|
||||
$smarty->assign($assign, $ret);
|
||||
} else {
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user