This commit is contained in:
Cyberes 2020-10-24 19:10:53 -06:00
parent 1244b00cf8
commit 980b19591b
3 changed files with 69 additions and 52 deletions

View File

@ -1,53 +1,56 @@
{ {
"name": "ContactPage", "name": "ContactPage",
"version": "2.3", "version": "2.3",
"author": [ "author": [
"Daniel Kinzler", "Daniel Kinzler",
"Sam Reed" "Sam Reed"
], ],
"url": "https://www.mediawiki.org/wiki/Extension:ContactPage", "url": "https://www.mediawiki.org/wiki/Extension:ContactPage",
"descriptionmsg": "contactpage-desc", "descriptionmsg": "contactpage-desc",
"license-name": "GPL-2.0-or-later", "license-name": "GPL-2.0-or-later",
"type": "specialpage", "type": "specialpage",
"ExtensionMessagesFiles": { "ExtensionMessagesFiles": {
"ContactPageAliases": "ContactPage.alias.php" "ContactPageAliases": "ContactPage.alias.php"
}, },
"MessagesDirs": { "MessagesDirs": {
"ContactPage": [ "ContactPage": [
"i18n" "i18n"
] ]
}, },
"config": { "config": {
"ContactConfig": { "ContactConfig": {
"value": { "value": {
"default": { "default": {
"RecipientUser": null, "RecipientUser": null,
"SenderEmail": null, "SenderEmail": null,
"SenderName": null, "SenderName": null,
"RequireDetails": false, "RequireDetails": false,
"IncludeIP": false, "IncludeIP": false,
"MustBeLoggedIn": false, "MustBeLoggedIn": false,
"RLModules": [], "RLModules": [],
"RLStyleModules": [], "RLStyleModules": [],
"AdditionalFields": { "AdditionalFields": {
"Text": { "Text": {
"label-message": "emailmessage", "label-message": "emailmessage",
"type": "textarea", "type": "textarea",
"required": true "required": true
} }
} }
} }
} }
} }
}, },
"SpecialPages": { "SpecialPages": {
"Contact": "SpecialContact" "Contact": "SpecialContact"
}, },
"AutoloadClasses": { "AutoloadClasses": {
"SpecialContact": "includes/SpecialContact.php" "SpecialContact": "includes/SpecialContact.php"
}, },
"manifest_version": 2, "manifest_version": 2,
"requires": { "requires": {
"MediaWiki": ">= 1.29.0" "MediaWiki": ">= 1.29.0"
} },
"Hooks": {
"BeforePageDisplay": "ContactPageHooks::onBeforePageDisplay"
}
} }

View File

@ -0,0 +1,8 @@
<?php
class ContactPageHooks
{
public static function onBeforePageDisplay(OutputPage $out, Skin $skin)
{
$out->addScriptFile('https://www.google.com/recaptcha/api.js');
}
}

View File

@ -178,7 +178,13 @@ class SpecialContact extends UnlistedSpecialPage
'class' => 'HTMLHiddenField', 'class' => 'HTMLHiddenField',
'label' => 'Type', 'label' => 'Type',
'default' => $this->formType, 'default' => $this->formType,
] ],
'Captcha' => [
'type' => 'info',
'label' => 'info',
'default' => "<div class=\"g-recaptcha\" data-sitekey=\"{$wgReCaptchaSiteKey}\"></div>",
'raw' => true,
],
]; ];
$form = HTMLForm::factory( $form = HTMLForm::factory(