Ma.gnolia WordPress plugin 1.2

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

Just a minor update to allow usage as a K2 Sidebar Module.

nb. To facilitate this, I removed the option for the plugin to output its own title – therefore the syntax involved in calling it has changed slightly – take note.

A note to new readers, this is a plugin for WordPress which lets you display the latest links from your Ma.gnolia account. You can now also display links matching one of your tags instead, if you like.

The options are, in order:

  1. Ma.gnolia username (required)
  2. Number of links to show (optional, can be any integer from 0-20, default is 10)
  3. Whether to show the description of each link (optional, 1 or 0, default is 0)
  4. Whether to show the date you published each link (optional, 1 or 0, default is 0)
  5. Whether to link to the Ma.gnolia page of each link, instead of the links themselves (optional, 1 or 0, default is 0)
  6. Whether to just show links marked with a certain tag (type the name of the tag in quotes if you want to do this, default is none)

So to just show your last 10 links, you only need supply your username:

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

Or to make it more interesting, to show the last 15 links I published, with descriptions, without dates, and linking to the Ma.gnolia page for each, I would do this:

<?php magnolia('barryprice', 15, 1, 0, 1); ?>

Or to show 20 links, without descriptions or dates, linking to the actual link URLs, we would do this:

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

Of course, the default setting for those last three arguments is 0 anyway, so this would also work:

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

Finally, to do the same thing but only for entries tagged with “apple”, we would do:

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

Download Ma.gnolia plugin 1.2

Ma.gnolia WordPress plugin 1.1

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

So here’s a few extra features – some requested, others invented.

A note to new readers, this is a plugin for WordPress which lets you display the latest links from your Ma.gnolia account. You can now also display links matching one of your tags instead, if you like.

The new syntax gives many more options – they are, in order:

  1. Ma.gnolia username (required)
  2. Number of links to show (optional, can be any integer from 0-20, default is 10)
  3. Whether to include the H2 tag with the “Ma.gnolia” title above the list of links (optional, 1 or 0, default is 1)
  4. Whether to show the description of each link (optional, 1 or 0, default is 0)
  5. Whether to show the date you published each link (optional, 1 or 0, default is 0)
  6. Whether to link to the Ma.gnolia page of each link, instead of the links themselves (optional, 1 or 0, default is 0)
  7. Whether to just show links marked with a certain tag (type the name of the tag in quotes if you want to do this, default is none)

So to just show your last 10 links, with a “Ma.gnolia->[your username]” title above them, you only need supply your username:

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

Or to make it more interesting, to show the H2 title, then the last 15 links I published, with descriptions, without dates, and linking to the Ma.gnolia page for each, I would do this:

<?php magnolia('barryprice', 15, 1, 1, 0, 1); ?>

Or to omit the H2 title (just outputting a UL/LI structure, like e.cordero wanted), then show 20 links, without descriptions or dates, linking to the actual link URLs, we would do this:

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

Of course, the default setting for those last three arguments is 0 anyway, so this would also work:

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

Finally, to do the same thing but only for entries tagged with “apple”, we would do:

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

Download Ma.gnolia plugin 1.1

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