Kickstarter Wordpress Plugin

Wordpress is a great blogging platform. Sometimes it has your best interests a little too at heart, though: try to include iframes for Paypal or some videos. I'm sure there are better plugins out there, but today I wanted to include a Kickstarter project video on a blog and couldn't, so I said screw it and wrote a plugin to take the project url and embed the video.

It's fragile as hell: if KS ever changes their url structure, or the location of their videos, etc etc, it will break. I could put more work into it, and I'm sure there are plugins that may do this exact thing already, but this seemed to be the quickest option. If you think this could be helpful, you can right click and save kickstarter.php and upload it to your wp-contents/plugins directory.

<?php
/*
Plugin Name: Kickstart embedder
Description: Add [kickstarter file=link_to_project /] (ie [kickstarter file=https://www.kickstarter.com/projects/2pp/minecraft-the-story-of-mojang /] to embed a Kickstarter video
Version: 0.5
Author: Dan Conley
Author URI: http://www.danconley.net
*/

function Kickstarter_Parse ($content) {
	global $post;
	$content = preg_replace("/\[kickstarter file=https:\/\/www\.kickstarter\.com\/projects\/([^ ]+) \/\]/i","<iframe frameborder=\"0\" height=\"410px\" src=\"https://www.kickstarter.com/projects/$1/widget/video.html\" width=\"480px\"></iframe>",$content);

	return $content;
}

add_filter('the_content', 'Kickstarter_Parse');
?>