Dotclear

source: plugins/contribute/_widget.php @ 848

Revision 848, 2.0 KB checked in by Moe, 15 years ago (diff)

Contribute 1.0-alpha7 :

  • fixed bug with MyMeta? values
  • fixed bug with similar tags
  • moved messages to template file
  • improved category check
  • added mailto link on post administration
  • improved administration page
Line 
1<?php 
2# ***** BEGIN LICENSE BLOCK *****
3#
4# This file is part of Contribute.
5# Copyright 2008,2009 Moe (http://gniark.net/)
6#
7# Contribute is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# Contribute is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19#
20# Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/
21#
22# ***** END LICENSE BLOCK *****
23
24if (!defined('DC_RC_PATH')) {return;}
25
26$core->addBehavior('initWidgets',array('contributeWidget','initWidgets'));
27
28/**
29@ingroup Contribute
30@brief Widget
31*/
32class contributeWidget
33{
34     /**
35     widget
36     @param    w    <b>object</b>  Widget
37     */
38     public static function initWidgets(&$w)
39     {
40          $w->create('contribute',__('Contribute'),array('contributeWidget','show'));
41
42          $w->contribute->setting('title',__('Title:').' ('.__('optional').')',
43               __('Contribute'),'text');
44         
45          $w->contribute->setting('text',__('Text:').' ('.__('optional').')',
46               __('Write a post for this blog'),'text');
47         
48          $w->contribute->setting('homeonly',__('Home page only'),false,'check');
49     }
50     
51     /**
52     show widget
53     @param    w    <b>object</b>  Widget
54     @return   <b>string</b> XHTML
55     */
56     public static function show(&$w)
57     {
58          global $core;
59
60          if ($w->homeonly && $core->url->type != 'default') {
61               return;
62          }
63         
64          # output
65          $header = (strlen($w->title) > 0)
66               ? '<h2>'.html::escapeHTML($w->title).'</h2>' : null;
67          $text = (strlen($w->text) > 0)
68               ? '<p><a href="'.$core->blog->url.$core->url->getBase('contribute').
69                    '">'.html::escapeHTML($w->text).'</a></p>' : null;
70
71          return '<div class="contribute">'.$header.$text.'</div>';
72     }
73}
74?>
Note: See TracBrowser for help on using the repository browser.

Sites map