PHP74 compatibility

This commit is contained in:
Michal "mišo" Červeňák
2020-09-12 19:29:25 +02:00
parent adac63f68f
commit eb6b101fd0
8 changed files with 23 additions and 49 deletions

View File

@@ -1,38 +1,36 @@
<?php
use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\Event;
use dokuwiki\Extension\EventHandler;
if (!defined('DOKU_INC')) die();
/**
* DokuWiki Plugin cookielaw (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Michal Koutny <michal@fykos.cz>
*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
class action_plugin_cookielaw extends DokuWiki_Action_Plugin {
class action_plugin_cookielaw extends ActionPlugin {
/**
* Registers a callback function for a given event
*
* @param Doku_Event_Handler $controller DokuWiki's event controller object
* @param EventHandler $controller DokuWiki's event controller object
* @return void
*/
public function register(Doku_Event_Handler $controller) {
$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_tpl_act_render');
public function register(EventHandler $controller): void {
$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_tpl_act_render');
}
/**
* [Custom event handler which performs action]
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @param Event $event event object by reference
* @return void
*/
public function handle_tpl_act_render(Doku_Event &$event, $param) {
public function handle_tpl_act_render(Event $event): void {
if ($event->data != 'show') {
return;
}
@@ -49,7 +47,4 @@ class action_plugin_cookielaw extends DokuWiki_Action_Plugin {
echo '<a href="' . hsc($this->getLang('details_url')) . '" target="_blank">' . hsc($this->getLang('details')) . '</a>';
echo '</div>';
}
}
// vim:ts=4:sw=4:et: