00001 <?php
00038 function smarty_gettext_strarg($str)
00039 {
00040 $tr = array();
00041 $p = 0;
00042
00043 for ($i=1; $i < func_num_args(); $i++) {
00044 $arg = func_get_arg($i);
00045
00046 if (is_array($arg)) {
00047 foreach ($arg as $aarg) {
00048 $tr['%'.++$p] = $aarg;
00049 }
00050 } else {
00051 $tr['%'.++$p] = $arg;
00052 }
00053 }
00054
00055 return strtr($str, $tr);
00056 }
00057
00073 function smarty_block_t($params, $text, &$smarty)
00074 {
00075 $text = stripslashes($text);
00076
00077
00078 if (isset($params['escape'])) {
00079 $escape = $params['escape'];
00080 unset($params['escape']);
00081 }
00082
00083
00084 if (isset($params['plural'])) {
00085 $plural = $params['plural'];
00086 unset($params['plural']);
00087
00088
00089 if (isset($params['count'])) {
00090 $count = $params['count'];
00091 unset($params['count']);
00092 }
00093 }
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 $module = $smarty->_tpl_vars['module'];
00104 $key = strtoupper('STRING_'.md5($text));
00105 $text = I18n::t($text, $key, $module);
00106
00107
00108
00109 if (count($params)) {
00110 $text = smarty_gettext_strarg($text, $params);
00111 }
00112
00113 if (!isset($escape) || $escape == 'html') {
00114 $text = nl2br(htmlspecialchars($text));
00115 } elseif (isset($escape)) {
00116 switch ($escape) {
00117 case 'javascript':
00118 case 'js':
00119
00120 $text = str_replace('\'', '\\\'', stripslashes($text));
00121 break;
00122 case 'url':
00123
00124 $text = urlencode($text);
00125 break;
00126 }
00127 }
00128
00129 return $text;
00130 }
00131
00132 ?>