<?php /** * DokuWiki Plugin wikistats (Syntax Component) * * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html * @author Chris4x4 <4x4.chris@gmail.com> */ // 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. * * <p> * The returned array holds the following fields: * <dl> * <dt>author</dt><dd>Author of the plugin</dd> * <dt>email</dt><dd>Email address to contact the author</dd> * <dt>date</dt><dd>Last modified date of the plugin in * <tt>YYYY-MM-DD</tt> format</dd> * <dt>name</dt><dd>Name of the plugin</dd> * <dt>desc</dt><dd>Short description of the plugin (Text only)</dd> * <dt>url</dt><dd>Website with more information on the plugin * (eg. syntax description)</dd> * </dl> * @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; } } } ?>