[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[270] | 6 | # Copyright (c) 2003-2011 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 ----------------------------------------- |
---|
| 12 | if (!defined('DC_RC_PATH')) { return; } |
---|
| 13 | |
---|
| 14 | $core->addBehavior('initWidgets',array('blogrollWidgets','initWidgets')); |
---|
| 15 | $core->addBehavior('initDefaultWidgets',array('blogrollWidgets','initDefaultWidgets')); |
---|
| 16 | |
---|
| 17 | class blogrollWidgets |
---|
| 18 | { |
---|
| 19 | public static function initWidgets($w) |
---|
| 20 | { |
---|
| 21 | $w->create('links',__('Blogroll'),array('tplBlogroll','linksWidget')); |
---|
| 22 | $w->links->setting('title',__('Title:'),__('Links')); |
---|
| 23 | |
---|
| 24 | $br = new dcBlogroll($GLOBALS['core']->blog); |
---|
| 25 | $h = $br->getLinksHierarchy($br->getLinks()); |
---|
| 26 | $h = array_keys($h); |
---|
| 27 | $categories = array(__('All categories') => ''); |
---|
| 28 | foreach ($h as $v) { |
---|
| 29 | if ($v) { |
---|
| 30 | $categories[$v] = $v; |
---|
| 31 | } |
---|
| 32 | } |
---|
| 33 | unset($br,$h); |
---|
| 34 | $w->links->setting('category',__('Category'),'','combo',$categories); |
---|
| 35 | |
---|
| 36 | $w->links->setting('homeonly',__('Home page only'),1,'check'); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | public static function initDefaultWidgets($w,$d) |
---|
| 40 | { |
---|
| 41 | $d['extra']->append($w->links); |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | ?> |
---|