fix last commit
[GitHub/Stricted/Domain-Control-Panel.git] / lib / api / smarty / plugins / modifiercompiler.from_charset.php
CommitLineData
2aa91ff2
S
1<?php
2/**
3 * Smarty plugin
4 *
5 * @package Smarty
6 * @subpackage PluginsModifierCompiler
7 */
8
9/**
10 * Smarty from_charset modifier plugin
11 * Type: modifier<br>
12 * Name: from_charset<br>
13 * Purpose: convert character encoding from $charset to internal encoding
14 *
15 * @author Rodney Rehm
16 *
17 * @param array $params parameters
18 *
19 * @return string with compiled code
20 */
21function smarty_modifiercompiler_from_charset($params)
22{
23 if (!Smarty::$_MBSTRING) {
24 // FIXME: (rodneyrehm) shouldn't this throw an error?
25 return $params[0];
26 }
27
28 if (!isset($params[1])) {
29 $params[1] = '"ISO-8859-1"';
30 }
31
32 return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';
33}