DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:icq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:icq [2008-01-12 10:49] 68.75.172.145plugin:icq [2023-10-30 22:50] (current) Klap-in
Line 1: Line 1:
 +====== ICQ Plugin ======
 +
 +---- plugin ----
 +description: With this plugin you can insert an ICQ-user status to your page. 
 +author     : Jakob Jensen
 +email      : koeppe@kazur.dk
 +type       : syntax
 +lastupdate : 2006-03-28
 +compatible : Angua, Adora Belle, Weatherwax, Binky
 +depends    : 
 +conflicts 
 +similar    : 
 +tags       : chat, status
 +
 +downloadurl: https://github.com/lupo49/dokuwiki-plugin-icq/zipball/master
 +sourcerepo: https://github.com/lupo49/dokuwiki-plugin-icq
 +bugtracker: https://github.com/lupo49/dokuwiki-plugin-icq/issues/
 +----
 +
 +===== Syntax =====
 +
 +The format is
 +
 +  [[icq>#########]]
 +
 +This will insert code 
 +<code>
 +<a href="http://wwp.icq.com/#########"><img border="0" alt="Online?" src="http://web.icq.com/whitepages/online?icq=#########&amp;img=5" /></a>
 +</code>
 +
 +
 +===== Installation =====
 +
 +==== Plugin ====
 +
 +Create a new folder ''lib/plugins/icq/'' and place the following file in it: ''syntax.php''.
 +
 +''lib/plugins/icq/syntax.php'':
 +
 +<code php syntax.php>
 +<?php
 +/**
 + * Plugin ICQ: Show if some ICQ user is online.
 + *
 + * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 + * @author     Jakob Jensen <koeppe@kazur.dk>
 + */
 +
 +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
 +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
 +require_once(DOKU_PLUGIN.'syntax.php');
 +
 +/**
 + * All DokuWiki plugins to extend the parser/rendering mechanism
 + * need to inherit from this class
 + */
 +class syntax_plugin_icq extends DokuWiki_Syntax_Plugin {
 +
 +    /**
 +     * return some info
 +     */
 +    function getInfo(){
 +        return array(
 +                'author' => 'Jakob Jensen',
 +                'email'  => 'koeppe@kazur.dk',
 +                'date'   => '2006-03-28',
 +                'name'   => 'ICQ plugin',
 +                'desc'   => 'Show if some ICQ user is online. Syntax: [[icq>0000000]]',
 +                'url'    => 'http://www.dokuwiki.org/plugin:icq',
 +                );
 +    }
 +
 +    /**
 +     * What kind of syntax are we?
 +     */
 +    function getType(){
 +        return 'substition';
 +    }
 +
 +    function getSort(){ return 298; }
 +
 +    function connectTo($mode) {
 +        $this->Lexer->addSpecialPattern('\[\[icq>\w+\]\]',$mode,'plugin_icq');
 +    }
 +
 +
 +    /**
 +     * Handle the match
 +     */
 +    function handle($match, $state, $pos, &$handler){
 +        $match = substr($match,6,-2);
 +        return array(strtolower($match));
 +    }
 +
 +    /**
 +     * Create output
 +     */
 +    function render($mode, &$renderer, $data) {
 +        if($mode == 'xhtml'){
 +            $renderer->doc .= '<a href="http://wwp.icq.com/' . $data[0] . '">';
 +            $renderer->doc .= '<img border="0" alt="Online?" src="http://web.icq.com/whitepages/online?icq=' . $data[0] . '&amp;img=5" />';
 +            $renderer->doc .= '</a>';
 +            return true;
 +        }
 +        return false;
 +    }
 +}
 +?>
 +</code>
 +
 +
 +
 +===== Discussion =====
 +
 +If you want to show not only ICQ flower, but UIN, make following changes in function **render**:
 +<code php>
 +    function render($mode, &$renderer, $data) {
 +        if($mode == 'xhtml'){
 +            $renderer->doc .= '<a href="http://wwp.icq.com/' . $data[0] . '">';
 +            $renderer->doc .= '<img border="0" align="absmiddle" alt="Online?" src="http://web.icq.com/whitepages/online?icq=' . $data[0] . '&amp;img=5" />';
 +            $renderer->doc .= $data[0] . '</a>';
 +            return true;
 +        }
 +        return false;
 +    }
 +
 +</code> --- // [[kibizoid@gmail.com|Alexander Sorkin aka Kibi]] 31 Jul 2006 19:18//
  

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki