Just about ready

I’ve just finished the last piece of the puzzle, so to speak, which is the Facebook-style ‘Link Excerpter’. This is the feature which I was using a lot on Facebook (and the accompanying commentary which was drawing the wrath of fellow Facebook users) which I needed to reproduce on this blog. Apparently no-one had released such a thing until now, other than one released by a company which was clearly looking to profit from passing the link through their servers and perhaps making use of the analytics information as a profit model. Interesting, but not for me.

My plugin is currently pretty crude in that it checks the content for a ‘quicktag’ on save, and replaces it with mark-up based on the arguments supplied (at a minimum, a URL, but more arguments for title and content are available). After that, you can edit the output HTML, and of course you’ll need some styles for that mark-up too.

andcurve.weblog » Archive » Irish Economics Made Simplehttp://www.andcurve.com/wordpress/2009/07/26/irish-economics-mad »I’m frequently (too frequently, some might say!) posting on Boards.ie, particularly these days in the Politics section, where you’ll find no end of interesting ideas on a) Ireland and the EU and b) Ireland’s economy. Although there are some …

That’s still one of my favourite posts, period. Anyway, the quicktag for this looks like this:
<!–wle_link url[http://www.andcurve.com/wordpress/2009/07/26/irish-economics-made-simple/] –>

The strategy for producing that excerpt is the clever bit. I’m pretty sure that this is exactly what Facebook is doing, and they’re doing it in PHP too; after some testing, I managed to reliably get the same results on a set of URLs as them. It handles YouTube URLs too by producing YouTube/Flash code but I might actually disable that, for mobile users and the fact that when YouTube upgrades, I’ll still be displaying video with old code. And let’s face it, I don’t want to land on the wrong side of Apple versus Flash.

I still need to make some sort of sophisticated interface (again, a little like what Facebook have) to create the quicktag and even create the thumbnail image which is something that currently is a little tricky and I’m still a bit unsure of how to do it. But it would be a nice feature to have.

With the focus of this blog being more on commentary and linking than just cataloging minutae of my personal life, and with advances in the WordPress UI, I don’t think I need to revisit the aging (and remarkably crap) pile of crap code which I used to use. It was a bad plugin written and rewritten by a number of people with varying degrees of skill (and ego, apparently) to handle image uploading and browsing which I cleaned up and modified for my own needs – including image clean-up and thumbnail creation – but the code mess and how the plugin interacted with increasingly complex WordPress UI iterations was too much to deal with. Who knows, I might start from scratch with some new ideas and knowledge.

[Update: I had to make some adjustments to the code. The ‘Excerpt’ was a little greedy and added too generous an excerpt. Fixed, plus some of the logic.]