Ma.gnolia WordPress plugin 1.0

[Edit: The latest version of this plugin can be found here.]

Well, that took slightly longer than I’d intended. Version 0.001 (a simple JavaScript wrapper) was posted almost four months ago. I’ve had some adventures on the way – neither Snoopy nor curl() could cope with the HTTP 301 codes they received from Ma.gnolia’s servers, and PHP’s DOM XML client requires PHP5, which just isn’t an option for most people not running their own servers, who are stuck with PHP4.

I tried hacking Snoopy, I tried reporting the bugs to WordPress and Snoopy forums, and for a while I thought Gary White’s RSSReader library was my saviour. But it couldn’t cope with the HTTP/1.1 301 either, and Gary didn’t respond to my email. Finally, I found LastRSS. It works.

So here it is. The syntax remains the same as the previous version. The default number of links to show is 10, and the maximum is 20 (as this is all that ma.gnolia will supply).

<?php magnolia(USERNAME[, NUMBER_OF_LINKS); ?>

eg. to show my 10 latest links, I simply use:

<?php magnolia('barryprice'); ?>

To show my 3 latest links, I’d use this instead:

<?php magnolia('barryprice', 3); ?>

Dead simple.

Download Ma.gnolia plugin 1.0

Ma.gnolia WordPress plugin 0.2

[Edit: The latest version of this plugin can be found here.]

I finally got round to hacking up the Ma.gnolia plugin so that it caches the link list for 30 minutes (by default), so as not to irritate the Ma.gnolia XML server any more than really necessary. Until now, it had been sending a request for each and every page render. I meant to fix it last week, and completely forgot…

To recap, this plugin allows you to easily publish your latest Ma.gnolia links in your WordPress sidebar (or anywhere else you want to call it from).

WordPress’s built-in RSS handlers didn’t seem to like Ma.gnolia’s feeds (they serve them up with a 301 redirect, which Snoopy apparently can’t cope with – details here), so I’ve used PHP5’s built-in DOM XML functions. Obviously this means that you will need version 5 of PHP on your server. If this isn’t an option, feel free to use my original JavaScript plugin, still available here.

The syntax remains the same as the previous version, with the exception that the byline is no longer an option. The default number of links to show is 10.

<?php magnolia(USERNAME[, NUMBER_OF_LINKS); ?>

eg. to show my 10 latest links, I simply use:

<?php magnolia('barryprice'); ?>

To show my 23 latest links, I’d use this instead:

<?php magnolia('barryprice', 23); ?>

Dead simple.

Diffs to automate usage of this plugin with K2 will be up shortly at some point…

Download Ma.gnolia plugin v0.2

Ma.gnolia plugin 0.1

[Edit: The latest version of this plugin can be found here.]

Here’s the latest version of my Ma.gnolia plugin for WordPress. It allows you to publish your latest Ma.gnolia links in your WordPress sidebar (or anywhere else you want to call it from).

WordPress’s built-in RSS handlers didn’t seem to like Ma.gnolia’s feeds, so I’ve used PHP5’s built-in DOM XML functions. Obviously this means that you will need version 5 of PHP on your server. If this isn’t an option, feel free to use my original JavaScript plugin, still available here.

The syntax remains the same as the previous version, with the exception that the byline is no longer an option.

<?php magnolia(USERNAME[, NUMBER_OF_STORIES); ?>

eg. to show my feeds with the default options, I simply use:

<?php magnolia('barryprice'); ?>

To show 23 of my feeds, I’d use this instead:

<?php magnolia('barryprice', 23); ?>

Dead simple.

Diffs to automate usage of this plugin with K2 will be up shortly.

Download Ma.gnolia plugin v0.1

Ma.gnolia WordPress Plugin 0.001

[Edit: The latest version of this plugin can be found here.]

Okay, this is laughably rubbish, but it works. Hopefully publishing this version will motivate me to write a proper one.

This is just a wrapper for Ma.gnolia’s JavaScript feed – I haven’t had time to write the RSS/XML parser yet. I had forgotten how much I hate PHP.

You can set the default number of stories to include, as well as whether to include the byline, within the plugin code itself. Or just override them when you call the function. The defaults number of stories is 10, and the byline display boolean defaults to ‘true’.

Call it from within your sidebar, like this:

<?php magnolia(USERNAME[, NUMBER_OF_STORIES, BYLINE_TRUEORFALSE); ?>

eg. to show my feeds with the default options, I simply use:

<?php magnolia('barryprice'); ?>

To show 20 of my feeds without the byline, I’d use this instead:

<?php magnolia('barryprice', 20, 'false'); ?>

The RSS/XML version of this plugin will be better. Hopefully. Can’t believe nobody else has written one of these yet, looks like you’re stuck with this one for now…

Download ma.gnolia plugin

PS. Regarding K2 integration, I’ve hacked my local version to allow K2 to auto-configure this plugin (as it does by default with Alexander Malov’s del.icio.us plugin). Will send some diffs to Michael if he’s interested – as soon as I’ve finished the final code…

Ma.gnolia hack

A feed of my Ma.gnolia links has replaced my (stagnant) del.icio.us feed in the sidebar. I haven’t written the plugin yet, but will do so when time allows. Currently needs JavaScript as I’m using their for-dummies feed instead of the RSS version which I’ll be using in the plugin…