From 85e7751452fdd17183b7217f9dd0ff841f65debc Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 25 May 2015 11:54:29 +0200 Subject: [PATCH] Add a PHP implementation of TitleInputWidget From the PHP side it's really just an infusable TextInputWidget. Change-Id: I607339c2e967e502f85164c9b1ea79dc0a17c9cc --- autoload.php | 1 + includes/widget/AUTHORS.txt | 10 +++++++ includes/widget/LICENSE.txt | 25 ++++++++++++++++ includes/widget/TitleInputWidget.php | 43 ++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 includes/widget/AUTHORS.txt create mode 100644 includes/widget/LICENSE.txt create mode 100644 includes/widget/TitleInputWidget.php diff --git a/autoload.php b/autoload.php index dcd8727264..284da46b37 100644 --- a/autoload.php +++ b/autoload.php @@ -754,6 +754,7 @@ $wgAutoloadLocalClasses = array( 'MediaWiki\\Logger\\Monolog\\WikiProcessor' => __DIR__ . '/includes/debug/logger/monolog/WikiProcessor.php', 'MediaWiki\\Logger\\NullSpi' => __DIR__ . '/includes/debug/logger/NullSpi.php', 'MediaWiki\\Logger\\Spi' => __DIR__ . '/includes/debug/logger/Spi.php', + 'MediaWiki\\Widget\\TitleInputWidget' => __DIR__ . '/includes/widget/TitleInputWidget.php', 'MemCachedClientforWiki' => __DIR__ . '/includes/objectcache/MemcachedClient.php', 'MemcLockManager' => __DIR__ . '/includes/filebackend/lockmanager/MemcLockManager.php', 'MemcachedBagOStuff' => __DIR__ . '/includes/objectcache/MemcachedBagOStuff.php', diff --git a/includes/widget/AUTHORS.txt b/includes/widget/AUTHORS.txt new file mode 100644 index 0000000000..10064b247e --- /dev/null +++ b/includes/widget/AUTHORS.txt @@ -0,0 +1,10 @@ +Authors (alphabetically) + +Alex Monk +Bartosz Dziewoński +Ed Sanders +James D. Forrester +Roan Kattouw +Sucheta Ghoshal +Timo Tijhof +Trevor Parscal diff --git a/includes/widget/LICENSE.txt b/includes/widget/LICENSE.txt new file mode 100644 index 0000000000..b03ca80157 --- /dev/null +++ b/includes/widget/LICENSE.txt @@ -0,0 +1,25 @@ +Copyright (c) 2011-2015 MediaWiki Widgets Team and others under the +terms of The MIT License (MIT), as follows: + +This software consists of voluntary contributions made by many +individuals (AUTHORS.txt) For exact contribution history, see the +revision history and logs, available at https://gerrit.wikimedia.org + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/includes/widget/TitleInputWidget.php b/includes/widget/TitleInputWidget.php new file mode 100644 index 0000000000..173dbb07c9 --- /dev/null +++ b/includes/widget/TitleInputWidget.php @@ -0,0 +1,43 @@ + true ) ) ); + + // Properties + if ( isset( $config['namespace'] ) ) { + // Actually ignored in PHP, we just ship it back to JS + $this->namespace = $config['namespace']; + } + + // Initialization + $this->addClasses( array( 'mw-widget-TitleInputWidget' ) ); + } + + public function getConfig( &$config ) { + if ( $this->namespace !== null ) { + $config['namespace'] = $this->namespace; + } + return parent::getConfig( $config ); + } +} -- 2.20.1