/** * * */ public function __construct() { $this->view = new CoreView(); $this->registry = Registry::getInstance(); $this->request = $this->registry->request; /* Set event object, Event object will be used to attach some data and will be passed to listeners */ $this->event = new Event(); // creat event dispatcher object $this->eventDispatcher = EventDispatcher::getInstance(); // set plugin Manager instance $this->setPluginManager(PluginManager::getInstance()); /* */ $this->setView(); }
/** * initialize required objects */ public function init() { $this->config = Registry::getInstance()->config = ApplicationConfig::getInstance(); $request = Registry::getInstance()->request = new Request(); $this->setAppName($this->config->appName); $this->setRouter(Router::getInstance())->setRequest($request)->setRawRoute()->setDefaultModule('site')->setDefaultController('site')->setDefaultAction('index')->setBasePath(dirname(dirname(dirname(__FILE__))))->setModule()->setController()->setAction(); // load module (modules which are in extension folders ) configuration ModuleManager::getInstance()->loadModuleConfig(); //set application configurations config.ini // Load system configuration system.xml $this->config->setConfigFile($this->getConfigFile())->setSystemConfigFile($this->getSystemConfigFile())->loadConfiguration(); // load the userspace bootstrap class and run init method $initialize = Registry::getInstance()->request->getBasePath() . DS . Registry::getInstance()->config->appDir . DS . 'initializer.php'; if (file_exists($initialize)) { $initializer = new \initializer(); $initializer->init(); } // Module specific configuration file <module>.xml ModuleConfig::getInstance()->loadConfiguration(); // load plugin configurations PluginManager::getInstance()->loadPluginConfig(); // load plugins PluginManager::getInstance()->loadPlugins(); $this->exception = new EasyException(null); return $this; }