/** * Returns an instance of class (singleton pattern implementation). * * @return QUESTIONS_CLASS_BaseBridge */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
private function fullInit() { OW::getRouter()->addRoute(new OW_Route('questions-index', 'questions', 'QUESTIONS_CTRL_List', 'all')); OW::getRouter()->addRoute(new OW_Route('questions-all', 'questions', 'QUESTIONS_CTRL_List', 'all')); OW::getRouter()->addRoute(new OW_Route('questions-my', 'questions/my', 'QUESTIONS_CTRL_List', 'my')); OW::getRouter()->addRoute(new OW_Route('questions-friends', 'questions/friends', 'QUESTIONS_CTRL_List', 'friends')); OW::getRouter()->addRoute(new OW_Route('questions-admin-main', 'admin/plugins/questions', 'QUESTIONS_CTRL_Admin', 'main')); OW::getRouter()->addRoute(new OW_Route('questions-question', 'questions/:qid', 'QUESTIONS_CTRL_Questions', 'question')); OW::getRouter()->addRoute(new OW_Route('questions-upgrade', 'admin/plugins/questions/extended-version', 'QUESTIONS_CTRL_Upgrade', 'index')); OW::getEventManager()->bind('admin.add_admin_notification', array($this, 'onSetupAdminNotification')); $newsfeedBridge = QUESTIONS_CLASS_NewsfeedBridge::getInstance(); OW::getEventManager()->bind('feed.get_status_update_cmp', array($newsfeedBridge, 'onStatusCmp')); OW::getEventManager()->bind('feed.on_item_render', array($newsfeedBridge, 'onItemRender')); OW::getEventManager()->bind('feed.on_entity_add', array($newsfeedBridge, 'onEntityAdd')); OW::getEventManager()->bind('feed.on_activity', array($newsfeedBridge, 'onActivity')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_ANSWER_ADDED, array($newsfeedBridge, 'onAnswerAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_ANSWER_REMOVED, array($newsfeedBridge, 'onAnswerRemove')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_FOLLOW_ADDED, array($newsfeedBridge, 'onFollowAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_FOLLOW_REMOVED, array($newsfeedBridge, 'onFollowRemove')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_QUESTION_REMOVED, array($newsfeedBridge, 'onQuestionRemove')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_POST_ADDED, array($newsfeedBridge, 'onPostAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_POST_REMOVED, array($newsfeedBridge, 'onPostRemove')); OW::getEventManager()->bind('feed.collect_configurable_activity', array($newsfeedBridge, 'configurableActivity')); $activityBridge = QUESTIONS_CLASS_ActivityBridge::getInstance(); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_QUESTION_ADDED, array($activityBridge, 'onQuestionAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_QUESTION_REMOVED, array($activityBridge, 'onQuestionRemove')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_ANSWER_ADDED, array($activityBridge, 'onAnswerAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_ANSWER_REMOVED, array($activityBridge, 'onAnswerRemove')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_FOLLOW_ADDED, array($activityBridge, 'onFollowAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_FOLLOW_REMOVED, array($activityBridge, 'onFollowRemove')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_POST_ADDED, array($activityBridge, 'onPostAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_POST_REMOVED, array($activityBridge, 'onPostRemove')); $commentBridge = QUESTIONS_CLASS_CommentsBridge::getInstance(); OW::getEventManager()->bind('base_add_comment', array($commentBridge, 'onCommentAdd')); OW::getEventManager()->bind('base_delete_comment', array($commentBridge, 'onCommentRemove')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_QUESTION_REMOVED, array($commentBridge, 'onQuestionRemove')); $groupsBridge = QUESTIONS_CLASS_GroupsBridge::getInstance(); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_BEFORE_QUESTION_ADDED, array($groupsBridge, 'onBeforeQuestionAdd')); OW::getEventManager()->bind(QUESTIONS_BOL_Service::EVENT_ON_INTERACT_PERMISSION_CHECK, array($groupsBridge, 'onCheckInteractPermission')); OW::getEventManager()->bind('admin.add_auth_labels', array($this, 'onAuthLabelsCollect')); QUESTIONS_CLASS_EnotificationBridge::getInstance()->init(); //Privacy OW::getEventManager()->bind('plugin.privacy.get_action_list', array($this, 'collectPrivacyActions')); OW::getEventManager()->bind('feed.collect_privacy', array($newsfeedBridge, 'collectPrivacy')); OW::getEventManager()->bind('plugin.privacy.on_change_action_privacy', array($this, 'onPrivacyChange')); QUESTIONS_CLASS_BaseBridge::getInstance()->init(); }