PluginProbe
User Access Manager / 1.2.4.2
User Access Manager v1.2.4.2
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 / class / UamAccessHandler.class.php

UamAccessHandler.class.php in User Access Manager 1.2.4.2, at class/UamAccessHandler.class.php

764 lines 22.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * UamAccessHandler.class.php
4 *
5 * The UamUserGroup class file.
6 *
7 * PHP versions 5
8 *
9 * @category UserAccessManager
10 * @package UserAccessManager
11 * @author Alexander Schneider <alexanderschneider85@googlemail.com>
12 * @copyright 2008-2013 Alexander Schneider
13 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
14 * @version SVN: $Id$
15 * @link http://wordpress.org/extend/plugins/user-access-manager/
16 */
17
18 /**
19 * The access handler class.
20 *
21 * @category UserAccessManager
22 * @package UserAccessManager
23 * @author Alexander Schneider <alexanderschneider85@gmail.com>
24 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
25 * @link http://wordpress.org/extend/plugins/user-access-manager/
26 */
27
28 class UamAccessHandler
29 {
30 protected $_oUserAccessManager = null;
31 protected $_aObjectUserGroups = array();
32 protected $_aObjectAccess = array();
33 protected $_aUserGroups = array(
34 'filtered' => array(),
35 'noneFiltered' => array(),
36 );
37 protected $_aPlObjects = array();
38 protected $_aObjectTypes = array(
39 'category',
40 'user',
41 'role',
42 );
43 protected $_aPostableTypes = array(
44 'post',
45 'page',
46 'attachment',
47 );
48 protected $_aAllObjectTypes = null;
49 protected $_aSqlResults = array();
50
51 /**
52 * The constructor
53 *
54 * @param UserAccessManager $oUserAccessManager The user access manager object.
55 */
56 public function __construct(UserAccessManager $oUserAccessManager)
57 {
58 $this->_oUserAccessManager = $oUserAccessManager;
59
60 $aPostTypes = get_post_types(array(), 'objects');
61
62 foreach ($aPostTypes as $oPostType) {
63 if ($oPostType->publicly_queryable) {
64 $this->_aPostableTypes[] = $oPostType->name;
65 }
66 }
67
68 $this->_aObjectTypes = array_merge($this->_aPostableTypes, $this->_aObjectTypes);
69 }
70
71 /**
72 * Returns the user access manager object.
73 *
74 * @return UserAccessManager
75 */
76 public function &getUserAccessManager()
77 {
78 return $this->_oUserAccessManager;
79 }
80
81 /**
82 * Returns the predefined object types.
83 *
84 * @return array
85 */
86 public function getObjectTypes()
87 {
88 return $this->_aObjectTypes;
89 }
90
91 /**
92 * Returns the predefined object types.
93 *
94 * @return array;
95 */
96 public function getPostableTypes()
97 {
98 return $this->_aPostableTypes;
99 }
100
101 /**
102 * Returns all _aObjects types.
103 *
104 * @return array
105 */
106 public function getAllObjectTypes()
107 {
108 if (isset($this->_aAllObjectTypes)) {
109 return $this->_aAllObjectTypes;
110 }
111
112 $aPlObjects = $this->getPlObjects();
113
114 $this->_aAllObjectTypes = array_merge(
115 $this->_aObjectTypes,
116 array_keys($aPlObjects)
117 );
118
119 return $this->_aAllObjectTypes;
120 }
121
122 /**
123 * Magic method getter.
124 *
125 * @param string $sName The name of the function
126 * @param array $aArguments The arguments for the function
127 *
128 * @return mixed
129 */
130 public function __call($sName, $aArguments)
131 {
132 $oUserAccessManager = $this->getUserAccessManager();
133
134 if ($oUserAccessManager->startsWith($sName, 'getUserGroupsFor')) {
135 $sPrefix = 'getUserGroupsFor';
136 } elseif ($oUserAccessManager->startsWith($sName, 'checkAccessFor')) {
137 $sPrefix = 'checkAccessFor';
138 }
139
140 if (isset($sPrefix)) {
141 $sObjectType = str_replace($sPrefix, '', $sName);
142 $sObjectType = strtolower($sObjectType);
143
144 $iObjectId = $aArguments[0];
145
146 if ($sPrefix == 'getUserGroupsFor') {
147 return $this->getUserGroupsForObject($sObjectType, $iObjectId);
148 } elseif ($sPrefix == 'checkAccessFor') {
149 return $this->checkObjectAccess($sObjectType, $iObjectId);
150 }
151 }
152
153 return null;
154 }
155
156 /**
157 * Filter the user groups of an object if authors_can_add_posts_to_groups
158 * option is enabled
159 *
160 * @param UamUserGroup[] $aUserGroups The user groups.
161 *
162 * @return array
163 */
164 protected function _filterUserGroups($aUserGroups)
165 {
166 $aUamOptions = $this->getUserAccessManager()->getAdminOptions();
167
168 if ($aUamOptions['authors_can_add_posts_to_groups'] == 'true'
169 && !$this->checkUserAccess('manage_user_groups')
170 && $this->getUserAccessManager()->atAdminPanel()
171 ) {
172 $oCurrentUser = $this->getUserAccessManager()->getCurrentUser();
173 $aUserGroupsForUser = $this->getUserGroupsForObject('user', $oCurrentUser->ID);
174
175 foreach ($aUserGroups as $sKey => $oUamUserGroup) {
176 if (!isset($aUserGroupsForUser[$oUamUserGroup->getId()])) {
177 unset($aUserGroups[$sKey]);
178 }
179 }
180 }
181
182 return $aUserGroups;
183 }
184
185 /**
186 * Returns all user groups or one requested by the user group _iId.
187 *
188 * @param integer $iUserGroupId The _iId of the single user group which should be returned.
189 * @param boolean $blFilter Filter the groups.
190 *
191 * @return UamUserGroup[]|UamUserGroup
192 */
193 public function getUserGroups($iUserGroupId = null, $blFilter = true)
194 {
195 if ($blFilter) {
196 $sFilterAttr = 'filtered';
197 } else {
198 $sFilterAttr = 'noneFiltered';
199 }
200
201 if ($iUserGroupId === null
202 && $this->_aUserGroups[$sFilterAttr] != array()
203 ) {
204 return $this->_aUserGroups[$sFilterAttr];
205 } elseif ($iUserGroupId !== null
206 && $this->_aUserGroups[$sFilterAttr] != array()
207 ) {
208 if (isset($this->_aUserGroups[$sFilterAttr][$iUserGroupId])) {
209 return $this->_aUserGroups[$sFilterAttr][$iUserGroupId];
210 } else {
211 return null;
212 }
213 }
214
215 $this->_aUserGroups[$sFilterAttr] = array();
216
217 /**
218 * @var wpdb $wpdb
219 */
220 global $wpdb;
221
222 $aUserGroupsDb = $wpdb->get_results(
223 "SELECT ID
224 FROM " . DB_ACCESSGROUP . "
225 ORDER BY ID", ARRAY_A
226 );
227
228 if (isset($aUserGroupsDb)) {
229 foreach ($aUserGroupsDb as $aUserGroupDb) {
230 $this->_aUserGroups[$sFilterAttr][$aUserGroupDb['ID']] = new UamUserGroup($this, $aUserGroupDb['ID']);
231 }
232 }
233
234 //Filter the user groups
235 if ($blFilter) {
236 $this->_aUserGroups[$sFilterAttr] = $this->_filterUserGroups($this->_aUserGroups[$sFilterAttr]);
237 }
238
239 if ($iUserGroupId == null) {
240 return $this->_aUserGroups[$sFilterAttr];
241 } else {
242 if (isset($this->_aUserGroups[$sFilterAttr][$iUserGroupId])) {
243 return $this->_aUserGroups[$sFilterAttr][$iUserGroupId];
244 } else {
245 return null;
246 }
247 }
248 }
249
250 /**
251 * Adds a user group.
252 *
253 * @param UamUserGroup $oUserGroup The user group which we want to add.
254 *
255 * @return null
256 */
257 public function addUserGroup($oUserGroup)
258 {
259 $this->getUserGroups();
260 $this->_aUserGroups['noneFiltered'][$oUserGroup->getId()] = $oUserGroup;
261 $this->_aUserGroups['filtered'] = array();
262 }
263
264 /**
265 * Deletes a user group.
266 *
267 * @param integer $iUserGroupId The user group _iId which we want to delete.
268 *
269 * @return null
270 */
271 public function deleteUserGroup($iUserGroupId)
272 {
273 if ($this->getUserGroups($iUserGroupId) != null) {
274 $this->getUserGroups($iUserGroupId)->delete();
275 unset($this->_aUserGroups['noneFiltered'][$iUserGroupId]);
276 $this->_aUserGroups['filtered'] = array();
277 }
278 }
279
280 /**
281 * Returns the user groups for the given object.
282 *
283 * @param string $sObjectType The object type.
284 * @param integer $iObjectId The _iId of the object.
285 * @param boolean $blFilter Filter the groups.
286 *
287 * @return UamUserGroup[]
288 */
289 public function getUserGroupsForObject($sObjectType, $iObjectId, $blFilter = true)
290 {
291 if (!in_array($sObjectType, $this->getAllObjectTypes())) {
292 return array();
293 }
294
295 if ($sObjectType == 'user') {
296 $blFilter = false;
297 }
298
299 if ($blFilter) {
300 $sFilterAttr = 'filtered';
301 } else {
302 $sFilterAttr = 'noneFiltered';
303 }
304
305 if (isset($this->_aObjectUserGroups[$sObjectType][$sFilterAttr][$iObjectId])) {
306 return $this->_aObjectUserGroups[$sObjectType][$sFilterAttr][$iObjectId];
307 }
308
309 $aObjectUserGroups = array();
310 $aUserGroups = $this->getUserGroups(null, $blFilter);
311
312 /*$blPlObject = false;
313 $aPostableTypes = $this->getPostableTypes();
314
315 if (!in_array($sObjectType, $aPostableTypes)) {
316 $blPlObject = true;
317 }*/
318
319 $aCurIp = explode(".", $_SERVER['REMOTE_ADDR']);
320
321 if (isset($aUserGroups)) {
322 foreach ($aUserGroups as $oUserGroup) {
323 $mObjectMembership = $oUserGroup->objectIsMember($sObjectType, $iObjectId, true);
324
325 if ($mObjectMembership !== false
326 || $sObjectType == 'user'
327 && $this->checkUserIp($aCurIp, $oUserGroup->getIpRange())
328 ) {
329 if (is_array($mObjectMembership)) {
330 $oUserGroup->aSetRecursive[$sObjectType][$iObjectId] = $mObjectMembership;
331 }
332
333 $aObjectUserGroups[$oUserGroup->getId()] = $oUserGroup;
334 }
335 }
336 }
337
338 //Filter the user groups
339 if ($blFilter) {
340 $aObjectUserGroups = $this->_filterUserGroups($aObjectUserGroups);
341 }
342
343 $this->_aObjectUserGroups[$sObjectType][$sFilterAttr][$iObjectId] = $aObjectUserGroups;
344 return $this->_aObjectUserGroups[$sObjectType][$sFilterAttr][$iObjectId];
345 }
346
347 /**
348 * Unset the user groups for _aObjects.
349 *
350 * @return null
351 */
352 public function unsetUserGroupsForObject()
353 {
354 $this->_aObjectUserGroups = array();
355 }
356
357 /**
358 * Checks if the current_user has access to the given post.
359 *
360 * @param string $sObjectType The object type which should be checked.
361 * @param integer $iObjectId The _iId of the object.
362 *
363 * @return boolean
364 */
365 public function checkObjectAccess($sObjectType, $iObjectId)
366 {
367 if (!in_array($sObjectType, $this->getAllObjectTypes())) {
368 return true;
369 }
370
371 if (isset($this->_aObjectAccess[$sObjectType][$iObjectId])) {
372 return $this->_aObjectAccess[$sObjectType][$iObjectId];
373 }
374
375 $oCurrentUser = $this->getUserAccessManager()->getCurrentUser();
376 $aPostableTypes = $this->getPostableTypes();
377
378 if (in_array($sObjectType, $aPostableTypes)) {
379 $oPost = get_post($iObjectId);
380 $sAuthorId = $oPost->post_author;
381 } else {
382 $sAuthorId = -1;
383 }
384
385 $aUamOptions = $this->getUserAccessManager()->getAdminOptions();
386 $aMembership = $this->getUserGroupsForObject($sObjectType, $iObjectId, false);
387
388 if ($aMembership == array()
389 || $this->checkUserAccess('manage_user_groups')
390 || $oCurrentUser->ID == $sAuthorId
391 && $aUamOptions['authors_has_access_to_own'] == 'true'
392 ) {
393 return $this->_aObjectAccess[$sObjectType][$iObjectId] = true;
394 }
395
396 $aCurIp = explode(".", $_SERVER['REMOTE_ADDR']);
397
398 foreach ($aMembership as $sKey => $oUserGroup) {
399 if ($this->checkUserIp($aCurIp, $oUserGroup->getIpRange())
400 || $oUserGroup->objectIsMember('user', $oCurrentUser->ID)
401 ) {
402 return $this->_aObjectAccess[$sObjectType][$iObjectId] = true;
403 break;
404 }
405
406 if ($this->getUserAccessManager()->atAdminPanel() && $oUserGroup->getWriteAccess() == 'all'
407 || !$this->getUserAccessManager()->atAdminPanel() && $oUserGroup->getReadAccess() == 'all'
408 ) {
409 unset($aMembership[$sKey]);
410 }
411 }
412
413 if ($aMembership == array()) {
414 return $this->_aObjectAccess[$sObjectType][$iObjectId] = true;
415 }
416
417 return $this->_aObjectAccess[$sObjectType][$iObjectId] = false;
418 }
419
420
421 /*
422 * SQL functions.
423 */
424
425 /**
426 * Returns the user groups for the current user as sql string.
427 *
428 * @return string
429 */
430 protected function _getUserGroupsForUserAsSqlString()
431 {
432 if (isset($this->_aSqlResults['groupsForUser'])) {
433 return $this->_aSqlResults['groupsForUser'];
434 }
435
436 $oCurrentUser = $this->getUserAccessManager()->getCurrentUser();
437 $aUserUserGroups = $this->getUserGroupsForObject('user', $oCurrentUser->ID, false);
438 $aUserUserGroupIds = array();
439
440 foreach ($aUserUserGroups as $oUserUserGroup) {
441 $aUserUserGroupIds[] = $oUserUserGroup->getId();
442 }
443
444 if ($aUserUserGroupIds !== array()) {
445 $sUserUserGroups = implode(', ', $aUserUserGroupIds);
446 } else {
447 $sUserUserGroups = "''";
448 }
449
450 $this->_aSqlResults['groupsForUser'] = $sUserUserGroups;
451 return $this->_aSqlResults['groupsForUser'];
452 }
453
454 /**
455 * Returns the categories assigned to the user.
456 *
457 * @return array
458 */
459 public function getCategoriesForUser()
460 {
461 /**
462 * @var wpdb $wpdb
463 */
464 global $wpdb;
465
466 if (isset($this->_aSqlResults['categoriesAssignedToUser'])) {
467 return $this->_aSqlResults['categoriesAssignedToUser'];
468 }
469
470 $sUserUserGroups = $this->_getUserGroupsForUserAsSqlString();
471
472 $sCategoriesAssignedToUserSql = "
473 SELECT igc.object_id
474 FROM ".DB_ACCESSGROUP_TO_OBJECT." AS igc
475 WHERE igc.object_type = 'category'
476 AND igc.group_id IN (".$sUserUserGroups.")";
477
478 $this->_aSqlResults['categoriesAssignedToUser'] = $wpdb->get_col($sCategoriesAssignedToUserSql);
479 return $this->_aSqlResults['categoriesAssignedToUser'];
480 }
481
482 /**
483 * Returns the posts assigned to the user.
484 *
485 * @return array
486 */
487 public function getPostsForUser()
488 {
489 /**
490 * @var wpdb $wpdb
491 */
492 global $wpdb;
493
494 if (isset($this->_aSqlResults['postsAssignedToUser'])) {
495 return $this->_aSqlResults['postsAssignedToUser'];
496 }
497
498 $sUserUserGroup = $this->_getUserGroupsForUserAsSqlString();
499 $sPostableTypes = "'".implode("','", $this->getPostableTypes())."'";
500
501 $sPostAssignedToUserSql = "
502 SELECT igp.object_id
503 FROM ".DB_ACCESSGROUP_TO_OBJECT." AS igp
504 WHERE igp.object_type IN (".$sPostableTypes.")
505 AND igp.group_id IN (".$sUserUserGroup.")";
506
507 $this->_aSqlResults['postsAssignedToUser'] = $wpdb->get_col($sPostAssignedToUserSql);
508 return $this->_aSqlResults['postsAssignedToUser'];
509 }
510
511 /**
512 * Returns the excluded posts.
513 *
514 * @return array
515 */
516 public function getExcludedPosts()
517 {
518 /**
519 * @var wpdb $wpdb
520 */
521 global $wpdb;
522
523 if ($this->checkUserAccess('manage_user_groups')) {
524 $this->_aSqlResults['excludedPosts'] = array();
525 }
526
527 if (isset($this->_aSqlResults['excludedPosts'])) {
528 return $this->_aSqlResults['excludedPosts'];
529 }
530
531 if ($this->getUserAccessManager()->atAdminPanel()) {
532 $sAccessType = "write";
533 } else {
534 $sAccessType = "read";
535 }
536
537 $aCategoriesAssignedToUser = $this->getCategoriesForUser();
538
539 if ($aCategoriesAssignedToUser !== array()) {
540 $sCategoriesAssignedToUser = implode(', ', $aCategoriesAssignedToUser);
541 } else {
542 $sCategoriesAssignedToUser = "''";
543 }
544
545 $aPostAssignedToUser = $this->getPostsForUser();
546
547 if ($aPostAssignedToUser !== array()) {
548 $sPostAssignedToUser = implode(', ', $aPostAssignedToUser);
549 } else {
550 $sPostAssignedToUser = "''";
551 }
552
553 $sPostSql = "SELECT DISTINCT p.ID
554 FROM $wpdb->posts AS p
555 INNER JOIN $wpdb->term_relationships AS tr
556 ON p.ID = tr.object_id
557 INNER JOIN $wpdb->term_taxonomy tt
558 ON tr.term_taxonomy_id = tt.term_taxonomy_id
559 WHERE tt.taxonomy = 'category'
560 AND tt.term_id IN (
561 SELECT gc.object_id
562 FROM ".DB_ACCESSGROUP." iag
563 INNER JOIN ".DB_ACCESSGROUP_TO_OBJECT." AS gc
564 ON iag.id = gc.group_id
565 WHERE gc.object_type = 'category'
566 AND iag.".$sAccessType."_access != 'all'
567 AND gc.object_id NOT IN (".$sCategoriesAssignedToUser.")
568 ) AND p.ID NOT IN (".$sPostAssignedToUser.")
569 UNION
570 SELECT DISTINCT gp.object_id
571 FROM ".DB_ACCESSGROUP." AS ag
572 INNER JOIN ".DB_ACCESSGROUP_TO_OBJECT." AS gp
573 ON ag.id = gp.group_id
574 INNER JOIN $wpdb->term_relationships AS tr
575 ON gp.object_id = tr.object_id
576 INNER JOIN $wpdb->term_taxonomy tt
577 ON tr.term_taxonomy_id = tt.term_taxonomy_id
578 WHERE gp.object_type = 'post'
579 AND ag.".$sAccessType."_access != 'all'
580 AND gp.object_id NOT IN (".$sPostAssignedToUser.")
581 AND tt.term_id NOT IN (".$sCategoriesAssignedToUser.")";
582
583 $this->_aSqlResults['excludedPosts'] = $wpdb->get_col($sPostSql);
584 return $this->_aSqlResults['excludedPosts'];
585 }
586
587
588 /*
589 * Other functions
590 */
591
592 /**
593 * Checks if the given ip matches with the range.
594 *
595 * @param array $aCurIp The ip of the current user.
596 * @param array $aIpRanges The ip ranges.
597 *
598 * @return boolean
599 */
600 public function checkUserIp($aCurIp, $aIpRanges)
601 {
602 if (isset($aIpRanges)) {
603 foreach ($aIpRanges as $aIpRange) {
604 $aIpRange = explode("-", $aIpRange);
605 $aRangeBegin = explode(".", $aIpRange[0]);
606
607 if (isset($aIpRange[1])) {
608 $aRangeEnd = explode(".", $aIpRange[1]);
609 } else {
610 $aRangeEnd = explode(".", $aIpRange[0]);
611 }
612
613 if ($aRangeBegin[0] <= $aCurIp[0] && $aCurIp[0] <= $aRangeEnd[0]
614 && $aRangeBegin[1] <= $aCurIp[1] && $aCurIp[1] <= $aRangeEnd[1]
615 && $aRangeBegin[2] <= $aCurIp[2] && $aCurIp[2] <= $aRangeEnd[2]
616 && $aRangeBegin[3] <= $aCurIp[3] && $aCurIp[3] <= $aRangeEnd[3]
617 ) {
618 return true;
619 }
620 }
621 }
622
623 return false;
624 }
625
626 /**
627 * Return the role of the user.
628 *
629 * @param integer $iUserId The user _iId.
630 *
631 * @return string|null
632 */
633 protected function _getUserRole($iUserId)
634 {
635 /**
636 * @var wpdb $wpdb
637 */
638 global $wpdb;
639
640 $oUserData = get_userdata($iUserId);
641
642 if (!empty($oUserData->user_level) && !isset($oUserData->user_level)) {
643 $oUserData->user_level = null;
644 }
645
646 if (isset($oUserData->{$wpdb->prefix . "capabilities"})) {
647 $aCapabilities = $oUserData->{$wpdb->prefix . "capabilities"};
648 } else {
649 $aCapabilities = array();
650 }
651
652 $aRole = (count($aCapabilities) > 0) ? array_keys($aCapabilities) : array('norole');
653 return trim($aRole[0]);
654 }
655
656 /**
657 * Checks if the user is an admin user
658 *
659 * @param integer $iUserId The user _iId.
660 *
661 * @return boolean
662 */
663 public function userIsAdmin($iUserId)
664 {
665 $sRole = $this->_getUserRole($iUserId);
666
667 if ($sRole == 'administrator' || is_super_admin($iUserId)) {
668 return true;
669 }
670
671 return false;
672 }
673
674 /**
675 * Checks the user access by user level.
676 *
677 * @param boolean $blAllowedCapability If true check also for the capability.
678 *
679 * @return boolean
680 */
681 public function checkUserAccess($blAllowedCapability = false)
682 {
683 $oCurrentUser = $this->getUserAccessManager()->getCurrentUser();
684 $aUamOptions = $this->getUserAccessManager()->getAdminOptions();
685
686 $sRole = $this->_getUserRole($oCurrentUser->ID);
687 $aOrderedRoles = $this->getRolesOrdered();
688
689 if (isset($aOrderedRoles[$sRole])
690 && $aOrderedRoles[$sRole] >= $aOrderedRoles[$aUamOptions['full_access_role']]
691 || $sRole == 'administrator' || is_super_admin($oCurrentUser->ID)
692 || ($blAllowedCapability && $oCurrentUser->has_cap($blAllowedCapability))
693 ) {
694 return true;
695 }
696
697 return false;
698 }
699
700 /**
701 * Returns the roles as associative array.
702 *
703 * @return array
704 */
705 public function getRolesOrdered()
706 {
707 $aOrderedRoles = array(
708 'norole' => 0,
709 'subscriber' => 1,
710 'contributor' => 2,
711 'author' => 3,
712 'editor' => 4,
713 'administrator' => 5
714 );
715
716 return $aOrderedRoles;
717 }
718
719 /**
720 * Registers object that should be handelt by the user access manager.
721 *
722 * @param array $oObject The object which you want to register.
723 *
724 * @return boolean
725 */
726 public function registerPlObject($oObject)
727 {
728 if (!isset($oObject['name']) || !isset($oObject['reference'])
729 || !isset($oObject['getFull']) || !isset($oObject['getFullObjects'])
730 ) {
731 return false;
732 }
733
734 $this->_aPlObjects[$oObject['name']] = $oObject;
735
736 return true;
737 }
738
739 /**
740 * Returns a registered pluggable object.
741 *
742 * @param string $sObjectName The name of the object which should be returned.
743 *
744 * @return array
745 */
746 public function getPlObject($sObjectName)
747 {
748 if (isset($this->_aPlObjects[$sObjectName])) {
749 return $this->_aPlObjects[$sObjectName];
750 }
751
752 return array();
753 }
754
755 /**
756 * Returns all registered pluggable _aObjects.
757 *
758 * @return array
759 */
760 public function getPlObjects()
761 {
762 return $this->_aPlObjects;
763 }
764 }