line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bootylicious::Plugin::Model; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2120
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
103
|
|
4
|
4
|
|
|
4
|
|
13
|
use warnings; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
77
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
12
|
use base 'Mojolicious::Plugin'; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
236
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
17
|
use Mojolicious::Controller; |
|
4
|
|
|
|
|
2
|
|
|
4
|
|
|
|
|
32
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
1318
|
use Bootylicious::Article; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
19
|
|
11
|
4
|
|
|
4
|
|
1402
|
use Bootylicious::ArticleArchive; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
14
|
|
12
|
4
|
|
|
4
|
|
1421
|
use Bootylicious::ArticleArchiveSimple; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
21
|
|
13
|
4
|
|
|
4
|
|
1372
|
use Bootylicious::ArticleByTagIterator; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
18
|
|
14
|
4
|
|
|
4
|
|
1353
|
use Bootylicious::ArticleByQueryIterator; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
19
|
|
15
|
4
|
|
|
4
|
|
1429
|
use Bootylicious::ArticleIteratorFinder; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
17
|
|
16
|
4
|
|
|
4
|
|
1422
|
use Bootylicious::ArticlePager; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
16
|
|
17
|
4
|
|
|
4
|
|
1385
|
use Bootylicious::Draft; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
30
|
|
18
|
4
|
|
|
4
|
|
1353
|
use Bootylicious::DraftIteratorLoader; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
18
|
|
19
|
4
|
|
|
4
|
|
1430
|
use Bootylicious::DraftIteratorFinder; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
31
|
|
20
|
4
|
|
|
4
|
|
93
|
use Bootylicious::IteratorSearchable; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
13
|
|
21
|
4
|
|
|
4
|
|
1325
|
use Bootylicious::Page; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
27
|
|
22
|
4
|
|
|
4
|
|
1415
|
use Bootylicious::PageIteratorLoader; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
20
|
|
23
|
4
|
|
|
4
|
|
85
|
use Bootylicious::PageIteratorFinder; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
36
|
|
24
|
4
|
|
|
4
|
|
1374
|
use Bootylicious::TagCloud; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
18
|
|
25
|
4
|
|
|
4
|
|
91
|
use Bootylicious::ArticleIteratorLoader; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
28
|
|
26
|
4
|
|
|
4
|
|
60
|
use Bootylicious::CommentIteratorLoader; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
17
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub register { |
29
|
5
|
|
|
5
|
1
|
209
|
my ($self, $app) = @_; |
30
|
|
|
|
|
|
|
|
31
|
5
|
|
|
|
|
23
|
my $c = Mojolicious::Controller->new(app => $app); |
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
|
|
66
|
my $config = $c->config; |
34
|
|
|
|
|
|
|
|
35
|
5
|
|
|
|
|
89
|
my $articles_root = $c->articles_root; |
36
|
5
|
|
|
|
|
144
|
my $pages_root = $c->pages_root; |
37
|
5
|
|
|
|
|
63
|
my $drafts_root = $c->drafts_root; |
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
42
|
my $page_limit = $config->{pagelimit}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$app->helper( |
42
|
|
|
|
|
|
|
get_pager => sub { |
43
|
0
|
|
|
0
|
|
0
|
shift; |
44
|
0
|
|
|
|
|
0
|
my $iterator = shift; |
45
|
0
|
|
|
|
|
0
|
Bootylicious::ArticlePager->new( |
46
|
|
|
|
|
|
|
limit => $page_limit, |
47
|
|
|
|
|
|
|
iterator => $iterator, |
48
|
|
|
|
|
|
|
@_ |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
} |
51
|
5
|
|
|
|
|
33
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$app->helper( |
54
|
|
|
|
|
|
|
get_articles => sub { |
55
|
5
|
|
|
5
|
|
10618
|
shift; |
56
|
|
|
|
|
|
|
|
57
|
5
|
|
|
|
|
57
|
Bootylicious::ArticlePager->new( |
58
|
|
|
|
|
|
|
iterator => Bootylicious::ArticleIteratorLoader->new( |
59
|
|
|
|
|
|
|
root => $articles_root |
60
|
|
|
|
|
|
|
)->load, |
61
|
|
|
|
|
|
|
limit => $page_limit, |
62
|
|
|
|
|
|
|
@_ |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
} |
65
|
5
|
|
|
|
|
77
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$app->helper( |
68
|
|
|
|
|
|
|
get_recent_articles => sub { |
69
|
1
|
|
|
1
|
|
9
|
my ($self, $limit) = @_; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
50
|
|
|
4
|
return Bootylicious::ArticleIteratorLoader->new( |
72
|
|
|
|
|
|
|
root => $articles_root)->load->next($limit || 5); |
73
|
|
|
|
|
|
|
} |
74
|
5
|
|
|
|
|
57
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$app->helper( |
77
|
|
|
|
|
|
|
get_recent_comments => sub { |
78
|
1
|
|
|
1
|
|
7
|
my ($self, $limit) = @_; |
79
|
1
|
|
50
|
|
|
10
|
Bootylicious::CommentIteratorLoader->new(root => $articles_root) |
80
|
|
|
|
|
|
|
->load->reverse->next($limit || 5); |
81
|
|
|
|
|
|
|
} |
82
|
5
|
|
|
|
|
50
|
); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$app->helper( |
85
|
|
|
|
|
|
|
get_archive => sub { |
86
|
3
|
|
|
3
|
|
96
|
shift; |
87
|
3
|
|
|
|
|
27
|
Bootylicious::ArticleArchive->new( |
88
|
|
|
|
|
|
|
articles => Bootylicious::ArticleIteratorLoader->new( |
89
|
|
|
|
|
|
|
root => $articles_root |
90
|
|
|
|
|
|
|
)->load, |
91
|
|
|
|
|
|
|
@_ |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
5
|
|
|
|
|
47
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$app->helper( |
97
|
|
|
|
|
|
|
get_archive_simple => sub { |
98
|
1
|
|
|
1
|
|
13
|
Bootylicious::ArticleArchiveSimple->new( |
99
|
|
|
|
|
|
|
articles => Bootylicious::ArticleIteratorLoader->new( |
100
|
|
|
|
|
|
|
root => $articles_root |
101
|
|
|
|
|
|
|
)->load, |
102
|
|
|
|
|
|
|
); |
103
|
|
|
|
|
|
|
} |
104
|
5
|
|
|
|
|
48
|
); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$app->helper( |
107
|
|
|
|
|
|
|
get_articles_by_tag => sub { |
108
|
1
|
|
|
1
|
|
29
|
my $self = shift; |
109
|
1
|
|
|
|
|
2
|
my $tag = shift; |
110
|
|
|
|
|
|
|
|
111
|
1
|
|
|
|
|
7
|
Bootylicious::ArticlePager->new( |
112
|
|
|
|
|
|
|
iterator => Bootylicious::ArticleByTagIterator->new( |
113
|
|
|
|
|
|
|
Bootylicious::ArticleIteratorLoader->new( |
114
|
|
|
|
|
|
|
root => $articles_root |
115
|
|
|
|
|
|
|
)->load, |
116
|
|
|
|
|
|
|
tag => $tag |
117
|
|
|
|
|
|
|
), |
118
|
|
|
|
|
|
|
limit => $page_limit, |
119
|
|
|
|
|
|
|
@_ |
120
|
|
|
|
|
|
|
); |
121
|
|
|
|
|
|
|
} |
122
|
5
|
|
|
|
|
47
|
); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
$app->helper( |
125
|
|
|
|
|
|
|
get_articles_by_query => sub { |
126
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
127
|
0
|
|
|
|
|
0
|
my $query = shift; |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
0
|
return Bootylicious::ArticleByQueryIterator->new( |
130
|
|
|
|
|
|
|
Bootylicious::ArticleIteratorLoader->new( |
131
|
|
|
|
|
|
|
root => $articles_root |
132
|
|
|
|
|
|
|
)->load, |
133
|
|
|
|
|
|
|
query => $query |
134
|
|
|
|
|
|
|
); |
135
|
|
|
|
|
|
|
} |
136
|
5
|
|
|
|
|
48
|
); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$app->helper( |
139
|
|
|
|
|
|
|
get_tag_cloud => sub { |
140
|
2
|
|
|
2
|
|
981
|
Bootylicious::TagCloud->new( |
141
|
|
|
|
|
|
|
articles => Bootylicious::ArticleIteratorLoader->new( |
142
|
|
|
|
|
|
|
root => $articles_root |
143
|
|
|
|
|
|
|
)->load |
144
|
|
|
|
|
|
|
); |
145
|
|
|
|
|
|
|
} |
146
|
5
|
|
|
|
|
46
|
); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
$app->helper( |
149
|
|
|
|
|
|
|
get_tags => sub { |
150
|
0
|
|
|
0
|
|
0
|
Bootylicious::TagCloud->new( |
151
|
|
|
|
|
|
|
articles => Bootylicious::ArticleIteratorLoader->new( |
152
|
|
|
|
|
|
|
root => $articles_root |
153
|
|
|
|
|
|
|
)->load |
154
|
|
|
|
|
|
|
); |
155
|
|
|
|
|
|
|
} |
156
|
5
|
|
|
|
|
53
|
); |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
$app->helper( |
159
|
|
|
|
|
|
|
get_article => sub { |
160
|
7
|
|
|
7
|
|
233
|
my $self = shift; |
161
|
7
|
|
|
|
|
58
|
Bootylicious::ArticleIteratorFinder->new( |
162
|
|
|
|
|
|
|
iterator => Bootylicious::ArticleIteratorLoader->new( |
163
|
|
|
|
|
|
|
root => $articles_root |
164
|
|
|
|
|
|
|
)->load |
165
|
|
|
|
|
|
|
)->find(@_); |
166
|
|
|
|
|
|
|
} |
167
|
5
|
|
|
|
|
56
|
); |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
$app->helper( |
170
|
|
|
|
|
|
|
get_page => sub { |
171
|
2
|
|
|
2
|
|
55
|
my $self = shift; |
172
|
2
|
|
|
|
|
5
|
my $name = shift; |
173
|
2
|
|
|
|
|
17
|
Bootylicious::PageIteratorFinder->new(iterator => |
174
|
|
|
|
|
|
|
Bootylicious::PageIteratorLoader->new(root => $pages_root) |
175
|
|
|
|
|
|
|
->load)->find($name); |
176
|
|
|
|
|
|
|
} |
177
|
5
|
|
|
|
|
66
|
); |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
$app->helper( |
180
|
|
|
|
|
|
|
get_draft => sub { |
181
|
1
|
|
|
1
|
|
29
|
my $self = shift; |
182
|
1
|
|
|
|
|
1
|
my $name = shift; |
183
|
|
|
|
|
|
|
|
184
|
1
|
|
|
|
|
7
|
Bootylicious::DraftIteratorFinder->new( |
185
|
|
|
|
|
|
|
iterator => Bootylicious::DraftIteratorLoader->new( |
186
|
|
|
|
|
|
|
root => $self->drafts_root |
187
|
|
|
|
|
|
|
)->load, |
188
|
|
|
|
|
|
|
)->find($name); |
189
|
|
|
|
|
|
|
} |
190
|
5
|
|
|
|
|
51
|
); |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
1; |