fixed proper escaping of " and ' with escape:javascript

This commit is contained in:
messju
2003-08-25 13:37:27 +00:00
parent dd8b56734e
commit 4b4157de20
2 changed files with 2 additions and 1 deletions

1
NEWS
View File

@@ -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)

View File

@@ -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;