]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/JabberPresence.php
Activated Revision substitution for Subversion
[SourceForge/phpwiki.git] / lib / plugin / JabberPresence.php
1 <?php // -*-php-*-
2 rcs_id('$Id$');
3 /**
4  * A simple Jabber presence WikiPlugin.
5  * http://wiki.crao.net/index.php/JabberPr%E9sence/Source
6  * http://edgar.netflint.net/howto.php
7  *
8  * Usage:
9  *  <?plugin JabberPresence scripturl=http://edgar.netflint.net/status.php 
10  *                          jid=yourid@jabberserver type=html iconset=phpbb ?>
11  *
12  * @author: Arnaud Fontaine
13  */
14
15 if (!defined('MY_JABBER_ID'))
16     define('MY_JABBER_ID', $GLOBALS['request']->_user->UserName()."@jabber.com"); // or "@netflint.net"
17
18 class WikiPlugin_JabberPresence
19 extends WikiPlugin
20 {
21     // Five required functions in a WikiPlugin.
22     function getName () {
23         return _("JabberPresence");
24     }
25
26     function getDescription () {
27         return _("Simple jabber presence plugin");
28
29     }
30
31     function getVersion() {
32         return preg_replace("/[Revision: $]/", '',
33                             "\$Revision$");
34     }
35
36     // Establish default values for each of this plugin's arguments.
37     function getDefaultArguments() {
38         return array('scripturl' => "http://edgar.netflint.net/status.php",
39                      'jid'       => MY_JABBER_ID,
40                      'type'      => 'image',
41                      'iconset'   => "gabber");
42     }
43
44     function run($dbi, $argstr, $request) {
45         extract($this->getArgs($argstr, $request));
46         // Any text that is returned will not be further transformed,
47         // so use html where necessary.
48         if (empty($jid))
49             $html = HTML();
50         else
51           $html = HTML::img(array('src' => urlencode($scripturl).
52                                   '&jid='.urlencode($jid).
53                                   '&type='.urlencode($type).
54                                   '&iconset='.($iconset)));
55         return $html;
56     }
57 };
58
59 // For emacs users
60 // Local Variables:
61 // mode: php
62 // tab-width: 8
63 // c-basic-offset: 4
64 // c-hanging-comment-ender-p: nil
65 // indent-tabs-mode: nil
66 // End:
67 ?>