|
3 | 3 | * Include Plugin: Display a wiki page within another wiki page |
4 | 4 | * |
5 | 5 | * Action plugin component, for cache validity determination |
6 | | - * |
| 6 | + * |
7 | 7 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
8 | | - * @author Christopher Smith <[email protected]> |
| 8 | + * @author Christopher Smith <[email protected]> |
9 | 9 | * @author Michael Klier <[email protected]> |
10 | 10 | */ |
11 | | - |
| 11 | + |
12 | 12 | /** |
13 | 13 | * All DokuWiki plugins to extend the parser/rendering mechanism |
14 | 14 | * need to inherit from this class |
15 | 15 | */ |
16 | 16 | class action_plugin_include extends DokuWiki_Action_Plugin { |
17 | | - |
| 17 | + |
18 | 18 | /* @var helper_plugin_include $helper */ |
19 | 19 | var $helper = null; |
20 | 20 |
|
21 | 21 | function __construct() { |
22 | 22 | $this->helper = plugin_load('helper', 'include'); |
23 | 23 | } |
24 | | - |
| 24 | + |
25 | 25 | /** |
26 | 26 | * plugin should use this method to register its handlers with the dokuwiki's event controller |
27 | 27 | */ |
28 | 28 | function register(Doku_Event_Handler $controller) { |
29 | 29 | /* @var Doku_event_handler $controller */ |
30 | 30 | $controller->register_hook('INDEXER_PAGE_ADD', 'BEFORE', $this, 'handle_indexer'); |
31 | 31 | $controller->register_hook('INDEXER_VERSION_GET', 'BEFORE', $this, 'handle_indexer_version'); |
32 | | - $controller->register_hook('PARSER_CACHE_USE','BEFORE', $this, '_cache_prepare'); |
33 | | - $controller->register_hook('HTML_EDITFORM_OUTPUT', 'BEFORE', $this, 'handle_form'); |
34 | | - $controller->register_hook('HTML_CONFLICTFORM_OUTPUT', 'BEFORE', $this, 'handle_form'); |
35 | | - $controller->register_hook('HTML_DRAFTFORM_OUTPUT', 'BEFORE', $this, 'handle_form'); |
36 | | - $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'handle_redirect'); |
37 | | - $controller->register_hook('PARSER_HANDLER_DONE', 'BEFORE', $this, 'handle_parser'); |
38 | | - $controller->register_hook('PARSER_METADATA_RENDER', 'AFTER', $this, 'handle_metadata'); |
39 | | - $controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'handle_secedit_button'); |
| 32 | + $controller->register_hook('PARSER_CACHE_USE','BEFORE', $this, '_cache_prepare'); |
| 33 | + $controller->register_hook('HTML_EDITFORM_OUTPUT', 'BEFORE', $this, 'handle_form'); // todo remove |
| 34 | + $controller->register_hook('FORM_EDIT_OUTPUT', 'BEFORE', $this, 'handle_form'); |
| 35 | + $controller->register_hook('HTML_CONFLICTFORM_OUTPUT', 'BEFORE', $this, 'handle_form'); // todo remove |
| 36 | + $controller->register_hook('FORM_CONFLICT_OUTPUT', 'BEFORE', $this, 'handle_form'); |
| 37 | + $controller->register_hook('HTML_DRAFTFORM_OUTPUT', 'BEFORE', $this, 'handle_form'); // todo remove |
| 38 | + $controller->register_hook('FORM_DRAFT_OUTPUT', 'BEFORE', $this, 'handle_form'); |
| 39 | + $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'handle_redirect'); |
| 40 | + $controller->register_hook('PARSER_HANDLER_DONE', 'BEFORE', $this, 'handle_parser'); |
| 41 | + $controller->register_hook('PARSER_METADATA_RENDER', 'AFTER', $this, 'handle_metadata'); |
| 42 | + $controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'handle_secedit_button'); |
40 | 43 | $controller->register_hook('PLUGIN_MOVE_HANDLERS_REGISTER', 'BEFORE', $this, 'handle_move_register'); |
41 | 44 | } |
42 | 45 |
|
@@ -172,10 +175,16 @@ function handle_parser(Doku_Event $event, $param) { |
172 | 175 | /** |
173 | 176 | * Add a hidden input to the form to preserve the redirect_id |
174 | 177 | */ |
175 | | - function handle_form(Doku_Event &$event, $param) { |
176 | | - if (array_key_exists('redirect_id', $_REQUEST)) { |
177 | | - $event->data->addHidden('redirect_id', cleanID($_REQUEST['redirect_id'])); |
178 | | - } |
| 178 | + function handle_form(Doku_Event $event, $param) |
| 179 | + { |
| 180 | + if (!array_key_exists('redirect_id', $_REQUEST)) return; |
| 181 | + |
| 182 | + if(is_a($event->data, \dokuwiki\Form\Form::class)) { |
| 183 | + $event->data->setHiddenField('redirect_id', cleanID($_REQUEST['redirect_id'])); |
| 184 | + } else { |
| 185 | + // todo remove when old FORM events are no longer supported |
| 186 | + $event->data->addHidden('redirect_id', cleanID($_REQUEST['redirect_id'])); |
| 187 | + } |
179 | 188 | } |
180 | 189 |
|
181 | 190 | /** |
|
0 commit comments