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