1<?php
2/**
3 * Site Export 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')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
12if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
13require_once(DOKU_PLUGIN.'action.php');
14
15class action_plugin_nodetailsxhtml extends DokuWiki_Action_Plugin {
16
17    /**
18     * for backward compatability
19     * @see inc/DokuWiki_Plugin#getInfo()
20     */
21    function getInfo(){
22        if ( method_exists(parent, 'getInfo')) {
23            $info = parent::getInfo();
24        }
25        return is_array($info) ? $info : confToHash(dirname(__FILE__).'/../plugin.info.txt');
26    }
27
28        /**
29    * Register Plugin in DW
30    **/
31    function register(Doku_Event_Handler $controller) {
32        $controller->register_hook('TPL_TOC_RENDER', 'BEFORE', $this, 'check_toc');
33    }
34
35    /**
36    * Check for Template changes
37    **/
38    function check_toc( Doku_Event $event ) {
39        global $conf, $INFO;
40
41        if ( empty($event->data) && array_key_exists( 'forceTOC', $INFO['meta'] ) && $INFO['meta']['forceTOC'] == true ) {
42            $event->data = $INFO['meta']['description']['tableofcontents'];
43        }
44
45    }
46}
47
48//Setup VIM: ex: et ts=4 enc=utf-8 :