1<?php
2/**
3 * DokuWiki Plugin ExtList (Action component)
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Satoshi Sahara <sahara.satoshi@gmail.com>
7 *
8 */
9if (!defined('DOKU_INC')) die();
10
11class action_plugin_extlist extends DokuWiki_Action_Plugin
12{
13    /**
14     * register the event handlers
15     */
16    public function register(Doku_Event_Handler $controller)
17    {
18        $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'prepareCssFile');
19    }
20
21    /**
22     * Prepare plugin stylesheet file
23     */
24    public function prepareCssFile(Doku_Event $event)
25    {
26        if ($this->getConf('use_plugin_css')) {
27            $f0 = dirname(__FILE__).'/sample.less';
28            $f1 = dirname(__FILE__).'/all.less';
29            if (!@file_exists($f1) && @file_exists($f0)) {
30                @copy( $f0, $f1 );
31            }
32        } else {
33            $f = dirname(__FILE__).'/all.less';
34            if (@file_exists($f)) { @unlink($f); }
35        }
36    }
37
38}
39