1<?php 2 3use ComboStrap\LinkUtility; 4use ComboStrap\PluginUtility; 5 6if (!defined('DOKU_INC')) die(); 7require_once(__DIR__ . '/../class/PluginUtility.php'); 8require_once(__DIR__ . '/../class/LinkUtility.php'); 9 10/** 11 * Class action_plugin_combo_move 12 * Handle the move of a page in order to update the link 13 */ 14class action_plugin_combo_linkmove extends DokuWiki_Action_Plugin 15{ 16 17 /** 18 * As explained https://www.dokuwiki.org/plugin:move 19 * @param Doku_Event_Handler $controller 20 */ 21 function register(Doku_Event_Handler $controller) 22 { 23 $controller->register_hook('PLUGIN_MOVE_HANDLERS_REGISTER', 'BEFORE', $this, 'handle_move', array()); 24 } 25 26 /** 27 * Handle the move of a page 28 * @param Doku_Event $event 29 * @param $params 30 */ 31 function handle_move(Doku_Event $event, $params) 32 { 33 /** 34 * The handlers is the name of the component (ie refers to the {@link syntax_plugin_combo_link} handler) 35 * and 'rewrite_combo' to the below method 36 */ 37 $event->data['handlers'][syntax_plugin_combo_link::COMPONENT] = array($this, 'rewrite_combo'); 38 } 39 40 /** 41 * 42 * @param $match 43 * @param $state 44 * @param $pos 45 * @param $plugin 46 * @param helper_plugin_move_handler $handler 47 */ 48 public function rewrite_combo($match, $state, $pos, $plugin, helper_plugin_move_handler $handler) 49 { 50 /** 51 * We call the original move method 52 * that supports Link rewriting 53 */ 54 $handler->internallink($match, $state, $pos); 55 56 } 57 58 59} 60