line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Escapejs; |
2
|
2
|
|
|
2
|
|
750
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
68
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
58
|
|
3
|
2
|
|
|
2
|
|
5
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'escapejs'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $CHARMAP = { |
8
|
|
|
|
|
|
|
"\n" => '\n', |
9
|
|
|
|
|
|
|
"\r" => '\r', |
10
|
|
|
|
|
|
|
"\t" => '\t', |
11
|
|
|
|
|
|
|
"\0" => '\0', |
12
|
|
|
|
|
|
|
"\'" => '\'', |
13
|
|
|
|
|
|
|
"\"" => '\"', |
14
|
|
|
|
|
|
|
}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#@Override |
17
|
|
|
|
|
|
|
sub filter |
18
|
|
|
|
|
|
|
{ |
19
|
1
|
|
|
1
|
0
|
1
|
shift; # self |
20
|
1
|
|
|
|
|
1
|
my $filter_manager = shift; # filter_manager |
21
|
1
|
|
|
|
|
0
|
my $value = shift; # value |
22
|
1
|
|
|
|
|
1
|
shift; # context |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
1
|
$filter_manager->{'safe'} = 1; |
25
|
1
|
|
|
|
|
13
|
$value =~ s/([\n\r\t\0'"])/$CHARMAP->{$1}/gs; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
4
|
return $value; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |