作者:mpalourdi
项目:zf2-maintenance-mod
/**
* @param ModuleManagerInterface $moduleManager
* @throws \Exception
*/
public function init(ModuleManagerInterface $moduleManager)
{
if (PHP_SAPI === 'cli') {
return;
}
$rootApplicationPath = realpath(dirname('.'));
$userConfig = $this->getUserConfig();
if (!isset($userConfig['maintenance']['flag_file'])) {
throw new \Exception('The \'flag_file\' parameter is missing in config/autoload/config/autoload/maintenance{,*.}{global,local}.php');
}
if (file_exists($rootApplicationPath . DIRECTORY_SEPARATOR . $userConfig['maintenance']['flag_file'])) {
if (!isset($userConfig['maintenance']['status_code']) || !isset($userConfig['maintenance']['message'])) {
throw new \Exception('Please fill all the parameters in config/autoload/config/autoload/maintenance{,*.}{global,local}.php');
}
$moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, function (ModuleEvent $moduleEvent) {
$moduleEvent->stopPropagation(true);
}, PHP_INT_MAX);
$moduleManager->getEventManager()->getSharedManager()->attach(Application::class, MvcEvent::EVENT_BOOTSTRAP, function (MvcEvent $mvcEvent) use($userConfig) {
$response = $mvcEvent->getResponse();
$response->setStatusCode($userConfig['maintenance']['status_code']);
$response->setContent($this->getResponseContent());
$mvcEvent->stopPropagation(true);
}, PHP_INT_MAX);
}
}
作者:JPG-Consultin
项目:LocaleManager-OL
public function init(ModuleManagerInterface $manager)
{
$events = $manager->getEventManager();
// Registering a listener at default priority, 1, which will trigger
// after the ConfigListener merges config.
$events->attach(ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'onMergeConfig'));
}
作者:skp
项目:profiler-toolba
/**
* Initialize workflow
*
* @param ModuleManagerInterface $manager
* @return void
*/
public function init(ModuleManagerInterface $manager)
{
$eventManager = $manager->getEventManager();
$eventManager->attach(ProfilerEvent::EVENT_PROFILER_INIT, function () {
xhprof_enable(XHPROF_FLAGS_MEMORY);
});
}
作者:coolm
项目:jquer
/**
* @param ModuleManagerInterface $moduleManager
*/
public function init(ModuleManagerInterface $moduleManager)
{
$moduleManager->loadModule('AssetManager');
$sm = $moduleManager->getEvent()->getParam('ServiceManager');
$serviceListener = $sm->get('ServiceListener');
$serviceListener->addServiceManager('JQueryPluginManager', 'jquery_plugins', JQueryPluginProviderInterface::class, 'getJQueryPluginConfig');
}
作者:alapin
项目:apigility-3hr-tutoria
/**
* Ensure the UI module is loaded
*
* @param ModuleManagerInterface $modules
*/
public function init(ModuleManagerInterface $modules)
{
$loaded = $modules->getLoadedModules();
if (isset($loaded['ZF\\Apigility\\Admin\\Ui'])) {
return;
}
$modules->loadModule('ZF\\Apigility\\Admin\\Ui');
}
作者:zfcampu
项目:zf-apigility-admi
/**
* Initialize module.
*
* If the admin UI module is not loaded yet, load it.
*
* Disable the opcache as well.
*
* @param ModuleManagerInterface $modules
*/
public function init(ModuleManagerInterface $modules)
{
$loaded = $modules->getLoadedModules(false);
if (!isset($loaded['ZF\\Apigility\\Admin\\Ui'])) {
$modules->loadModule('ZF\\Apigility\\Admin\\Ui');
}
$this->disableOpCache();
}
作者:Ellipizl
项目:DoctrineCouchODMModul
/**
* {@inheritDoc}
*/
public function init(ModuleManagerInterface $manager)
{
$events = $manager->getEventManager();
// Initialize logger collector once the profiler is initialized itself
$events->attach('profiler_init', function (EventInterface $e) use($manager) {
$manager->getEvent()->getParam('ServiceManager')->get('doctrine.couch_logger_collector.odm_default');
});
}
作者:rafajaque
项目:colloquiu
/**
* Initialize workflow
*
* @param ModuleManagerInterface $manager
*/
public function init(ModuleManagerInterface $manager)
{
if (PHP_SAPI === 'cli') {
return;
}
$eventManager = $manager->getEventManager();
$eventManager->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, array($this, 'onLoadModulesPost'), -1100);
}
作者:mtyme
项目:modular-expressiv
/**
* @return ModuleManagerInterface
*/
protected function getModuleManager()
{
if (null == $this->moduleManager) {
$this->moduleManager = new ModuleManager([]);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener());
}
return $this->moduleManager;
}
作者:esas
项目:dream-cm
/**
* Init
*
* @param \Zend\ModuleManager\ModuleManagerInterface
* @return void
*/
public function init(ModuleManagerInterface $moduleManager)
{
// get the service manager
$this->serviceLocator = $moduleManager->getEvent()->getParam('ServiceManager');
// get the module manager
$this->moduleManager = $moduleManager;
$moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, [$this, 'initApplication']);
}
作者:coolm
项目:doctrine-or
/**
* @param ModuleManagerInterface $moduleManager
*/
public function init(ModuleManagerInterface $moduleManager)
{
$moduleManager->loadModule('DoctrineModule');
$moduleManager->loadModule('DoctrineORMModule');
$moduleManager->loadModule('CmsDoctrine');
$em = $moduleManager->getEventManager();
$em->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, [$this, 'onPostLoadModules']);
}
作者:stefanotorres
项目:thorr-persistenc
/**
* {@inheritdoc}
*/
public function init(ModuleManagerInterface $moduleManager)
{
/** @var ServiceManager $serviceManager */
$serviceManager = $moduleManager->getEvent()->getParam('ServiceManager');
/** @var ServiceListenerInterface $serviceListener */
$serviceListener = $serviceManager->get('ServiceListener');
$serviceListener->addServiceManager(DataMapper\Manager\DataMapperManager::class, 'thorr_persistence_dmm', DataMapper\Manager\DataMapperManagerConfigProviderInterface::class, 'getDataMapperManagerConfig');
}
作者:zourc
项目:zourc
public function init(ModuleManagerInterface $moduleManager)
{
/** @var ServiceListener $serviceListener */
$serviceListener = $moduleManager->getEvent()->getParam('ServiceManager')->get('ServiceListener');
$serviceListener->addServiceManager(AuthorizationConditionPluginManager::class, 'zource_conditions', '', '');
$serviceListener->addServiceManager(UiNavigationItemPluginManager::class, 'zource_ui_nav_items', '', '');
$this->initializeErrorLogging();
}
作者:gridguy
项目:cor
/**
* Initialize workflow
*
* @param ModuleManagerInterface $manager
* @return void
*/
public function init(ModuleManagerInterface $manager)
{
$this->moduleManager = $manager;
$this->serviceLocator = $manager->getEvent()->getParam('ServiceManager');
$shared = $manager->getEventManager()->getSharedManager();
$shared->attach('Zend\\Stdlib\\DispatchableInterface', MvcEvent::EVENT_DISPATCH, array(new InjectTemplateListener(), 'injectTemplate'), -85);
$shared->attach('Zend\\Stdlib\\DispatchableInterface', MvcEvent::EVENT_DISPATCH, array($this, 'onDispatch'), 100);
}
作者:gstearmi
项目:EshopVegeTabl
/**
* Initialize workflow
*
* @param ModuleManagerInterface $manager
*/
public function init(ModuleManagerInterface $manager)
{
defined('REQUEST_MICROTIME') || define('REQUEST_MICROTIME', microtime(true));
if (PHP_SAPI === 'cli') {
return;
}
$eventManager = $manager->getEventManager();
$eventManager->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, array($this, 'onLoadModulesPost'), -1100);
}
作者:oscar12
项目:doggerou
/**
* {@inheritDoc}
*/
public function init(ModuleManagerInterface $manager)
{
$events = $manager->getEventManager();
// Initialize logger collector once the profiler is initialized itself
$events->attach('profiler_init', function () use($manager) {
$manager->getEvent()->getParam('ServiceManager')->get('doctrine.sql_logger_collector.orm_default');
});
$events->getSharedManager()->attach('doctrine', 'loadCli.post', array($this, 'initializeConsole'));
}
作者:89snake8
项目:PHPTes
public function init(ModuleManagerInterface $manager)
{
$events = $manager->getEventManager();
// Initialize logger collector once the profiler is initialized itself
$events->attach('profiler_init', function () use($manager) {
$manager->getEvent()->getParam('ServiceManager')->get('doctrine.sql_logger_collector.orm_another');
// moduificare nome
});
}
作者:spooner7
项目:dream-cm
/**
* Init
*/
public function init(ModuleManagerInterface $moduleManager)
{
// delete the user's files and dirs
$eventManager = UserEvent::getEventManager();
$eventManager->attach(UserEvent::DELETE, function ($e) use($moduleManager) {
// get a model instance
$model = $moduleManager->getEvent()->getParam('ServiceManager')->get('Application\\Model\\ModelManager')->getInstance('FileManager\\Model\\FileManagerBase')->deleteUserHomeDirectory($e->getParam('object_id'));
});
}
作者:webpant
项目:YAWI
public function init(\Zend\ModuleManager\ModuleManagerInterface $moduleManager)
{
if (\Zend\Console\Console::isConsole()) {
return;
}
$eventManager = $moduleManager->getEventManager()->getSharedManager();
$tokenListener = new TokenListener();
$tokenListener->attachShared($eventManager);
}
作者:alex-patterson-webde
项目:arp-entity-servic
/**
* init
*
* Initialise the modules services.
*
* @param ModuleManagerInterface $moduleManager
*/
public function init(ModuleManagerInterface $moduleManager)
{
/**
* @var ModuleManager $moduleManager
* @var ServiceManager $serviceManager
* @var ServiceListener $serviceListener
*/
$serviceManager = $moduleManager->getEvent()->getParam('ServiceManager');
$serviceListener = $serviceManager->get('ServiceListener');
$serviceListener->addServiceManager('EntityServiceManager', 'entity_service_manager', EntityServiceProviderInterface::class, 'getEntityServiceConfig');
}