PluginProbe
User Access Manager / 2.1.9
User Access Manager v2.1.9
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.9, at src/Controller/ControllerFactory.php

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