1b07cf47aSGerry Weißbach<?php 2b07cf47aSGerry Weißbach/** 3b07cf47aSGerry Weißbach * Site Export Plugin 4b07cf47aSGerry Weißbach * 5b07cf47aSGerry Weißbach * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6b07cf47aSGerry Weißbach * @author i-net software <tools@inetsoftware.de> 7b07cf47aSGerry Weißbach * @author Gerry Weissbach <gweissbach@inetsoftware.de> 8b07cf47aSGerry Weißbach */ 9b07cf47aSGerry Weißbach 10b07cf47aSGerry Weißbach// must be run within Dokuwiki 11b07cf47aSGerry Weißbachif(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 12b07cf47aSGerry Weißbachif(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 13b07cf47aSGerry Weißbach 14b07cf47aSGerry Weißbachclass action_plugin_nodetailsxhtml extends DokuWiki_Action_Plugin { 15b07cf47aSGerry Weißbach 16b07cf47aSGerry Weißbach /** 17b07cf47aSGerry Weißbach * for backward compatability 18b07cf47aSGerry Weißbach * @see inc/DokuWiki_Plugin#getInfo() 19b07cf47aSGerry Weißbach */ 20b07cf47aSGerry Weißbach function getInfo(){ 21b07cf47aSGerry Weißbach if ( method_exists(parent, 'getInfo')) { 22b07cf47aSGerry Weißbach $info = parent::getInfo(); 23b07cf47aSGerry Weißbach } 24b07cf47aSGerry Weißbach return is_array($info) ? $info : confToHash(dirname(__FILE__).'/../plugin.info.txt'); 25b07cf47aSGerry Weißbach } 26b07cf47aSGerry Weißbach 27b07cf47aSGerry Weißbach /** 28b07cf47aSGerry Weißbach * Register Plugin in DW 29b07cf47aSGerry Weißbach **/ 3010f21024SGerry Weißbach function register(Doku_Event_Handler $controller) { 31b07cf47aSGerry Weißbach $controller->register_hook('TPL_TOC_RENDER', 'BEFORE', $this, 'check_toc'); 32b07cf47aSGerry Weißbach } 33b07cf47aSGerry Weißbach 34b07cf47aSGerry Weißbach /** 35b07cf47aSGerry Weißbach * Check for Template changes 36b07cf47aSGerry Weißbach **/ 379751fde1SGerry Weißbach function check_toc( Doku_Event $event ) { 38b07cf47aSGerry Weißbach global $conf, $INFO; 39b07cf47aSGerry Weißbach 40*94ec4299SGerry Weißbach if ( empty($event->data) && array_key_exists( 'forceTOC', $INFO['meta'] ) && $INFO['meta']['forceTOC'] == true ) { 41b07cf47aSGerry Weißbach $event->data = $INFO['meta']['description']['tableofcontents']; 42b07cf47aSGerry Weißbach } 43b07cf47aSGerry Weißbach 44b07cf47aSGerry Weißbach } 45b07cf47aSGerry Weißbach} 469751fde1SGerry Weißbach 479751fde1SGerry Weißbach//Setup VIM: ex: et ts=4 enc=utf-8 :