DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:wikisign

wikisign plugin

Compatible with DokuWiki

No compatibility info given!

plugin Adds support for wikipedia style signatures by translating "~~~~" into signature/login name + date information.

Last updated on
2008-08-11
Provides
Action

The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.

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 editing, mediawiki, users

Download and Installation

Just create a folder in your lib/plugins dir, called “wikisign”. In it, create a file called action.php containing the following code:

wikisign/action.php
<?php
 
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
require_once(DOKU_INC.'inc/common.php');
 
class action_plugin_wikisign extends DokuWiki_Action_Plugin {
    function getInfo() {
        return array (
            'author' => 'FeepingCreature',
            'email' => 'default_357-line@yahoo.de',
            'date' => '2008-11-08',
            'name' => 'WP-style signature',
            'desc' => 'Translate ~~~~ into signature info',
            'url' => ''
        );
    }
    function register(Doku_Event_Handler $controller) {
      $controller->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, 'signtranslate');
    }
 
    function signtranslate(&$event, $param) {
      $pi = pageinfo();
      global $USERINFO;
      $userinfo = $USERINFO['name'];
      if (empty($userinfo)) $userinfo = $_SERVER[REMOTE_ADDR];
      $date = gmdate('H:i, d F Y e');
      // $event->data[0][1] = str_replace('~~~~', '---//'.$userinfo.' '.$date.'//', $event->data[0][1]);
      // thanks to mystore for the next line (ignore ~~~~ in unparsed blocks)
      $event->data[0][1] = preg_replace('#[^(<nowiki>|<code>|<file>|  |%%)]~~~~#', '---//'.$userinfo.' '.$date.'//', $event->data[0][1]);
    }
}
?>

Have fun!

Discussions

Add compatibility with non-parsed block : Replace the last line by :

$event->data[0][1] = preg_replace('#[^(<nowiki>|<code>|<file>|  |%%)]~~~~#', '---//'.$userinfo.' '.$date.'//', $event->data[0][1]);

myst6re 2008/10/05

Bug

At least give an example of its use. ~~~~ (DOES NOT WORK!)

Strange. That's how it's SUPPOSED to work, and _does_ work here. Are you sure you installed it correctly?

Agree with the person above me. Does not parse at all (even after adding the closing PHP tag at the end), and just shows ~~~~.


Mine gives me the username and date, but adds a weird character after the date. example: —Admin 15:21, 12 December 2008 e

Your PHP's gmdate does not parse the “e” code correctly.
> $date = gmdate('H:i, d F Y e');
Remove the “e” from that line.

I tried putting #~~~~#, it kind of works. but it leaves a trailing #

Ok, same poster as above line. I've modified the last line to…

$event->data[0][1] = preg_replace('/[ \t]+[^(<nowiki>|<code>|<file>|%%)]~~~~ *$/x', '---//'.$userinfo.' '.$date.'//', $event->data[0][1]);

Give it a shot –johncruise

This line works in Hrun. Thank you for the mod.aKaiMartin 2015-02-27 19:18
This line produces the desired signature in hrun. However, the plugin breaks the download of images. Images cached in the browser still rendered fine in my set-up (Dokuwiki hrun, firefox 31.5). But new images were not displayed. Seems like there is a major conflict which makes the plugin unusable in its current state. — KaiMartin 2015-03-12 01:44

Requests

How can I change the code to insert a link to the user-page? like … Admin instead of “Admin”

plugin/wikisign.txt · Last modified: 2015-03-12 01:47 by kaimartin

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