From 4a7583d1353a0b7e35328a18de89fd0ea671e350 Mon Sep 17 00:00:00 2001 From: Anna Dabrowska Date: Wed, 15 Jul 2020 12:00:21 +0200 Subject: [PATCH 1/2] Adjust method signatures to match the current DokuWiki --- action.php | 4 ++-- syntax.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/action.php b/action.php index 792c381..7c25b30 100644 --- a/action.php +++ b/action.php @@ -32,7 +32,7 @@ function getInfo(){ /****************************************************************************** ** Register its handlers with the dokuwiki's event controller */ - function register(Doku_Event_Handler &$controller) { + function register(Doku_Event_Handler $controller) { $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_handle_act', array()); $controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, 'output', array()); } @@ -40,7 +40,7 @@ function register(Doku_Event_Handler &$controller) { /****************************************************************************** ** Handle the action */ - function _handle_act(&$event, $param) { + function _handle_act($event, $param) { if ($event->data === 'rate_voteup') { $this->raterfile = $_GET['rater_file']; $this->rater_id = $_GET['rater_id']; diff --git a/syntax.php b/syntax.php index 3ea7382..8274179 100644 --- a/syntax.php +++ b/syntax.php @@ -32,7 +32,7 @@ function connectTo($mode){ /******************************************************************************/ /* Handle the match */ - function handle($match, $state, $pos, Doku_Handler &$handler){ + function handle($match, $state, $pos, Doku_Handler $handler){ $match = substr($match,8,-2); //strip markup from start and end //handle params @@ -98,7 +98,7 @@ function handle($match, $state, $pos, Doku_Handler &$handler){ /******************************************************************************/ /* Create output */ - function render($mode, Doku_Renderer &$renderer, $data) { + function render($mode, Doku_Renderer $renderer, $data) { global $ID; global $lang; global $conf; From 0723ab4138b07bb73382d43b812937a0b3cead3a Mon Sep 17 00:00:00 2001 From: Anna Dabrowska Date: Wed, 15 Jul 2020 12:01:24 +0200 Subject: [PATCH 2/2] Fix PHP warnings --- syntax.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax.php b/syntax.php index 8274179..29c83f1 100644 --- a/syntax.php +++ b/syntax.php @@ -764,8 +764,8 @@ function calc_rater_rating($rater_filename) { $rater_str=""; $rater_str = fread($rater_file, 1024*8); if($rater_str!=""){ - $rater_data=explode($rater_end_of_line_char,$rater_str); - $rater_votes=count($rater_data)-1; + $rater_data=explode($rater_end_of_line_char,trim($rater_str)); + $rater_votes=count($rater_data); $rater_sum=0; foreach($rater_data as $d){