Extension:StaffTag

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear app error.svg
StaffTag
Release status: unstable
Implementation Parser extension
Description Creates a XML tag that displays a "@Site" sign similar to Wikia's staff
Author(s) Seth Rees (The Oracletalk)
Latest version 1.1 (2009-01-30)
MediaWiki 1.13+
License GNU GPL
Download http://theoracle.uuuq.com/StaffTag_1-1.zip
Example theoracle.uuuq.com
Tags
<staff/>
Translate the StaffTag extension if it is available at translatewiki.net
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 and place the file(s) in a directory called StaffTag in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/StaffTag/StaffTag.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

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;
}
?>