summaryrefslogtreecommitdiff
path: root/extensions/TitleBlacklist/TitleBlacklist.library.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /extensions/TitleBlacklist/TitleBlacklist.library.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'extensions/TitleBlacklist/TitleBlacklist.library.php')
-rw-r--r--extensions/TitleBlacklist/TitleBlacklist.library.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/extensions/TitleBlacklist/TitleBlacklist.library.php b/extensions/TitleBlacklist/TitleBlacklist.library.php
new file mode 100644
index 00000000..0c2a599c
--- /dev/null
+++ b/extensions/TitleBlacklist/TitleBlacklist.library.php
@@ -0,0 +1,33 @@
+<?php
+
+class Scribunto_LuaTitleBlacklistLibrary extends Scribunto_LuaLibraryBase {
+ public function register() {
+ $lib = array(
+ 'test' => array( $this, 'test' ),
+ );
+
+ $this->getEngine()->registerInterface( __DIR__ . '/mw.ext.TitleBlacklist.lua', $lib, array() );
+ }
+
+ public function test( $action = null, $title = null ) {
+ $this->checkType( 'mw.ext.TitleBlacklist.test', 1, $action, 'string' );
+ $this->checkTypeOptional( 'mw.ext.TitleBlacklist.test', 2, $title, 'string', '' );
+ $this->incrementExpensiveFunctionCount();
+ if ( $title == '' ) {
+ $title = $this->getParser()->mTitle->getPrefixedText();
+ }
+ $entry = TitleBlacklist::singleton()->isBlacklisted( $title, $action );
+ if ( $entry ) {
+ return array( array(
+ 'params' => $entry->getParams(),
+ 'regex' => $entry->getRegex(),
+ 'raw' => $entry->getRaw(),
+ 'version' => $entry->getFormatVersion(),
+ 'message' => $entry->getErrorMessage( $action ),
+ 'custommessage' => $entry->getCustomMessage()
+ ) );
+ }
+ return array( null );
+ }
+
+}