PluginProbe
User Access Manager / 2.1.3
User Access Manager v2.1.3
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.3, at src/Controller/ControllerFactory.php

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