mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
add char_set param
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- add char_set parameter to escape modifier (Loading, monte)
|
||||||
- fix notice in debug security check (Drakla, monte)
|
- fix notice in debug security check (Drakla, monte)
|
||||||
- return valid reference in get_template_vars() when given var is
|
- return valid reference in get_template_vars() when given var is
|
||||||
non-existant (monte)
|
non-existant (monte)
|
||||||
|
@@ -18,14 +18,14 @@
|
|||||||
* @param html|htmlall|url|quotes|hex|hexentity|javascript
|
* @param html|htmlall|url|quotes|hex|hexentity|javascript
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_modifier_escape($string, $esc_type = 'html')
|
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'UTF-8')
|
||||||
{
|
{
|
||||||
switch ($esc_type) {
|
switch ($esc_type) {
|
||||||
case 'html':
|
case 'html':
|
||||||
return htmlspecialchars($string, ENT_QUOTES);
|
return htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||||
|
|
||||||
case 'htmlall':
|
case 'htmlall':
|
||||||
return htmlentities($string, ENT_QUOTES);
|
return htmlentities($string, ENT_QUOTES, $char_set);
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
return rawurlencode($string);
|
return rawurlencode($string);
|
||||||
|
Reference in New Issue
Block a user