コード例 #1
0
ファイル: Initializer.php プロジェクト: baphled/boodah
 private function _initErrorReporting()
 {
     Zend_SetupInit::initErrorReporting();
     // set the test environment parameters
     if (('local' | 'development') === Zend_SetupInit::$_env) {
         $this->_front->throwExceptions(true);
     }
 }
コード例 #2
0
ファイル: Bootstrap.php プロジェクト: KasaiDot/FansubCMS
 /**
  * init plugins
  * @return void
  */
 protected function _initPlugins()
 {
     # only embed the debugging plugin if application status is development or testing
     if ($this->applicationStatus == "development") {
         # embed the ZFDebug Plugin/console
         $debug = new ZFDebug_Controller_Plugin_Debug(array('jquery_path' => '', 'plugins' => array('Variables', 'File' => array('basePath' => APPLICATION_PATH), 'Memory', 'Time', 'Html', 'Exception')));
         $this->frontController->registerPlugin($debug);
     }
     # init error handler
     $this->frontController->throwExceptions(false);
     $errorhandler = new Zend_Controller_Plugin_ErrorHandler();
     $errorhandler->setErrorHandler(array('module' => 'cms', 'controller' => 'error', 'action' => 'error'));
     $this->frontController->registerPlugin($errorhandler);
     # gadget plugin
     $gadgetPlugin = new FansubCMS_Controller_Plugin_Gadget();
     $this->frontController->registerPlugin($gadgetPlugin);
     # not-logged-in-so-go-to-login plugin
     $aclPlugin = new FansubCMS_Controller_Plugin_Acl(Zend_Auth::getInstance()->setStorage(new FansubCMS_Auth_Storage_DoctrineSession()));
     $this->frontController->registerPlugin($aclPlugin);
     # check if install or update is needed
     $installPlugin = new FansubCMS_Controller_Plugin_InstallCheck();
     $this->frontController->registerPlugin($installPlugin);
     # the navigation plugin
     $navPlugin = new FansubCMS_Controller_Plugin_Navigation();
     $this->frontController->registerPlugin($navPlugin);
 }
コード例 #3
0
ファイル: Bootstrapper.php プロジェクト: Cryde/sydney-core
 /**
  * Show debug info (to supress in prod)
  */
 public function setDebugMode()
 {
     if ($this->config->general->env != 'PROD') {
         if ($this->config->general->env != 'CMD' && is_object($this->frontController)) {
             $this->frontController->throwExceptions(true);
         }
         $this->debug = true;
     }
 }
コード例 #4
0
 /**
  * Constructor
  *
  * Initialize environment, root path, and configuration.
  * 
  * @param  string $env 
  * @param  string|null $root 
  * @return void
  */
 public function __construct($env, $root = null)
 {
     $this->_setEnv($env);
     if (null === $root) {
         $root = realpath(dirname(__FILE__) . '/../');
     }
     $this->_root = $root;
     $this->initPhpConfig();
     $this->_front = Zend_Controller_Front::getInstance();
     // set the test environment parameters
     if ($env == 'test') {
         // Enable all errors so we'll know when something goes wrong.
         error_reporting(E_ALL | E_STRICT);
         ini_set('display_startup_errors', 1);
         ini_set('display_errors', 1);
         $this->_front->throwExceptions(true);
     }
 }
コード例 #5
0
ファイル: App.php プロジェクト: riteshsahu1981/Weadvance
 /**
  * Same route function in Zend_Controller_Front::dispatch().
  * It updates the request with routes and sends a message to
  * Zend_Controller_Front. This is processed in dispatch().
  * 
  * @param Zend_Controller_Request_Abstract $request
  */
 private function _route(Zend_Controller_Request_Abstract $request)
 {
     try {
         $this->_router->route($request);
     } catch (Exception $e) {
         if ($this->_front->throwExceptions()) {
             throw $e;
         }
     }
 }
コード例 #6
0
ファイル: Initializer.php プロジェクト: ajbrown/bitnotion
 /**
  * Constructor
  *
  * Initialize environment, root path, and configuration.
  *
  * @param  string $env
  * @param  string|null $root
  * @return void
  */
 public function __construct($env, $root = null)
 {
     $this->_setEnv($env);
     if (null === $root) {
         $root = realpath(dirname(__FILE__) . '/../');
     }
     $this->_root = $root;
     $this->initPhpConfig();
     $this->_front = Zend_Controller_Front::getInstance();
     date_default_timezone_set('UTC');
     // set the test environment parameters
     if (true || $env == 'test') {
         // Enable all errors so we'll know when something goes wrong.
         error_reporting(E_ALL | E_STRICT);
         ini_set('display_startup_errors', 1);
         ini_set('display_errors', 1);
         $this->_front->throwExceptions(true);
     }
     $configFile = dirname(__FILE__) . '/config.xml';
     require_once 'Zend/Config/Xml.php';
     self::$_config = new Zend_Config_Xml($configFile, $this->_env);
     require_once 'Zend/Registry.php';
     Zend_Registry::set('Config', self::$_config);
 }
コード例 #7
0
 /**
  * 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);
 }
コード例 #8
0
ファイル: ZF1.php プロジェクト: kansey/yii2albom
 public function setBootstrap($bootstrap)
 {
     $this->bootstrap = $bootstrap;
     $this->front = $this->bootstrap->getBootstrap()->getResource('frontcontroller');
     $this->front->throwExceptions(true)->returnResponse(false);
 }
コード例 #9
0
ファイル: SocialEngine.php プロジェクト: itillawarra/cmfive
 public function setBootstrap($bootstrap)
 {
     $this->bootstrap = $bootstrap;
     $this->front = $this->bootstrap->getBootstrap()->getContainer()->frontcontroller;
     $this->front->throwExceptions(false)->returnResponse(false);
 }