Difference between revisions of "Extension:ImageHistoryClear"
From Organic Design wiki
m |
m |
||
Line 26: | Line 26: | ||
/** | /** | ||
− | * | + | * Function called from the hook BeforePageDisplay, with a regular expression to replace TOC, history and image information. |
*/ | */ | ||
function efImageHistoryClear (&$out) { | function efImageHistoryClear (&$out) { | ||
− | |||
$out->mBodytext = preg_replace ('%<ul id="filetoc">.+?</ul>%s','',$out->mBodytext); | $out->mBodytext = preg_replace ('%<ul id="filetoc">.+?</ul>%s','',$out->mBodytext); | ||
$out->mBodytext = preg_replace ('%<h2 id="filehistory".+$%s','',$out->mBodytext); | $out->mBodytext = preg_replace ('%<h2 id="filehistory".+$%s','',$out->mBodytext); | ||
− | |||
return true; | return true; | ||
} | } |
Revision as of 20:27, 29 October 2008
<?php /**
* ImageHistoryClear extension - An extension to strip TOC, history and links information from image page views by anonymous users. Made with Template:Extension. *Template:Php
* See http://www.mediawiki.org/wiki/Extension:ImageHistoryClear for installation and usage details * * @package MediaWiki * @subpackage Extensions * @author User:Jack * @copyright © 2008 User:Jack * @licence GNU General Public Licence 2.0 or later */
if (!defined('MEDIAWIKI')) die('Not an entry point.');
define('IMAGEHISTORYCLEAR_VERSION', '1.0.0, 2008-10-21');
$wgExtensionFunctions[] = 'efSetupImageHistoryClear';
$wgExtensionCredits['parserhook'][] = array( 'name' => 'ImageHistoryClear', 'author' => 'User:Jack', 'description' => 'An extension to strip TOC, history and links information from image page views by anonymous users. Made with Template:Extension.', 'url' => 'http://www.organicdesign.co.nz/Extension:ImageHistoryClear', 'version' => IMAGEHISTORYCLEAR_VERSION );
/**
* Function called from the hook BeforePageDisplay, with a regular expression to replace TOC, history and image information. */
function efImageHistoryClear (&$out) {
$out->mBodytext = preg_replace ('%
- .+?
%s',,$out->mBodytext); $out->mBodytext = preg_replace ('%