/
settings.php
85 lines (83 loc) · 3.17 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
<?php
$scopes = get_option('WPMDBUG_plugins', array());
$scope = (is_array($scopes) && count($scopes) > 0);
if (!function_exists('get_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
?>
<div class="wrap">
<h2>E-Mail Debugger Settings</h2>
<form action="options-general.php?page=wpmdbug" method="post">
<table class="form-table">
<tbody>
<tr>
<th scope="row">Enable E-Mail Debugging</strong></th>
<td>
<label>
<input type="checkbox" value="1" name="wpmdbug_enabled" <?php echo (WPMailDebugger::doEnforce()) ? 'checked="checked"': ''; ?>/>
</label>
</td>
</tr>
<tr>
<th scope="row">Redirect E-Mails To</strong></th>
<td>
<label>
<input type="text" size="40" value="<?php echo get_option('WPMDBUG_email', get_bloginfo('admin_email')); ?>" name="wpmdbug_sendto"/>
</label>
</td>
</tr>
<tr>
<th scope="row"> </strong></th>
<td>
<label>
<input type="radio" value="1" name="wpmdbug_scope" <?php echo ($scope) ? '': 'checked="checked"'; ?>/>
Redirect all e-mails sent through WordPress
</label>
<br/>
<label>
<input type="radio" value="2" name="wpmdbug_scope" <?php echo ($scope) ? 'checked="checked"': ''; ?>/>
Limit to specific plugins
</label>
</td>
</tr>
<tr style="display:<?php echo ($scope) ? 'table-row': 'none'; ?>;" id="pluginlist">
<th scope="row">Select Plugins</th>
<td>
<table>
<tbody>
<tr>
<th colspan="2">
<input type="checkbox" id="selall" <?php echo (count($scopes) === count($plugins)) ? 'checked="checked"': ''; ?>/> Select All
</th>
</tr>
<?php foreach ($plugins as $plugin => $pdata): if (stripos($plugin, 'wp-mail-debugger.php') !== FALSE) {continue;} ?>
<tr>
<td style="padding-top: 5px; padding-bottom: 5px;"><input type="checkbox" name="targetplugins[]" value="<?php echo $plugin; ?>" <?php echo ($scope && in_array($plugin, $scopes)) ? 'checked="checked"': ''; ?>/></td>
<td style="padding-top: 5px; padding-bottom: 5px;"><?php echo $pdata['Name']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p><input type="submit" name="wpmdbug_submit" value="Save Settings" class="button-primary"/></p>
</form>
</div>
<script type="text/javascript">
(function($) {
$("input[name='wpmdbug_scope']").on("click", function() {
var target = $("input[name='wpmdbug_scope']:checked").val();
if (target == 2) {
$("#pluginlist").show();
} else {
$("#pluginlist").hide();
}
});
$("#selall").on("click", function() {
$("input[name='targetplugins[]']").prop("checked", $(this).prop("checked"));
});
})(jQuery);
</script>