/** * Register a callback for the given event(s) * * @throws iMSCP_Plugin_Exception * @param iMSCP_Events_Manager_Interface $eventsManager */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { if (!is_xhr()) { // Do not act on AJAX request $components = $this->getConfigParam('components'); if ($components) { if (is_array($components)) { foreach ($components as $component) { require_once 'Component/' . $component . '.php'; $componentClass = "iMSCP_Plugin_DebugBar_Component_{$component}"; $component = new $componentClass(); if (!$component instanceof iMSCP_Plugin_DebugBar_Component_Interface) { throw new iMSCP_Plugin_Exception('Any DebugBar component must implement the iMSCP_Plugin_DebugBar_Component_Interface interface.'); } else { $events = $component->getListenedEvents(); if (!empty($events)) { $eventsManager->registerListener($events, $component, $component->getPriority()); } } $this->components[] = $component; } $eventsManager->registerListener($this->getListenedEvents(), $this, -100); } else { throw new iMSCP_Plugin_Exception('DebugBar plugin: components parameter must be an array containing list of DeburBar components'); } } } }
/** * Register listeners on the event manager * * @throws iMSCP_Plugin_Exception * @param iMSCP_Events_Manager_Interface $eventsManager * @return void */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $pluginManager = $this->getPluginManager(); $pluginName = $this->getName(); if ($pluginManager->pluginIsKnown($pluginName) && $pluginManager->pluginIsEnabled($pluginName)) { $events = $this->getConfigParam('disabled_actions', array()); if (is_array($events)) { $this->disabledActions = $events; if ($userAccounts = $this->getConfigParam('user_accounts', array())) { if (is_array($userAccounts)) { if (!empty($userAccounts)) { $eventsManager->registerListener(onLoginScriptEnd, $this, -10); $events[] = iMSCP_Events::onBeforeEditUser; $events[] = iMSCP_Events::onBeforeDeleteUser; $events[] = iMSCP_Events::onBeforeDeleteCustomer; } } else { throw new iMSCP_Plugin_Exception('The user_accounts configuration parameter must be an array.'); } } $events = array_unique($events); if (!empty($events)) { $eventsManager->registerListener($events, $this, 999); } } else { throw new iMSCP_Plugin_Exception('The disabled_actions configuration parameter must be an array.'); } $disabledPages = $events = $this->getConfigParam('disabled_pages', array()); if (is_array($disabledPages)) { $this->disabledPages = $disabledPages; if (!empty($disabledPages)) { $eventsManager->registerListener(array(iMSCP_Events::onAdminScriptStart, iMSCP_Events::onResellerScriptStart, iMSCP_Events::onClientScriptStart), array($this, 'disablePages')); } } else { throw new iMSCP_Plugin_Exception('The disabled_pages configuration parameter must be an array.'); } } else { $eventsManager->registerListener(iMSCP_Events::onBeforeEnablePlugin, $this); } }
/** * Register event listeners * * @param iMSCP_Events_Manager_Interface $eventsManager * @return void */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(iMSCP_Events::onLoginScriptStart, $this, -500); }
/** * Register a callback for the given event(s) * * @param iMSCP_Events_Manager_Interface $eventsManager */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(array(iMSCP_Events::onBeforeAuthentication, iMSCP_Events::onBeforeSetIdentity), $this, -99); }
/** * Register a callback for the given event(s). * * @param iMSCP_Events_Manager_Interface $eventsManager */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(array(iMSCP_Events::onBeforeInstallPlugin, iMSCP_Events::onBeforeUpdatePlugin, iMSCP_Events::onBeforeEnablePlugin, iMSCP_Events::onAdminScriptStart, iMSCP_Events::onResellerScriptStart, iMSCP_Events::onClientScriptStart, iMSCP_Events::onAfterDeleteUser, iMSCP_Events::onAfterDeleteDomainAlias, iMSCP_Events::onAfterEditDomain, iMSCP_Events::onBeforeAddSubdomain, iMSCP_Events::onBeforeAddDomainAlias, iMSCP_Events::onBeforeAddDomain), $this); }
/** * Register a callback for the given event(s) * * @param $eventManager iMSCP_Events_Manager_Interface $eventManager */ public function register(iMSCP_Events_Manager_Interface $eventManager) { $eventManager->registerListener(array(iMSCP_Events::onAfterAddUser, iMSCP_Events::onAfterEditUser, iMSCP_Events::onAfterAddDomain), $this); }
/** * Register a callback for the given event(s) * * @param iMSCP_Events_Manager_Interface $eventsManager * @return void */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(array(iMSCP_Events::onLoginScriptStart, iMSCP_Events::onLostPasswordScriptStart, iMSCP_Events::onAdminScriptStart, iMSCP_Events::onResellerScriptStart, iMSCP_Events::onClientScriptStart, iMSCP_Events::onBeforePluginsRoute), array($this, 'overrideHttpPorts')); }
/** * Register event listeners * * @param iMSCP_Events_Manager_Interface $eventsManager * @return void */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(array(iMSCP_Events::onResellerScriptStart, iMSCP_Events::onClientScriptStart, iMSCP_Events::onAfterAddDomainAlias, iMSCP_Events::onAfterDeleteDomainAlias, iMSCP_Events::onAfterDeleteCustomer), $this); }
/** * Register a callback for the given event(s) * * @param iMSCP_Events_Manager_Interface $eventsManager * @return void */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { # We register this listener with low priority to let any other plugin which listen on the same event a chance # to act before the redirect $eventsManager->registerListener(iMSCP_Events::onAfterAddDomainAlias, $this, -99); }
/** * Register a callback for the given event(s) * * @param iMSCP_Events_Manager_Interface $eventsManager */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(array(iMSCP_Events::onAdminScriptStart, iMSCP_Events::onClientScriptStart), $this); }
/** * Register a callback for the given event(s) * * @param iMSCP_Events_Manager_Interface $eventsManager */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(array(iMSCP_Events::onBeforeInstallPlugin, iMSCP_Events::onBeforeUpdatePlugin, iMSCP_Events::onBeforeEnablePlugin), $this); }
/** * Register a callback for the given event(s) * * @param iMSCP_Events_Manager_Interface $eventsManager */ public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener(array(iMSCP_Events::onBeforeInstallPlugin, iMSCP_Events::onBeforeUpdatePlugin, iMSCP_Events::onClientScriptStart, iMSCP_Events::onAfterDeleteCustomer, iMSCP_Events::onBeforeAddMail), $this); $eventsManager->registerListener(iMSCP_Events::onBeforeAddSubdomain, $this, 99); }
/** * Register a callback for the given event(s). * * @param iMSCP_Events_Manager_Interface $controller */ public function register(iMSCP_Events_Manager_Interface $controller) { $controller->registerListener(array(iMSCP_Events::onLoginScriptStart, iMSCP_Events::onLoginScriptEnd), $this); }