mediawiki-extensions-SpamBl.../SpamBlacklist.php

44 lines
1 KiB
PHP
Raw Normal View History

2004-12-11 09:59:06 +00:00
<?php
# Loader for spam blacklist feature
# Include this from LocalSettings.php
if ( defined( 'MEDIAWIKI' ) ) {
global $wgFilterCallback, $wgPreSpamFilterCallback;
global $wgSpamBlacklistFiles;
2005-07-08 16:29:22 +00:00
global $wgSpamBlacklistSettings;
2004-12-11 09:59:06 +00:00
$wgSpamBlacklistFiles = false;
2005-07-08 16:29:22 +00:00
$wgSpamBlacklistSettings = array();
2004-12-11 09:59:06 +00:00
if ( $wgFilterCallback ) {
$wgPreSpamFilterCallback = $wgFilterCallback;
} else {
$wgPreSpamFilterCallback = false;
}
$wgFilterCallback = 'wfSpamBlacklistLoader';
2005-08-26 14:33:40 +00:00
$wgExtensionCredits['other'][] = array(
'name' => 'SpamBlacklist',
);
2004-12-11 09:59:06 +00:00
function wfSpamBlacklistLoader( &$title, $text, $section ) {
require_once( "SpamBlacklist_body.php" );
static $spamObj = false;
2005-07-08 16:29:22 +00:00
global $wgSpamBlacklistFiles, $wgSpamBlacklistSettings, $wgPreSpamFilterCallback;
2004-12-11 09:59:06 +00:00
if ( $spamObj === false ) {
2005-07-08 16:29:22 +00:00
$spamObj = new SpamBlacklist( $wgSpamBlacklistSettings );
2004-12-11 09:59:06 +00:00
if ( $wgSpamBlacklistFiles ) {
$spamObj->files = $wgSpamBlacklistFiles;
$spamObj->previousFilter = $wgPreSpamFilterCallback;
}
}
return $spamObj->filter( $title, $text, $section );
}
} # End invocation guard
?>