DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:signature

Table of Contents

Signature Plugin

Compatible with DokuWiki

No compatibility info given!

plugin signatures for unregistered users

Last updated on
2006-03-29
Provides
Syntax

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with signature, users

By Dmitry

Author

Author is Dmitry (dmit_10@jabber.spbu.ru).
I just posted this plugin to the public — Bukhalenkov Alexander 2007-06-26 15:08

Purpose

It can be simply modified to fit many purposes - it's just a substitute plugin,
which substitutes “{{user>username}}” to (in this modification) “ --- **//[[p:username]]//**” (in our wiki it links on personal pages)

In another words, this plugin is mechanism for adding signatures for unregistered wiki users.

Code

It consist just one file: syntax.php:

syntax.php
<?php 
 
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');
 
class syntax_plugin_signature extends DokuWiki_Syntax_Plugin {
 
    function getInfo(){
        return array(
            'author' => 'dmit10',
            'email'  => 'dmit10@mail.ru',
            'date'   => '29/03/2006',
            'name'   => 'Signature Plugin',
            'desc'   => 'Add the possibility to put down a signature',
            'url'    => '???',
        );
    }
 
    function getType(){
        return 'substition';
    }
 
    function getSort(){
        return 250;
    }
 
    function connectTo($mode) {
      $this->Lexer->addSpecialPattern("{{user>[a-zA-Z0-9]+}}",$mode,'plugin_signature');
    }
 
    function handle($match, $state, $pos, &$handler){
 
        //  {{user>username}}    
        //  ^^^^^^^^      
        //  01234567     
        $match = substr($match,7,-2);
        //Maybe it is useful to add here current date
        return array($match);
    }
 
    function render($mode, &$renderer, $data) {
        $renderer->doc.="&mdash; "; //this string depends on the HTML that is not good =)
        $renderer->strong_open();
        $renderer->emphasis_open();
        $renderer->internallink("p:{$data[0]}");
        $renderer->emphasis_close();
        $renderer->strong_close();
        return true;
    }
 
}
plugin/signature.txt · Last modified: 2014-03-20 18:23 by Aleksandr