add javascript escape parameter to escape modifier

This commit is contained in:
mohrt
2003-01-06 23:15:27 +00:00
parent 09f703480f
commit a7106ed311
4 changed files with 15 additions and 5 deletions

10
NEWS
View File

@@ -1,11 +1,13 @@
- add javascript parameter to escape modifier (Monte)
- added correct line numbers to syntax error messages
in compiler (Monte)
- added support for modifiers to function calls (Monte) - added support for modifiers to function calls (Monte)
- support return value for custom functions (Monte) - support return value for custom functions (Monte)
- can access constants via $smarty.const.FOO (Monte) - can access constants via $smarty.const.FOO (Monte)
- cleaned up regex code in compiler (Monte) - cleaned up regex code in compiler (Monte)
- can now pass modifiers to static content, - can now pass modifiers to static content (Monte)
among other minor syntax features (monte) - fix up regex code in compiler, more flexible and
- fix up regex code in compiler, make much more flexible maintainable (Monte)
(Monte)
- added support for object method access (Monte) - added support for object method access (Monte)
- added day_value_format to html_select_date (Marcus - added day_value_format to html_select_date (Marcus
Bointon, Monte) Bointon, Monte)

View File

@@ -8,7 +8,7 @@
<style-specification id="docbook-smarty-html" use="docbook"> <style-specification id="docbook-smarty-html" use="docbook">
<style-specification-body> <style-specification-body>
(define %html-ext% ".html") (define %html-ext% ".php")
&html-common.dsl; &html-common.dsl;
&common.dsl; &common.dsl;

View File

@@ -37,6 +37,10 @@ function smarty_modifier_escape($string, $esc_type = 'html')
} }
return $return; return $return;
case 'javascript':
// escape quotes and backslashes and newlines
return str_replace(array('\\','\'',"\r","\n"), array("\\\\", "\\'",'\r','\r'), $string);
default: default:
return $string; return $string;
} }

View File

@@ -37,6 +37,10 @@ function smarty_modifier_escape($string, $esc_type = 'html')
} }
return $return; return $return;
case 'javascript':
// escape quotes and backslashes and newlines
return str_replace(array('\\','\'',"\r","\n"), array("\\\\", "\\'",'\r','\r'), $string);
default: default:
return $string; return $string;
} }