1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear |
---|
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 | if (!defined('DC_RC_PATH')) { return; } |
---|
13 | |
---|
14 | require dirname(__FILE__).'/class.widgets.php'; |
---|
15 | |
---|
16 | # Available widgets |
---|
17 | global $__widgets; |
---|
18 | $__widgets = new dcWidgets; |
---|
19 | |
---|
20 | $__widgets->create('search',__('Search engine'),array('defaultWidgets','search')); |
---|
21 | $__widgets->search->setting('title',__('Title:'),__('Search')); |
---|
22 | |
---|
23 | $__widgets->create('navigation',__('Navigation links'),array('defaultWidgets','navigation')); |
---|
24 | $__widgets->navigation->setting('title',__('Title:'),''); |
---|
25 | |
---|
26 | $__widgets->create('bestof',__('Selected entries'),array('defaultWidgets','bestof')); |
---|
27 | $__widgets->bestof->setting('title',__('Title:'),__('Best of me')); |
---|
28 | $__widgets->bestof->setting('orderby',__('Sort:'),'asc','combo',array(__('Ascending') => 'asc', __('Descending') => 'desc')); |
---|
29 | $__widgets->bestof->setting('homeonly',__('Home page only'),1,'check'); |
---|
30 | |
---|
31 | $__widgets->create('langs',__('Blog languages'),array('defaultWidgets','langs')); |
---|
32 | $__widgets->langs->setting('title',__('Title:'),__('Languages')); |
---|
33 | $__widgets->langs->setting('homeonly',__('Home page only'),1,'check'); |
---|
34 | |
---|
35 | $__widgets->create('categories',__('Categories list'),array('defaultWidgets','categories')); |
---|
36 | $__widgets->categories->setting('title',__('Title:'),__('Categories')); |
---|
37 | $__widgets->categories->setting('postcount',__('With entries counts'),0,'check'); |
---|
38 | |
---|
39 | $__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe')); |
---|
40 | $__widgets->subscribe->setting('title',__('Title:'),__('Subscribe')); |
---|
41 | $__widgets->subscribe->setting('type',__('Feeds type:'),'atom','combo',array('Atom' => 'atom', 'RSS' => 'rss2')); |
---|
42 | $__widgets->subscribe->setting('homeonly',__('Home page only'),0,'check'); |
---|
43 | |
---|
44 | $__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed')); |
---|
45 | $__widgets->feed->setting('title',__('Title:'),__('Somewhere else')); |
---|
46 | $__widgets->feed->setting('url',__('Feed URL:'),''); |
---|
47 | $__widgets->feed->setting('limit',__('Entries limit:'),10); |
---|
48 | $__widgets->feed->setting('homeonly',__('Home page only'),1,'check'); |
---|
49 | |
---|
50 | $__widgets->create('text',__('Text'),array('defaultWidgets','text')); |
---|
51 | $__widgets->text->setting('title',__('Title:'),''); |
---|
52 | $__widgets->text->setting('text',__('Text:'),'','textarea'); |
---|
53 | $__widgets->text->setting('homeonly',__('Home page only'),0,'check'); |
---|
54 | |
---|
55 | $__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts')); |
---|
56 | $__widgets->lastposts->setting('title',__('Title:'),__('Last entries')); |
---|
57 | $rs = $core->blog->getCategories(array('post_type'=>'post')); |
---|
58 | $categories = array('' => '', __('Uncategorized') => 'null'); |
---|
59 | while ($rs->fetch()) { |
---|
60 | $categories[str_repeat(' ',$rs->level-1).($rs->level-1 == 0 ? '' : '• ').html::escapeHTML($rs->cat_title)] = $rs->cat_id; |
---|
61 | } |
---|
62 | $__widgets->lastposts->setting('category',__('Category:'),'','combo',$categories); |
---|
63 | unset($rs,$categories); |
---|
64 | if ($core->plugins->moduleExists('tags')) { |
---|
65 | $__widgets->lastposts->setting('tag',__('Tag:'),''); |
---|
66 | } |
---|
67 | $__widgets->lastposts->setting('limit',__('Entries limit:'),10); |
---|
68 | $__widgets->lastposts->setting('homeonly',__('Home page only'),1,'check'); |
---|
69 | |
---|
70 | |
---|
71 | $__widgets->create('lastcomments',__('Last comments'),array('defaultWidgets','lastcomments')); |
---|
72 | $__widgets->lastcomments->setting('title',__('Title:'),__('Last comments')); |
---|
73 | $__widgets->lastcomments->setting('limit',__('Comments limit:'),10); |
---|
74 | $__widgets->lastcomments->setting('homeonly',__('Home page only'),1,'check'); |
---|
75 | |
---|
76 | # --BEHAVIOR-- initWidgets |
---|
77 | $core->callBehavior('initWidgets',$__widgets); |
---|
78 | |
---|
79 | # Default widgets |
---|
80 | global $__default_widgets; |
---|
81 | $__default_widgets = array('nav'=> new dcWidgets(), 'extra'=> new dcWidgets()); |
---|
82 | |
---|
83 | $__default_widgets['nav']->append($__widgets->search); |
---|
84 | $__default_widgets['nav']->append($__widgets->navigation); |
---|
85 | $__default_widgets['nav']->append($__widgets->bestof); |
---|
86 | $__default_widgets['nav']->append($__widgets->categories); |
---|
87 | $__default_widgets['extra']->append($__widgets->subscribe); |
---|
88 | |
---|
89 | # --BEHAVIOR-- initDefaultWidgets |
---|
90 | $core->callBehavior('initDefaultWidgets',$__widgets,$__default_widgets); |
---|
91 | ?> |
---|