Extension:FileLinkCorrection
From MediaWiki.org
![]() |
This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version Extension:FCKeditor (Official). |
FileLinkCorrection Release status: beta |
|||
---|---|---|---|
Implementation | Page action | ||
Description | Using file:// links with linktext with MediaWiki+FCKeditor | ||
Author(s) | Johannes Perl (JperlTalk) | ||
Last version | 0.1.0 (2008-02-28) | ||
MediaWiki | 1.10.2+ | ||
License | No license specified | ||
Download | see below | ||
|
|||
Check usage (experimental) |
Contents |
[edit] What can this extension do?
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.
[edit] Usage
[edit] Download instructions
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.
[edit] Installation
To install this extension, add the following to LocalSettings.php:
#to correct file:// links destroyed by FCKeditor include("extensions/FileLinkCorrection.php");
[edit] Code
<?php # 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.', 'version'=>'0.1.0' ); $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); else $parseroutput = preg_replace('/\[(<a[^>]*\>)([^(bearbeiten)].*)<\/a>(.*)\]/U', "$1$3</a>", $parseroutput); return true; } ?>