6 * @subpackage PluginsModifierCompiler
10 * Smarty unescape modifier plugin
13 * Purpose: unescape html entities
17 * @param array $params parameters
19 * @return string with compiled code
21 function smarty_modifiercompiler_unescape($params)
23 if (!isset($params[1])) {
26 if (!isset($params[2])) {
27 $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
29 $params[2] = "'" . $params[2] . "'";
32 switch (trim($params[1], '"\'')) {
35 if (Smarty::$_MBSTRING) {
36 return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
39 return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
42 return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
45 return 'rawurldecode(' . $params[0] . ')';