Add extension.json

Bug: T87901
Change-Id: Iba8dccbf5ec5b303610c89bb82ff13d86dc5883a
This commit is contained in:
Kunal Mehta 2015-03-02 18:51:39 -08:00
parent 96786dce81
commit eb3a743cba
3 changed files with 63 additions and 0 deletions

View File

@ -15,6 +15,11 @@ if( !defined( 'MEDIAWIKI' ) ) {
die( 1 );
}
/**
* This PHP entry point is deprecated. Please use wfLoadExtension() and the extension.json file instead.
* See https://www.mediawiki.org/wiki/Manual:Extension_registration for more details.
*/
// Extension credits that will show up on Special:Version
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
@ -64,6 +69,7 @@ $wgContactConfig['default'] = array(
// The name to be used with SenderEmail.
// This will be shown in the recipient's email program
// Defaults to "Contact Form on $wgSitename"
'SenderName' => 'Contact Form on ' . $wgSitename,
// If true, users will be required to supply a name and an email address

View File

@ -15,6 +15,16 @@
* @ingroup SpecialPage
*/
class SpecialContact extends UnlistedSpecialPage {
/**
* Set default value after registration
*/
public static function onRegistration() {
global $wgContactConfig, $wgSitename;
if ( $wgContactConfig['default']['SenderName'] === null ) {
$wgContactConfig['default']['SenderName'] = "Contact Form on $wgSitename";
}
}
/**
* Constructor
*/

47
extension.json Normal file
View File

@ -0,0 +1,47 @@
{
"name": "ContactPage",
"version": 2.2,
"author": [
"Daniel Kinzler",
"Sam Reed"
],
"url": "https://www.mediawiki.org/wiki/Extension:ContactPage",
"descriptionmsg": "contactpage-desc",
"license-name": "GPL-2.0+",
"type": "specialpage",
"ExtensionMessagesFiles": {
"ContactPageAliases": "ContactPage.alias.php"
},
"MessagesDirs": {
"ContactPage": [
"i18n"
]
},
"config": {
"ContactConfig": {
"default": {
"RecipientUser": null,
"SenderEmail": null,
"SenderName": null,
"RequireDetails": false,
"IncludeIP": false,
"AdditionalFields": {
"Text": {
"label-message": "emailmessage",
"type": "textarea",
"rows": 20,
"cols": 80,
"required": true
}
}
}
}
},
"callback": "SpecialContact::onRegistration",
"SpecialPages": {
"Contact": "SpecialContact"
},
"AutoloadClasses": {
"SpecialContact": "ContactPage_body.php"
}
}