Dotclear

source: plugins/widgets/_default_widgets.php @ 904:f1fd70475361

Revision 904:f1fd70475361, 4.8 KB checked in by franck <carnet.franck.paul@…>, 13 years ago (diff)

Add class attribute (applied to encapsulated div) for standard widgets - Fixes #1230

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

Sites map