User:Robchurch/Integrating FCKeditor with 1.9.3

It's possible to integrate FCKeditor with MediaWiki 1.9.3, although I wouldn't recommend doing this unless allowing raw HTML is acceptable. You'll still need to use wiki text for things like linking, etc. but FCKeditor doesn't care about most wiki markup, as far as I can tell.

As usual, following these instructions is done at your own risk, and I won't be responsible for death, destruction, mutilation, disembowelling, cuts, bruises, loss of job, loss of funds, loss of foreign assets, loss of marbles, loss of hair, loss of...well, you get the idea.

In true Blue Peter fashion, you will need:


 * FCKeditor : Download from http://www.fckeditor.net/download
 * MediaWiki : This integration was done against 1.9.3, although this should work for all later versions, too

You may also find sticky-backed plastic useful, but it is not essential for this particular operation.

Steps

 * 1) Install MediaWiki
 * 2) Edit LocalSettings.php and add the line
 * 3) Place all FCKeditor files in /path/to/mediawiki/fckeditor
 * 4) Patch MediaWiki with the following patch
 * 1) Patch MediaWiki with the following patch

You should be done. Here's one I made earlier. Both Save buttons will work. A quick test suggests that FCKeditor protects against certain malicious HTML insertions in the "raw source" mode, which is also useful when editing wiki text...I tested with  and it didn't work, at least.

Patch
This patch adds the FCKeditor integration class for PHP to MediaWiki's autoloading framework, and patches the editor to render an FCKeditor control in place of the standard textbox.

Index: includes/AutoLoader.php

=
====================================================== --- includes/AutoLoader.php	(revision 22928) +++ includes/AutoLoader.php	(working copy) @@ -272,6 +272,10 @@ 		'ApiQuerySiteinfo' => 'includes/api/ApiQuerySiteinfo.php', 'ApiQueryWatchlist' => 'includes/api/ApiQueryWatchlist.php', 'ApiResult' => 'includes/api/ApiResult.php', +		+		# FCKeditor +		'FCKeditor' => 'fckeditor/fckeditor_php5.php', +		 	); 	if ( isset( $localClasses[$className] ) ) { Index: includes/EditPage.php

=
====================================================== --- includes/EditPage.php	(revision 22928) +++ includes/EditPage.php	(working copy) @@ -1195,6 +1195,12 @@ 			? "" 			: "\n"; +	# Prepare FCKeditor +	$fckeditor = new FCKeditor( 'wpTextbox1' ); +	$fckeditor->BasePath = $GLOBALS['wgScriptPath']. '/fckeditor/'; +	$fckeditor->Value = $this->safeUnicodeOutput( $this->textbox1 ); +	$editor = $fckeditor->CreateHtml; + 		$wgOut->addHTML( << @@ -1212,18 +1218,7 @@ edittime}\" name=\"wpEdittime\" />\n scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n" ); -		$wgOut->addHTML( << -END -. htmlspecialchars( $this->safeUnicodeOutput( $this->textbox1 ) ) . -" - -		" ); - +		$wgOut->addHtml( $recreate . $commentsubject . $subjectpreview . $editor ); 		$wgOut->addWikiText( $copywarn ); 		$wgOut->addHTML( $this->editFormTextAfterWarn ); 		$wgOut->addHTML( "