1<?php
2/**
3 * Wiki Statistics Plugin: Displays some wiki stats
4 *
5 * @author     Emanuele <emanuele45@interfree.it>
6 */
7
8if(!defined('DOKU_INC')) die();
9if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
10require_once DOKU_PLUGIN.'action.php';
11
12class action_plugin_wikistatistics extends DokuWiki_Action_Plugin {
13
14	/**
15	 * return some info
16	 */
17	function getInfo(){
18		return array(
19			'author' => 'Emanuele, Thomas',
20			'email'  => 'emanuele45@interfree.it',
21			'date'   => '2010-02-xx',
22			'name'   => 'WikiStatistics',
23			'desc'   => 'Display statistics about the Wiki and their users',
24			'url'	 => 'http://lacroa.altervista.org/dokucount/',
25		);
26	}
27
28	/**
29	 * Register its handlers with the DokuWiki's event controller
30	 */
31	function register(&$controller) {
32		$controller->register_hook('TPL_CONTENT_DISPLAY', 'BEFORE', $this,
33								   '_clean_xhtml');
34	}
35
36	/**
37	 *
38	 *
39	 *
40	 */
41	function _clean_xhtml(&$event, $param) {
42		$pattern = '/(<p>(.*?)<table class="wikistat (.*?)<\/p>)/ism';
43		$replace = '<p>$2</p><table class="wikistat $3';
44		$event->data = preg_replace($pattern, $replace,$event->data);
45	}
46}
47
48