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 ) { // Matching to see if the URL matches the prefixes in $wgUrlProtocols.. if (preg_match("/^(http:\/\/|https:\/\/|ftp:\/\/|irc:\/\/|gopher:\/\/|news:|mailto:)/", $argv['url'])) { // Fetching the 'url' parameter.. $url = $argv['url']; } else { $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 ($url !=  && $target != ) { // If a target parameter exists then print the link with it.. return "". htmlspecialchars($input). ""; } else if ($url != '') { // If a target parameter does not exist then just print the link with the 'href' URL.. return "". htmlspecialchars($input). ""; } else { return ''; } }

Modification to allow the use of 
Replace if ($url !=  && $target != ) { // If a target parameter exists then print the link with it.. return "". htmlspecialchars($input). ""; } else if ($url != '') { // If a target parameter does not exist then just print the link with the 'href' URL.. return "". htmlspecialchars($input). ""; with if (strncasecmp($input,'$)/","$2",$input)). ">";       } else { $body = htmlspecialchars($input); }       if ($url !=  && $target != ) { // If a target parameter exists then print the link with it.. return "". $body. "</a>"; } else if ($url != '') { // If a target parameter does not exist then just print the link with the 'href' URL.. return "". $body. "</a>"; When using <IMG...> in this way, you must use single quotes - for example: url='http://www.site.tld'><img align='left' src='url'>

Error message fix
Change the line $target = $argv['target']; to if(isset($argv['target'])) {$target = $argv['target'];} else { $target = ;} to eliminate an annoying Undefined index:'' error message. Here's a gzipped tar file with both this fix and the <img...> change in it. Fetch it if you have access to gunzip and tar. You'll have to rename it or change your LocalSettings.php to use this version.