]> git.mxchange.org Git - friendica.git/blob - library/Smarty/libs/plugins/modifiercompiler.from_charset.php
Merge branch 'master' of git://github.com/friendica/friendica
[friendica.git] / library / Smarty / libs / plugins / modifiercompiler.from_charset.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  *\r
5  * @package Smarty\r
6  * @subpackage PluginsModifierCompiler\r
7  */\r
8 \r
9 /**\r
10  * Smarty from_charset modifier plugin\r
11  *\r
12  * Type:     modifier<br>\r
13  * Name:     from_charset<br>\r
14  * Purpose:  convert character encoding from $charset to internal encoding\r
15  *\r
16  * @author Rodney Rehm\r
17  * @param array $params parameters\r
18  * @return string with compiled code\r
19  */\r
20 function smarty_modifiercompiler_from_charset($params, $compiler)\r
21 {\r
22     if (!Smarty::$_MBSTRING) {\r
23         // FIXME: (rodneyrehm) shouldn't this throw an error?\r
24         return $params[0];\r
25     }\r
26 \r
27     if (!isset($params[1])) {\r
28         $params[1] = '"ISO-8859-1"';\r
29     }\r
30 \r
31     return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';\r
32 }\r
33 \r
34 ?>