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.

RevLine 
[0]1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
[1179]6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
[0]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
[954]20$__widgets->create('search',__('Search engine'),array('defaultWidgets','search'),null,'Search engine form');
[0]21$__widgets->search->setting('title',__('Title:'),__('Search'));
[945]22$__widgets->search->setting('homeonly',__('Display on:'),0,'combo',
23     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]24$__widgets->search->setting('content_only',__('Content only'),0,'check');
[904]25$__widgets->search->setting('class',__('CSS class:'),'');
[0]26
[954]27$__widgets->create('navigation',__('Navigation links'),array('defaultWidgets','navigation'),null,'List of navigation links');
[0]28$__widgets->navigation->setting('title',__('Title:'),'');
[945]29$__widgets->navigation->setting('homeonly',__('Display on:'),0,'combo',
30     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]31$__widgets->navigation->setting('content_only',__('Content only'),0,'check');
[904]32$__widgets->navigation->setting('class',__('CSS class:'),'');
[0]33
[954]34$__widgets->create('bestof',__('Selected entries'),array('defaultWidgets','bestof'),null,'List of selected entries');
[0]35$__widgets->bestof->setting('title',__('Title:'),__('Best of me'));
36$__widgets->bestof->setting('orderby',__('Sort:'),'asc','combo',array(__('Ascending') => 'asc', __('Descending') => 'desc'));
[945]37$__widgets->bestof->setting('homeonly',__('Display on:'),1,'combo',
38     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]39$__widgets->bestof->setting('content_only',__('Content only'),0,'check');
[904]40$__widgets->bestof->setting('class',__('CSS class:'),'');
[0]41
[954]42$__widgets->create('langs',__('Blog languages'),array('defaultWidgets','langs'),null,'List of available languages');
[0]43$__widgets->langs->setting('title',__('Title:'),__('Languages'));
[945]44$__widgets->langs->setting('homeonly',__('Display on:'),1,'combo',
45     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]46$__widgets->langs->setting('content_only',__('Content only'),0,'check');
[904]47$__widgets->langs->setting('class',__('CSS class:'),'');
[0]48
[1610]49$__widgets->create('categories',__('Categories'),array('defaultWidgets','categories'),null,'List of categories');
[0]50$__widgets->categories->setting('title',__('Title:'),__('Categories'));
51$__widgets->categories->setting('postcount',__('With entries counts'),0,'check');
[1610]52$__widgets->categories->setting('with_empty',__('Include empty categories'),0,'check');
[945]53$__widgets->categories->setting('homeonly',__('Display on:'),0,'combo',
54     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]55$__widgets->categories->setting('content_only',__('Content only'),0,'check');
[904]56$__widgets->categories->setting('class',__('CSS class:'),'');
[0]57
[954]58$__widgets->create('subscribe',__('Subscribe links'),array('defaultWidgets','subscribe'),null,'RSS or Atom feed subscription links');
[0]59$__widgets->subscribe->setting('title',__('Title:'),__('Subscribe'));
60$__widgets->subscribe->setting('type',__('Feeds type:'),'atom','combo',array('Atom' => 'atom', 'RSS' => 'rss2'));
[945]61$__widgets->subscribe->setting('homeonly',__('Display on:'),1,'combo',
62     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]63$__widgets->subscribe->setting('content_only',__('Content only'),0,'check');
[904]64$__widgets->subscribe->setting('class',__('CSS class:'),'');
[0]65
[954]66$__widgets->create('feed',__('Feed reader'),array('defaultWidgets','feed'),null,'Last entries from feed');
[0]67$__widgets->feed->setting('title',__('Title:'),__('Somewhere else'));
68$__widgets->feed->setting('url',__('Feed URL:'),'');
69$__widgets->feed->setting('limit',__('Entries limit:'),10);
[945]70$__widgets->feed->setting('homeonly',__('Display on:'),1,'combo',
71     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]72$__widgets->feed->setting('content_only',__('Content only'),0,'check');
[904]73$__widgets->feed->setting('class',__('CSS class:'),'');
[0]74
[954]75$__widgets->create('text',__('Text'),array('defaultWidgets','text'),null,'Simple text');
[0]76$__widgets->text->setting('title',__('Title:'),'');
77$__widgets->text->setting('text',__('Text:'),'','textarea');
[945]78$__widgets->text->setting('homeonly',__('Display on:'),0,'combo',
79     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]80$__widgets->text->setting('content_only',__('Content only'),0,'check');
[904]81$__widgets->text->setting('class',__('CSS class:'),'');
[0]82
[954]83$__widgets->create('lastposts',__('Last entries'),array('defaultWidgets','lastposts'),null,'List of last entries published');
[0]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()) {
[252]88     $categories[str_repeat('&nbsp;&nbsp;',$rs->level-1).($rs->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($rs->cat_title)] = $rs->cat_id;
[0]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);
[945]96$__widgets->lastposts->setting('homeonly',__('Display on:'),1,'combo',
97     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]98$__widgets->lastposts->setting('content_only',__('Content only'),0,'check');
[904]99$__widgets->lastposts->setting('class',__('CSS class:'),'');
[0]100
[954]101$__widgets->create('lastcomments',__('Last comments'),array('defaultWidgets','lastcomments'),null,'List of last comments posted');
[0]102$__widgets->lastcomments->setting('title',__('Title:'),__('Last comments'));
103$__widgets->lastcomments->setting('limit',__('Comments limit:'),10);
[945]104$__widgets->lastcomments->setting('homeonly',__('Display on:'),1,'combo',
105     array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
[1063]106$__widgets->lastcomments->setting('content_only',__('Content only'),0,'check');
[904]107$__widgets->lastcomments->setting('class',__('CSS class:'),'');
[0]108
109# --BEHAVIOR-- initWidgets
110$core->callBehavior('initWidgets',$__widgets);
111
112# Default widgets
113global $__default_widgets;
[665]114$__default_widgets = array('nav'=> new dcWidgets(), 'extra'=> new dcWidgets(), 'custom'=> new dcWidgets());
[0]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