1<?php 2/** 3 * DokuWiki Plugin pagehere (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Andreas Gohr <gohr@cosmocode.de> 7 */ 8 9// must be run within Dokuwiki 10if (!defined('DOKU_INC')) die(); 11 12if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); 13if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); 14if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 15 16require_once DOKU_PLUGIN.'action.php'; 17 18class action_plugin_pagehere extends DokuWiki_Action_Plugin { 19 20 public function register(Doku_Event_Handler $controller) { 21 $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'handle_dokuwiki_started'); 22 } 23 24 public function handle_dokuwiki_started(Doku_Event &$event, $param) { 25 if(!$_REQUEST['pagehere']) return; 26 27 global $ID; 28 global $conf; 29 30 $page = cleanID($_REQUEST['pagehere']); 31 if(!$this->getConf('subns')){ 32 $page = str_replace(':', $conf['sepchar'], $page); 33 34 } 35 36 $ns = getNS($ID); 37 $newpage = cleanID($ns.':'.$page); 38 39 send_redirect(wl($newpage,array('do'=>'edit'),true,'&')); 40 } 41 42} 43 44// vim:ts=4:sw=4:et: 45