*/ if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'action.php'); class action_plugin_relativelinks extends DokuWiki_Action_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Andy Turner', 'email' => 'public [at] ssbd [dot] net', 'date' => '2008-03-07', 'name' => 'Relative Links', 'desc' => 'Replaces standard wiki-base-centric links with relative ones (anything which doesn\'t start with . or : is assumed to be relative to the current namespace)', ); } /** * Register its handlers with the DokuWiki's event controller */ function register(Doku_Event_Handler $controller) { $controller->register_hook('PARSER_WIKITEXT_PREPROCESS', 'BEFORE', $this, '_hookrellink'); } /** * Stick a colon in front of links... that's all :D * * @author Andy Turner */ function _hookrellink(&$event, $param) { $event->data = preg_replace( "/\[\[([^:.][^\/]*?(?:\|.*?))\]\]/", '[[.:${1}]]', $event->data ); } }