PluginProbe
User Access Manager / 2.0.13
User Access Manager v2.0.13
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
user-access-manager / src / UserAccessManager / View / AdminSettings.php

AdminSettings.php in User Access Manager 2.0.13, at src/UserAccessManager/View/AdminSettings.php

344 lines 18.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * AdminSettings.php
4 *
5 * Shows the settings page at the admin panel.
6 *
7 * PHP versions 5
8 *
9 * @author Alexander Schneider <alexanderschneider85@gmail.com>
10 * @copyright 2008-2017 Alexander Schneider
11 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
12 * @version SVN: $id$
13 * @link http://wordpress.org/extend/plugins/user-access-manager/
14 */
15
16 /**
17 * @var \UserAccessManager\Controller\AdminSettingsController $controller
18 */
19 if ($controller->hasUpdateMessage()) {
20 ?>
21 <div class="updated">
22 <p><strong><?php echo $controller->getUpdateMessage(); ?></strong></p>
23 </div>
24 <?php
25 }
26
27 ?>
28 <div class="wrap">
29 <form method="post" action="<?php echo $controller->getRequestUrl(); ?>">
30 <?php $controller->createNonceField('uamUpdateSettings'); ?>
31 <input type="hidden" name="uam_action" value="update_settings"/>
32 <h2><?php echo TXT_UAM_SETTINGS; ?></h2>
33 <?php
34 $groupedConfigParameters = $controller->getGroupedConfigParameters();
35
36 /**
37 * @var \UserAccessManager\Config\ConfigParameter[] $groupParameters
38 */
39 foreach ($groupedConfigParameters as $groupKey => $groupParameters) {
40 $cssClass = $controller->isPostTypeGroup($groupKey) ? ' uam_settings_group_post_type' : '';
41
42 ?>
43 <h3><?php echo $controller->getSectionText($groupKey); ?></h3>
44 <p><?php echo $controller->getSectionText($groupKey, true); ?></p>
45 <table id="uam_settings_group_<?php echo $groupKey; ?>"
46 class="form-table<?php echo $cssClass; ?>">
47 <tbody>
48 <?php
49 $configParameters = $controller->getConfigParameters();
50
51 foreach ($groupParameters as $groupParameter) {
52 ?>
53 <tr valign="top">
54 <?php
55 if ($groupParameter->getId() === 'lock_file_types') {
56 $lockedFileTypes = $configParameters['locked_file_types'];
57
58 ?>
59 <th><?php
60 echo TXT_UAM_LOCK_FILE_TYPES; ?></th>
61 <td>
62 <label for="uam_lock_file_types_all">
63 <input type="radio" id="uam_lock_file_types_all"
64 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
65 value="all"
66 <?php
67 if ($groupParameter->getValue() === 'all'
68 || $controller->isNginx()
69 && $groupParameter->getValue() === 'not_selected'
70 ) {
71 echo 'checked="checked"';
72 }
73 ?>
74 />
75 <?php echo TXT_UAM_ALL; ?>
76 </label>&nbsp;&nbsp;&nbsp;
77 <label for="uam_lock_file_types_selected">
78 <input type="radio" id="uam_lock_file_types_selected"
79 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
80 value="selected"
81 <?php
82 if ($groupParameter->getValue() === 'selected') {
83 echo 'checked="checked"';
84 }
85 ?>
86 />
87 <?php echo TXT_UAM_LOCKED_FILE_TYPES; ?>
88 <input name="config_parameters[<?php echo $lockedFileTypes->getId(); ?>]"
89 value="<?php echo $lockedFileTypes->getValue(); ?>"/>
90 </label>
91 &nbsp;&nbsp;&nbsp;
92 <?php
93 if ($controller->isNginx() === false) {
94 $notLockedFileTypes = $configParameters['not_locked_file_types'];
95
96 ?>
97 <label for="uam_lock_file_types_not_selected">
98 <input type="radio" id="uam_lock_file_types_not_selected"
99 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
100 value="not_selected"
101 <?php
102 if ($groupParameter->getValue() === 'not_selected') {
103 echo 'checked="checked"';
104 }
105 ?>
106 />
107 <?php echo TXT_UAM_NOT_LOCKED_FILE_TYPES; ?>
108 <input name="config_parameters[<?php echo $notLockedFileTypes->getId(); ?>]"
109 value="<?php echo $notLockedFileTypes->getValue(); ?>"/>
110 </label>
111 <br/>
112 <?php echo TXT_UAM_LOCK_FILE_TYPES_DESC; ?>
113 <?php
114 }
115 ?>
116 </td>
117 <?php
118 } elseif ($groupParameter->getId() === 'redirect') {
119 $redirectCustomPage = $configParameters['redirect_custom_page'];
120 $redirectCustomUrl = $configParameters['redirect_custom_url'];
121
122 ?>
123 <th><?php echo TXT_UAM_REDIRECT; ?></th>
124 <td>
125 <label for="uam_redirect_no">
126 <input type="radio" id="uam_redirect_no"
127 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
128 value="false"
129 <?php
130 if ($groupParameter->getValue() === 'false') {
131 echo 'checked="checked"';
132 }
133 ?>
134 />
135 <?php echo TXT_UAM_NO; ?>
136 </label>&nbsp;&nbsp;&nbsp;&nbsp;
137 <label for="uam_redirect_blog">
138 <input type="radio" id="uam_redirect_blog"
139 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
140 value="blog"
141 <?php
142 if ($groupParameter->getValue() === 'blog') {
143 echo 'checked="checked"';
144 }
145 ?>
146 />
147 <?php echo TXT_UAM_REDIRECT_TO_BLOG; ?>
148 </label>&nbsp;&nbsp;&nbsp;&nbsp;
149 <label for="uam_redirect_custom_page">
150 <input type="radio" id="uam_redirect_custom_page"
151 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
152 value="custom_page"
153 <?php
154 if ($groupParameter->getValue() === 'custom_page') {
155 echo 'checked="checked"';
156 }
157 ?>
158 />
159 <?php echo TXT_UAM_REDIRECT_TO_PAGE; ?>
160 <select name="config_parameters[<?php echo $redirectCustomPage->getId(); ?>]">
161 <?php
162 $pages = $controller->getPages();
163
164 foreach ($pages as $page) {
165 $option = "<option value=\"{$page->ID}\"";
166 $redirectValue = (int)$redirectCustomPage->getValue();
167
168 if ($redirectValue === $page->ID) {
169 $option .= ' selected="selected"';
170 }
171
172 $option .= ">{$page->post_title}</option>";
173 echo $option;
174 }
175 ?>
176 </select>
177 </label>&nbsp;&nbsp;&nbsp;&nbsp;
178 <label for="uam_redirect_custom_url">
179 <input type="radio" id="uam_redirect_custom_url"
180 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
181 value="custom_url"
182 <?php
183 if ($groupParameter->getValue() === 'custom_url') {
184 echo 'checked="checked"';
185 }
186 ?>
187 />
188 <?php echo TXT_UAM_REDIRECT_TO_URL; ?>
189 <input name="config_parameters[<?php echo $redirectCustomUrl->getId(); ?>]"
190 value="<?php echo $redirectCustomUrl->getValue(); ?>"/>
191 </label>
192 <br/>
193 <?php echo TXT_UAM_REDIRECT_DESC; ?>
194 </td>
195 <?php
196 } elseif ($groupParameter->getId() === 'full_access_role'
197 && $groupParameter instanceof \UserAccessManager\Config\SelectionConfigParameter
198 ) {
199 ?>
200 <th scope="row">
201 <label for="uam_<?php echo $groupParameter->getId(); ?>">
202 <?php echo $controller->getParameterText($groupKey, $groupParameter); ?>
203 </label>
204 </th>
205 <td>
206 <select id="uam_<?php echo $groupParameter->getId(); ?>"
207 name="config_parameters[<?php echo $groupParameter->getId(); ?>]">
208 <?php
209 $selections = $groupParameter->getSelections();
210
211 foreach ($selections as $selection) {
212 ?>
213 <option value="<?php echo $selection; ?>" <?php
214 if ($groupParameter->getValue() === $selection) {
215 echo 'selected="selected"';
216 }
217 ?> >
218 <?php
219 $optionNameKey = 'TXT_UAM_'
220 .strtoupper($groupParameter->getId().'_'.$selection);
221
222 if (defined($optionNameKey) === true) {
223 echo constant($optionNameKey);
224 } else {
225 echo $selection;
226 }
227 ?>
228 </option>
229 <?php
230 }
231 ?>
232 </select>
233
234 <br/>
235 <p><?php echo $controller->getParameterText($groupKey, $groupParameter, true); ?></p>
236 </td>
237 <?php
238 } elseif ($groupParameter instanceof \UserAccessManager\Config\BooleanConfigParameter) {
239 $parameterText = $controller->getParameterText($groupKey, $groupParameter);
240
241 ?>
242 <th scope="row"><?php echo $parameterText; ?></th>
243 <td>
244 <label for="uam_<?php echo $groupParameter->getId(); ?>_yes">
245 <input id="uam_<?php echo $groupParameter->getId(); ?>_yes"
246 type="radio"
247 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
248 value="true"
249 <?php
250 if ($groupParameter->getValue() === true) {
251 echo 'checked="checked"';
252 }
253 ?>
254 />
255 <?php echo TXT_UAM_YES; ?>
256 </label>&nbsp;&nbsp;&nbsp;
257 <label for="uam_<?php echo $groupParameter->getId(); ?>_no">
258 <input id="uam_<?php echo $groupParameter->getId(); ?>_no"
259 type="radio"
260 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
261 value="false"
262 <?php
263 if ($groupParameter->getValue() === false) {
264 echo 'checked="checked"';
265 }
266 ?>
267 />
268 <?php echo TXT_UAM_NO; ?>
269 </label>
270 <br/>
271 <p><?php echo $controller->getParameterText($groupKey, $groupParameter, true); ?></p>
272 </td>
273 <?php
274 } elseif ($groupParameter instanceof \UserAccessManager\Config\StringConfigParameter) {
275 ?>
276 <th scope="row">
277 <label for="uam_<?php echo $groupParameter->getId(); ?>">
278 <?php echo $controller->getParameterText($groupKey, $groupParameter); ?>
279 </label>
280 </th>
281 <td>
282 <input id="uam_<?php echo $groupParameter->getId(); ?>"
283 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
284 value="<?php echo $groupParameter->getValue(); ?>"/>
285 <br/>
286 <p><?php echo $controller->getParameterText($groupKey, $groupParameter, true); ?></p>
287 </td>
288 <?php
289 } elseif ($groupParameter instanceof \UserAccessManager\Config\SelectionConfigParameter) {
290 $parameterText = $controller->getParameterText($groupKey, $groupParameter);
291
292 ?>
293 <th scope="row"><?php echo $parameterText; ?></th>
294 <td>
295 <?php
296 $selections = $groupParameter->getSelections();
297
298 foreach ($selections as $selection) {
299 ?>
300 <label for="uam_<?php echo $groupParameter->getId(); ?>_yes">
301 <input id="uam_<?php echo $groupParameter->getId(); ?>_yes"
302 type="radio"
303 name="config_parameters[<?php echo $groupParameter->getId(); ?>]"
304 value="<?php echo $selection; ?>"
305 <?php
306 if ($groupParameter->getValue() === $selection) {
307 echo 'checked="checked"';
308 }
309 ?>
310 />
311 <?php
312 $optionNameKey = 'TXT_UAM_'
313 .strtoupper($groupParameter->getId().'_'.$selection);
314
315 if (defined($optionNameKey) === true) {
316 echo constant($optionNameKey);
317 } else {
318 echo $selection;
319 }
320 ?>
321 </label>&nbsp;&nbsp;&nbsp;
322 <?php
323 }
324 ?>
325 <br/>
326 <p><?php echo $controller->getParameterText($groupKey, $groupParameter, true); ?></p>
327 </td>
328 <?php
329 }
330 ?>
331 </tr>
332 <?php
333 }
334 ?>
335 </tbody>
336 </table>
337 <?php
338 }
339 ?>
340 <div class="submit">
341 <input type="submit" value="<?php echo TXT_UAM_UPDATE_SETTING; ?>"/>
342 </div>
343 </form>
344 </div>