From 540d31b1f91c7f34241040b7196b6e06d8cdc2a9 Mon Sep 17 00:00:00 2001 From: annda Date: Wed, 18 Oct 2023 15:58:57 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Automatic=20code=20style=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action.php | 14 +++++++++----- admin.php | 7 +++++-- helper.php | 8 +++++--- syntax/include.php | 6 ++++-- syntax/lms.php | 6 ++++-- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/action.php b/action.php index 654828d..132dc3c 100644 --- a/action.php +++ b/action.php @@ -1,15 +1,19 @@ */ -class action_plugin_lms extends \dokuwiki\Extension\ActionPlugin +class action_plugin_lms extends ActionPlugin { /** @inheritDoc */ - public function register(Doku_Event_Handler $controller) + public function register(EventHandler $controller) { $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'handleStart'); $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleAction'); @@ -23,7 +27,7 @@ public function register(Doku_Event_Handler $controller) * @param mixed $param optional parameter passed when event was registered * @return void */ - public function handleStart(Doku_Event $event, $param) + public function handleStart(Event $event, $param) { global $JSINFO; global $INPUT; @@ -45,7 +49,7 @@ public function handleStart(Doku_Event $event, $param) * @param mixed $param optional parameter passed when event was registered * @return void */ - public function handleAction(Doku_Event $event, $param) + public function handleAction(Event $event, $param) { global $INPUT; global $ID; @@ -89,7 +93,7 @@ public function handleAction(Doku_Event $event, $param) * @param Doku_Event $event * @return void */ - public function handleAdminAjax(Doku_Event $event) + public function handleAdminAjax(Event $event) { if ($event->data !== 'plugin_lms_autocomplete') return; global $INPUT; diff --git a/admin.php b/admin.php index a9de4c1..06cd63c 100644 --- a/admin.php +++ b/admin.php @@ -1,12 +1,15 @@ */ -class admin_plugin_lms extends \dokuwiki\Extension\AdminPlugin +class admin_plugin_lms extends AdminPlugin { /** @inheritDoc */ public function forAdminOnly() @@ -27,7 +30,7 @@ public function html() echo '

' . $this->getLang('menu') . '

'; - $form = new dokuwiki\Form\Form(['method' => 'POST', 'id' => 'lms__admin-autocomplete']); + $form = new Form(['method' => 'POST', 'id' => 'lms__admin-autocomplete']); $form->addTextInput('user', $this->getLang('username')); $form->addButton('submit', '🔍'); echo '

' . $form->toHTML() . '

'; diff --git a/helper.php b/helper.php index 323b753..0e6b489 100644 --- a/helper.php +++ b/helper.php @@ -1,12 +1,14 @@ */ -class helper_plugin_lms extends \dokuwiki\Extension\Plugin +class helper_plugin_lms extends Plugin { /** * Return all lessons and info about the user's current completion status @@ -76,7 +78,7 @@ public function getUserLessons($user) $lessons = []; $lines = file($file); foreach ($lines as $line) { - list($time, $id, $seen) = explode("\t", trim($line)); + [$time, $id, $seen] = explode("\t", trim($line)); // we use simple log files if ($seen) { @@ -99,7 +101,7 @@ public function getUserLessons($user) public function getLesson($id, $user) { $all = $this->getLessons($user); - return isset($all[$id]) ? $all[$id] : false; + return $all[$id] ?? false; } /** diff --git a/syntax/include.php b/syntax/include.php index 5d98a71..316bb46 100644 --- a/syntax/include.php +++ b/syntax/include.php @@ -1,12 +1,14 @@ */ -class syntax_plugin_lms_include extends \dokuwiki\Extension\SyntaxPlugin +class syntax_plugin_lms_include extends SyntaxPlugin { /** @var helper_plugin_lms */ protected $hlp; @@ -51,7 +53,7 @@ public function connectTo($mode) /** @inheritDoc */ public function handle($match, $state, $pos, Doku_Handler $handler) { - $data = array(); + $data = []; return $data; } diff --git a/syntax/lms.php b/syntax/lms.php index 64cc57f..c235bda 100644 --- a/syntax/lms.php +++ b/syntax/lms.php @@ -1,12 +1,14 @@ */ -class syntax_plugin_lms_lms extends \dokuwiki\Extension\SyntaxPlugin +class syntax_plugin_lms_lms extends SyntaxPlugin { /** @var helper_plugin_lms */ protected $hlp; @@ -51,7 +53,7 @@ public function connectTo($mode) /** @inheritDoc */ public function handle($match, $state, $pos, Doku_Handler $handler) { - $data = array(); + $data = []; return $data; }