1<?php 2/** 3 * 4 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 5 * @author 6 */ 7 8// must be run within Dokuwiki 9if(!defined('DOKU_INC')) die(); 10include_once (DOKU_INC . 'inc/confutils.php'); 11class action_plugin_ckgedit_iwiki extends DokuWiki_Action_Plugin { 12 private $interlinks = null; 13 /** 14 * Registers a callback function for a given event 15 * 16 * @param Doku_Event_Handler $controller DokuWiki's event controller object 17 * @return void 18 */ 19 public function register(Doku_Event_Handler $controller) { 20 21 $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_call_unknown'); 22 23 } 24 25 /** 26 * @param Doku_Event $event event object by reference 27 * @param mixed $param [the parameters passed as fifth argument to register_hook() when this 28 * handler was registered] 29 * @return void 30 */ 31 32 public function handle_ajax_call_unknown(Doku_Event &$event, $param) { 33 34 if ($event->data !== 'iwiki_list') { 35 return; 36 } 37 38 $event->stopPropagation(); 39 $event->preventDefault(); 40 $a = getInterwiki(); 41 ksort($a); 42 echo json_encode($a); 43 } 44 45} 46