*/
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class action_plugin_wikistats extends DokuWiki_Action_Plugin {
/**
* Get an associative array with plugin info.
*
*
* The returned array holds the following fields:
*
* - author
- Author of the plugin
* - email
- Email address to contact the author
* - date
- Last modified date of the plugin in
* YYYY-MM-DD format
* - name
- Name of the plugin
* - desc
- Short description of the plugin (Text only)
* - url
- Website with more information on the plugin
* (eg. syntax description)
*
* @param none
* @return Array Information about this plugin class.
* @public
* @static
*/
function getInfo(){
return confToHash(dirname(__FILE__).'/plugin.info.txt');
}
/*
* Plugin should use this method to register its handlers with the dokuwiki's event controller
*/
function register(&$controller) {
$controller->register_hook('PARSER_CACHE_USE', 'BEFORE', $this, '_purgecache');
}
/**
* Check for pages changes and eventually purge cache.
*/
function _purgecache(&$event, $param) {
global $ID;
$str = rawWiki($ID);
if (strpos($str, '{{wikistats') !== false) {
$event->preventDefault();
$event->stopPropagation();
$event->result = false;
}
}
}
?>