PluginProbe
User Access Manager / 2.2.23
User Access Manager v2.2.23
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
← All changes | src/Config/MainConfig.php +357 -111 2.3.192.2.23 View file →
@@ -1,5 +1,18 @@
1 1 <?php
2 +/**
3 + * Config.php
4 + *
5 + * The Config class file.
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 + */
2 15
3 16 declare(strict_types=1);
4 17
5 18 namespace UserAccessManager\Config;
@@ -5,92 +18,114 @@
5 18 namespace UserAccessManager\Config;
6 19
7 20 use Exception;
8 21 use UserAccessManager\Cache\Cache;
9 -use UserAccessManager\Config\Parameter\ConfigParameter;
10 -use UserAccessManager\Config\Parameter\ConfigParameterFactory;
11 22 use UserAccessManager\Object\ObjectHandler;
12 23 use UserAccessManager\Wrapper\Wordpress;
13 24
25 +/**
26 + * Class Config
27 + *
28 + * @package UserAccessManager\Config
29 + */
14 30 class MainConfig extends Config
15 31 {
16 - public const MAIN_CONFIG_KEY = 'uamAdminOptions';
17 - public const DEFAULT_TYPE = 'default';
18 - public const CACHE_PROVIDER_NONE = 'none';
32 + const MAIN_CONFIG_KEY = 'uamAdminOptions';
33 + const DEFAULT_TYPE = 'default';
34 + const CACHE_PROVIDER_NONE = 'none';
19 35
20 - public function __construct(
21 - Wordpress $wordpress,
22 - private ObjectHandler $objectHandler,
23 - private Cache $cache,
24 - private ConfigParameterFactory $configParameterFactory
25 - ) {
26 - parent::__construct($wordpress, self::MAIN_CONFIG_KEY);
27 - }
36 + /**
37 + * @var ObjectHandler
38 + */
39 + private $objectHandler;
28 40
29 41 /**
30 - * @throws Exception
42 + * @var Cache
31 43 */
32 - private function addBoolean(array &$configParameters, string $id, bool $defaultValue = false): void
33 - {
34 - $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, $defaultValue);
35 - }
44 + private $cache;
36 45
37 46 /**
38 - * @throws Exception
47 + * @var ConfigParameterFactory
39 48 */
40 - private function addString(array &$configParameters, string $id, string $defaultValue = ''): void
41 - {
42 - $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id, $defaultValue);
43 - }
49 + protected $configParameterFactory;
44 50
45 51 /**
46 - * @throws Exception
52 + * MainConfig constructor.
53 + * @param Wordpress $wordpress
54 + * @param ObjectHandler $objectHandler
55 + * @param Cache $cache
56 + * @param ConfigParameterFactory $configParameterFactory
47 57 */
48 - private function addSelection(
49 - array &$configParameters,
50 - string $id,
51 - string $defaultValue,
52 - array $selections
53 - ): void {
54 - $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
55 - $id,
56 - $defaultValue,
57 - $selections
58 - );
58 + public function __construct(
59 + Wordpress $wordpress,
60 + ObjectHandler $objectHandler,
61 + Cache $cache,
62 + ConfigParameterFactory $configParameterFactory
63 + ) {
64 + $this->objectHandler = $objectHandler;
65 + $this->cache = $cache;
66 + $this->configParameterFactory = $configParameterFactory;
67 +
68 + parent::__construct($wordpress, self::MAIN_CONFIG_KEY);
59 69 }
60 70
61 71 /**
72 + * Adds the default general config parameters to the config parameters.
73 + * @param array $configParameters
62 74 * @throws Exception
63 75 */
64 - private function addDefaultGeneralConfigParameters(array &$configParameters): void
76 + private function addDefaultGeneralConfigParameters(array &$configParameters)
65 77 {
66 - $this->addSelection(
67 - $configParameters,
68 - 'redirect',
78 + $id = 'redirect';
79 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
80 + $id,
69 81 'false',
70 - ['false', 'blog', 'login', 'custom_page', 'custom_url', 'origin']
82 + ['false', 'blog', 'login', 'custom_page', 'custom_url']
71 83 );
72 - $this->addString($configParameters, 'redirect_custom_page');
73 - $this->addString($configParameters, 'redirect_custom_url');
74 - $this->addBoolean($configParameters, 'append_redirect_to_parameter');
75 - $this->addBoolean($configParameters, 'lock_recursive', true);
76 - $this->addBoolean($configParameters, 'authors_has_access_to_own', true);
77 - $this->addBoolean($configParameters, 'authors_can_add_posts_to_groups');
78 - $this->addBoolean($configParameters, 'blog_admin_hint', true);
79 - $this->addString($configParameters, 'blog_admin_hint_text', '[L]');
80 - $this->addBoolean($configParameters, 'show_assigned_groups', true);
81 - $this->addBoolean($configParameters, 'hide_edit_link_on_no_access', true);
82 - $this->addString($configParameters, 'extra_ip_header', 'HTTP_X_REAL_IP');
83 - $this->addBoolean($configParameters, 'protect_feed', true);
84 - $this->addSelection(
85 - $configParameters,
86 - 'full_access_role',
84 +
85 + $id = 'redirect_custom_page';
86 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id);
87 +
88 + $id = 'redirect_custom_url';
89 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id);
90 +
91 + $id = 'lock_recursive';
92 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
93 +
94 + $id = 'authors_has_access_to_own';
95 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
96 +
97 + $id = 'authors_can_add_posts_to_groups';
98 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
99 +
100 + $id = 'blog_admin_hint';
101 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
102 +
103 + $id = 'blog_admin_hint_text';
104 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id, '[L]');
105 +
106 + $id = 'show_assigned_groups';
107 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
108 +
109 + $id = 'hide_edit_link_on_no_access';
110 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
111 +
112 + $id = 'extra_ip_header';
113 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id, 'HTTP_X_REAL_IP');
114 +
115 + $id = 'protect_feed';
116 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
117 +
118 + $id = 'full_access_role';
119 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
120 + $id,
87 121 'administrator',
88 122 ['administrator', 'editor', 'author', 'contributor', 'subscriber']
89 123 );
90 - $this->addSelection(
91 - $configParameters,
92 - 'active_cache_provider',
124 +
125 + $id = 'active_cache_provider';
126 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
127 + $id,
93 128 self::CACHE_PROVIDER_NONE,
94 129 array_merge([self::CACHE_PROVIDER_NONE], array_keys($this->cache->getRegisteredCacheProviders()))
95 130 );
96 131 }
@@ -95,11 +130,13 @@
95 130 );
96 131 }
97 132
98 133 /**
134 + * Adds the default post config parameters to the config parameters.
135 + * @param array $configParameters
99 136 * @throws Exception
100 137 */
101 - private function addDefaultPostConfigParameters(array &$configParameters): void
138 + private function addDefaultPostConfigParameters(array &$configParameters)
102 139 {
103 140 $postTypes = $this->objectHandler->getPostTypes();
104 141 array_unshift($postTypes, self::DEFAULT_TYPE);
105 142
@@ -108,30 +145,53 @@
108 145 continue;
109 146 }
110 147
111 148 if ($postType !== self::DEFAULT_TYPE) {
112 - $this->addBoolean($configParameters, "{$postType}_use_default");
149 + $id = "{$postType}_use_default";
150 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
113 151 }
114 152
115 - $this->addBoolean($configParameters, "hide_$postType");
116 - $this->addBoolean($configParameters, "hide_{$postType}_title");
117 - $this->addString($configParameters, "{$postType}_title", TXT_UAM_SETTING_DEFAULT_NO_RIGHTS);
118 - $this->addString($configParameters, "{$postType}_content", TXT_UAM_SETTING_DEFAULT_NO_RIGHTS_FOR_ENTRY);
119 - $this->addBoolean($configParameters, "hide_{$postType}_comment");
120 - $this->addString(
121 - $configParameters,
122 - "{$postType}_comment_content",
153 + $id = "hide_{$postType}";
154 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
155 +
156 + $id = "hide_{$postType}_title";
157 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
158 +
159 + $id = "{$postType}_title";
160 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter(
161 + $id,
162 + TXT_UAM_SETTING_DEFAULT_NO_RIGHTS
163 + );
164 +
165 + $id = "{$postType}_content";
166 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter(
167 + $id,
168 + TXT_UAM_SETTING_DEFAULT_NO_RIGHTS_FOR_ENTRY
169 + );
170 +
171 + $id = "hide_{$postType}_comment";
172 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
173 +
174 + $id = "{$postType}_comment_content";
175 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter(
176 + $id,
123 177 TXT_UAM_SETTING_DEFAULT_NO_RIGHTS_FOR_COMMENTS
124 178 );
125 - $this->addBoolean($configParameters, "{$postType}_comments_locked");
126 - $this->addBoolean($configParameters, "show_{$postType}_content_before_more");
179 +
180 + $id = "{$postType}_comments_locked";
181 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
182 +
183 + $id = "show_{$postType}_content_before_more";
184 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
127 185 }
128 186 }
129 187
130 188 /**
189 + * Adds the default taxonomy config parameters to the config parameters.
190 + * @param array $configParameters
131 191 * @throws Exception
132 192 */
133 - private function addDefaultTaxonomyConfigParameters(array &$configParameters): void
193 + private function addDefaultTaxonomyConfigParameters(array &$configParameters)
134 194 {
135 195 $taxonomies = $this->objectHandler->getTaxonomies();
136 196 array_unshift($taxonomies, self::DEFAULT_TYPE);
137 197
@@ -136,255 +196,441 @@
136 196 array_unshift($taxonomies, self::DEFAULT_TYPE);
137 197
138 198 foreach ($taxonomies as $taxonomy) {
139 199 if ($taxonomy !== self::DEFAULT_TYPE) {
140 - $this->addBoolean($configParameters, "{$taxonomy}_use_default");
200 + $id = "{$taxonomy}_use_default";
201 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
141 202 }
142 203
143 - $this->addBoolean($configParameters, "hide_empty_$taxonomy", true);
204 + $id = 'hide_empty_' . $taxonomy;
205 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id, true);
144 206 }
145 207 }
146 208
147 209 /**
210 + * Adds the default file config parameters to the config parameters.
211 + * @param array $configParameters
148 212 * @throws Exception
149 213 */
150 - private function addDefaultFileConfigParameters(array &$configParameters): void
214 + private function addDefaultFileConfigParameters(array &$configParameters)
151 215 {
152 - $this->addBoolean($configParameters, 'lock_file');
153 - $this->addSelection($configParameters, 'download_type', 'fopen', ['xsendfile', 'fopen', 'normal']);
154 - $this->addString($configParameters, 'inline_files', 'pdf');
155 - $this->addSelection($configParameters, 'no_access_image_type', 'default', ['default', 'custom']);
156 - $this->addString($configParameters, 'custom_no_access_image');
157 - $this->addBoolean($configParameters, 'use_custom_file_handling_file');
158 - $this->addSelection($configParameters, 'locked_directory_type', 'wordpress', ['wordpress', 'all', 'custom']);
159 - $this->addString($configParameters, 'custom_locked_directories');
160 - $this->addSelection($configParameters, 'file_pass_type', 'random', ['random', 'user']);
161 - $this->addSelection($configParameters, 'lock_file_types', 'all', ['all', 'selected', 'not_selected']);
162 - $this->addString($configParameters, 'locked_file_types', 'zip,rar,tar,gz');
163 - $this->addString($configParameters, 'not_locked_file_types', 'gif,jpg,jpeg,png');
216 + $id = 'lock_file';
217 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
218 +
219 + $id = 'download_type';
220 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
221 + $id,
222 + 'fopen',
223 + ['xsendfile', 'fopen', 'normal']
224 + );
225 +
226 + $id = 'inline_files';
227 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id, 'pdf');
228 +
229 + $id = 'no_access_image_type';
230 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
231 + $id,
232 + 'default',
233 + ['default', 'custom']
234 + );
235 +
236 + $id = 'custom_no_access_image';
237 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id);
238 +
239 + $id = 'use_custom_file_handling_file';
240 + $configParameters[$id] = $this->configParameterFactory->createBooleanConfigParameter($id);
241 +
242 + $id = 'locked_directory_type';
243 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
244 + $id,
245 + 'wordpress',
246 + ['wordpress', 'all', 'custom']
247 + );
248 +
249 + $id = 'custom_locked_directories';
250 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter($id);
251 +
252 + $id = 'file_pass_type';
253 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
254 + $id,
255 + 'random',
256 + ['random', 'user']
257 + );
258 +
259 + $id = 'lock_file_types';
260 + $configParameters[$id] = $this->configParameterFactory->createSelectionConfigParameter(
261 + $id,
262 + 'all',
263 + ['all', 'selected', 'not_selected']
264 + );
265 +
266 + $id = 'locked_file_types';
267 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter(
268 + $id,
269 + 'zip,rar,tar,gz'
270 + );
271 +
272 + $id = 'not_locked_file_types';
273 + $configParameters[$id] = $this->configParameterFactory->createStringConfigParameter(
274 + $id,
275 + 'gif,jpg,jpeg,png'
276 + );
164 277 }
165 278
166 279 /**
280 + * Returns the default config parameters settings
167 281 * @return ConfigParameter[]
168 282 * @throws Exception
169 283 */
170 284 protected function getDefaultConfigParameters(): array
171 285 {
172 - if ($this->defaultConfigParameters !== []) {
173 - return $this->defaultConfigParameters;
174 - }
286 + if ($this->defaultConfigParameters === []) {
287 + /**
288 + * @var ConfigParameter[] $configParameters
289 + */
290 + $configParameters = [];
175 291
176 - /**
177 - * @var ConfigParameter[] $configParameters
178 - */
179 - $configParameters = [];
292 + $this->addDefaultGeneralConfigParameters($configParameters);
293 + $this->addDefaultPostConfigParameters($configParameters);
294 + $this->addDefaultTaxonomyConfigParameters($configParameters);
295 + $this->addDefaultFileConfigParameters($configParameters);
180 296
181 - $this->addDefaultGeneralConfigParameters($configParameters);
182 - $this->addDefaultPostConfigParameters($configParameters);
183 - $this->addDefaultTaxonomyConfigParameters($configParameters);
184 - $this->addDefaultFileConfigParameters($configParameters);
297 + $this->defaultConfigParameters = $configParameters;
298 + }
185 299
186 - return $this->defaultConfigParameters = $configParameters;
300 + return $this->defaultConfigParameters;
187 301 }
188 302
303 + /**
304 + * Returns the object parameter name.
305 + * @param string $objectType
306 + * @param string $rawParameterName
307 + * @return ConfigParameter|null
308 + */
189 309 private function getObjectParameter(string $objectType, string $rawParameterName): ?ConfigParameter
190 310 {
191 311 $options = $this->getConfigParameters();
192 312 $parameterName = sprintf($rawParameterName, $objectType);
193 - $useDefaultParameter = $options["{$objectType}_use_default"] ?? null;
194 313
195 - if (isset($options[$parameterName]) === false || $useDefaultParameter?->getValue() === true) {
314 + if (isset($options[$parameterName]) === false
315 + || isset($options["{$objectType}_use_default"]) === true
316 + && $options["{$objectType}_use_default"]->getValue() === true
317 + ) {
196 318 $parameterName = sprintf($rawParameterName, self::DEFAULT_TYPE);
197 319 }
198 320
199 - return $options[$parameterName] ?? null;
321 + return (isset($options[$parameterName]) === true) ? $options[$parameterName] : null;
200 322 }
201 323
324 + /**
325 + * Returns the option value if the option exists otherwise true.
326 + * @param string $objectType
327 + * @param string $parameterName
328 + * @return bool
329 + */
202 330 private function hideObject(string $objectType, string $parameterName): bool
203 331 {
204 - return $this->getObjectParameter($objectType, $parameterName)?->getValue() ?? true;
332 + $parameter = $this->getObjectParameter($objectType, $parameterName);
333 + return ($parameter !== null) ? $parameter->getValue() : true;
205 334 }
206 335
207 - private function getObjectContent(string $objectType, string $parameterName): bool|string
336 + /**
337 + * Returns the option value if the option exists otherwise an empty string.
338 + * @param string $objectType
339 + * @param string $parameterName
340 + * @return bool|string
341 + */
342 + private function getObjectContent(string $objectType, string $parameterName)
208 343 {
209 - return $this->getObjectParameter($objectType, $parameterName)?->getValue() ?? '';
344 + $parameter = $this->getObjectParameter($objectType, $parameterName);
345 + return ($parameter !== null) ? $parameter->getValue() : '';
210 346 }
211 347
348 + /**
349 + * @param string $postType
350 + * @return bool
351 + */
212 352 public function hidePostType(string $postType): bool
213 353 {
214 354 return $this->hideObject($postType, 'hide_%s');
215 355 }
216 356
357 + /**
358 + * @param string $postType
359 + * @return bool
360 + */
217 361 public function hidePostTypeTitle(string $postType): bool
218 362 {
219 363 return $this->hideObject($postType, 'hide_%s_title');
220 364 }
221 365
366 + /**
367 + * @param string $postType
368 + * @return bool
369 + */
222 370 public function hidePostTypeComments(string $postType): bool
223 371 {
224 372 return $this->hideObject($postType, 'hide_%s_comment');
225 373 }
226 374
375 + /**
376 + * @param string $postType
377 + * @return bool
378 + */
227 379 public function lockPostTypeComments(string $postType): bool
228 380 {
229 381 return $this->hideObject($postType, '%s_comments_locked');
230 382 }
231 383
384 + /**
385 + * @param string $postType
386 + * @return string
387 + */
232 388 public function getPostTypeTitle(string $postType): string
233 389 {
234 390 return $this->getObjectContent($postType, '%s_title');
235 391 }
236 392
393 + /**
394 + * @param string $postType
395 + * @return string
396 + */
237 397 public function getPostTypeContent(string $postType): string
238 398 {
239 399 return $this->getObjectContent($postType, '%s_content');
240 400 }
241 401
402 + /**
403 + * @param string $postType
404 + * @return string
405 + */
242 406 public function getPostTypeCommentContent(string $postType): string
243 407 {
244 408 return $this->getObjectContent($postType, '%s_comment_content');
245 409 }
246 410
247 - public function showPostTypeContentBeforeMore(string $postType): bool
411 + /**
412 + * @param string $postType
413 + * @return bool
414 + */
415 + public function showPostTypeContentBeforeMore(string $postType)
248 416 {
249 417 return (bool) $this->getObjectContent($postType, 'show_%s_content_before_more');
250 418 }
251 419
420 + /**
421 + * @return string
422 + */
252 423 public function getRedirect(): ?string
253 424 {
254 425 return $this->getParameterValue('redirect');
255 426 }
256 427
428 + /**
429 + * @return string
430 + */
257 431 public function getRedirectCustomPage(): ?string
258 432 {
259 433 return $this->getParameterValue('redirect_custom_page');
260 434 }
261 435
436 + /**
437 + * @return string
438 + */
262 439 public function getRedirectCustomUrl(): ?string
263 440 {
264 441 return $this->getParameterValue('redirect_custom_url');
265 442 }
266 443
267 - public function appendRedirectToParameter(): bool
268 - {
269 - return (bool) $this->getParameterValue('append_redirect_to_parameter');
270 - }
271 -
444 + /**
445 + * @return bool
446 + */
272 447 public function lockRecursive(): bool
273 448 {
274 449 return (bool) $this->getParameterValue('lock_recursive');
275 450 }
276 451
452 + /**
453 + * @return bool
454 + */
277 455 public function authorsHasAccessToOwn(): bool
278 456 {
279 457 return (bool) $this->getParameterValue('authors_has_access_to_own');
280 458 }
281 459
460 + /**
461 + * @return bool
462 + */
282 463 public function authorsCanAddPostsToGroups(): bool
283 464 {
284 465 return (bool) $this->getParameterValue('authors_can_add_posts_to_groups');
285 466 }
286 467
468 + /**
469 + * @return bool
470 + */
287 471 public function lockFile(): bool
288 472 {
289 473 return (bool) $this->getParameterValue('lock_file');
290 474 }
291 475
476 + /**
477 + * @return string
478 + */
292 479 public function getInlineFiles(): ?string
293 480 {
294 481 return $this->getParameterValue('inline_files');
295 482 }
296 483
484 + /**
485 + * @return string
486 + */
297 487 public function getNoAccessImageType(): ?string
298 488 {
299 489 return $this->getParameterValue('no_access_image_type');
300 490 }
301 491
492 + /**
493 + * @return string
494 + */
302 495 public function getCustomNoAccessImage(): ?string
303 496 {
304 497 return $this->getParameterValue('custom_no_access_image');
305 498 }
306 499
500 + /**
501 + * @return bool
502 + */
307 503 public function useCustomFileHandlingFile(): bool
308 504 {
309 505 return (bool) $this->getParameterValue('use_custom_file_handling_file');
310 506 }
311 507
508 + /**
509 + * @return string
510 + */
312 511 public function getLockedDirectoryType(): ?string
313 512 {
314 513 return $this->getParameterValue('locked_directory_type');
315 514 }
316 515
516 + /**
517 + * @return string
518 + */
317 519 public function getCustomLockedDirectories(): ?string
318 520 {
319 521 return $this->getParameterValue('custom_locked_directories');
320 522 }
321 523
524 + /**
525 + * @return string
526 + */
322 527 public function getFilePassType(): ?string
323 528 {
324 529 return $this->getParameterValue('file_pass_type');
325 530 }
326 531
532 + /**
533 + * @return string
534 + */
327 535 public function getDownloadType(): ?string
328 536 {
329 537 return $this->getParameterValue('download_type');
330 538 }
331 539
540 + /**
541 + * @return string
542 + */
332 543 public function getLockedFileType(): ?string
333 544 {
334 545 return $this->getParameterValue('lock_file_types');
335 546 }
336 547
548 + /**
549 + * @return string
550 + */
337 551 public function getLockedFiles(): ?string
338 552 {
339 553 return $this->getParameterValue('locked_file_types');
340 554 }
341 555
556 + /**
557 + * @return string
558 + */
342 559 public function getNotLockedFiles(): ?string
343 560 {
344 561 return $this->getParameterValue('not_locked_file_types');
345 562 }
346 563
564 + /**
565 + * @return bool
566 + */
347 567 public function blogAdminHint(): bool
348 568 {
349 569 return (bool) $this->getParameterValue('blog_admin_hint');
350 570 }
351 571
572 + /**
573 + * @return string
574 + */
352 575 public function getBlogAdminHintText(): ?string
353 576 {
354 577 return $this->getParameterValue('blog_admin_hint_text');
355 578 }
356 579
580 + /**
581 + * @return bool
582 + */
357 583 public function showAssignedGroups(): bool
358 584 {
359 585 return (bool) $this->getParameterValue('show_assigned_groups');
360 586 }
361 587
588 + /**
589 + * @return bool
590 + */
362 591 public function hideEditLinkOnNoAccess(): bool
363 592 {
364 593 return (bool) $this->getParameterValue('hide_edit_link_on_no_access');
365 594 }
366 595
596 + /**
597 + * @param string $taxonomy
598 + * @return bool
599 + */
367 600 public function hideEmptyTaxonomy(string $taxonomy): bool
368 601 {
369 - return $this->getObjectParameter($taxonomy, 'hide_empty_%s')?->getValue() ?? false;
602 + $parameter = $this->getObjectParameter($taxonomy, 'hide_empty_%s');
603 + return ($parameter !== null) ? $parameter->getValue() : false;
370 604 }
371 605
606 + /**
607 + * @return bool
608 + */
372 609 public function protectFeed(): bool
373 610 {
374 611 return (bool) $this->getParameterValue('protect_feed');
375 612 }
376 613
614 + /**
615 + * @return string
616 + */
377 617 public function getFullAccessRole(): ?string
378 618 {
379 619 return $this->getParameterValue('full_access_role');
380 620 }
381 621
622 + /**
623 + * @return null|string
624 + */
382 625 public function getActiveCacheProvider(): ?string
383 626 {
384 627 return $this->getParameterValue('active_cache_provider');
385 628 }
386 629
630 + /**
631 + * @return null|string
632 + */
387 633 public function getExtraIpHeader(): ?string
388 634 {
389 635 return $this->getParameterValue('extra_ip_header');
390 636 }