Skip to content

Commit

Permalink
Merge pull request #2 from cosmocode/bot/autofix
Browse files Browse the repository at this point in the history
🤖 Automatic code style fixes
  • Loading branch information
annda authored Oct 18, 2023
2 parents d89a28e + 540d31b commit ce4acaa
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
14 changes: 9 additions & 5 deletions action.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<?php

use dokuwiki\Extension\ActionPlugin;
use dokuwiki\Extension\EventHandler;
use dokuwiki\Extension\Event;

/**
* DokuWiki Plugin lms (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <[email protected]>
*/
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');
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions admin.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

use dokuwiki\Extension\AdminPlugin;
use dokuwiki\Form\Form;

/**
* DokuWiki Plugin lms (Admin Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <[email protected]>
*/
class admin_plugin_lms extends \dokuwiki\Extension\AdminPlugin
class admin_plugin_lms extends AdminPlugin
{
/** @inheritDoc */
public function forAdminOnly()
Expand All @@ -27,7 +30,7 @@ public function html()

echo '<h1>' . $this->getLang('menu') . '</h1>';

$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 '<p>' . $form->toHTML() . '</p>';
Expand Down
8 changes: 5 additions & 3 deletions helper.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

use dokuwiki\Extension\Plugin;

/**
* DokuWiki Plugin lms (Helper Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <[email protected]>
*/
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
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions syntax/include.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

use dokuwiki\Extension\SyntaxPlugin;

/**
* DokuWiki Plugin lms (Syntax Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <[email protected]>
*/
class syntax_plugin_lms_include extends \dokuwiki\Extension\SyntaxPlugin
class syntax_plugin_lms_include extends SyntaxPlugin
{
/** @var helper_plugin_lms */
protected $hlp;
Expand Down Expand Up @@ -51,7 +53,7 @@ public function connectTo($mode)
/** @inheritDoc */
public function handle($match, $state, $pos, Doku_Handler $handler)
{
$data = array();
$data = [];

return $data;
}
Expand Down
6 changes: 4 additions & 2 deletions syntax/lms.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

use dokuwiki\Extension\SyntaxPlugin;

/**
* DokuWiki Plugin lms (Syntax Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <[email protected]>
*/
class syntax_plugin_lms_lms extends \dokuwiki\Extension\SyntaxPlugin
class syntax_plugin_lms_lms extends SyntaxPlugin
{
/** @var helper_plugin_lms */
protected $hlp;
Expand Down Expand Up @@ -51,7 +53,7 @@ public function connectTo($mode)
/** @inheritDoc */
public function handle($match, $state, $pos, Doku_Handler $handler)
{
$data = array();
$data = [];

return $data;
}
Expand Down

0 comments on commit ce4acaa

Please sign in to comment.