This is an old revision of the document!
Table of Contents
wikisign plugin
Compatible with DokuWiki
Hrun
Adds support for wikipedia style signatures by translating "~~~~" into signature/login name + date information.
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.
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. — KaiMartin 2015-02-27 19:18
Requests
How can I change the code to insert a link to the user-page? like … Admin instead of “Admin”