In this previous post, I had actually made use of a small plug-in I had written for WordPress, which creates a macro for pulling bibliographical information from Wikindx, which I use to manage my bibliography.
The plug-in is rather simple, but since a web search turned up nothing similar (which is kind of surprising), and someone might find it useful, I thought I’d post it here.
Here is the code for “wikindx.php”:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | <?php /* Plugin Name: Wikindx Plugin URL: http://stargrads.net/blogs/davinci/2009/09/wikindx-macro-plug-in-for-wordpress Description: Adds a macro to WordPress to insert bibliography information from Wikindx. Author: D. L. Yonge-Mallo Version: 1.0 Author URI: http://stargrads.net/blogs/davinci/ */ function parse_wikindx($content) { $WikindxPath="http://path.to/wikindx/"; preg_match_all('#<wikindx( resource="([ \w]+)")?(>(.*)</wikindx>| ?/>)#Usi', $content, $wikindxs, PREG_SET_ORDER); if ( count($wikindxs) > 0 ) { foreach ( (array) $wikindxs as $wikindx ) { if( empty($wikindx[2]) ) { $output = "ERROR: WIKINDX MISSING RESOURCE ARGUMENT"; } else { $resourceId = $wikindx[2]; $string = file_get_contents("{$WikindxPath}cmsprint.php?action=getResource&id={$resourceId}"); if($string) { $array = unserialize(base64_decode($string)); $output = $array[$resourceId] . " ([{$WikindxPath}index.php?action=resourceView&id={$resourceId} details])"; } else { $output = "ERROR: WIKINDX RESOURCE ".$resourceId." NOT FOUND"; } } $content = str_replace($wikindx[0], $output, $content); } } return $content; } add_filter('the_content', 'parse_wikindx', 2); ?> |
Replace “http://path.to/wikindx/” in the above with the URL to your installation of Wikindx, obviously. For example, mine is “http://stargrads.net/bibliography/”.
Put the file into the “plugins” directory on WordPress, or if you are using WordPressμ, then into its “mu-plugins” directory.
The plug-in creates a new macro “wikindx” with one parameter “resource”, which can be used inside WordPress posts like this:
<wikindx resource="68" />
Replace “68″ in the example with the resource ID of the bibliography entry whose information you want. (This ID can be found in the URL of the resource’s page on Wikindx.) The result is that the macro is replaced by the bibliographical information for that resource. For the above example, this would be:
R. Cleve, D. Gavinsky, and D. L. Yonge-Mallo, “Quantum Algorithms for Evaluating Min-Max Trees,” in Proc. TQC 2008, Tokyo, Japan, 2008, (details)
This plug-in can be used to good effect with Rob Miller’s Footnotes plug-in for WordPress, like this:
<ref name="CGMSY08"><wikindx resource="206" /></ref>
The result[1] can be seen in the footnote below.
– davinci 11780
Update (Sept. 15, 2009): I’ve added the plug-in to the WordPress Plugin Directory.

I linked to this plug-in from Wikindx’s SourceForge support forums. For my own record-keeping, the URL for the thread is: https://sourceforge.net/projects/wikindx/forums/forum/326883/topic/3399463
nice plugin, thx