Extension:StaffTag
From MediaWiki.org
| This extension stores its source code on a wiki page. Please be aware that this code may be unreviewed or maliciously altered. They may contain security holes, outdated interfaces that are no longer compatible etc. Note: No localisation updates are provided for this extension by translatewiki.net. |
|
StaffTag Release status: stable |
|||
|---|---|---|---|
| Implementation | Parser extension | ||
| Description | Creates a XML tag that displays a "@Site" sign similar to Wikia's staff | ||
| Author(s) | Seth Rees (The Oracletalk) | ||
| Last version | 1.1 (1/30/09) | ||
| MediaWiki | >= 1.13.0 | ||
| License | GNU GPL | ||
| Download | http://theoracle.uuuq.com/StaffTag_1-1.zip | ||
| Example | theoracle.uuuq.com | ||
|
|||
| Check usage and version matrix | |||
Introduction [edit]
This extension is made for Sysadmins who would like to have a tag similar to the Wikia's staff tag.
The tag is fully customizable, with three different variables that must be defined:
| Name | Use |
$wgSTagURL
|
Used to define the url the tag links to. |
$wgSTagIMG
|
Used to define the location of the image. |
$wgSTagALT
|
Used to define the HTML <img> alt="" attribute. |
These variables are defined under the "Variables" section of stafftag.php.
Installation [edit]
- Download the zip file
- Unzip and upload the stafftag.php file to the
/extensionsdirectory. - Add the following line to LocalSettings.php:
require_once( $IP."/extensions/stafftag.php");
You may also copy the following source code and save it as stafftag.php. Then do numbers 2-3.
<?php ################### # Syntax: <staff/># ################### ################### # MetaData # ################### $wgExtensionCredits['other'][] = array( 'name' => 'StaffTag', 'author' => 'Seth Rees', 'version' => '1.0', 'url' => 'http://www.mediawiki.org/wiki/Extension:StaffTag', 'description' => 'This extension generates a tag showing the user is a member of the staff'); ################### # Extension Code # ################### $wgExtensionFunctions[] = "wfStaffTag"; function wfStaffTag() { global $wgParser; $wgParser->setHook( "staff", "renderStaffTag" ); } # The callback function for converting the input text to HTML output function renderStaffTag( $input ) { ################### # Varibles: # ################### $wgSTagURL = ""; //URL the image links to $wgSTagIMG = ""; //URL of the image $wgSTagALT = ""; //[HTML/image/alt] attribute (text displayed if image is unavailable) $output = '<a href="' .$wgSTagURL. '"><img src="' .$wgSTagIMG. '" alt="' .$wgSTagALT. '" /></a>'; return $output; } ?>
