Extension:YouTubeTag

The YouTubeTag Extension is a MediaWiki extension which provides a means for embedding YouTube content into wiki articles.


 * Note: There are already at least two other extensions designed to meet the same need as this one. Skip down to the  for a list of differentiating features.


 * Project Homepage: YouTubeTag Extension - Jimbojw.com
 * Source Code: YouTubeTag.php
 * Licensing: YouTubeTag is released under The MIT License.

Installation

 * 1) Download YouTubeTag, and be sure to rename the downloaded file to YouTubeTag.php.
 * 2) Drop this script in $IP/extensions
 * Note: $IP is your MediaWiki install dir.
 * 1) Enable the extension by adding this line to your LocalSettings.php: require_once('extensions/YouTubeTag.php');

Usage
Once installed, you may embed YouTube content to any article.

To do so, simply add this text to the body of your page where you'd like the video to appear: &lt;youtube v="aYouTubeId" /&gt; Where "aYouTubeId" should be replaced with the id of the video to embed.

That's it!

Developer Notes
After being unable to find a YouTube MediaWiki extension to my specifications, I decided to write my own. Sorry, but every once in a while it's easier to re-invent the wheel then to try to fix an old one.

Here are the differentiating features of this particular extension:


 * Ridiculously simple syntax: &lt;youtube v="aYouTubeId" /&gt;
 * Uses an extension tag parameter for the id rather than inner-text (reduces liklihood of injection attacks)
 * Further avoids malicious input by html-encoding specialchars
 * Checks input for invalid YouTube id characters (only allows alphanumeric chars and '-' and '_')
 * Displays informative error message on bad id which is configurable by system message (for localization purposes).

--Jimbojw 09:15, 7 March 2007 (UTC)