Extension:YouTubeTag

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
YouTubeTag

Release status:Extension status beta

ImplementationTemplate:Extension#type Tag
DescriptionTemplate:Extension#description Adds <youtube> tag for embedding YouTube videos.
Author(s)Template:Extension#username Jim R. Wilson (Jimbojw)
Latest versionTemplate:Extension#version 0.1
MediaWikiTemplate:Extension#mediawiki 1.6.x, 1.8.x, 1.9.x
LicenseTemplate:Extension#license MIT License
Download YouTubeTag.php
ExampleTemplate:Extension#example see the Project Homepage

Translate the YouTubeTag extension if it is available at translatewiki.net

Check usage and version matrix.

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

Important! - Please consider using the EmbedVideo Extension instead of this - it supports multiple video sharing sites and is syntactically and functionally superior.

Note: There are already at least two other extensions designed to meet the same need as this one. Skip down to the #Developer Notes 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[edit]

  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.
  3. Enable the extension by adding this line to your LocalSettings.php:
    require_once("$IP/extensions/YouTubeTag.php");
    

Usage[edit]

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:

<youtube v="aYouTubeId" />

Where "aYouTubeId" should be replaced with the id of the video to embed.

That's it!

Developer Notes[edit]

Important! - Please consider using the EmbedVideo Extension instead of this - it supports multiple video sharing sites and is syntactically and functionally superior.

Here are the differentiating features of this particular extension:

  • Ridiculously simple syntax: <youtube v="aYouTubeId" />
  • 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).

Wikis Using this Extension[edit]