From 75bb450a6ece6b2e30ad4c148083b7192d7d7224 Mon Sep 17 00:00:00 2001 From: rvelices Date: Wed, 27 Feb 2008 02:31:51 +0000 Subject: - first smarty use ... (in admin.php and admin plugins page) git-svn-id: http://piwigo.org/svn/trunk@2216 68402e56-0260-453c-a942-63ccdbb3a9ee --- .../libs/plugins/shared.escape_special_chars.php | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/smarty/libs/plugins/shared.escape_special_chars.php (limited to 'include/smarty/libs/plugins/shared.escape_special_chars.php') diff --git a/include/smarty/libs/plugins/shared.escape_special_chars.php b/include/smarty/libs/plugins/shared.escape_special_chars.php new file mode 100644 index 000000000..c07ce31be --- /dev/null +++ b/include/smarty/libs/plugins/shared.escape_special_chars.php @@ -0,0 +1,31 @@ + + * Purpose: used by other smarty functions to escape + * special chars except for already escaped ones + * @author Monte Ohrt + * @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: */ + +?> -- cgit v1.2.3