6 * @subpackage PluginsShared
9 if (version_compare(PHP_VERSION, '5.2.3', '>=')) {
11 * escape_special_chars common function
12 * Function: smarty_function_escape_special_chars<br>
13 * Purpose: used by other smarty functions to escape
14 * special chars except for already escaped ones
16 * @author Monte Ohrt <monte at ohrt dot com>
18 * @param string $string text that should by escaped
22 function smarty_function_escape_special_chars($string)
24 if (!is_array($string)) {
25 $string = htmlspecialchars($string, ENT_COMPAT, Smarty::$_CHARSET, false);
32 * escape_special_chars common function
33 * Function: smarty_function_escape_special_chars<br>
34 * Purpose: used by other smarty functions to escape
35 * special chars except for already escaped ones
37 * @author Monte Ohrt <monte at ohrt dot com>
39 * @param string $string text that should by escaped
43 function smarty_function_escape_special_chars($string)
45 if (!is_array($string)) {
46 $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
47 $string = htmlspecialchars($string);
48 $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);