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