Files
smarty/plugins/shared.escape_special_chars.php

27 lines
635 B
PHP
Raw Normal View History

<?php
/**
* Smarty shared plugin
2010-08-17 15:39:51 +00:00
*
* @package Smarty
* @subpackage PluginsShared
*/
/**
* escape_special_chars common function
2017-11-11 07:11:33 +01:00
* Function: smarty_function_escape_special_chars
* 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>
*
2018-06-12 09:58:15 +02:00
* @param string $string text that should by escaped
*
* @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);
}
return $string;
}