Dotclear

source: plugins/categoriesMode/_widgets.php @ 3067

Revision 3067, 1.4 KB checked in by brol, 12 years ago (diff)

dépôt version 0.3 avec l'accord de l'auteur initial (Adjaya)

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of categoriesMode, a plugin for Dotclear 2.
5#
6# Copyright (c) 2007-2011 Adjaya and contributors
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('widgetsCategoriesMode','initWidgets'));
15 
16class widgetsCategoriesMode
17{
18     # Widget function
19     public static function categoriesPageWidgets($w)
20     {
21          global $core;
22
23          if (!$core->blog->settings->categoriesmode->categoriesmode_active) return;
24
25          if ($w->homeonly && $core->url->type != 'default') {
26               return;
27          }
28
29          $res =
30          '<div class="categories">'.
31          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : '').
32          '<ul>';
33
34          $res .=
35          '<li><strong><a href="'.$core->blog->url.$core->url->getBase("categories").'">'.
36          __('All categories').'</a></strong></li>';
37
38          $res .= '</ul>'.
39          '</div>';
40         
41          return $res;
42     }
43
44     public static function initWidgets($w)
45     {
46          $w->create('CategoriesPage',__('Categories page'),array('widgetsCategoriesMode','categoriesPageWidgets'));
47
48          $w->CategoriesPage->setting('title',__('Title:'),__('Categories page'),'text');
49          $w->CategoriesPage->setting('homeonly',__('Home page only'),0,'check');
50     }
51}
52?>
Note: See TracBrowser for help on using the repository browser.

Sites map