Skip to content

Commit

Permalink
Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
annda committed Oct 9, 2024
1 parent ba165cb commit 9de4e22
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 36 deletions.
39 changes: 18 additions & 21 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class action_plugin_watchcycle extends DokuWiki_Action_Plugin
{

/**
* Registers a callback function for a given event
*
Expand All @@ -22,20 +21,20 @@ class action_plugin_watchcycle extends DokuWiki_Action_Plugin
public function register(Doku_Event_Handler $controller)
{

$controller->register_hook('PARSER_METADATA_RENDER', 'AFTER', $this, 'handle_parser_metadata_render');
$controller->register_hook('PARSER_CACHE_USE', 'AFTER', $this, 'handle_parser_cache_use');
$controller->register_hook('PARSER_METADATA_RENDER', 'AFTER', $this, 'handleParserMetadataRender');
$controller->register_hook('PARSER_CACHE_USE', 'AFTER', $this, 'handleParserCacheUse');
// ensure a page revision is created when summary changes:
$controller->register_hook('COMMON_WIKIPAGE_SAVE', 'BEFORE', $this, 'handle_pagesave_before');
$controller->register_hook('COMMON_WIKIPAGE_SAVE', 'BEFORE', $this, 'handlePagesaveBefore');
$controller->register_hook('SEARCH_RESULT_PAGELOOKUP', 'BEFORE', $this, 'addIconToPageLookupResult');
$controller->register_hook('SEARCH_RESULT_FULLPAGE', 'BEFORE', $this, 'addIconToFullPageResult');
$controller->register_hook('FORM_SEARCH_OUTPUT', 'BEFORE', $this, 'addFilterToSearchForm');
$controller->register_hook('FORM_QUICKSEARCH_OUTPUT', 'BEFORE', $this, 'handle_form_quicksearch_output');
$controller->register_hook('FORM_QUICKSEARCH_OUTPUT', 'BEFORE', $this, 'handleFormQuicksearchOutput');
$controller->register_hook('SEARCH_QUERY_FULLPAGE', 'AFTER', $this, 'filterSearchResults');
$controller->register_hook('SEARCH_QUERY_PAGELOOKUP', 'AFTER', $this, 'filterSearchResults');

$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar_define');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_get');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_validate');
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handleToolbarDefine');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handleAjaxGet');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handleAjaxValidate');
}


Expand All @@ -48,7 +47,7 @@ public function register(Doku_Event_Handler $controller)
*
* @return void
*/
public function handle_toolbar_define(Doku_Event $event, $param)
public function handleToolbarDefine(Doku_Event $event, $param)
{
$event->data[] = [
'type' => 'plugin_watchcycle',
Expand Down Expand Up @@ -81,7 +80,7 @@ public function addFilterToSearchForm(Doku_Event $event, $param)
*
* @return void
*/
public function handle_form_quicksearch_output(Doku_Event $event, $param)
public function handleFormQuicksearchOutput(Doku_Event $event, $param)
{
/** @var \dokuwiki\Form\Form $qsearchForm */
$qsearchForm = $event->data;
Expand Down Expand Up @@ -117,7 +116,7 @@ public function filterSearchResults(Doku_Event $event, $param)
*
* @return void
*/
public function handle_parser_metadata_render(Doku_Event $event, $param)
public function handleParserMetadataRender(Doku_Event $event, $param)
{
global $ID;

Expand Down Expand Up @@ -191,7 +190,7 @@ public function handle_parser_metadata_render(Doku_Event $event, $param)
* @param Doku_Event $event
* @param string $param
*/
public function handle_ajax_get(Doku_Event $event, $param)
public function handleAjaxGet(Doku_Event $event, $param)
{
if ($event->data != 'plugin_watchcycle_get') return;
$event->preventDefault();
Expand All @@ -201,11 +200,11 @@ public function handle_ajax_get(Doku_Event $event, $param)
header('Content-Type: application/json');
try {
$result = $this->fetchUsersAndGroups();
} catch(\Exception $e) {
} catch (\Exception $e) {
$result = [
'error' => $e->getMessage().' '.basename($e->getFile()).':'.$e->getLine()
'error' => $e->getMessage() . ' ' . basename($e->getFile()) . ':' . $e->getLine()
];
if($conf['allowdebug']) {
if ($conf['allowdebug']) {
$result['stacktrace'] = $e->getTraceAsString();
}
http_status(500);
Expand All @@ -220,7 +219,7 @@ public function handle_ajax_get(Doku_Event $event, $param)
* @param Doku_Event $event
* @param $param
*/
public function handle_ajax_validate(Doku_Event $event, $param)
public function handleAjaxValidate(Doku_Event $event, $param)
{
if ($event->data != 'plugin_watchcycle_validate') return;
$event->preventDefault();
Expand Down Expand Up @@ -266,7 +265,7 @@ protected function fetchUsersAndGroups()

// check cache
$cachedGroups = new cache('retrievedGroups', '.txt');
if($cachedGroups->useCache(['age' => 30])) {
if ($cachedGroups->useCache(['age' => 30])) {
$foundGroups = unserialize($cachedGroups->retrieveCache());
} else {
$foundGroups = $auth->retrieveGroups();
Expand Down Expand Up @@ -335,7 +334,7 @@ protected function getLastMaintainerRev($meta, $maintainer, &$rev)
*
* @return void
*/
public function handle_parser_cache_use(Doku_Event $event, $param)
public function handleParserCacheUse(Doku_Event $event, $param)
{
/* @var \helper_plugin_watchcycle $helper */
$helper = plugin_load('helper', 'watchcycle');
Expand All @@ -354,7 +353,7 @@ public function handle_parser_cache_use(Doku_Event $event, $param)
*
* @return void
*/
public function handle_pagesave_before(Doku_Event $event, $param)
public function handlePagesaveBefore(Doku_Event $event, $param)
{
if ($event->data['contentChanged']) {
return;
Expand Down Expand Up @@ -401,5 +400,3 @@ public function addIconToFullPageResult(Doku_Event $event, $param)
}
}
}

// vim:ts=4:sw=4:et:
1 change: 0 additions & 1 deletion admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class admin_plugin_watchcycle extends DokuWiki_Admin_Plugin
{

/**
* @return int sort number in admin menu
*/
Expand Down
1 change: 1 addition & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Default settings for the watchcycle plugin
*
Expand Down
3 changes: 1 addition & 2 deletions conf/metadata.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

/**
* Options for the watchcycle plugin
*
* @author Michael Große <[email protected]>
*/


$meta['default_maintained_only'] = ['onoff'];

7 changes: 4 additions & 3 deletions helper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* DokuWiki Plugin struct (Helper Component)
*
Expand All @@ -8,9 +9,9 @@

class helper_plugin_watchcycle extends DokuWiki_Plugin
{
const MAINTAINERS_RAW = 0;
const MAINTAINERS_FLAT = 1;
const MAINTAINERS_EXPANDED = 2;
public const MAINTAINERS_RAW = 0;
public const MAINTAINERS_FLAT = 1;
public const MAINTAINERS_EXPANDED = 2;

/**
* Create HTML for an icon showing the maintenance status of the provided pageid
Expand Down
18 changes: 9 additions & 9 deletions syntax.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps

use dokuwiki\Extension\SyntaxPlugin;

/**
* DokuWiki Plugin watchcycle (Syntax Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Szymon Olewniczak <[email protected]>
*/

// must be run within Dokuwiki
if (!defined('DOKU_INC')) {
die();
}

class syntax_plugin_watchcycle extends DokuWiki_Syntax_Plugin
class syntax_plugin_watchcycle extends SyntaxPlugin
{
/**
* @return string Syntax mode type
Expand Down Expand Up @@ -188,10 +188,10 @@ protected function getMaintainerHtml($def)

$all = $helper->getMaintainers($def);
$flat = array();
foreach($all as $name => $info) {
if(is_array($info)) {
foreach ($all as $name => $info) {
if (is_array($info)) {
$flat[] = $this->email($info['mail'], $info['name']);
}elseif($info === null) {
} elseif ($info === null) {
$flat[] = $name;
}
}
Expand Down

0 comments on commit 9de4e22

Please sign in to comment.