-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.php
212 lines (180 loc) · 7.85 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
// Block direct access.
defined('ABSPATH') or die("You is bot, spam, .v..v..");
if (isset($_POST['_ais_settings_nonce'])):
// Security Check
if (!wp_verify_nonce(sanitize_text_field($_POST['_ais_settings_nonce']), '_save_ais_settings')):
// Display Error
add_settings_error('ais_settings_options', 'ais_security_error', 'Security check failed.', 'error'); // $setting, $code, $message, $type
// Die
wp_die(__('Security Check Failed. Click <a href="' . get_bloginfo('url') . '/wp-admin/options-general.php?page=protect_ais">here</a> to try again.', 'Secure AXS Settings'), array(
'response' => '500'
));
else:
self::validate_settings($_POST['protect_ais']);
// Retreive updated values after saving.
$this->protect_ais = self::retrieve_settings('protect_ais');
// Reload to pickup any warning or errors.
echo '<script>location.reload();</script>';
endif;
endif;
?>
<div class="wrap">
<?php
echo "<h2>" . __('Access Settings', 'Protect_Ais') . "</h2>";
?>
<form name="protect_ais" id="protect_ais" method="post" action="">
<?php
wp_nonce_field('_save_ais_settings', '_ais_settings_nonce')
?>
<table class="form-table">
<tbody>
<tr valign="top"><th scope="row"><h4><?php
_e('Security Options', 'Protect_Ais');
?></h4></tr>
<tr valign="top">
<th scope="row">
<label for="protect_ais[ais_url]">
<?php
_e("Access URL (i.e ais-login):", "Protect_Ais");
?>
</label></th>
<td>
<input name="protect_ais[ais_url]" type="text" id="ais_url" value="<?php
echo $this->protect_ais['ais_url'];
?>" class="regular-text">
<p class="description">Alphanumeric and dash "-" are only allowed.</p>
<p class="description">Your current secured access login is: <a href="<?php
echo get_bloginfo('url') . '/' . $this->plink . $this->protect_ais['ais_url'];
?>" target="_blank"><?php
echo get_bloginfo('url') . '/' . $this->plink . $this->protect_ais['ais_url'];
?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="protect_ais[allow_editors]"><?php
_e("Allow Editors to edit settings:", "Protect_Ais");
?></label></th>
<td><input name="protect_ais[allow_editors]" type="checkbox" id="allow_editors" <?php
if ($this->protect_ais['allow_editors'] == 'on'):
echo 'checked';
endif;
?>>
<p class="description">When Checked, Editors are able to access/change plugin settings.</p>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="protect_ais[ggcap_key]"><?php
_e("reCAPTCHA site key* ", "Protect_Ais");
?></label></th>
<td>
<input name="protect_ais[ggcap_key]" type="text"
placeholder=""
value="<?php
echo ($this->protect_ais['ggcap_key'] == NULL ? NULL : $this->protect_ais['ggcap_key']);
?>"
class="regular-text">
<p class="description">Claim your free reCAPTCHA site key and secret key from this link <a href="https://www.google.com/recaptcha/admin" target="_blabk">https://www.google.com/recaptcha/admin</a></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="protect_ais[ggcap_secret]"><?php
_e("reCAPTCHA secret key* ", "Protect_Ais");
?></label></th>
<td>
<input name="protect_ais[ggcap_secret]" type="text"
placeholder=""
value="<?php
echo ($this->protect_ais['ggcap_secret'] == NULL ? NULL : $this->protect_ais['ggcap_secret']);
?>"
class="regular-text">
</td>
</tr>
</tbody>
<tbody>
<tr valign="top"><th scope="row"><h4><?php
_e('Branding Options', 'Protect_Ais');
?></h4></tr>
<tr valign="top">
<th scope="row">
<label for="protect_ais[bg_color]">
<?php
_e("Background Color", "Protect_Ais");
?>
</label></th>
<td>
<input name="protect_ais[bg_color]" type="text" id="bg_color" value="<?php
echo $this->protect_ais['bg_color'];
?>" class="regular-text ais-colors">
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="protect_ais[text_color]">
<?php
_e("Text Color", "Protect_Ais");
?>
</label></th>
<td>
<input name="protect_ais[text_color]" type="text" id="text_color" value="<?php
echo $this->protect_ais['text_color'];
?>" class="regular-text ais-colors">
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="protect_ais[brand_logo]">
<?php
_e("Custom Logo", "Protect_Ais");
?>
</label></th>
<td>
<div id="ais_image_thumb">
<?php
if ($this->protect_ais['ais_image'] != NULL):
?>
<img src="<?php
echo $this->protect_ais['ais_image'];
?>" style="max-height: 50px; width: auto;"><br>
<?php
endif;
?>
</div>
<input name="protect_ais[ais_image]" id="ais_image" type="text" size="36" value="<?php
echo $this->protect_ais['ais_image'];
?>" class="regular-text logo">
<input type="button" id="ais_image_button" class="button-secondary upload-img" value="Select Image">
</td>
</tr>
</tr>
<tr valign="top">
<th scope="row">
<label for="protect_ais[brand_bg]">
<?php
_e("Custom Background Image", "Protect_Ais");
?>
</label></th>
<td>
<div id="brand_bg_thumb">
<?php
if ($this->protect_ais['brand_bg'] != NULL):
?>
<img src="<?php
echo $this->protect_ais['brand_bg'];
?>" style="max-height: 50px; width: auto;"><br>
<?php
endif;
?>
</div>
<input name="protect_ais[brand_bg]" id="brand_bg" type="text" size="36" value="<?php
echo $this->protect_ais['brand_bg'];
?>" class="regular-text">
<input type="button" id="brand_bg_button" class="button-secondary upload-img" value="Select Image">
</td>
</tr>
</tbody>
</table>
<?php
submit_button();
?>
</form>