xref: /plugin/timezoneco/action.php (revision efb330856fa26164e5ba2b98a63e46ae1845b0fe)
1<?php
2
3use dokuwiki\Extension\ActionPlugin;
4use dokuwiki\Extension\EventHandler;
5use dokuwiki\Extension\Event;
6
7class action_plugin_timezoneco extends ActionPlugin
8{
9    public function register(EventHandler $controller)
10    {
11        $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'setTimezone');
12    }
13
14    public function setTimezone(Event $event, $param)
15    {
16        $tz = $this->getConf('timezone');
17        if (!empty($tz)) {
18            date_default_timezone_set($tz);
19        }
20    }
21}
22