Skip to content

Commit

Permalink
clean up skeletons
Browse files Browse the repository at this point in the history
They should now adhere closer to the coding standard
  • Loading branch information
splitbrain committed Sep 2, 2023
1 parent abd1c9c commit 8673a04
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 37 deletions.
13 changes: 8 additions & 5 deletions skel/action.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<?php

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

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends \dokuwiki\Extension\ActionPlugin
class @@PLUGIN_COMPONENT_NAME@@ extends ActionPlugin
{

/** @inheritDoc */
public function register(Doku_Event_Handler $controller)
public function register(EventHandler $controller)
{
@@REGISTER@@
}

@@HANDLERS@@
}

6 changes: 3 additions & 3 deletions skel/action_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Event handler for @@EVENT@@
*
* @see https://www.dokuwiki.org/devel:events:@@EVENT@@
* @param Doku_Event $event Event object
* @param Event $event Event object
* @param mixed $param optional parameter passed when event was registered
* @return void
*/
public function @@HANDLER@@(Doku_Event $event, $param) {

public function @@HANDLER@@(Event $event, $param)
{
}
9 changes: 5 additions & 4 deletions skel/admin.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use dokuwiki\Extension\AdminPlugin;

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Admin Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends \dokuwiki\Extension\AdminPlugin
class @@PLUGIN_COMPONENT_NAME@@ extends AdminPlugin
{

/** @inheritDoc */
public function handle()
{
Expand All @@ -21,4 +23,3 @@ public function html()
echo '<h1>' . $this->getLang('menu') . '</h1>';
}
}

12 changes: 6 additions & 6 deletions skel/auth.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use dokuwiki\Extension\AuthPlugin;

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Auth Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends \dokuwiki\Extension\AuthPlugin
class @@PLUGIN_COMPONENT_NAME@@ extends AuthPlugin
{

/** @inheritDoc */
public function __construct()
{
Expand All @@ -31,7 +33,6 @@ public function __construct()
$this->success = true;
}


/** @inheritDoc */
// public function logOff()
// {
Expand Down Expand Up @@ -69,7 +70,7 @@ public function checkPass($user, $pass)
}

/** @inheritDoc */
public function getUserData($user, $requireGroups=true)
public function getUserData($user, $requireGroups = true)
{
/*
FIXME implement and return something like this
Expand Down Expand Up @@ -156,4 +157,3 @@ public function cleanGroup($group)
// FIXME implement
//}
}

9 changes: 5 additions & 4 deletions skel/helper.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

use dokuwiki\Extension\Plugin;

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Helper Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends \dokuwiki\Extension\Plugin
class @@PLUGIN_COMPONENT_NAME@@ extends Plugin
{

}

12 changes: 7 additions & 5 deletions skel/remote.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

use dokuwiki\Extension\RemotePlugin;
use dokuwiki\Remote\AccessDeniedException;

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends \dokuwiki\Extension\RemotePlugin
class @@PLUGIN_COMPONENT_NAME@@ extends RemotePlugin
{

/**
* Example function
*
Expand All @@ -18,10 +21,9 @@ public function myExample($id)
// FIXME handle security in your method!
$id = cleanID($id);
if (auth_quickaclcheck($id) < AUTH_READ) {
throw new RemoteAccessDeniedException('You are not allowed to read this file', 111);
throw new AccessDeniedException('You are not allowed to read this file', 111);
}

return 'example';
}
}

5 changes: 2 additions & 3 deletions skel/renderer.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Renderer Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends Doku_Renderer
{

/** @inheritDoc */
public function getFormat()
{
Expand All @@ -16,4 +16,3 @@ public function getFormat()

// FIXME implement all methods of Doku_Renderer here
}

5 changes: 2 additions & 3 deletions skel/renderer_xhtml.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Renderer Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends Doku_Renderer_xhtml
{

/**
* @inheritDoc
* Make available as XHTML replacement renderer
Expand All @@ -22,4 +22,3 @@ public function canRender($format)

// FIXME override any methods of Doku_Renderer_xhtml here
}

10 changes: 6 additions & 4 deletions skel/syntax.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

use dokuwiki\Extension\SyntaxPlugin;

/**
* DokuWiki Plugin @@PLUGIN_NAME@@ (Syntax Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
* @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
*/
class @@PLUGIN_COMPONENT_NAME@@ extends \dokuwiki\Extension\SyntaxPlugin
class @@PLUGIN_COMPONENT_NAME@@ extends SyntaxPlugin
{
/** @inheritDoc */
public function getType()
Expand Down Expand Up @@ -41,7 +44,7 @@ public function connectTo($mode)
/** @inheritDoc */
public function handle($match, $state, $pos, Doku_Handler $handler)
{
$data = array();
$data = [];

return $data;
}
Expand All @@ -56,4 +59,3 @@ public function render($mode, Doku_Renderer $renderer, $data)
return true;
}
}

0 comments on commit 8673a04

Please sign in to comment.