xref: /plugin/siteexport/action/startup.php (revision 7d101cc131696cb3a0de345d8044a69fb2ef70e9)
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_siteexport_startup 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(&$controller) {
32		$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'siteexport_check_template');
33		$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'siteexport_check_export');
34	}
35
36	/**
37	* Check for Template changes
38	**/
39	function siteexport_check_template()
40	{
41		global $conf, $INFO;
42
43		if ( !defined('SITEEXPORT_TPL') ) { return; }
44		$conf['template'] = SITEEXPORT_TPL;
45	}
46
47	function siteexport_check_export(&$event)
48	{
49	    global $conf;
50	    if ( $event->data == 'export_siteexport_pdf')
51	    {
52	        $event->data = 'show';
53	        $conf['renderer_xhtml'] = 'siteexport_pdf';
54	    }
55	}
56}