Esempio n. 1
0
/**
 * Smarty date_format modifier plugin
 *
 * Type:     modifier<br>
 * Name:     lang<br>
 * Purpose:  Traduit le code renseigné<br>
 * Input:<br>
 *         - code: Code de traduction
 *         - type: Type de variable
 *         - pref: Préfixe avant le code
 * @link http://www.tiloweb.com
 * @author   Tilotiti <contact at tiloweb dot com>
 * @param string
 * @return string|void
 */
function smarty_modifier_lang($code, $type = "text", $pref = false)
{
    if ($pref) {
        return lang::find($type, $pref . ":" . $code);
    } else {
        return lang::find($type, $code);
    }
}
Esempio n. 2
0
 /**
  * Generic method for sending message
  * @param String $type[optional] message type - default: success
  * @param String $lang[optional] lang code - default: none
  * @param String $uri[optional] URI to redirect to - default: current URI
  * @param Array $arg[optional] arguments for translated message
  * @return void
  */
 static function send($type = "success", $lang = "", $uri = false, $arg = false)
 {
     $_SESSION['message']['type'] = $type;
     if (!empty($lang)) {
         $_SESSION['message']['text'] = lang::find($type, $lang, $arg);
     }
     $_SESSION['debug'] = debug::$html;
     if (!$uri) {
         $page = get();
     } else {
         $page = $uri;
     }
     header("location: " . $page);
     exit;
 }