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