PluginProbe
User Access Manager / 2.1.12
User Access Manager v2.1.12
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 / Controller / ControllerFactory.php

ControllerFactory.php in User Access Manager 2.1.12, at src/Controller/ControllerFactory.php

543 lines 14.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ControllerFactory.php
4 *
5 * The ControllerFactory 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 */
15 namespace UserAccessManager\Controller;
16
17 use UserAccessManager\Access\AccessHandler;
18 use UserAccessManager\Cache\Cache;
19 use UserAccessManager\Config\MainConfig;
20 use UserAccessManager\Config\WordpressConfig;
21 use UserAccessManager\Controller\Backend\AboutController;
22 use UserAccessManager\Controller\Backend\BackendController;
23 use UserAccessManager\Controller\Backend\CacheController;
24 use UserAccessManager\Controller\Backend\DynamicGroupsController;
25 use UserAccessManager\Controller\Backend\ObjectController;
26 use UserAccessManager\Controller\Backend\ObjectInformationFactory;
27 use UserAccessManager\Controller\Backend\PostObjectController;
28 use UserAccessManager\Controller\Backend\SettingsController;
29 use UserAccessManager\Controller\Backend\SetupController;
30 use UserAccessManager\Controller\Backend\TermObjectController;
31 use UserAccessManager\Controller\Backend\UserGroupController;
32 use UserAccessManager\Controller\Backend\UserObjectController;
33 use UserAccessManager\Controller\Frontend\FrontendController;
34 use UserAccessManager\Controller\Frontend\PostController;
35 use UserAccessManager\Controller\Frontend\RedirectController;
36 use UserAccessManager\Controller\Frontend\ShortCodeController;
37 use UserAccessManager\Controller\Frontend\TermController;
38 use UserAccessManager\Database\Database;
39 use UserAccessManager\File\FileHandler;
40 use UserAccessManager\File\FileObjectFactory;
41 use UserAccessManager\Form\FormFactory;
42 use UserAccessManager\Form\FormHelper;
43 use UserAccessManager\Object\ObjectHandler;
44 use UserAccessManager\Object\ObjectMapHandler;
45 use UserAccessManager\Setup\SetupHandler;
46 use UserAccessManager\UserGroup\UserGroupAssignmentHandler;
47 use UserAccessManager\UserGroup\UserGroupFactory;
48 use UserAccessManager\User\UserHandler;
49 use UserAccessManager\UserGroup\UserGroupHandler;
50 use UserAccessManager\Util\DateUtil;
51 use UserAccessManager\Util\Util;
52 use UserAccessManager\Wrapper\Php;
53 use UserAccessManager\Wrapper\Wordpress;
54
55 /**
56 * Class ControllerFactory
57 *
58 * @package UserAccessManager\Controller
59 */
60 class ControllerFactory
61 {
62 /**
63 * @var Php
64 */
65 private $php;
66
67 /**
68 * @var Wordpress
69 */
70 private $wordpress;
71
72 /**
73 * @var Database
74 */
75 private $database;
76
77 /**
78 * @var WordpressConfig
79 */
80 private $wordpressConfig;
81
82 /**
83 * @var MainConfig
84 */
85 private $mainConfig;
86
87 /**
88 * @var Util
89 */
90 private $util;
91
92 /**
93 * @var DateUtil
94 */
95 private $dateUtil;
96
97 /**
98 * @var Cache
99 */
100 private $cache;
101
102 /**
103 * @var ObjectHandler
104 */
105 private $objectHandler;
106
107 /**
108 * @var ObjectMapHandler
109 */
110 private $objectMapHandler;
111
112 /**
113 * @var UserHandler
114 */
115 private $userHandler;
116
117 /**
118 * @var UserGroupHandler
119 */
120 private $userGroupHandler;
121
122 /**
123 * @var UserGroupFactory
124 */
125 private $userGroupFactory;
126
127 /**
128 * @var UserGroupAssignmentHandler
129 */
130 private $userGroupAssignmentHandler;
131
132 /**
133 * @var AccessHandler
134 */
135 private $accessHandler;
136
137 /**
138 * @var FileHandler
139 */
140 private $fileHandler;
141
142 /**
143 * @var FileObjectFactory
144 */
145 private $fileObjectFactory;
146
147 /**
148 * @var SetupHandler
149 */
150 private $setupHandler;
151
152 /**
153 * @var FormFactory
154 */
155 private $formFactory;
156
157 /**
158 * @var FormHelper
159 */
160 private $formHelper;
161
162 /**
163 * @var ObjectInformationFactory
164 */
165 private $objectInformationFactory;
166
167 /**
168 * ControllerFactory constructor.
169 *
170 * @param Php $php
171 * @param Wordpress $wordpress
172 * @param Database $database
173 * @param WordpressConfig $wordpressConfig
174 * @param MainConfig $mainConfig
175 * @param Util $util
176 * @param DateUtil $dateUtil
177 * @param Cache $cache
178 * @param ObjectHandler $objectHandler
179 * @param ObjectMapHandler $objectMapHandler
180 * @param UserHandler $userHandler
181 * @param UserGroupHandler $userGroupHandler
182 * @param UserGroupFactory $userGroupFactory
183 * @param UserGroupAssignmentHandler $userGroupAssignmentHandler
184 * @param AccessHandler $accessHandler
185 * @param FileHandler $fileHandler
186 * @param FileObjectFactory $fileObjectFactory
187 * @param SetupHandler $setupHandler
188 * @param FormFactory $formFactory
189 * @param FormHelper $formHelper
190 * @param ObjectInformationFactory $objectInformationFactory
191 */
192 public function __construct(
193 Php $php,
194 Wordpress $wordpress,
195 Database $database,
196 WordpressConfig $wordpressConfig,
197 MainConfig $mainConfig,
198 Util $util,
199 DateUtil $dateUtil,
200 Cache $cache,
201 ObjectHandler $objectHandler,
202 ObjectMapHandler $objectMapHandler,
203 UserHandler $userHandler,
204 UserGroupHandler $userGroupHandler,
205 UserGroupFactory $userGroupFactory,
206 UserGroupAssignmentHandler $userGroupAssignmentHandler,
207 AccessHandler $accessHandler,
208 FileHandler $fileHandler,
209 FileObjectFactory $fileObjectFactory,
210 SetupHandler $setupHandler,
211 FormFactory $formFactory,
212 FormHelper $formHelper,
213 ObjectInformationFactory $objectInformationFactory
214 ) {
215 $this->php = $php;
216 $this->wordpress = $wordpress;
217 $this->database = $database;
218 $this->wordpressConfig = $wordpressConfig;
219 $this->mainConfig = $mainConfig;
220 $this->util = $util;
221 $this->dateUtil = $dateUtil;
222 $this->cache = $cache;
223 $this->objectHandler = $objectHandler;
224 $this->objectMapHandler = $objectMapHandler;
225 $this->userHandler = $userHandler;
226 $this->userGroupHandler = $userGroupHandler;
227 $this->userGroupFactory = $userGroupFactory;
228 $this->userGroupAssignmentHandler = $userGroupAssignmentHandler;
229 $this->accessHandler = $accessHandler;
230 $this->fileHandler = $fileHandler;
231 $this->fileObjectFactory = $fileObjectFactory;
232 $this->setupHandler = $setupHandler;
233 $this->formFactory = $formFactory;
234 $this->formHelper = $formHelper;
235 $this->objectInformationFactory = $objectInformationFactory;
236 }
237
238 /**
239 * Creates and returns a new backend controller.
240 *
241 * @return BackendController
242 */
243 public function createBackendController()
244 {
245 return new BackendController(
246 $this->php,
247 $this->wordpress,
248 $this->wordpressConfig,
249 $this->userHandler,
250 $this->fileHandler,
251 $this->setupHandler
252 );
253 }
254
255 /**
256 * Creates and returns a new backend about controller.
257 *
258 * @return AboutController
259 */
260 public function createBackendAboutController()
261 {
262 return new AboutController(
263 $this->php,
264 $this->wordpress,
265 $this->wordpressConfig
266 );
267 }
268
269 /**
270 * Creates and returns a new backend object controller.
271 *
272 * @return ObjectController
273 */
274 public function createBackendObjectController()
275 {
276 return new ObjectController(
277 $this->php,
278 $this->wordpress,
279 $this->wordpressConfig,
280 $this->mainConfig,
281 $this->database,
282 $this->dateUtil,
283 $this->objectHandler,
284 $this->userHandler,
285 $this->userGroupHandler,
286 $this->userGroupAssignmentHandler,
287 $this->accessHandler,
288 $this->objectInformationFactory
289 );
290 }
291
292 /**
293 * Creates and returns a new backend cache controller.
294 *
295 * @return CacheController
296 */
297 public function createBackendCacheController()
298 {
299 return new CacheController(
300 $this->cache
301 );
302 }
303
304 /**
305 * Creates and returns a new backend post object controller.
306 *
307 * @return PostObjectController
308 */
309 public function createBackendPostObjectController()
310 {
311 return new PostObjectController(
312 $this->php,
313 $this->wordpress,
314 $this->wordpressConfig,
315 $this->mainConfig,
316 $this->database,
317 $this->dateUtil,
318 $this->objectHandler,
319 $this->userHandler,
320 $this->userGroupHandler,
321 $this->userGroupAssignmentHandler,
322 $this->accessHandler,
323 $this->objectInformationFactory
324 );
325 }
326
327 /**
328 * Creates and returns a new backend term object controller.
329 *
330 * @return TermObjectController
331 */
332 public function createBackendTermObjectController()
333 {
334 return new TermObjectController(
335 $this->php,
336 $this->wordpress,
337 $this->wordpressConfig,
338 $this->mainConfig,
339 $this->database,
340 $this->dateUtil,
341 $this->objectHandler,
342 $this->userHandler,
343 $this->userGroupHandler,
344 $this->userGroupAssignmentHandler,
345 $this->accessHandler,
346 $this->objectInformationFactory
347 );
348 }
349
350 /**
351 * Creates and returns a new backend user object controller.
352 *
353 * @return UserObjectController
354 */
355 public function createBackendUserObjectController()
356 {
357 return new UserObjectController(
358 $this->php,
359 $this->wordpress,
360 $this->wordpressConfig,
361 $this->mainConfig,
362 $this->database,
363 $this->dateUtil,
364 $this->objectHandler,
365 $this->userHandler,
366 $this->userGroupHandler,
367 $this->userGroupAssignmentHandler,
368 $this->accessHandler,
369 $this->objectInformationFactory
370 );
371 }
372
373 /**
374 * Creates and returns a new backend dynamic group controller.
375 *
376 * @return DynamicGroupsController
377 */
378 public function createBackendDynamicGroupsController()
379 {
380 return new DynamicGroupsController(
381 $this->php,
382 $this->wordpress,
383 $this->wordpressConfig,
384 $this->mainConfig,
385 $this->database,
386 $this->dateUtil,
387 $this->objectHandler,
388 $this->userHandler,
389 $this->userGroupHandler,
390 $this->userGroupAssignmentHandler,
391 $this->accessHandler,
392 $this->objectInformationFactory
393 );
394 }
395
396 /**
397 * Creates and returns a new backend setup controller.
398 *
399 * @return SettingsController
400 */
401 public function createBackendSettingsController()
402 {
403 return new SettingsController(
404 $this->php,
405 $this->wordpress,
406 $this->wordpressConfig,
407 $this->mainConfig,
408 $this->cache,
409 $this->fileHandler,
410 $this->formFactory,
411 $this->formHelper
412 );
413 }
414
415 /**
416 * Creates and returns a new backend setup controller.
417 *
418 * @return SetupController
419 */
420 public function createBackendSetupController()
421 {
422 return new SetupController(
423 $this->php,
424 $this->wordpress,
425 $this->wordpressConfig,
426 $this->database,
427 $this->setupHandler
428 );
429 }
430
431 /**
432 * Creates and returns a new backend user group controller.
433 *
434 * @return UserGroupController
435 */
436 public function createBackendUserGroupController()
437 {
438 return new UserGroupController(
439 $this->php,
440 $this->wordpress,
441 $this->wordpressConfig,
442 $this->userGroupHandler,
443 $this->userGroupFactory,
444 $this->formHelper
445 );
446 }
447
448 /**
449 * Creates and returns a new frontend controller.
450 *
451 * @return FrontendController
452 */
453 public function createFrontendController()
454 {
455 return new FrontendController(
456 $this->php,
457 $this->wordpress,
458 $this->wordpressConfig,
459 $this->mainConfig,
460 $this->accessHandler
461 );
462 }
463
464 /**
465 * Creates and returns a new frontend post controller.
466 *
467 * @return PostController
468 */
469 public function createFrontendPostController()
470 {
471 return new PostController(
472 $this->php,
473 $this->wordpress,
474 $this->wordpressConfig,
475 $this->mainConfig,
476 $this->database,
477 $this->util,
478 $this->objectHandler,
479 $this->userHandler,
480 $this->userGroupHandler,
481 $this->accessHandler
482 );
483 }
484
485 /**
486 * Creates and returns a new frontend redirect controller.
487 *
488 * @return RedirectController
489 */
490 public function createFrontendRedirectController()
491 {
492 return new RedirectController(
493 $this->php,
494 $this->wordpress,
495 $this->wordpressConfig,
496 $this->mainConfig,
497 $this->database,
498 $this->util,
499 $this->cache,
500 $this->objectHandler,
501 $this->accessHandler,
502 $this->fileHandler,
503 $this->fileObjectFactory
504 );
505 }
506
507 /**
508 * Creates and returns a new frontend short code controller.
509 *
510 * @return ShortCodeController
511 */
512 public function createFrontendShortCodeController()
513 {
514 return new ShortCodeController(
515 $this->php,
516 $this->wordpress,
517 $this->wordpressConfig,
518 $this->userGroupHandler
519 );
520 }
521
522 /**
523 * Creates and returns a new frontend term controller.
524 *
525 * @return TermController
526 */
527 public function createFrontendTermController()
528 {
529 return new TermController(
530 $this->php,
531 $this->wordpress,
532 $this->wordpressConfig,
533 $this->mainConfig,
534 $this->util,
535 $this->objectHandler,
536 $this->objectMapHandler,
537 $this->userHandler,
538 $this->userGroupHandler,
539 $this->accessHandler
540 );
541 }
542 }
543