Revision 1704,
1.5 KB
checked in by kozlika, 13 years ago
(diff) |
Spéciale cassededi pour Philippe le Rebelle histoire que je puisse corriger ses plougs.
|
Line | |
---|
1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of AdvancedTagList, a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2009 Philippe Amalgame and contributors |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ------------------------------------ |
---|
12 | |
---|
13 | require dirname(__FILE__).'/_widget.php'; |
---|
14 | |
---|
15 | class publicAdvancedTagList |
---|
16 | { |
---|
17 | public static function advancedTagList(&$w) |
---|
18 | { |
---|
19 | global $core; |
---|
20 | |
---|
21 | $limit = abs((integer) $w->limit); |
---|
22 | |
---|
23 | $objMeta = new dcMeta($core); |
---|
24 | $rs = $objMeta->getMeta('tag',$limit); |
---|
25 | |
---|
26 | if ($rs->isEmpty()) { |
---|
27 | return; |
---|
28 | } |
---|
29 | |
---|
30 | if ($w->homeonly && $core->url->type != 'default') { |
---|
31 | return; |
---|
32 | } |
---|
33 | |
---|
34 | $sort = $w->sortby; |
---|
35 | if (!in_array($sort,array('meta_id_lower','count'))) { |
---|
36 | $sort = 'meta_id_lower'; |
---|
37 | } |
---|
38 | |
---|
39 | $order = $w->orderby; |
---|
40 | if ($order != 'asc') { |
---|
41 | $order = 'desc'; |
---|
42 | } |
---|
43 | |
---|
44 | $rs->sort($sort,$order); |
---|
45 | |
---|
46 | $res = |
---|
47 | '<div class="tags">'. |
---|
48 | ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). |
---|
49 | '<ul>'; |
---|
50 | |
---|
51 | while ($rs->fetch()) { |
---|
52 | $k = $rs->meta_id; |
---|
53 | if ($w->$k) { |
---|
54 | $res .= |
---|
55 | '<li><a href="'.$core->blog->url.$core->url->getBase('tag').'/'.rawurlencode($rs->meta_id).'">'. |
---|
56 | html::escapeHTML($rs->meta_id).'</a>'. |
---|
57 | ($w->postcount ? ' ('.$rs->count.')' : ''). |
---|
58 | '</li>'; |
---|
59 | } |
---|
60 | } |
---|
61 | $res .= '</ul>'; |
---|
62 | $res .= '</div>'; |
---|
63 | |
---|
64 | return $res; |
---|
65 | } |
---|
66 | } |
---|
67 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.