2003-02-24 21:45:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/*======================================================================*\
|
|
|
|
|
Function: smarty_function_escape_special_chars
|
|
|
|
|
Purpose: used by other smarty functions to escape
|
|
|
|
|
special chars except for already escaped ones
|
|
|
|
|
\*======================================================================*/
|
|
|
|
|
function smarty_function_escape_special_chars($string)
|
2003-04-14 16:57:40 +00:00
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
2003-02-24 21:45:19 +00:00
|
|
|
return $string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* vim: set expandtab: */
|
|
|
|
|
|
|
|
|
|
?>
|