mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-15 10:17:49 +00:00
9a723566ac
* remove trailing whitespace
51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
exit(1);
|
|
}
|
|
|
|
$wgExtensionCredits['other'][] = array(
|
|
'name' => 'Title Blacklist',
|
|
'version' => '1.1',
|
|
'url' => 'http://www.mediawiki.org/wiki/Extension:TitleBlacklist',
|
|
'author' => 'VasilievVV',
|
|
'description' => 'Allows to forbide creation of pages with specified titles',
|
|
);
|
|
|
|
$wgAutoloadClasses['TitleBlacklist'] = dirname( __FILE__ ) . '/TitleBlacklist.list.php';
|
|
$wgAutoloadClasses['TitleBlacklistHooks'] = dirname( __FILE__ ) . '/TitleBlacklist.hooks.php';
|
|
|
|
$wgExtensionFunctions[] = 'efInitTitleBlacklist';
|
|
|
|
// Sources of TitleBlacklist
|
|
define( 'TBLSRC_MSG', 0 ); //For internal usage
|
|
define( 'TBLSRC_LOCALPAGE', 1 ); //Local wiki page
|
|
define( 'TBLSRC_URL', 2 ); //Load blacklist from URL
|
|
define( 'TBLSRC_FILE', 3 ); //Load from file
|
|
$wgTitleBlacklistSources = array();
|
|
|
|
$wgAvailableRights[] = 'tboverride';
|
|
$wgGroupPermissions['sysop']['tboverride'] = true;
|
|
|
|
function efInitTitleBlacklist() {
|
|
global $wgTitleBlacklist;
|
|
$wgTitleBlacklist = new TitleBlacklist();
|
|
efSetupTitleBlacklistMessages();
|
|
efSetupTitleBlacklistHooks();
|
|
}
|
|
|
|
function efSetupTitleBlacklistMessages() {
|
|
global $wgMessageCache;
|
|
require_once( 'TitleBlacklist.i18n.php' );
|
|
foreach( efGetTitleBlacklistMessages() as $lang => $messages ) {
|
|
$wgMessageCache->addMessages( $messages, $lang );
|
|
}
|
|
}
|
|
|
|
function efSetupTitleBlacklistHooks() {
|
|
global $wgHooks;
|
|
$titleBlacklistHooks = new TitleBlacklistHooks();
|
|
$wgHooks['userCan'][] = array( $titleBlacklistHooks, 'userCan' );
|
|
$wgHooks['AbortMove'][] = array( $titleBlacklistHooks, 'abortMove' );
|
|
$wgHooks['UploadVerification'][] = array( $titleBlacklistHooks, 'verifyUpload' );
|
|
}
|