line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Escapejs; |
2
|
2
|
|
|
2
|
|
1172
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
4
|
|
|
2
|
|
|
2
|
|
47
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
49
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
69
|
|
3
|
2
|
|
|
2
|
|
9
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
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
|
2
|
shift; # self |
20
|
1
|
|
|
|
|
2
|
my $filter_manager = shift; # filter_manager |
21
|
1
|
|
|
|
|
1
|
my $value = shift; # value |
22
|
1
|
|
|
|
|
2
|
shift; # context |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
2
|
$filter_manager->{'safe'} = 1; |
25
|
1
|
|
|
|
|
21
|
$value =~ s/([\n\r\t\0'"])/$CHARMAP->{$1}/gs; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
5
|
return $value; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |