Extension:AllowAnchorTags

What can this extension do?
This extension adds tags and parses them to  tags.

Usage
The URL must be specified in the following format: Some Text

Installation
To install / test the extension kindly add it to the end of your 'LocalSettings.php' file in your MediaWiki installation folder.

Changes to LocalSettings.php
require_once("/extensions/AllowAnchorTags/anchor_tags.php");

Code
$wgExtensionFunctions[] = 'addAnchorTag';
 * 1) Defines the main function to be executed for this extension.

$wgHooks['ParserAfterStrip'][] = 'addAnchorTag';
 * 1) Sets the hook to be executed once the parser has stripped HTML tags.

function addAnchorTag { // Declaring the global parser.. global $wgParser;
 * 1) This function initiates the hook for the parser to convert
 * 2) tags to  tags.

// Setting the hook to parse tags from the parser output.. $wgParser->setHook( 'anchor', 'startAddAnchor' ); }

function startAddAnchor( $input, $argv ) { // Fetching the 'url' parameter.. $url = $argv['url'];
 * 1) This function extracts the parameters from the  tags and
 * 2) the text between the and tags and formats them as ""
 * 3) tags and writes them in the document.

// Fetching the 'target' parameter.. $target = $argv['target'];

if ($target != '') { // If a target parameter exists then print the link with it.. return "$input"; } else { // If a target parameter does not exist then just print the link with the 'href' URL.. return "$input"; } }