1<?php 2/** 3 * Table editor 4 * 5 * @author Adrian Lang <lang@cosmocode.de> 6 */ 7 8/** 9 * redirect to the section containg the table 10 */ 11class action_plugin_edittable_sectionjump extends DokuWiki_Action_Plugin 12{ 13 /** 14 * Register its handlers with the DokuWiki's event controller 15 */ 16 function register(Doku_Event_Handler $controller) 17 { 18 $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'jump_to_section'); 19 } 20 21 /** 22 * Jump after save to the section containing this table 23 * 24 * @param Doku_Event $event 25 */ 26 function jump_to_section($event) 27 { 28 global $INPUT; 29 if (!$INPUT->has('edittable_data')) return; 30 31 global $PRE; 32 if (preg_match_all('/^\s*={2,}([^=\n]+)/m', $PRE, $match, PREG_SET_ORDER)) { 33 $check = false; //Byref 34 $match = array_pop($match); 35 $event->data['fragment'] = sectionID($match[1], $check); 36 } 37 } 38} 39