Extension:NukeHtmlPhp

Up to date information on this extension can be found at: The update provides better integration with other extensions:
 * GeSHi syntax highlighter
 * RunPHP Page

Purpose
This extension enables the conditional removal replacement of the following tags  from article being saved. Potential security issues can thus be managed.

Source Code
<?php
 * 1) NukeHtmlPhp Mediawiki Extension
 * 2) Author: Jean-Lou Dupont
 * 1) Author: Jean-Lou Dupont
 * 1) This extension implements a "hook" on the "ArticleSave" event
 * 2) in order to 'nuke' any, or tags
 * 3) found to be entered by members without the 'coding' right.


 * 1) To activate the extension, include it from your "LocalSettings.php"
 * 2) with: include("extensions/nukeHtmlPhp.php");


 * 1) Also, specify which group(s) have the 'coding' right e.g:
 * 2) $wgGroupPermissions['user']['coding'] = false;
 * 3) $wgGroupPermissions['sysop']['coding'] = true;



$wgHooks['ArticleSave'][] = 'fnNukeHtmlPhpHook';

function fnNukeHtmlPhpHook(&$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags) { if ($user->isAllowed('coding')!='true') { #If not, "nuke" all HTML, PHP and RUNPHP tags $text=str_ireplace("html>","ehtml>",$text); # case with article_title --> $text=str_ireplace(" "," ",$text); $text=str_ireplace(" "," ",$text); $text=str_ireplace(" "," ",$text); } return true; } ?>
 * 1) First, check if User has "coding" permission