Revision 1347,
1.1 KB
checked in by philippe, 14 years ago
(diff) |
New plugin Advanced Tags List created
|
Line | |
---|
1 | <?php |
---|
2 | require dirname(__FILE__).'/_widget.php'; |
---|
3 | |
---|
4 | class publicAdvancedTagList |
---|
5 | { |
---|
6 | public static function advancedTagList(&$w) |
---|
7 | { |
---|
8 | global $core; |
---|
9 | |
---|
10 | $limit = abs((integer) $w->limit); |
---|
11 | |
---|
12 | $objMeta = new dcMeta($core); |
---|
13 | $rs = $objMeta->getMeta('tag',$limit); |
---|
14 | |
---|
15 | if ($rs->isEmpty()) { |
---|
16 | return; |
---|
17 | } |
---|
18 | |
---|
19 | if ($w->homeonly && $core->url->type != 'default') { |
---|
20 | return; |
---|
21 | } |
---|
22 | |
---|
23 | $sort = $w->sortby; |
---|
24 | if (!in_array($sort,array('meta_id_lower','count'))) { |
---|
25 | $sort = 'meta_id_lower'; |
---|
26 | } |
---|
27 | |
---|
28 | $order = $w->orderby; |
---|
29 | if ($order != 'asc') { |
---|
30 | $order = 'desc'; |
---|
31 | } |
---|
32 | |
---|
33 | $rs->sort($sort,$order); |
---|
34 | |
---|
35 | $res = |
---|
36 | '<div class="tags">'. |
---|
37 | ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''). |
---|
38 | '<ul>'; |
---|
39 | |
---|
40 | while ($rs->fetch()) { |
---|
41 | $k = $rs->meta_id; |
---|
42 | if ($w->$k) { |
---|
43 | $res .= |
---|
44 | '<li><a href="'.$core->blog->url.$core->url->getBase('tag').'/'.rawurlencode($rs->meta_id).'">'. |
---|
45 | html::escapeHTML($rs->meta_id).'</a>'. |
---|
46 | ($w->postcount ? ' ('.$rs->count.')' : ''). |
---|
47 | '</li>'; |
---|
48 | } |
---|
49 | } |
---|
50 | $res .= '</ul>'; |
---|
51 | $res .= '</div>'; |
---|
52 | |
---|
53 | return $res; |
---|
54 | } |
---|
55 | } |
---|
56 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.