Dotclear

source: plugins/categoriesMode/_widgets.php @ 3157

Revision 3157, 1.8 KB checked in by brol, 10 years ago (diff)

version 0.4 : mise à jour widget

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 == 1 && $core->url->type != 'default') ||
26               ($w->homeonly == 2 && $core->url->type == 'default')) {
27               return;
28          }
29
30          $res = ($w->content_only ? '' : '<div class="categories'.($w->class ? ' '.html::escapeHTML($w->class) : '').'">').
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          ($w->content_only ? '' : '</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',__('Display on:'),0,'combo',
50               array(
51                    __('All pages') => 0,
52                    __('Home page only') => 1,
53                    __('Except on home page') => 2
54                    )
55          );
56    $w->CategoriesPage->setting('content_only',__('Content only'),0,'check');
57    $w->CategoriesPage->setting('class',__('CSS class:'),'');
58     }
59}
60?>
Note: See TracBrowser for help on using the repository browser.

Sites map