| 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 | $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'),null,'Blogroll list'); |
|---|
| 22 | $w->links->setting('title',__('Title (optional)').' :',__('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',__('Display on:'),1,'combo', |
|---|
| 37 | array( |
|---|
| 38 | __('All pages') => 0, |
|---|
| 39 | __('Home page only') => 1, |
|---|
| 40 | __('Except on home page') => 2 |
|---|
| 41 | ) |
|---|
| 42 | ); |
|---|
| 43 | $w->links->setting('content_only',__('Content only'),0,'check'); |
|---|
| 44 | $w->links->setting('class',__('CSS class:'),''); |
|---|
| 45 | $w->links->setting('offline',__('Offline'),0,'check'); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | public static function initDefaultWidgets($w,$d) |
|---|
| 49 | { |
|---|
| 50 | $d['extra']->append($w->links); |
|---|
| 51 | } |
|---|
| 52 | } |
|---|