Laconica/MediaWiki Plugin

From Forge

Jump to: navigation, search

Converts MediaWiki-style freelinks into Wiki links:

This status message was written by [[Evan Prodromou]]. 

would convert [[Evan Prodromou]] into a link to the Wiki of your choice.

Contents

[edit] Download

Version 0.1 was released on April 19, 2009 and is available on github.

[edit] Installation

Copy MediaWikiPlugin.php into the plugins directory.

Edit WIKI_BASE_URL in MediaWiikiPlugin.php to point to your Wiki's base URL.

Add the following to config.php:

require_once('plugins/MediaWikiPlugin.php');
$mw = new MediaWikiPlugin();

Enjoy!!

[edit] To Do

This was my first PHP script, and I didn't spend a lot of time trying to figure out PHP. There are a bunch of things I'd like to do better, and I welcome advice on making it better.

  • Make preg_replace_callback call a MediaWikiPlugin method rather than a function. This would allow people to specify the WIKI_BASE_URL in the constructor rather than have to edit the plugin itself.
  • You could potentially use this plugin to support Wiki formatting: bold, italics, you name it. Not sure this is desirable, but it would be easy enough.
  • May need some additional escaping in the Wiki link parsing. It's pretty dumb right now.

[edit] Discussion

  • Make the wiki base URL a parameter to the plugin's constructor, so users don't have to edit the source - otherwise they will have to re-edit every time they upgrade. CiaranG 14:50, 20 April 2009 (UTC)
    • Already noted in the first bullet point above. --eekim 00:07, 21 April 2009 (UTC)
  • Host the source somewhere that is not closed-source? ;) CiaranG 14:50, 20 April 2009 (UTC)
    • I'm open to this. Suggestions? --eekim 00:07, 21 April 2009 (UTC)
  • change "<a href=\"$url\" >" . $match[0] . "</a>" by "<a href=\"$url\" target=\"_blank\">" . $match[0] . "</a>" to open in new windows
    • This should be configurable. In fact, there should be a Laconica-wide configuration variable that does this. --eekim 14:19, 20 June 2009 (UTC)


[edit] Copyright and License

Written by Eugene Eric Kim.

Copyright 2009 Blue Oxen Associates.

Licensed under the Affero GPL (AGPL) v3.0.

Personal tools