]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/JabberPresence.php
Normalize header
[SourceForge/phpwiki.git] / lib / plugin / JabberPresence.php
1 <?php // -*-php-*-
2 rcs_id('$Id$');
3 /*
4  * Copyright (C) 2004 $ThePhpWikiProgrammingTeam
5  * 
6  * This file is part of PhpWiki.
7  *
8  * PhpWiki is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * PhpWiki is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with PhpWiki; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 /**
24  * A simple Jabber presence WikiPlugin.
25  * http://wiki.crao.net/index.php/JabberPr%E9sence/Source
26  * http://edgar.netflint.net/howto.php
27  *
28  * Usage:
29  *  <?plugin JabberPresence scripturl=http://edgar.netflint.net/status.php 
30  *                          jid=yourid@jabberserver type=html iconset=phpbb ?>
31  *
32  * @author: Arnaud Fontaine
33  */
34
35 if (!defined('MY_JABBER_ID'))
36     define('MY_JABBER_ID', $GLOBALS['request']->_user->UserName()."@jabber.com"); // or "@netflint.net"
37
38 class WikiPlugin_JabberPresence
39 extends WikiPlugin
40 {
41     // Five required functions in a WikiPlugin.
42     function getName () {
43         return _("JabberPresence");
44     }
45
46     function getDescription () {
47         return _("Simple jabber presence plugin");
48
49     }
50
51     function getVersion() {
52         return preg_replace("/[Revision: $]/", '',
53                             "\$Revision$");
54     }
55
56     // Establish default values for each of this plugin's arguments.
57     function getDefaultArguments() {
58         return array('scripturl' => "http://edgar.netflint.net/status.php",
59                      'jid'       => MY_JABBER_ID,
60                      'type'      => 'image',
61                      'iconset'   => "gabber");
62     }
63
64     function run($dbi, $argstr, $request) {
65         extract($this->getArgs($argstr, $request));
66         // Any text that is returned will not be further transformed,
67         // so use html where necessary.
68         if (empty($jid))
69             $html = HTML();
70         else
71           $html = HTML::img(array('src' => urlencode($scripturl).
72                                   '&jid='.urlencode($jid).
73                                   '&type='.urlencode($type).
74                                   '&iconset='.($iconset),
75                                   'alt' =>""));
76         return $html;
77     }
78 };
79
80 // For emacs users
81 // Local Variables:
82 // mode: php
83 // tab-width: 8
84 // c-basic-offset: 4
85 // c-hanging-comment-ender-p: nil
86 // indent-tabs-mode: nil
87 // End:
88 ?>