line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Filter::Base64; |
2
|
2
|
|
|
2
|
|
53356
|
use 5.008001; |
|
2
|
|
|
|
|
12
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
31
|
|
4
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
49
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
778
|
use Template::Plugin::Filter; |
|
2
|
|
|
|
|
9838
|
|
|
2
|
|
|
|
|
53
|
|
7
|
2
|
|
|
2
|
|
11
|
use base qw( Template::Plugin::Filter ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
107
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
876
|
use Encode; |
|
2
|
|
|
|
|
15998
|
|
|
2
|
|
|
|
|
121
|
|
10
|
2
|
|
|
2
|
|
706
|
use MIME::Base64 qw(encode_base64); |
|
2
|
|
|
|
|
912
|
|
|
2
|
|
|
|
|
110
|
|
11
|
2
|
|
|
2
|
|
754
|
use HTML::Entities qw(encode_entities_numeric); |
|
2
|
|
|
|
|
9082
|
|
|
2
|
|
|
|
|
543
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = "0.06"; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub init { |
16
|
5
|
|
|
5
|
0
|
60153
|
my ($self) = @_; |
17
|
5
|
|
|
|
|
14
|
$self->{_DYNAMIC} = 1; |
18
|
5
|
|
|
|
|
20
|
$self->install_filter('b64'); |
19
|
5
|
|
|
|
|
178
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub filter { |
23
|
5
|
|
|
5
|
0
|
356
|
my ($self, $text, $args, $conf) = @_; |
24
|
|
|
|
|
|
|
|
25
|
5
|
|
|
|
|
13
|
$conf = $self->merge_config($conf); |
26
|
|
|
|
|
|
|
|
27
|
5
|
100
|
|
|
|
59
|
if ($conf->{trim}) { |
28
|
4
|
|
|
|
|
16
|
$text =~ s/^\s+//ms; |
29
|
4
|
|
|
|
|
20
|
$text =~ s/\s+$//ms; |
30
|
|
|
|
|
|
|
} |
31
|
5
|
100
|
|
|
|
13
|
if($conf->{safeurl}){ |
32
|
1
|
|
|
|
|
5
|
return MIME::Base64::encode_base64url($text); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
7
|
my @encode_args = (); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
4
|
100
|
|
|
|
15
|
if ($conf->{use_html_entity}) { |
39
|
1
|
|
|
|
|
3
|
my $charset = $conf->{use_html_entity}; |
40
|
1
|
50
|
|
|
|
4
|
if($charset){ |
41
|
1
|
|
|
|
|
6
|
$text = decode($charset, $text) |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
|
|
2473
|
$text = Encode::encode('UTF-8',$text); |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
229
|
Encode::_utf8_on($text); |
46
|
1
|
|
|
|
|
4
|
$text = encode_entities_numeric($text); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
4
|
100
|
|
|
|
69
|
if ($conf->{dont_broken_into_lines_each_76_char}) { |
50
|
2
|
|
|
|
|
4
|
push @encode_args, ''; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
4
|
|
|
|
|
8
|
unshift @encode_args, $text; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
18
|
my $encoded = &encode_base64(@encode_args); |
56
|
|
|
|
|
|
|
|
57
|
4
|
|
|
|
|
23
|
return $encoded |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |