-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsettings.php
102 lines (91 loc) · 4.38 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
// This file is part of the Contact Form plugin for Moodle - https://moodle.org/
//
// Contact Form is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Contact Form is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Contact Form. If not, see <https://www.gnu.org/licenses/>.
/**
* This plugin for Moodle is used to send emails through a web form.
*
* @package local_contact
* @copyright 2016-2024 TNG Consulting Inc. - www.tngconsulting.ca
* @author Michael Milette
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
// Heading.
$settings = new admin_settingpage('local_contact', get_string('pluginname', 'local_contact'));
$ADMIN->add('localplugins', $settings);
// Custom sender (from) email address.
$default = '';
$name = 'local_contact/senderaddress';
$title = get_string('senderaddress', 'local_contact');
$description = get_string('senderaddress_description', 'local_contact');
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_RAW);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// List of tags and recipient email addresses.
$default = '';
$name = 'local_contact/recipient_list';
$title = get_string('recipient_list', 'local_contact');
$description = get_string('recipient_list_description', 'local_contact');
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
$settings->add($setting);
// Don't use reply-to.
$default = 0;
$name = 'local_contact/noreplyto';
$title = get_string('noreplyto', 'local_contact');
$description = get_string('noreplyto_description', 'local_contact');
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
$settings->add($setting);
// Require the user to be logged-in in order to send the form.
$default = 0;
$name = 'local_contact/loginrequired';
$title = get_string('loginrequired', 'local_contact');
$description = get_string('loginrequired_description', 'local_contact');
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
$settings->add($setting);
// Do not include site name in email subject line.
$default = 0;
$name = 'local_contact/nosubjectsitename';
$title = get_string('nosubjectsitename', 'local_contact');
$description = get_string('nosubjectsitename_description', 'local_contact');
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
$settings->add($setting);
// Enable a file attachment.
$default = 0;
$name = 'local_contact/attachment';
$title = get_string('attachment', 'local_contact');
$description = get_string('attachment_description', 'local_contact');
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
$settings->add($setting);
// Override and disable ReCAPTCHA, if the private and public keys are setup in Moodle.
if (!empty($CFG->recaptchaprivatekey) && !empty($CFG->recaptchapublickey)) {
// Information on using recaptcha with Contact Form.
$name = 'local_contact/recapchainfo';
$title = get_string('recapchainfo', 'local_contact');
if (empty(get_config('local_contact', 'norecaptcha'))) {
$description = get_string('recapchainfo_description', 'local_contact');
} else {
$description = '';
}
$setting = new admin_setting_heading($name, $title, $description);
$settings->add($setting);
// Disable Recapcha - if configured.
$name = 'local_contact/norecaptcha';
$title = get_string('norecaptcha', 'local_contact');
$description = get_string('norecaptcha_description', 'local_contact');
$setting = new admin_setting_configcheckbox($name, $title, $description, 0);
$settings->add($setting);
}
}