Dotclear

source: plugins/widgets/_default_widgets.php @ 1610:2d5ebb2fcdfd

Revision 1610:2d5ebb2fcdfd, 7.0 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Fixes #472, <tpl:Categories> (new without_empty="0" attribute) and categories' widget ("Include empty categories" checkbox) may includes empty categories.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 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'),null,'Search engine form');
21$__widgets->search->setting('title',__('Title:'),__('Search'));
22$__widgets->search->setting('homeonly',__('Display on:'),0,'combo',
23     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
24$__widgets->search->setting('content_only',__('Content only'),0,'check');
25$__widgets->search->setting('class',__('CSS class:'),'');
26
27$__widgets->create('navigation',__('Navigation links'),array('defaultWidgets','navigation'),null,'List of navigation links');
28$__widgets->navigation->setting('title',__('Title:'),'');
29$__widgets->navigation->setting('homeonly',__('Display on:'),0,'combo',
30     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
31$__widgets->navigation->setting('content_only',__('Content only'),0,'check');
32$__widgets->navigation->setting('class',__('CSS class:'),'');
33
34$__widgets->create('bestof',__('Selected entries'),array('defaultWidgets','bestof'),null,'List of selected entries');
35$__widgets->bestof->setting('title',__('Title:'),__('Best of me'));
36$__widgets->bestof->setting('orderby',__('Sort:'),'asc','combo',array(__('Ascending') => 'asc', __('Descending') => 'desc'));
37$__widgets->bestof->setting('homeonly',__('Display on:'),1,'combo',
38     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
39$__widgets->bestof->setting('content_only',__('Content only'),0,'check');
40$__widgets->bestof->setting('class',__('CSS class:'),'');
41
42$__widgets->create('langs',__('Blog languages'),array('defaultWidgets','langs'),null,'List of available languages');
43$__widgets->langs->setting('title',__('Title:'),__('Languages'));
44$__widgets->langs->setting('homeonly',__('Display on:'),1,'combo',
45     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
46$__widgets->langs->setting('content_only',__('Content only'),0,'check');
47$__widgets->langs->setting('class',__('CSS class:'),'');
48
49$__widgets->create('categories',__('Categories'),array('defaultWidgets','categories'),null,'List of categories');
50$__widgets->categories->setting('title',__('Title:'),__('Categories'));
51$__widgets->categories->setting('postcount',__('With entries counts'),0,'check');
52$__widgets->categories->setting('with_empty',__('Include empty categories'),0,'check');
53$__widgets->categories->setting('homeonly',__('Display on:'),0,'combo',
54     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
55$__widgets->categories->setting('content_only',__('Content only'),0,'check');
56$__widgets->categories->setting('class',__('CSS class:'),'');
57
58$__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe'),null,'RSS or Atom feed subscription links');
59$__widgets->subscribe->setting('title',__('Title:'),__('Subscribe'));
60$__widgets->subscribe->setting('type',__('Feeds type:'),'atom','combo',array('Atom' => 'atom', 'RSS' => 'rss2'));
61$__widgets->subscribe->setting('homeonly',__('Display on:'),1,'combo',
62     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
63$__widgets->subscribe->setting('content_only',__('Content only'),0,'check');
64$__widgets->subscribe->setting('class',__('CSS class:'),'');
65
66$__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed'),null,'Last entries from feed');
67$__widgets->feed->setting('title',__('Title:'),__('Somewhere else'));
68$__widgets->feed->setting('url',__('Feed URL:'),'');
69$__widgets->feed->setting('limit',__('Entries limit:'),10);
70$__widgets->feed->setting('homeonly',__('Display on:'),1,'combo',
71     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
72$__widgets->feed->setting('content_only',__('Content only'),0,'check');
73$__widgets->feed->setting('class',__('CSS class:'),'');
74
75$__widgets->create('text',__('Text'),array('defaultWidgets','text'),null,'Simple text');
76$__widgets->text->setting('title',__('Title:'),'');
77$__widgets->text->setting('text',__('Text:'),'','textarea');
78$__widgets->text->setting('homeonly',__('Display on:'),0,'combo',
79     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
80$__widgets->text->setting('content_only',__('Content only'),0,'check');
81$__widgets->text->setting('class',__('CSS class:'),'');
82
83$__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts'),null,'List of last entries published');
84$__widgets->lastposts->setting('title',__('Title:'),__('Last entries'));
85$rs = $core->blog->getCategories(array('post_type'=>'post'));
86$categories = array('' => '', __('Uncategorized') => 'null');
87while ($rs->fetch()) {
88     $categories[str_repeat('&nbsp;&nbsp;',$rs->level-1).($rs->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($rs->cat_title)] = $rs->cat_id;
89}
90$__widgets->lastposts->setting('category',__('Category:'),'','combo',$categories);
91unset($rs,$categories);
92if ($core->plugins->moduleExists('tags')) {
93     $__widgets->lastposts->setting('tag',__('Tag:'),'');
94}
95$__widgets->lastposts->setting('limit',__('Entries limit:'),10);
96$__widgets->lastposts->setting('homeonly',__('Display on:'),1,'combo',
97     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
98$__widgets->lastposts->setting('content_only',__('Content only'),0,'check');
99$__widgets->lastposts->setting('class',__('CSS class:'),'');
100
101$__widgets->create('lastcomments',__('Last comments'),array('defaultWidgets','lastcomments'),null,'List of last comments posted');
102$__widgets->lastcomments->setting('title',__('Title:'),__('Last comments'));
103$__widgets->lastcomments->setting('limit',__('Comments limit:'),10);
104$__widgets->lastcomments->setting('homeonly',__('Display on:'),1,'combo',
105     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
106$__widgets->lastcomments->setting('content_only',__('Content only'),0,'check');
107$__widgets->lastcomments->setting('class',__('CSS class:'),'');
108
109# --BEHAVIOR-- initWidgets
110$core->callBehavior('initWidgets',$__widgets);
111
112# Default widgets
113global $__default_widgets;
114$__default_widgets = array('nav'=> new dcWidgets(), 'extra'=> new dcWidgets(), 'custom'=> new dcWidgets());
115
116$__default_widgets['nav']->append($__widgets->search);
117$__default_widgets['nav']->append($__widgets->navigation);
118$__default_widgets['nav']->append($__widgets->bestof);
119$__default_widgets['nav']->append($__widgets->categories);
120$__default_widgets['extra']->append($__widgets->subscribe);
121
122# --BEHAVIOR-- initDefaultWidgets
123$core->callBehavior('initDefaultWidgets',$__widgets,$__default_widgets);
124?>
Note: See TracBrowser for help on using the repository browser.

Sites map