I’ve been working on and off over the last few weeks on doing an update for the Verse of the Day Wordpress plugin (and the TTLB Ecosystem plugin, but more on that later). This was initiated by my hosting company shutting off access to remote file access using the PHP fopen() and file() commands for security reasons. This made me realise that I was relying on an assumption for the plugins to work, that being that remote file access was on. Bad assumption considering how paranoid a lot of hosting companies are becoming (and not without reason). So after digging around a bit I re-discovered the Snoopy net library for PHP which doesn’t rely on any PHP remote functions, but actually acts as its own user agent (read: web browser).

Can I just take a moment to cheer the developers of the Snoopy PHP class. This is a great piece of code, that has made my life so much easier.

As well as this problem, the previous versions of the VotD plugin suffered from some rather ugly error-reporting problems, including a couple of errors that would actually display PHP warnings on the site. Also in some cases, if the plugin failed to run properly it would simply display nothing, with no hint as to what went wrong. Really not very helpful.

So I’ve done a complete rebuild of the plugin and I’m putting out a call for beta testers. I’d like to actually get most of the bugs ironed out before putting this live this time. Any takers please leave a comment with a real email address and I’ll send the code to you. If you don’t want to post your email address, then please send an email to gdalziel (at) gmail dot com with the subject I wanna be a beta tester

Changes

You can see the major changes on the Wordpress Plugins Repository with changeset 2506 & 2507. Note, the code there is not the latest version, it simply has a lot of the changes. I’ve got the version 2.0 beta stored locally.

  • Now uses the Snoopy net class to pull down the RSS feed to extract the enclosure
  • Removed the $force_refresh parameter. To force a reload of the cache file you now only need to add a query string to the page when you load it: force_refresh_votd=1 (i.e. http://blog.slaven.net.au/?force_refresh_votd=1).
  • Removed the $die_loud parameter. Basically, the plugin should now trap all errors, including write-permission errors on the cache file. If there is an error normally, nothing will display, the plugin will fail silently so nobody can see anything is wrong, but to debug, add the querystring dieloud=1 to the page’s URL and it will display an error explaining what went wrong (no sensitive info, the permissions failure error looks like this:
    VOTD Plugin Error
    The cache file location either doesn’t exist or the web server doesn’t have permission to write to it.
    )
  • I’ve added the Magpie RSS error() function, as the WordPress version of Magpie doesn’t include it, which resulted in a fatal error when the url you pass is not valid. (See this thread on the WP Support Forums) This will hopefully be resolved in a future version of WP.

So please drop me a line, either by comment or email & I’ll send you the latest code to install. Note that this is an update to the trunk, not the WP1.2 branch, so you’ll need to be running WordPress 1.5.