Alfred extension: Convert clipboard to plain text

Update: Well, what do you I know? It turns out that Andrew, developer of Alfred, has already got this covered and my weak Google-Fu didn’t turn it up: plain text paste in Alfred. So don’t use my version, use his. I got tired of copying formatted text from a web page, pasting into a text …

Clickable stack traces with Netbeans

I’m clearly in a fickle mood this month, as I’ve changed my PHP editor again, this time to Netbeans (thanks to the tireless nagging of @JJJ)… so far, so good. I particularly love being able to jump to declarations quickly and easily. One hurdle I overcame today, and I’d be interested to know if there’s …

Bees!

My grandpa always wanted to keep bees. Or at least that’s how I remember it, him talking about it and me fascinated by the idea. For some reason the urge has resurfaced recently, and as luck would have it the local NamBeePamBee Beekeepers in nearby Scott’s Avenue Allotments have begun holding open days and now …

Filtering HTML to exclude all but a small number of HTML elements and attributes

How much do we trust user input? Not. At. All. That’s how much we trust user input. You just don’t know where they’ve been! WordPress has such a plethora of functions for escaping and filtering input and output, that I’m always discovering new possibilities. One I found recently is wp_kses, which allows you to strip …

Extending WP Help to users who can’t edit_posts

Yesterday I was explaining how I created a user role to edit a particular post type and only that post type. Today I want to show how you can use Mark Jaquith‘s excellent WP Help plugin to support these users. The issue I wanted to solve is that a freshly installed copy of WP Help …

Capabilities for custom post types in WordPress

I’ve just had to break out some serious Capabilities in WordPress today, and I’m documenting the process here in case it helps me in the future (or the past, though it seems unlikely) or anyone else. The scenario i: I have a custom post type (Video) and I want to allow Editors and Admins to …

Escaping lists of strings for SQL in WordPress

Today I found myself wanting to use a query similar to SELECT DISTINCT post_id FROM $wpdb->posts WHERE meta_key IN ( ‘string_x’, ‘string_y’, ‘string_z’ ), but where I needed to construct the values for the list of strings from an array of untrusted values (because we never trust inputs, we always look suspiciously on them if …