2009-03-22 16:09:05 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Smarty shared plugin
|
2010-08-17 15:39:51 +00:00
|
|
|
*
|
2014-06-06 02:40:04 +00:00
|
|
|
* @package Smarty
|
2009-03-22 16:09:05 +00:00
|
|
|
* @subpackage PluginsShared
|
|
|
|
|
*/
|
2016-07-23 22:37:17 +02:00
|
|
|
/**
|
|
|
|
|
* escape_special_chars common function
|
2017-11-11 07:11:33 +01:00
|
|
|
* Function: smarty_function_escape_special_chars
|
2016-07-23 22:37:17 +02:00
|
|
|
* Purpose: used by other smarty functions to escape
|
|
|
|
|
* special chars except for already escaped ones
|
|
|
|
|
*
|
2018-06-12 09:58:15 +02:00
|
|
|
* @author Monte Ohrt <monte at ohrt dot com>
|
2016-07-23 22:37:17 +02:00
|
|
|
*
|
2018-06-12 09:58:15 +02:00
|
|
|
* @param string $string text that should by escaped
|
2016-07-23 22:37:17 +02:00
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function smarty_function_escape_special_chars($string)
|
|
|
|
|
{
|
|
|
|
|
if (!is_array($string)) {
|
2022-11-30 00:25:27 +01:00
|
|
|
$string = htmlspecialchars($string, ENT_COMPAT, \Smarty\Smarty::$_CHARSET, false);
|
2013-07-14 22:15:45 +00:00
|
|
|
}
|
2016-07-23 22:37:17 +02:00
|
|
|
return $string;
|
2013-07-14 22:15:45 +00:00
|
|
|
}
|