2025-08-29 23:14:10 +03:00
< ? php
use dokuwiki\Extension\AdminPlugin ;
/**
2025-09-01 16:25:25 +02:00
* Bot Monitoring Plugin
2025-08-29 23:14:10 +03:00
*
* @ license GPL 2 ( http :// www . gnu . org / licenses / gpl . html )
* @ author Sascha Leib < ad @ hominem . info >
*/
/**
* All DokuWiki plugins to extend the admin function
* need to inherit from this class
**/
2025-09-01 16:25:25 +02:00
class admin_plugin_botmon extends AdminPlugin {
2025-08-29 23:14:10 +03:00
/**
* Return the path to the icon being displayed in the main admin menu .
*
* @ return string full path to the icon file
**/
public function getMenuIcon () {
$plugin = $this -> getPluginName ();
return DOKU_PLUGIN . $plugin . '/img/admin.svg' ;
}
/**
* output appropriate html
*/
public function html () {
2025-09-01 18:55:56 +02:00
global $conf ;
$pluginPath = $conf [ 'basedir' ] . 'lib/plugins/' . $this -> getPluginName ();
2025-08-29 23:14:10 +03:00
/* Plugin Headline */
2025-09-01 16:25:25 +02:00
echo '<div id="botmon__admin">' ;
echo '<h1>Bot Monitoring Plugin</h1>' ;
2025-08-29 23:14:10 +03:00
/* tab navigation */
2025-09-01 16:25:25 +02:00
echo '<nav id="botmon__tabs">' ;
2025-08-29 23:14:10 +03:00
echo '<ul class="tabs" role="tablist">' ;
echo '<li role="presentation" class="active">' ;
2025-09-01 16:25:25 +02:00
echo '<a role="tab" href="#botmon__panel1" aria-controls="botmon__panel1" id="botmon__tab1" aria-selected="true">Today</a></li>' ;
2025-08-29 23:14:10 +03:00
echo '</ul></nav>' ;
2025-09-01 18:55:56 +02:00
// Beta warning message:
2025-09-03 18:22:29 +02:00
echo '<div class="info"><strong>Please note:</strong> This plugin is still in the early stages of development and does not (yet) clean up its <code>logs</code> directory.<br>You can clean up the old log files by <a href="' . $pluginPath . '/cleanup.php" target="_blank">clicking here</a>, or by adding the cleanup script to your cron jobs.</div>' ;
2025-09-01 18:55:56 +02:00
2025-08-29 23:14:10 +03:00
/* Live tab */
2025-09-01 16:25:25 +02:00
echo '<article role="tabpanel" id="botmon__today"">' ;
2025-08-29 23:14:10 +03:00
echo '<h2 class="a11y">Today</h2>' ;
2025-09-01 16:25:25 +02:00
echo '<header id="botmon__today__title">Loading …</header>' ;
echo '<div id="botmon__today__content">' ;
2025-09-03 18:22:29 +02:00
echo '<details id="botmon__today__visitors"><summary>Visitor logs</summary>' ;
echo '<div id="botmon__today__visitorlists"></div>' ;
2025-08-30 18:40:16 +03:00
echo '</details></div>' ;
2025-09-01 18:55:56 +02:00
echo '<footer aria-live="polite"><img src="' . $pluginPath . '/img/spinner.svg" id="botmon__today__busy" width="12" height="12" alt="busy indicator"><span id="botmon__today__status">Initialising …</span></footer>' ;
2025-09-01 15:42:06 +02:00
echo '</article>' ;
2025-09-01 16:25:25 +02:00
echo '</div><!-- End of BotMon Admin Tool -->' ;
2025-08-29 23:14:10 +03:00
}
}