It's better when it's simple

User Tools

Site Tools


Plugin Survey 2011 - Source Code

(This is a part of the plugin survey 2011)

The 802 downloaded plugins could be analysed and commented in a number of ways, here are a few. Metrics were done by CLOC and comparisons were done with DokuWiki 2011-05-25a (bundled plugins included). This is also an attempt to determine which common_plugin_functions and other features are used by the plugin authors.


Downloaded plugins contain a total of 558,975 lines of PHP, compared to DokuWiki's approx. 114,000 (+19,000 since last survey) lines of code. Smallest plugin wysiwyg_nicedit is 11 lines and only contains info for plugin manager, actual plugin in JavaScript. The median plugin is a syntax plugin with 147 lines of PHP. Finally there are 34 plugins with more than 2,000 lines of code, largest is dw2pdf with 71,000 lines of code.


DokuWiki framework enable plugins or templates to be configurable by the configuration manager which will handle/display the options. Plugins should provide

  • <plugin>/conf/default.php which will hold the default settings and
  • <plugin>/conf/metadata.php which holds the describing configuration metadata.

During the survey 271 plugins (34%) were found compatible with the configuration manager. 10 plugins are missing the metadata file, unknown whether this is intentional or not.


Since the 2009-12-25c “Lemming” release DokuWiki requires PHP version 5.1.2 which supports object oriented concepts like visibility (public, private, inherit) etc. Technically plugins now could be written in this style but only 41 plugins (5%) is found by looking for 'private function'. But in the population of new plugins there are more than 11% written in PHP 5.

Saving data on action SAVE

DokuWiki release 2010-11-07a “Anteater” changed the behavior on page save. Functions handle() and render() are in most cases no longer called during save. The change means that relying on $ACT == 'save' doesn't work anymore. 5 plugins are still found using this technique.

The best fix is to save the data during metadata rendering because metadata is only rendered for current and saved pages. Metadata rendering will happen also for unchanged pages, if this is an issue for you you could add a check for the last modification time of the page, it should be available in the metadata you can access via the renderer (and e.g. store in the persistent metadata when you last saved your data).


The toolbar makes DokuWiki easy to use even for novice users. Sometimes plugins need to extend the toolbar with another button or interact in other ways. There are more than one way to achieve this, 40 plugins are using PHP and the TOOLBAR DEFINE event to add toolbar buttons. See the survey event list for a detailed list.

Adding a button using JavaScript is just as simple as doing it in PHP, 21 plugins interacts with the toolbar array this way. Together with those using PHP event they represent 10% of the 573 syntax plugins.

15 plugins are using the static data method accessing toolbar[…]

6 plugins are using dynamic method based on getElementById('tool__bar') or jQuery('tool__bar').


Almost 20% of the downloaded plugins use javascript to enhance the user experience. There is a total of 284,062 lines of JavaScript compared to DokuWiki's approx. 2,500 lines. Five FCK editors (fckw, grensladawritezor, wysiwyg, fckg, fckglite) contain about 30,000+ rows each and 9 other are 4,000+ lines of code but the median is only 77 lines of code. A few scripts are also compressed to single line without whitespace.

DokuWiki handles plugins without any PHP code but the plugin manager is not able to display information about the plugin. enforcesummary, ipa and lightboxv2 do not have an accompanying PHP plugin class.

JavaScript include

DokuWiki's JavaScript dispatcher allows you to use special JavaScript comments to include other script files. This is useful for cases where usually only a single JavaScript file would be parsed, e.g. in templates or plugins. Following 7 plugins uses DokuWiki JavaScript include.


The jQuery library was introduced with DokuWiki release 2011-11-10 “Angua”. This enables plugin and template developers to more stuff with fewer lines of Java. jQuery code is found in 6 plugins.


By using the event AJAX_CALL_UNKNOWN that is signalled from lib/exe/ajax.php if the AJAX call is not recognized action_plugins can create interactive web applications. SurveyBot tried three ways to identify plugins using AJAX.

21 plugins contains a AJAX_CALL_UNKNOWN 'register_hook()'

An additional 33 plugins are found by looking in JavaScript for 'runAJAX'.

At last 9 more plugins are tagged ajax


Presentation can be controlled by CSS stylesheets. The downloaded plugins contain a total of 38,787 lines of CSS divided among 320 plugins (i.e. 39% uses CSS). syntaxhighlighter3 has one of the largest files with 3,600 lines but the median is only 34 lines of CSS. There are 15 plugins with more than 500 lines of CSS:


DokuWiki knows three types of stylesheet modes. Most plugins just use the screen mode by adding styles.css, Plugins styles hints about the possibility to support other modes, SurveyBot found some examples:

40 plugins with Print.css.

6 plugins with rtl.css.

Guaranteed colour place holders

DokuWiki's CSS dispatcher is able to replace place holders in the loaded stylesheets. From 2006-08-05 on they have been renamed to be more semantically correct. SurveyBot found 16 plugins that still uses now obsolete css replacements.

Continue to ⇒ events

devel/plugin_survey/source_code.txt · Last modified: 2013-07-04 13:58 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki