README.md
1# Wiki statistics
2
3wikistats Plugin for DokuWiki
4
5## General informations
6
7| Title | |
8| - | - |
9| Last updated on | 2017-06-28 |
10| Provides | [Syntax](https://www.dokuwiki.org/plugins?plugintype=1#extension__table "List all Syntax plugins"), [Helper](https://www.dokuwiki.org/plugins?plugintype=16#extension__table "List all Helper plugins"), [Action](https://www.dokuwiki.org/plugins?plugintype=4#extension__table "List all Action plugins") |
11| Conflicts with | N/A |
12| Requires | N/A |
13| Optionally requires | [tag](https://www.dokuwiki.org/plugin:tag "plugin tag") (for displaying tag related stats) |
14| Similar to | [numberof](https://www.dokuwiki.org/plugin:numberof "plugin numberof"), [stats](https://www.dokuwiki.org/plugin:stats "plugin stats") |
15| Tagged with | [report](https://www.dokuwiki.org/plugins?plugintag=report#extension__table "List all plugins with this tag"), [statistics](https://www.dokuwiki.org/plugins?plugintag=statistics#extension__table "List all plugins with this tag") |
16| Compatible with Dokuwiki | [Release 2017-02-19b "Frusterick Manners"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2017-02-19b.tgz "Release 2017-02-19b - Frusterick Manners"),<br>[Release 2016-06-26b "Elenor of Tsort"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2016-06-26b.tgz "Release 2016-06-26b - Elenor of Tsort"),<br>[Release 2015-08-10 "Detritus"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2015-08-10.tgz "Release 2015-08-10 - Detritus"),<br>[Release 2014-09-29d "Hrun"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2014-09-29d.tgz "Release 2014-09-29d - Hrun"),<br> [Release 2014-05-05a "Ponder Stibbons"](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2014-05-05a.tgz "Release 2014-05-05a - Ponder Stibbons") |
17| License | [GNU GPL v2](http://www.opensource.org/licenses/gpl-license.php "GNU GPL v2") |
18
19All documentation for this plugin can be found at
20[wikistats plugin page at Dokuwiki](https://www.dokuwiki.org/plugin:wikistats)
21
22## Installation
23
24Download the wikistats archive from the [git repo](https://github.com/4x4-chris/wikistats).
25
26If you install this plugin manually, make sure it is installed in
27`lib/plugins/wikistats/` - if the folder is called different it
28will not work!
29
30Please refer to [Dokuwiki plugin general page](https://www.dokuwiki.org/plugins) or [Dokuwiki plugin installation instructions](https://www.dokuwiki.org/plugin_installation_instructions) for additional info
31on how to install plugins in DokuWiki.
32
33### Add Stat Link to your Template
34
35This plugin requires the modification of the template (often `main.php`).
36Decide where you want to insert the *Stats* link in your template and
37insert the following code:
38
39```php
40if (!plugin_isdisabled('wikistats') &&
41 ($wikistats =& plugin_load('helper', 'wikistats'))) {
42 $wikistats->add_stats_link();
43}
44```
45
46Most likely you want to do that in the `/lib/tpl/default/main.php` inside the
47`<div id="bar__bottomright"/>` as follows:
48
49```html
50<div class="bar-right" id="bar__bottomright">
51 <?php if (!plugin_isdisabled('wikistats') &&
52 ($wikistats =& plugin_load('helper', 'wikistats')))
53 $wikistats->add_stats_link(); ?>
54 <?php tpl_button('subscription')?>
55 <?php tpl_button('admin')?>
56 <?php tpl_button('profile')?>
57 <?php tpl_button('login')?>
58 <?php tpl_button('index')?>
59 <?php tpl_button('top')?>
60</div>
61```
62
63For Dokuwiki "**Release 2017-02-19b Frusterick Manners**", you should process as follows:
64
65```html
66<!-- SITE TOOLS -->
67<div id="dokuwiki__sitetools">
68 <h3 class="a11y"><?php echo $lang['site_tools']; ?></h3>
69 <?php tpl_searchform(); ?>
70 <div class="mobileTools">
71 <?php tpl_actiondropdown($lang['tools']); ?>
72 </div>
73 <ul>
74 <?php
75 if (!plugin_isdisabled('wikistats') && ($wikistats = plugin_load('helper', 'wikistats')))
76 $wikistats->add_stats_link();
77 ?>
78 <?php
79 tpl_toolsevent('sitetools', array(
80 tpl_action('recent', true, 'li', true),
81 tpl_action('media', true, 'li', true),
82 tpl_action('index', true, 'li', true)
83 ));
84 ?>
85 </ul>
86</div>
87```
88
89Now, you have to create the **stats page** following the namespace and name given in the plugin admin configuration (```wiki:statistiques``` is the default value).
90
91To create this page, do as usual :smile:
92
93And add some code within, for example:
94
95```
96====== Statistiques ======
97
98{{wikistats>ns = -wiki & type = stats}}
99```
100
101## Usage
102
103### Type of stats displayed
104
105To display only topic (pages) stats
106```
107 {{wikistats>type = pages}}
108```
109
110To display only resources stats
111```
112 {{wikistats>type = medias}}
113```
114
115To display all stats (including namspaces and tags (if tag plugin is installed))
116```
117 {{wikistats>type = all}}
118```
119
120> Note that the type parameter is mandatory
121
122### Whitelist/blacklist by namespace
123
124By default plugin shows the stats of the entire wiki. To restrict the statistics
125to a given namespace and its sub-namespaces you can specify its name
126either directly or using `ns` parameter:
127
128```
129 {{wikistats>foo & type = pages}}
130 {{wikistats>ns = foo & type = pages}}
131```
132
133The `ns` parameter supports both inclusion and exclusion of the namespaces.
134If a namespace name starts with a minus sign that namespace will be excluded.
135Also you can assign a number of namespaces as a comma separated list:
136
137```
138 {{wikistats>ns = -foo & type = pages}}
139 {{wikistats>ns = foo, bar, -bar:baz & type = pages}}
140```
141
142The first example will show the pages stats in all namespaces except of “foo”,
143the second one will include “foo” and “bar” namespaces except of “bar:baz”
144sub-namespace.
145
146> Note that namespaces restrictions are not supported for tags and
147> namespaces stats
148
149### Multiple parameters syntax
150
151If you want to pass a number of parameters to the plugin they should be
152separated with an ampersand (`&`), for example:
153
154```
155 {{wikistats>ns = -foo & type = pages}}
156```
157
158The above syntax would display pages stats for the entire wiki except for
159the “foo” namespace.
160
161## Development
162
163### Git repository
164
165A public git repository is available [here](https://github.com/4x4-chris/wikistats)
166
167### Bugs and features request
168
169Please report issues in the [bug tracker](https://github.com/4x4-chris/wikistats/issues)
170
171### Languages
172
173 * English
174 * French
175 * Spanish
176 * German
177
178### ToDo / Wish list
179
180 * Add bargraph display
181 * Allow configuration of bar color
182 * Support namespaces restrictions for tags stats
183 * Handle namespaces with medias and without pages as an error (could be configured)
184 * Color for namespace errors could be configured
185 * Add Docker support for development environnement
186 * Add total for resources and namespaces stats
187 * Add Travis-CI support
188 * Add unit tests: plugin.info.txt compliance
189
190### Changelog
191
192 * 2017-06-30
193 * Add screenshot for dokuwiki plugin page
194 * 2017-06-29
195 * Add TOC support
196 * TOC display could be desactivated in plugin administration
197 * 2017-06-28
198 * **2017-06-28 release**
199 * 2017-06-27
200 * Add option to change render style
201 * Add resources types translations
202 * Namespace stats now show medias counts
203 * Update General Informations and Installation instructions
204 * Plugin now display stats even if Tag plugin is not installed
205 * Namespaces are sorted in ascending alphabetical order
206 * Code refactoring
207 * 2017-06-22
208 * Add stats icon to wiki template
209 * 2017-06-20
210 * **Initial release**
211
212## FAQ
213
214_None actually_
215
216----
217Copyright (C) Chris4x4 <4x4.chris@gmail.com>
218
219This program is free software; you can redistribute it and/or modify
220it under the terms of the GNU General Public License as published by
221the Free Software Foundation; version 2 of the License
222
223This program is distributed in the hope that it will be useful,
224but WITHOUT ANY WARRANTY; without even the implied warranty of
225MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
226GNU General Public License for more details.
227
228See the COPYING file in your DokuWiki folder for details
229