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