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

View File

@@ -4,5 +4,4 @@
* *
* @author Michal Koutny <michal@fykos.cz> * @author Michal Koutny <michal@fykos.cz>
*/ */
$conf['position'] = 'bottom'; $conf['position'] = 'bottom';

View File

@@ -4,7 +4,4 @@
* *
* @author Michal Koutny <michal@fykos.cz> * @author Michal Koutny <michal@fykos.cz>
*/ */
$meta['position'] = ['multichoice', '_choices' => ['top', 'bottom']];
$meta['position'] = array('multichoice', '_choices' => array('top', 'bottom'));

View File

@@ -4,14 +4,8 @@
* *
* @author Michal Koutny <michal@fykos.cz> * @author Michal Koutny <michal@fykos.cz>
*/ */
// custom language strings for the plugin
$lang['information'] = 'Tato stránka využívá cookies pro analýzu provozu. ' . $lang['information'] = 'Tato stránka využívá cookies pro analýzu provozu. ' .
'Používáním stránky souhlasíte s ukládáním těchto cookies na vašem počítači.'; 'Používáním stránky souhlasíte s ukládáním těchto cookies na vašem počítači.';
$lang['consent'] = 'OK'; $lang['consent'] = 'OK';
$lang['details'] = 'Více informací'; $lang['details'] = 'Více informací';
$lang['details_url'] = 'https://www.google.com/intl/cs/policies/technologies/cookies/'; $lang['details_url'] = 'https://www.google.com/intl/cs/policies/technologies/cookies/';
//Setup VIM: ex: et ts=4 :

View File

@@ -4,14 +4,8 @@
* *
* @author Django <django@nausch.org> * @author Django <django@nausch.org>
*/ */
// custom language strings for the plugin
$lang['information'] = 'Cookies helfen bei der Bereitstellung von Inhalten. ' . $lang['information'] = 'Cookies helfen bei der Bereitstellung von Inhalten. ' .
'Durch die Nutzung dieser Seiten erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Rechner gespeichert werden. '; 'Durch die Nutzung dieser Seiten erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Rechner gespeichert werden. ';
$lang['consent'] = 'OK'; $lang['consent'] = 'OK';
$lang['details'] = ' Weitere Information'; $lang['details'] = ' Weitere Information';
$lang['details_url'] = 'https://de.wikipedia.org/wiki/Cookie'; $lang['details_url'] = 'https://de.wikipedia.org/wiki/Cookie';
//Setup VIM: ex: et ts=4 :

View File

@@ -4,14 +4,8 @@
* *
* @author Michal Koutny <michal@fykos.cz> * @author Michal Koutny <michal@fykos.cz>
*/ */
// custom language strings for the plugin
$lang['information'] = 'This website uses cookies for visitor traffic analysis. ' . $lang['information'] = 'This website uses cookies for visitor traffic analysis. ' .
'By using the website, you agree with storing the cookies on your computer.'; 'By using the website, you agree with storing the cookies on your computer.';
$lang['consent'] = 'OK'; $lang['consent'] = 'OK';
$lang['details'] = 'More information'; $lang['details'] = 'More information';
$lang['details_url'] = 'https://www.google.com/intl/en/policies/technologies/cookies/'; $lang['details_url'] = 'https://www.google.com/intl/en/policies/technologies/cookies/';
//Setup VIM: ex: et ts=4 :

View File

@@ -1,9 +1,10 @@
jQuery(function() { window.addEventListener('DOMContentLoaded', () => {
jQuery('.cookielaw-banner button').click(function() { document.querySelectorAll('.cookielaw-banner button').forEach((el) => {
var date = new Date(); el.addEventListener('click', () => {
const date = new Date();
date.setFullYear(date.getFullYear() + 10); date.setFullYear(date.getFullYear() + 10);
document.cookie = 'cookielaw=1; path=/; expires=' + date.toGMTString(); document.cookie = 'cookielaw=1; path=/; expires=' + date.toUTCString();
jQuery('.cookielaw-banner').hide(); document.querySelector('.cookielaw-banner').remove();
})
}); });
}); });

View File

@@ -7,7 +7,7 @@ div.cookielaw-banner {
background-color: @ini_background_alt; background-color: @ini_background_alt;
z-index: 1000; z-index: 1000;
padding: 10px; padding: 10px;
box-shadow: 0px 0px 10px @ini_text_alt; box-shadow: 0 0 10px @ini_text_alt;
} }
div.cookielaw-top { div.cookielaw-top {