Dotclear

source: plugins/blogroll/_widgets.php @ 954:958704d2486f

Revision 954:958704d2486f, 1.4 KB checked in by franck <carnet.franck.paul@…>, 13 years ago (diff)

Add description to widget, fixes #990

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2011 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
14$core->addBehavior('initWidgets',array('blogrollWidgets','initWidgets'));
15$core->addBehavior('initDefaultWidgets',array('blogrollWidgets','initDefaultWidgets'));
16
17class 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:'),__('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('class',__('CSS class:'),'');
44     }
45     
46     public static function initDefaultWidgets($w,$d)
47     {
48          $d['extra']->append($w->links);
49     }
50}
51?>
Note: See TracBrowser for help on using the repository browser.

Sites map