1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: |
|
21: | function smarty_modifiercompiler_unescape($params, Smarty_Internal_TemplateCompilerBase $compiler)
|
22: | {
|
23: | $compiler->template->_checkPlugins(
|
24: | array(
|
25: | array(
|
26: | 'function' => 'smarty_literal_compiler_param',
|
27: | 'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'
|
28: | )
|
29: | )
|
30: | );
|
31: |
|
32: | $esc_type = smarty_literal_compiler_param($params, 1, 'html');
|
33: |
|
34: | if (!isset($params[ 2 ])) {
|
35: | $params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
|
36: | }
|
37: |
|
38: | switch ($esc_type) {
|
39: | case 'entity':
|
40: | case 'htmlall':
|
41: | if (Smarty::$_MBSTRING) {
|
42: | return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')';
|
43: | }
|
44: | return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')';
|
45: | case 'html':
|
46: | return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
|
47: | case 'url':
|
48: | return 'rawurldecode(' . $params[ 0 ] . ')';
|
49: | default:
|
50: | return $params[ 0 ];
|
51: | }
|
52: | }
|
53: | |