From: Moritz Bunkus Date: Mon, 7 Jan 2008 15:36:24 +0000 (+0000) Subject: Ein Template-Plugin zum Escape von Angaben für JavaScript-Strings. X-Git-Tag: release-2.6.0beta1~377 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=518ed6b5bd287b66ea4d8495d319640541878dea;p=kivitendo-erp.git Ein Template-Plugin zum Escape von Angaben für JavaScript-Strings. --- diff --git a/SL/Template/Plugin/JavaScript.pm b/SL/Template/Plugin/JavaScript.pm new file mode 100644 index 000000000..467c59111 --- /dev/null +++ b/SL/Template/Plugin/JavaScript.pm @@ -0,0 +1,24 @@ +package SL::Template::Plugin::JavaScript; + +use base qw( Template::Plugin ); +use Template::Plugin; + +sub new { + my $class = shift; + my $context = shift; + + bless { }, $class; +} + +sub escape { + my $self = shift; + my $text = shift; + + $text =~ s|\"|\\\"|g; + + return $text; +} + +1; + +