From 4d7bbf217aeaed75291301f31f612d6792751614 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Tue, 3 Jul 2012 09:07:33 +0000 Subject: [PATCH] // Smarty fix bugs with php version < 5.2.3 --- tools/smarty/plugins/modifier.escape.php | 4 ++++ .../plugins/modifiercompiler.escape.php | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/tools/smarty/plugins/modifier.escape.php b/tools/smarty/plugins/modifier.escape.php index cd2215fdb..680bcfe3f 100644 --- a/tools/smarty/plugins/modifier.escape.php +++ b/tools/smarty/plugins/modifier.escape.php @@ -48,7 +48,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ } // no MBString fallback + /* PrestaShop return htmlentities($string, ENT_QUOTES, $char_set, $double_encode); + */ + return htmlentities($string, ENT_QUOTES, $char_set); + /* END */ case 'url': return rawurlencode($string); diff --git a/tools/smarty/plugins/modifiercompiler.escape.php b/tools/smarty/plugins/modifiercompiler.escape.php index b4cd3c88c..b4f1f6638 100644 --- a/tools/smarty/plugins/modifiercompiler.escape.php +++ b/tools/smarty/plugins/modifiercompiler.escape.php @@ -36,12 +36,19 @@ function smarty_modifiercompiler_escape($params, $compiler) switch ($esc_type) { case 'html': + /* PrestaShop return 'htmlspecialchars(' . $params[0] .', ENT_QUOTES, ' . var_export($char_set, true) . ', ' . var_export($double_encode, true) . ')'; + */ + return 'htmlspecialchars(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ')'; + /* END */ case 'htmlall': + /* PrestaShop if (Smarty::$_MBSTRING) { return 'mb_convert_encoding(htmlspecialchars(' . $params[0] .', ENT_QUOTES, ' @@ -50,12 +57,27 @@ function smarty_modifiercompiler_escape($params, $compiler) . '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')'; } + */ + if (Smarty::$_MBSTRING) { + return 'mb_convert_encoding(htmlspecialchars(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) + . '), "HTML-ENTITIES", ' + . var_export($char_set, true) . ')'; + } + /* END */ // no MBString fallback + /* PrestaShop return 'htmlentities(' . $params[0] .', ENT_QUOTES, ' . var_export($char_set, true) . ', ' . var_export($double_encode, true) . ')'; + */ + return 'htmlentities(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ')'; + /* END */ case 'url': return 'rawurlencode(' . $params[0] . ')';