当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Front::setDispatcher方法代码示例

本文整理汇总了PHP中Zend_Controller_Front::setDispatcher方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Front::setDispatcher方法的具体用法?PHP Zend_Controller_Front::setDispatcher怎么用?PHP Zend_Controller_Front::setDispatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Controller_Front的用法示例。


在下文中一共展示了Zend_Controller_Front::setDispatcher方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _initApplication

 /**
  * 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);
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:41,代码来源:Bootstrap.php

示例2: init

 /**
  * Initialises the application
  *
  */
 public function init()
 {
     $__start = getmicrotime();
     if (isset($this->config['log_file'])) {
         $writer = new Zend_Log_Writer_Stream($this->config['log_file']);
         $this->logger = new Zend_Log($writer);
         if (isset($this->config['log_format'])) {
             $formatter = new Zend_Log_Formatter_Simple($this->config['log_format']);
             $writer->setFormatter($formatter);
         }
         // If not in debug mode, hide debug log messages
         if (!ifset($this->config, 'debug', false)) {
             $this->logger->addFilter(Zend_Log::NOTICE);
         }
     }
     $this->recordStat('za::initlog', getmicrotime() - $__start);
     $__start = getmicrotime();
     $mailServer = $this->getConfig('smtp_server');
     if (mb_strlen($mailServer)) {
         ini_set('SMTP', $mailServer);
     }
     // Create a new view object.
     $view = new CompositeView();
     Zend_Registry::set(self::$ZEND_VIEW, $view);
     /* @var Zend_Controller_Front $controller */
     $this->frontController = Zend_Controller_Front::getInstance();
     $this->frontController->setDispatcher(new InjectingDispatcher());
     $this->frontController->addControllerDirectory($this->getConfig('controller_dir', 'controllers'), 'default');
     $modules = ifset($this->config, 'modules', array());
     foreach ($modules as $module) {
         if (is_dir(APP_DIR . '/modules/' . $module)) {
             $this->frontController->addControllerDirectory('modules/' . $module, $module);
         }
     }
     $this->recordStat('za::initmodules', getmicrotime() - $__start);
     $__start = getmicrotime();
     $this->frontController->throwExceptions(ifset($this->config, 'debug', false) ? true : false);
     if (isset($this->config['route_config']) && php_sapi_name() != 'cli') {
         $router = $this->frontController->getRouter();
         /* @var $router Zend_Controller_Router_Rewrite */
         $config = new Zend_Config_Ini($this->config['route_config'], 'routes');
         $router->addConfig($config, 'routes');
     }
     Zend_Controller_Action_HelperBroker::removeHelper('viewRenderer');
     $this->frontController->setParam('noViewRenderer', true);
     /**
      * Set the session
      */
     $session_name = str_replace(' ', '_', $this->config['name']);
     Zend_Session::start(array('name' => $session_name));
     $this->injector->addAutoProperty('log', $this->logger);
     $__start = getmicrotime();
     // $services = $this->loadDefaultServices();
     $this->injector->addServiceDirectory(NOVEMBER_APP_DIR . '/services');
     // $this->injector->loadServices($this->config['services']);
     $this->recordStat('za::initdefaultservices', getmicrotime() - $__start);
     $__start = getmicrotime();
     //
     //        foreach ($services as $defaultService) {
     //            $this->injector->inject($defaultService);
     //        }
     //
     $this->recordStat('za::initinjectdefaultservices', getmicrotime() - $__start);
     $__start = getmicrotime();
     // Load extensions
     $this->loadExtensions();
     $this->injector->addServiceDirectory(ifset($this->config, 'services_dir', APP_DIR . '/services'));
     $this->recordStat('za::initloadext', getmicrotime() - $__start);
     $__start = getmicrotime();
     $this->injector->loadServices($this->config['services']);
     $this->recordStat('za::initloadservices', getmicrotime() - $__start);
     $__start = getmicrotime();
     // We know that there's definitely going to be an AuthService,
     // so we can now go and load the user if there was one in
     // the session.
     $auth = $this->injector->getService('AuthService');
     if (isset($this->getSession()->CURRENT_USER_TICKET) && mb_strlen($this->getSession()->CURRENT_USER_TICKET)) {
         $auth->validateTicket($this->getSession()->CURRENT_USER_NAME, $this->getSession()->CURRENT_USER_TICKET);
     }
     $this->recordStat('za::initvalidateauth', getmicrotime() - $__start);
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:85,代码来源:NovemberApplication.php


注:本文中的Zend_Controller_Front::setDispatcher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。