/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $this->basePath = realpath(__DIR__ . str_repeat(DIRECTORY_SEPARATOR . '..', 2)); $this->request = new \Zend\Controller\Request\Http(); $this->response = new \Zend\Controller\Response\Http(); $this->front = \Zend\Controller\Front::getInstance(); $this->front->resetInstance(); $this->front->addModuleDirectory($this->basePath . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'modules')->setRequest($this->request)->setResponse($this->response); $this->helper = new Helper\ViewRenderer(); HelperBroker::addHelper($this->helper); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $this->basePath = realpath(dirname(__FILE__) . str_repeat(DIRECTORY_SEPARATOR . '..', 2)); $this->request = new Zend_Controller_Request_Http(); $this->response = new Zend_Controller_Response_Http(); $this->front = Zend_Controller_Front::getInstance(); $this->front->resetInstance(); $this->front->addModuleDirectory($this->basePath . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'modules')->setRequest($this->request)->setResponse($this->response); $this->helper = new Zend_Controller_Action_Helper_ViewRenderer(); Zend_Controller_Action_HelperBroker::addHelper($this->helper); }
/** * Sets up all the initial required pieces of the app. * * @param string $environment * @param string $appPath * @param string $moduleDir */ public function __construct($environment, $appPath = APPLICATION_PATH, $moduleDir = 'modules') { // set the environment $this->_environment = (string) $environment; // set the application path $this->_appPath = $appPath; // set the modules dir path $this->_moduleDir = $this->_appPath . DIRECTORY_SEPARATOR . $moduleDir; // initiate autoloader require_once 'Zend/Loader/Autoloader.php'; $this->_autoloader = Zend_Loader_Autoloader::getInstance(); // set up module autoloading $this->_autoloader->pushAutoloader(array($this, 'moduleAutoload')); // set front controller $this->_front = Zend_Controller_Front::getInstance(); // add module directory $this->_front->addModuleDirectory($this->_moduleDir); // initiate request if ($this->_request === null) { $this->_request = new Zend_Controller_Request_Http(); } // initiate response if ($this->_response === null) { $this->_response = new Zend_Controller_Response_Http(); } // initiate router (Zend_Controller_Router_Rwrite) $this->_router = $this->_front->getRouter(); // get application.ini options $appOptions = $this->_getApplicationOptions(); // set routes in router from application.ini (if any) $this->_addRoutesFromConfig($appOptions); // update request with routes $this->_route($this->_request); // get module options $moduleOptions = $this->_getModuleOptions(); // merge application and module options into one array $options = $this->mergeOptions($appOptions, $moduleOptions); // set options $this->setOptions($options); // update front controller request $this->_front->setRequest($this->_request); // update front controller response $this->_front->setResponse($this->_response); // to be used in dispatch $this->_front->setRouter($this->_router); }
/** * Add modules */ public function initCustomModules() { if (count($this->customModules) > 0) { $this->frontController->addModuleDirectory(Sydney_Tools_Paths::getCustomapPath() . '/modules'); foreach ($this->customModules as $module => $role) { $this->frontController->addControllerDirectory(Sydney_Tools_Paths::getCustomapPath() . '/modules/' . $module . '/controllers', $module); } } }
/** * init application * @return void */ protected function _initApplication() { Zend_Session::setOptions(array('name' => $this->settings->page->session->name, 'save_path' => realpath(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'sessions'))); Zend_Session::start(); // sollte wenn name feststeht ge�ndert werden # get an instance of the frontend controller $this->bootstrap('FrontController'); $this->frontController = Zend_Controller_Front::getInstance(); # now add our own dispatcher $this->frontController->setDispatcher(new FansubCMS_Controller_Dispatcher_Standard()); # prefix default module as well $this->frontController->setParam('prefixDefaultModule', true); # set default and module controller directrories // $this->frontController->setControllerDirectory($this->settings->controllers->toArray()); $this->frontController->addModuleDirectory(APPLICATION_PATH . "/modules"); $this->frontController->removeControllerDirectory('default'); # set default module $this->frontController->setDefaultModule("news"); # Init application-wide Session $applicationSessionNamespace = new Zend_Session_Namespace('application'); $applicationSessionNamespace->tstamp = !isset($applicationSessionNamespace->tstamp) ? time() : $applicationSessionNamespace->tstamp; # add it to the registry Zend_Registry::set('applicationSessionNamespace', $applicationSessionNamespace); # Init authentication Session $authSessionNamespace = new Zend_Session_Namespace('Zend_Auth'); # add it to the registry Zend_Registry::set('AuthSessionNamespace', $authSessionNamespace); # set timezone date_default_timezone_set(empty($this->settings->page->timezone) ? 'Europe/Berlin' : $this->settings->page->timezone); # hook to settings $this->settings->applicationStatus = $this->applicationStatus; # hook needed objects/values to the zend registry Zend_Registry::set('settings', $this->settings); Zend_Registry::set('applicationStatus', $this->applicationStatus); Zend_Registry::set('environmentSettings', $this->environmentsettings); Zend_Registry::set('emailSettings', $this->mailsettings); }
/** * @static * @param \Zend_Controller_Front $front */ public static function initControllerFront(\Zend_Controller_Front $front) { // disable build-in error handler $front->setParam('noErrorHandler', true); // for admin an other modules directly in the core $front->addModuleDirectory(PIMCORE_PATH . "/modules"); // for plugins if (is_dir(PIMCORE_PLUGINS_PATH) && is_readable(PIMCORE_PLUGINS_PATH)) { $front->addModuleDirectory(PIMCORE_PLUGINS_PATH); } // for frontend (default: website) $front->addControllerDirectory(PIMCORE_WEBSITE_PATH . "/controllers", PIMCORE_FRONTEND_MODULE); $front->setDefaultModule(PIMCORE_FRONTEND_MODULE); }
/** * Initialize Controller paths * * @return void */ public function initControllers() { //$this->_front->addControllerDirectory($this->_root . '/application/modules/default/controllers', 'default'); //$this->_front->addControllerDirectory($this->_root . '/application/modules/sc/controllers', 'sc'); $this->_front->addModuleDirectory($this->_root . '/application/modules'); }
public function initFrontController() { $this->_front->addModuleDirectory(APPLICATION_PATH . '/modules')->registerPlugin(new SxCms_Controller_Plugin_HTTPCrawler())->registerPlugin(new SxCms_Controller_Plugin_Auth())->registerPlugin(new SxCms_Controller_Plugin_Messenger())->registerPlugin(new SxCms_Controller_Plugin_PageLocker())->registerPlugin(new SxCms_Controller_Plugin_ErrorSelector()); }