====== Plugin Survey 2011 - Source Code ====== (This is a part of the [[start|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 [[http://cloc.sourceforge.net/|CLOC]] and comparisons were done with DokuWiki 2011-05-25a (bundled plugins included). This is also an attempt to determine which [[devel:common_plugin_functions]] and other features are used by the plugin authors. ===== PHP ===== 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 [[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 [[plugin:dw2pdf]] with 71,000 lines of code. === Config === DokuWiki framework enable plugins or templates to be [[devel:configuration|configurable]] by the [[plugin:config|configuration manager]] which will handle/display the options. Plugins should provide * ''/conf/default.php'' which will hold the default settings and * ''/conf/metadata.php'' which holds the describing [[devel:configuration#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. * [[plugin:easyvar]], [[plugin:icalevents]], [[plugin:javadoc]], [[plugin:kixovar]], [[plugin:lampshade]], [[plugin:linkbonus]], [[plugin:noticeboard]], [[plugin:searchpattern]], [[plugin:twitter]], [[plugin:userannotations]] === PHP5 === 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. * [[plugin:captcha]], [[plugin:gtd]], [[plugin:noticeboard]], [[plugin:recaptcha]], [[plugin:saveandedit]] 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). ===== Toolbar ===== 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 [[devel:toolbar#using PHP]] and the [[devel:event:toolbar_define|TOOLBAR DEFINE]] event to add toolbar buttons. See the [[events#TOOLBAR_DEFINE|survey event list]] for a detailed list. Adding a button [[devel:toolbar#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[...]'' * [[plugin:block]], [[plugin:code3]], [[plugin:cryptsign]], [[plugin:divalign2]], [[plugin:facebooklike]], [[plugin:fields]], [[plugin:grensladawritezor]], [[plugin:imagereference]], [[plugin:ipa]], [[plugin:jcapture]], [[plugin:linkmanager]], [[plugin:note]], [[plugin:nspages]], [[plugin:vkeyboard]], [[plugin:vshare]] 6 plugins are using dynamic method based on ''getElementById('tool%%__%%bar')'' or ''jQuery('tool%%__%%bar')''. * [[plugin:cellbg]], [[plugin:fontfamily]], [[plugin:indexmenu]], [[plugin:jspwiki_import]], [[plugin:spellcheck]], [[plugin:svgedit]] ===== JavaScript ===== Almost 20% of the downloaded plugins use [[devel: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 ([[plugin:fckw]], [[plugin:grensladawritezor]], [[plugin:wysiwyg]], [[plugin:fckg]], [[plugin: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. [[plugin:enforcesummary]], [[plugin:ipa]] and [[plugin: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 [[devel:javascript#include_syntax|DokuWiki JavaScript include]]. * [[plugin:bureaucracy]], [[plugin:edittable]], [[plugin:picasawebalbum]], [[plugin:supa]], [[plugin:toolbox]], [[plugin:vshare]], [[plugin:wysiwyg_nicedit]] === jQuery === The [[http://www.jquery.com/|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. * [[plugin:acl]], [[plugin:fancysearch]], [[plugin:picasawebalbum]], [[plugin:runcommand]], [[plugin:twistienav]], [[plugin:usermanager]] === AJAX === By using the event [[devel:event:ajax_call_unknown|AJAX_CALL_UNKNOWN]] that is signalled from [[xref>lib/exe/ajax.php]] if the AJAX call is not recognized [[devel:action_plugins]] can create interactive web applications. SurveyBot tried three ways to identify plugins using AJAX. 21 plugins contains a [[devel:event:ajax_call_unknown|AJAX_CALL_UNKNOWN]] '''register_hook()''' * [[plugin:ac]], [[plugin:ajaxloader]], [[plugin:blogtng]], [[plugin:bureaucracy]], [[plugin:data]], [[plugin:do]], [[plugin:fckw]], [[plugin:freesync]], [[plugin:lastfm]], [[plugin:nsexport]], [[plugin:popupviewer]], [[plugin:preservefilenames]], [[plugin:refnotes]], [[plugin:securelogin]], [[plugin:semanticdata]], [[plugin:siteexport]], [[plugin:siteexport]], [[plugin:snippets]], [[plugin:starred]], [[plugin:translator]], [[plugin:twistienav]] An additional 33 plugins are found by looking in JavaScript for 'runAJAX'. * [[plugin:actickets]], [[plugin:autlogin]], [[plugin:autolink3]], [[plugin:chat]], [[plugin:cryptsign]], [[plugin:dokucrypt]], [[plugin:dokukiwix]], [[plugin:fckglite]], [[plugin:indexmenu]], [[plugin:infomail]], [[plugin:inlineeditor]], [[plugin:jcapture]], [[plugin:keywordvoting]], [[plugin:linkmanager]], [[plugin:log]], [[plugin:qc]], [[plugin:quickedit]], [[plugin:quicksubscribe]], [[plugin:quiz]], [[plugin:readability]], [[plugin:recommend]], [[plugin:searchindex]], [[plugin:smartcache]], [[plugin:snmplive]], [[plugin:spellcheck]], [[plugin:superacl]], [[plugin:tabinclude]], [[plugin:tag]], [[plugin:tagging]], [[plugin:todo]], [[plugin:usercontact]], [[plugin:wysiwyg]], [[plugin:xfortune]] At last 9 more plugins are [[plugintag>ajax|tagged ajax]] * [[plugin:aimg]], [[plugin:fancysearch]], [[plugin:galleryv1.5]], [[plugin:imageflow]], [[plugin:indexmenu2]], [[plugin:jquery]], [[plugin:lightboxv2]], [[plugin:remotescript]], [[plugin:rssticker]] ===== CSS ===== Presentation can be controlled by [[devel:CSS]] stylesheets. The downloaded plugins contain a total of 38,787 lines of CSS divided among 320 plugins (i.e. 39% uses CSS). [[plugin: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: * [[plugin:syntaxhighlighter3]], [[plugin:fckglite]], [[plugin:fckw]], [[plugin:wysiwyg]], [[plugin:fckg]], [[plugin:grensladawritezor]], [[plugin:dokumicrobugtracker]], [[plugin:syntaxhighlighter2]], [[plugin:highlightjs]], [[plugin:indexmenu2]], [[plugin:boxwh]], [[plugin:s5reloaded]], [[plugin:s5]], [[plugin:html2pdf]], [[plugin:animation]] === Modes === DokuWiki knows three types of [[devel:css#stylesheet_modes|stylesheet modes]]. Most plugins just use the **screen** mode by adding ''styles.css'', [[devel:css#Plugins styles]] hints about the possibility to support other modes, SurveyBot found some examples: 40 plugins with ''Print.css''. * [[plugin:autoincludeindex]], [[plugin:blog]], [[plugin:box]], [[plugin:boxwh]], [[plugin:chord]], [[plugin:classificationbanner]], [[plugin:columns]], [[plugin:cssmenu]], [[plugin:database2]], [[plugin:discussion]], [[plugin:divalign2]], [[plugin:explain]], [[plugin:flex]], [[plugin:gcalendar]], [[plugin:geotag]], [[plugin:gil]], [[plugin:hidden]], [[plugin:loadskin]], [[plugin:modalpopup]], [[plugin:multilingual]], [[plugin:noprint]], [[plugin:openlayersmap]], [[plugin:outliner]], [[plugin:pagenav]], [[plugin:piclens]], [[plugin:progrecss]], [[plugin:publish]], [[plugin:purplenumbers]], [[plugin:rack]], [[plugin:screenplay]], [[plugin:searchjump]], [[plugin:searchpattern]], [[plugin:searchtablejs]], [[plugin:task]], [[plugin:translation]], [[plugin:translation3]], [[plugin:wikipediasnippet]], [[plugin:wrap]], [[plugin:xtermrtf]], [[plugin:yalist]] 6 plugins with ''rtl.css''. * [[plugin:acl]], [[plugin:config]], [[plugin:loadskin]], [[plugin:plugin]], [[plugin:wikipediasnippet]], [[plugin:wrap]] === 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 [[devel:css#replacements]]. ^Old replacements ^Plugins ^ |%%__medium__%% |[[plugin:bookcreator]], [[plugin:box]], [[plugin:boxwh]], [[plugin:folded]], [[plugin:google_adsense2]], [[plugin:permissioninfo]]| |%%__lightgray__%% |[[plugin:bookcreator]], [[plugin:layeranimation]], [[plugin:wikicalendar]]| |%%__darkgray__%% |[[plugin:bookmarkme]]| |%%__darker__%% |[[plugin:bookmarkme]], [[plugin:imageflow]]| |%%__dark__%% |[[plugin:bookmarkme]], [[plugin:box]], [[plugin:boxwh]], [[plugin:google_adsense2]], [[plugin:livepreview]], [[plugin:multipoll]], [[plugin:permissioninfo]], [[plugin:poll]], [[plugin:tools]], [[plugin:userpoll]]| |%%__light__%% |[[plugin:box]], [[plugin:boxwh]], [[plugin:explain]], [[plugin:google_adsense2]], [[plugin:livepreview]], [[plugin:multipoll]], [[plugin:permissioninfo]], [[plugin:poll]], [[plugin:userpoll]], [[plugin:wikicalendar]]| |%%__lighter__%% |[[plugin:box]], [[plugin:boxwh]], [[plugin:google_adsense2]]| |%%__black__%% |[[plugin:wikicalendar]]| Continue to => [[events]]