Tinkering with Atom

For a while now I’ve been talking about writing some classes to ease use of Atom in PHP, primarily as a base for an implementation of the Atom Publishing/Editing Protocol. I’ve been putting it off, partly due to time restrictions, and partly because the Atom Syndication Format isn’t quite an approved standard yet and I didn’t want to have to spend too much time keeping up with drafts. Atom is rapidly approaching stability, and a little time over the weekend has led me to start work on some code. Rather than just write a parser for Atom I decided to follow the lead set by Mark Pilgrim’s Universal Feed Parser, which makes working with feeds in python a breeze, and have begun to shape some classes that I hope will provide a similar level of flexibility and abstraction for PHP coders. ...

June 5, 2005

Managing Content-Negotiation with PHP

Back home and almost caught up on email… One of the many things on my to-do list for Grand Rapids WiFi is to switch from the current system of having separate URLs for the RDF representations of resources to something based on content negotiation. In order to do that using PHP I needed a couple of functions to extract the relevant headers. A quick web search didn’t turn up any appropriate libraries, so I threw together a couple of functions that should cover everything. For those not familiar with content-negotiation it works by having a user agent (web browser, newsreader, etc.) add an “Accept:” header specifying what types of content it can manage and which it prefers. For example, Firefox might send something like: ...

June 3, 2005

Services_Technorati 0.6.3alpha

Services_Technorati 0.6.3 has just been released. The main change this time around is that the suite of unit tests are now complete for basic queries. I may add more at a later date to test handling of optional parameters, and more will be needed once Attention.XML support comes online, but for now they do their job. Following the completion of the tests I found a few little bugs which are now corrected. They mostly related to the testing of parameters and the building of cache filenames. I also added a patch from Ryan that improves the cache checking. ...

May 9, 2005

Services_Technorati 0.6.2alpha

Services_Technorati 0.6.2alpha is now available through PEAR. Despite the minor version number increment, this version contains quite a few changes. The class no longer instantiates its own cache object, and instead the factory (which should be the default interface to instantiate an object) will accept a pre-existing cache object. For the purposes of forward compatibility, the factory also now takes an argument to specify which API version should be used. ...

May 1, 2005

Musings on Application Structure

Among other things, I’m currently working on a relatively large CMS/membership site. At the project’s initiation I decided to steer clear of off-the-shelf solutions, partly because I wanted to take myself through the learning curve that the project was sure to involve, partly because none of the CMS or framework options I looked at really appealed to me, and partly because it seemed as though the customisations required to manage this dataset would take nearly as much time as a from-scratch solution. ...

April 22, 2005

Services_Technorati 0.5.6

A couple of bug reports reminded me that it was time for another release of Services_Technorati. This release fixes a typo and adds some important checks on the return value of $this->_checkOptions() I’m hoping to finish the last few coding standards issues this week so I can move the package up to alpha status. There’s still no word from Technorati about fixes to their attention.XML support, so I’m not inclined to hold up the package’s release based on that. ...

April 16, 2005

Services_Technorati 0.5.5

Voting was complete on my Technorati package a couple of weeks back, but I’ve been waiting to announce it until I was able to upload an initial version to PEAR. The package was approved today, and you can now find version 0.5.5 at the PEAR website. It’s currently set to ‘devel’ so to install it from the command line you’ll need to use: % pear install Services_Technorati-devel Changes in the latest release mostly arise from voters’ suggestions, with the key one being the change of a number of method names to remove the superfluous word ‘query.’ I’ll hopefully be moving it out of ‘devel’ soon, probably once I’ve made the final few tweaks to bring it in line with the PEAR Coding Standards and/or when Technorati finish overhauling the attention.XML API. ...

April 5, 2005

Services_Technorati 0.5.4

I just made another round of changes to Services_Technorati. As well as a few maintenance tasks, I made it more explicit that the caching is optional, added a factory method, and worked in support for the new TopTags API call. The Attention.XML support is still not working as hoped. Niall Kennedy (Technorati’s Community Manager) assures me that they will be working on it at their end as soon as possible, so I’ll wait for that before doing any more work there. ...

March 22, 2005

DB_DataObject_FormBuilder with multiple tables

Today I found myself reworking a set of directory classes I wrote in haste a few months ago. I decided that some of them would gain from making use of DB_DataObject_FormBuilder but had to remind myself of how to make that package work with multiple tables. The presentation included as part of the documentation demonstrates how to create a form with data from multiple tables, using something like: $first_table =& DB_DataObject::factory('table_one'); $first_table->fb_createSubmit = false; $first_build =& DB_DataObject_FormBuilder::create($first_table); $first_form = $first_build->getForm(); $second_table = DB_DataObject::factory('table_two'); $second_build =& DB_DataObject_FormBuilder::create($second_table); $second_build->useForm($first_form); print $second_build->toHTML(); Personally, I’m not a fan of the headers that QuickForm (the form class behind FormBuilder) adds for each table, so after a little hunting around I discovered that: ...

March 15, 2005

MTPastEntries 0.3

It can be all too easy to get sucked into a single project and then find most of the day has disappeared. I’ve now packaged up MTPastEntries version 0.3 and put it along with an instruction page here. The main changes are to the PHP code which I’ve now had time to test. It seems to work pretty nicely for now, though as before I’ve not tested on a large-scale setup. I’ve also tidied up the perl a little bit, and added in two new tags MTPastEntriesIfComment and MTPastEntriesIfTrackback which are taken with only the slightest of modifications from Adam Kalsey/ Brad Choate’s SimpleComments plugin. ...

March 9, 2005