MediaWiki REL1_30
TitleBlacklist.library.php
Go to the documentation of this file.
1<?php
2
3class Scribunto_LuaTitleBlacklistLibrary extends Scribunto_LuaLibraryBase {
4 public function register() {
5 $lib = [
6 'test' => [ $this, 'test' ],
7 ];
8
9 return $this->getEngine()->registerInterface(
10 __DIR__ . '/mw.ext.TitleBlacklist.lua', $lib, []
11 );
12 }
13
14 public function test( $action = null, $title = null ) {
15 $this->checkType( 'mw.ext.TitleBlacklist.test', 1, $action, 'string' );
16 $this->checkTypeOptional( 'mw.ext.TitleBlacklist.test', 2, $title, 'string', '' );
17 $this->incrementExpensiveFunctionCount();
18 if ( $title == '' ) {
19 $title = $this->getParser()->mTitle->getPrefixedText();
20 }
21 $entry = TitleBlacklist::singleton()->isBlacklisted( $title, $action );
22 if ( $entry ) {
23 return [ [
24 'params' => $entry->getParams(),
25 'regex' => $entry->getRegex(),
26 'raw' => $entry->getRaw(),
27 'version' => $entry->getFormatVersion(),
28 'message' => $entry->getErrorMessage( $action ),
29 'custommessage' => $entry->getCustomMessage()
30 ] ];
31 }
32 return [ null ];
33 }
34
35}
static singleton()
Get an instance of this class.