mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
fixed proper escaping of " and ' with escape:javascript
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- fixed proper escaping of " and ' with escape:javascript (messju)
|
||||||
- fixed bug in traversal of $smarty->plugins_dir-array. now the
|
- fixed bug in traversal of $smarty->plugins_dir-array. now the
|
||||||
first matching plugin is taken (messju)
|
first matching plugin is taken (messju)
|
||||||
- moved {strip} back into the compiler (messju)
|
- moved {strip} back into the compiler (messju)
|
||||||
|
@@ -51,7 +51,7 @@ function smarty_modifier_escape($string, $esc_type = 'html')
|
|||||||
|
|
||||||
case 'javascript':
|
case 'javascript':
|
||||||
// escape quotes and backslashes and newlines
|
// escape quotes and backslashes and newlines
|
||||||
return str_replace(array('\\','\'',"\r","\n"), array("\\\\", "\\'",'\r','\n'), $string);
|
return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n'));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return $string;
|
return $string;
|
||||||
|
Reference in New Issue
Block a user