Dotclear

source: plugins/muppet/_widgets.php @ 2313

Revision 2313, 2.2 KB checked in by Osku, 3 years ago (diff)

New plugin : muppet

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2009 Olivier Meunier 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 ------------------------------------
12if (!defined('DC_RC_PATH')) { return; }
13
14$mytypes = muppet::getPostTypes();
15if (!empty($mytypes))
16{
17     $core->addBehavior('initWidgets',array('muppetWidgets','initWidgetsMuppetBestof'));
18     $core->addBehavior('initWidgets',array('muppetWidgets','initWidgetsMuppetLastPosts'));
19}
20
21class muppetWidgets
22{
23     public static function initWidgetsMuppetBestof($w)
24     {
25          $w->create('bestofMuppetWidget',__('Muppet: selected entries'),array('widgetsMuppet','bestofWidget'));
26          $w->bestofMuppetWidget->setting('title',__('Title:'),__('Best of me'));
27          $w->bestofMuppetWidget->setting('homeonly',__('Home page only'),1,'check');
28          $ty = muppet::getPostTypes();
29          $types = array('' => '');
30          foreach ($ty as $k =>$v) {
31               $types[ucfirst($v['name'])] = $k;
32          }
33          $w->bestofMuppetWidget->setting('posttype',__('Type:'),'','combo',$types);
34          unset($ty,$types);
35     }
36     public static function initWidgetsMuppetLastPosts($w)
37     {
38          global $core;
39          $w->create('lastthreadsMuppetWidget',__('Muppet: last posts'),array('widgetsMuppet','lastpostsWidget'));;
40          $w->lastthreadsMuppetWidget->setting('title',__('Title:'),__('Last entries'));
41          $rs = $core->blog->getCategories();
42          $categories = array('' => '', __('Uncategorized') => 'null');
43          while ($rs->fetch()) {
44               $categories[str_repeat('&nbsp;&nbsp;',$rs->level-1).'&bull; '.html::escapeHTML($rs->cat_title)] = $rs->cat_id;
45          }
46          $w->lastthreadsMuppetWidget->setting('category',__('Category:'),'','combo',$categories);
47          unset($rs,$categories);
48          $w->lastthreadsMuppetWidget->setting('limit',__('Entries limit:'),10);
49          $w->lastthreadsMuppetWidget->setting('homeonly',__('Home page only'),1,'check');
50          $ty = muppet::getPostTypes();
51          $types = array('' => '');
52          foreach ($ty as $k =>$v) {
53               $types[ucfirst($v['name'])] = $k;
54          }
55          $w->lastthreadsMuppetWidget->setting('posttype',__('Type:'),'','combo',$types);
56          unset($ty,$types);
57     }
58}
59?>
Note: See TracBrowser for help on using the repository browser.

Sites map