1<?php 2/** 3 * DokuWiki Plugin filelisting (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Szymon Olewniczak <dokuwiki@cosmocode.de> 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12class action_plugin_filelisting_delete extends DokuWiki_Action_Plugin { 13 14 /** 15 * Registers a callback function for a given event 16 * 17 * @param Doku_Event_Handler $controller DokuWiki's event controller object 18 * @return void 19 */ 20 public function register(Doku_Event_Handler $controller) { 21 22 $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handle_action_act_preprocess'); 23 24 } 25 26 /** 27 * Send the namespace files as html table rows 28 * 29 * @param Doku_Event $event event object by reference 30 * @param mixed $param [the parameters passed as fifth argument to register_hook() when this 31 * handler was registered] 32 * @return void 33 */ 34 35 public function handle_action_act_preprocess(Doku_Event &$event, $param) { 36 if(act_clean($event->data) != 'plugin_filelisting_delete') return; 37 38 global $ACT; 39 $ACT = 'show'; 40 41 if (!checkSecurityToken()) return; 42 43 /** @var Input */ 44 global $INPUT; 45 46 $files_to_delete = array_keys($INPUT->arr('delete')); 47 48 /** @var helper_plugin_filelisting $filelisting */ 49 $filelisting = $this->loadHelper('filelisting'); 50 $msgs = $filelisting->delete_files($files_to_delete); 51 foreach ($msgs as $msg) { 52 msg($msg['message'], $msg['lvl']); 53 } 54 } 55} 56 57// vim:ts=4:sw=4:et: 58