Adding an ICS Event File to Google Calendar

If you register for webinars, conferences, meetings, etc. on a somewhat regular basis, you are probably familiar with ICS files. An ICS file is an iCalendar file; and can contain a single event or an entire calendar feed. Online registrations and event notices tend to make use of these files quite a bit, because they offer a one-click method for people to add the events to their calendars.

If you’re using Outlook, Thunderbird, iCal or just about any other desktop calendar program, you simply download the file, open it and save the event to your calendar.

However, if you’re using Google Calendar, things get a little bit trickier. There’s no simple way to open the file and have Google Calendar take over from there. Instead, you basically have to understand how Google Calendar expects ICS files to be used (why the system uses this logic is kind of beyond me; but that’s the way things are). Google Calendar, for some reason, does not seem to expect people to use ICS files to add individual events regularly. Instead, it uses the logic that an ICS file should include a calendar “feed”, similar to a website’s RSS feed, that would contain a complete list of events.

Gmail’s “Add to Calendar”

A while back, Google unveiled a new feature in Gmail that automatically scans the message currently being viewed, checks for a date and time in the message body, and, if found, adds a link allowing you to add the item directly to your Google Calendar (as shown in the image on the right). Lately, I’ve noticed that that algorithm has improved greatly. I used to see the “Add to calendar” feature only appear in very rare cases, but I am now seeing it almost every time I am viewing a message that I want to add to my calendar.

Firefox and HTML5

Earlier this evening, I was reminded of just how primitive the HTML5 support was in Firefox 3.5/3.6. While we have seen three major version releases since 3.5, it was actually still the latest version of Firefox less than 6 months ago (and was that way for almost 2 years). Therefore, Firefox 3.5.x still holds a decent amount of market share (probably as much as, if not more than IE6 did a year or two ago). Looking at a handful of websites for which I have analytics data, versions of Firefox prior to 4 still accounted for anywhere between 2% and 15% of the total visits to those sites last month.¬†With all of that information, it’s probably still important to make sure your sites work in versions of Firefox as far back as 3.5.

There are two somewhat major gotchas in the way Firefox 3.x handled HTML5. The first is easily fixed with a few lines of CSS. The second can only really be fixed if you rewrite some of your HTML.

WordPress: Adding “Get Shortlink” to Custom Post Types

For some reason, by default, WordPress only includes the “Get Shortlink” button when editing posts; not when editing any kind of custom post type or when editing pages. Honestly, I’m not sure why, since pages and custom post types all use the same basic short URL as standard posts (example.com/?p=[post_id]).

The solution is simple, though. You just need to hook into the get_shortlink filter. Following is a simple function that will help you add the button to all “publicly_queryable” post types in your theme.

WordPress: Adding “Page Links To” to Custom Post Types

If you use WordPress (especially as a content management system) and you haven’t heard of Mark Jaquith’s “Page Links To” plugin, you should definitely check it out. Basically, the plugin allows you to set up a WordPress page or post to redirect to a different URL. It can be very handy for setting up redirects, adding menu items for pages that wouldn’t normally appear in those menus, etc.

One issue with the plugin, however, is that it does not (as of version 2.4.1) support custom post types. It only supports WordPress posts and pages. If you want to set a custom post type to redirect to a URL other than its permalink, you can’t do so with this plugin.

However, there is a pretty simple way to add support for custom post types to this plugin; and the changes do not require you to edit the plugin itself. Instead, you can make all of the necessary changes in your theme’s functions.php file.

Image Manipulation Script Vulnerabilities

Yesterday, Mark Maunder published a blog post making people aware of a vulnerability in the popular PHP image manipulation script TimThumb. Anyone that uses TimThumb should definitely read that article to make sure that the vulnerability gets patched. Almost a year ago, though, I posted (and I was far from the first) about a vulnerability in another extremely popular PHP image manipulation script; phpThumb.