From 518ed6b5bd287b66ea4d8495d319640541878dea Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 7 Jan 2008 15:36:24 +0000 Subject: [PATCH] =?utf8?q?Ein=20Template-Plugin=20zum=20Escape=20von=20Ang?= =?utf8?q?aben=20f=C3=BCr=20JavaScript-Strings.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Template/Plugin/JavaScript.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 SL/Template/Plugin/JavaScript.pm 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; + + -- 2.20.1