xref: /plugin/box2/action.php (revision bd01c8ec14d1117f4ace103a8b4b80a4101bb9e1)
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
13if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
14require_once(DOKU_PLUGIN.'action.php');
15
16class action_plugin_box extends DokuWiki_Action_Plugin {
17
18	function getInfo(){
19		return array(
20		'author' => 'i-net software / Gerry Weissbach',
21        'email'  => 'tools@inetsoftware.de',
22        'date'   => '2009-11-11',
23        'name'   => 'Box Plugin Action Component',
24		);
25	}
26
27	function register(&$controller) {
28		$controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'act_box_redirect_execute');
29	}
30
31	function act_box_redirect_execute( &$event ) {
32		global $PRE;
33		global $TEXT;
34
35		if ( !empty($event->data['fragment']) ) { return; }
36		if ( $event->data['preact'] == 'save' ) { return; }
37
38		if($PRE && preg_match('/^\s*<box.*?\|([^>\n]+)/',$TEXT,$match)){
39			$check = false; //Byref
40			$event->data['fragment'] = sectionID($match[1], $check);
41		}
42	}
43}