MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: unmaintained
Implementation Page action
Description Using file:// links with linktext with MediaWiki+FCKeditor
Author(s) Johannes Perl (Jperltalk)
Latest version 0.1.0 (2008-02-28)
MediaWiki 1.10.2+
License No license specified
Download see below

Check usage and version matrix.

What can this extension do?Edit

This extension corrects file:// links with description which are destroyed by the FCKeditor.

This extension should have become obsolete for new mediawiki versions as FCKeditor has been improved now. Go to Extension:FCKeditor_(by_FCKeditor_and_Wikia) for details.


Download instructionsEdit

Please cut and paste the code found below and place it in $IP/extensions/FileLinkCorrection.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php .


To install this extension, add the following to LocalSettings.php :

#to correct file:// links destroyed by FCKeditor


# FileLinkCorrection MediaWiki Extention
# Created by Johannes Perl
# When using file:// links with MediaWiki+FCKeditor, file links of the form 
# [file://path/to/file/file.txt filename] are destroyed.
# This extension parses the html output and corrects destroyed tags. 

$wgExtensionCredits['parserhook'][] = array(
	'name' => 'FileLinkCorrection',
	'author' => 'Johannes Perl',
	'url' => 'http://www.mediawiki.org/wiki/User:Jperl',
	'description' => 'This extension helps to be able to use file:// links with description MediaWiki+FCKeditor.',

$wgHooks['OutputPageBeforeHTML'][] = 'fileLinkCorrection';

function fileLinkCorrection(&$out, &$parseroutput)
	$mBodytext = $out->mBodytext;
	//preview of text	
	if($mBodytext != "")
		$out->mBodytext = preg_replace('/\[(<a[^>]*\>)([^(bearbeiten)].*)<\/a>(.*)\]/U', "$1$3</a>", $mBodytext);
		$parseroutput = preg_replace('/\[(<a[^>]*\>)([^(bearbeiten)].*)<\/a>(.*)\]/U', "$1$3</a>", $parseroutput);

	return true;