line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Date; |
2
|
3
|
|
|
3
|
|
1965
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
3
|
|
|
3
|
|
6
|
|
|
3
|
|
|
3
|
|
73
|
|
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
72
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
98
|
|
3
|
3
|
|
|
3
|
|
14
|
use parent 'DTL::Fast::Filter'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
14
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'date'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
168
|
use DTL::Fast::Utils; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
585
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
#@todo make pre-defined formats from Django |
11
|
|
|
|
|
|
|
sub parse_parameters |
12
|
|
|
|
|
|
|
{ |
13
|
3
|
|
|
3
|
0
|
5
|
my $self = shift; |
14
|
0
|
|
|
|
|
0
|
push @{$self->{'parameter'}}, DTL::Fast::Variable->new('"DATE_FORMAT"') |
15
|
3
|
50
|
|
|
|
5
|
if not scalar @{$self->{'parameter'}}; |
|
3
|
|
|
|
|
10
|
|
16
|
3
|
|
|
|
|
6
|
$self->{'format'} = $self->{'parameter'}->[0]; |
17
|
3
|
|
|
|
|
11
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#@Override |
21
|
|
|
|
|
|
|
sub filter |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; # self |
24
|
0
|
|
|
|
|
|
shift; # filter_manager |
25
|
0
|
|
|
|
|
|
my $value = shift; |
26
|
0
|
|
|
|
|
|
my $context = shift; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $format = $self->{'format'}->render($context); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return DTL::Fast::Utils::time2str_php($format, $value); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |