X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=smarty%2FSmarty-2.6.10%2Flibs%2Fplugins%2Fshared.escape_special_chars.php;fp=smarty%2FSmarty-2.6.10%2Flibs%2Fplugins%2Fshared.escape_special_chars.php;h=515763abedc096e496cfbf3dd8424c197d0e387c;hb=b42b2bf946332ad8544d53f610be9cb05e80bf56;hp=0000000000000000000000000000000000000000;hpb=e586807dafc64c3fe152ab518599e6cf3f0f84e1;p=mirrors%2FKyberia-bloodline.git diff --git a/smarty/Smarty-2.6.10/libs/plugins/shared.escape_special_chars.php b/smarty/Smarty-2.6.10/libs/plugins/shared.escape_special_chars.php new file mode 100644 index 0000000..515763a --- /dev/null +++ b/smarty/Smarty-2.6.10/libs/plugins/shared.escape_special_chars.php @@ -0,0 +1,30 @@ + + * Purpose: used by other smarty functions to escape + * special chars except for already escaped ones + * @param string + * @return string + */ +function smarty_function_escape_special_chars($string) +{ + if(!is_array($string)) { + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlspecialchars($string); + $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string); + } + return $string; +} + +/* vim: set expandtab: */ + +?>