PHP74 compatibility
This commit is contained in:
31
action.php
31
action.php
@@ -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:
|
||||
|
||||
@@ -4,5 +4,4 @@
|
||||
*
|
||||
* @author Michal Koutny <michal@fykos.cz>
|
||||
*/
|
||||
|
||||
$conf['position'] = 'bottom';
|
||||
|
||||
@@ -4,7 +4,4 @@
|
||||
*
|
||||
* @author Michal Koutny <michal@fykos.cz>
|
||||
*/
|
||||
|
||||
|
||||
$meta['position'] = array('multichoice', '_choices' => array('top', 'bottom'));
|
||||
|
||||
$meta['position'] = ['multichoice', '_choices' => ['top', 'bottom']];
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
*
|
||||
* @author Michal Koutny <michal@fykos.cz>
|
||||
*/
|
||||
|
||||
// custom language strings for the plugin
|
||||
$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.';
|
||||
$lang['consent'] = 'OK';
|
||||
$lang['details'] = 'Více informací';
|
||||
$lang['details_url'] = 'https://www.google.com/intl/cs/policies/technologies/cookies/';
|
||||
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
*
|
||||
* @author Django <django@nausch.org>
|
||||
*/
|
||||
|
||||
// custom language strings for the plugin
|
||||
$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. ';
|
||||
$lang['consent'] = 'OK';
|
||||
$lang['details'] = ' Weitere Information';
|
||||
$lang['details_url'] = 'https://de.wikipedia.org/wiki/Cookie';
|
||||
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
*
|
||||
* @author Michal Koutny <michal@fykos.cz>
|
||||
*/
|
||||
|
||||
// custom language strings for the plugin
|
||||
$lang['information'] = 'This website uses cookies for visitor traffic analysis. ' .
|
||||
'By using the website, you agree with storing the cookies on your computer.';
|
||||
$lang['consent'] = 'OK';
|
||||
$lang['details'] = 'More information';
|
||||
$lang['details_url'] = 'https://www.google.com/intl/en/policies/technologies/cookies/';
|
||||
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
||||
15
script.js
15
script.js
@@ -1,9 +1,10 @@
|
||||
jQuery(function() {
|
||||
jQuery('.cookielaw-banner button').click(function() {
|
||||
var date = new Date();
|
||||
date.setFullYear(date.getFullYear() + 10);
|
||||
document.cookie = 'cookielaw=1; path=/; expires=' + date.toGMTString();
|
||||
jQuery('.cookielaw-banner').hide();
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.cookielaw-banner button').forEach((el) => {
|
||||
el.addEventListener('click', () => {
|
||||
const date = new Date();
|
||||
date.setFullYear(date.getFullYear() + 10);
|
||||
document.cookie = 'cookielaw=1; path=/; expires=' + date.toUTCString();
|
||||
document.querySelector('.cookielaw-banner').remove();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ div.cookielaw-banner {
|
||||
background-color: @ini_background_alt;
|
||||
z-index: 1000;
|
||||
padding: 10px;
|
||||
box-shadow: 0px 0px 10px @ini_text_alt;
|
||||
box-shadow: 0 0 10px @ini_text_alt;
|
||||
}
|
||||
|
||||
div.cookielaw-top {
|
||||
Reference in New Issue
Block a user