1<?php
2/**
3 * Box Plugin
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     i-net software <tools@inetsoftware.de>
7 * @author     Gerry Weissbach <gweissbach@inetsoftware.de>
8 */
9
10// must be run within Dokuwiki
11if(!defined('DOKU_INC')) die();
12
13class action_plugin_box2 extends DokuWiki_Action_Plugin {
14
15    function register(Doku_Event_Handler $controller) {
16        $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'act_box_redirect_execute');
17    }
18
19    function act_box_redirect_execute( Doku_Event &$event ) {
20        global $PRE;
21        global $TEXT;
22
23        if ( !empty($event->data['fragment']) ) { return; }
24        if ( $event->data['preact'] == 'save' ) { return; }
25
26        if($PRE && preg_match('/^\s*<box.*?\|([^>\n]+)/',$TEXT,$match)){
27            $check = false; //Byref
28            $event->data['fragment'] = sectionID($match[1], $check);
29        }
30    }
31}
32