本文整理汇总了PHP中Zend_Controller_Front::throwExceptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Front::throwExceptions方法的具体用法?PHP Zend_Controller_Front::throwExceptions怎么用?PHP Zend_Controller_Front::throwExceptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Front
的用法示例。
在下文中一共展示了Zend_Controller_Front::throwExceptions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initErrorReporting
private function _initErrorReporting()
{
Zend_SetupInit::initErrorReporting();
// set the test environment parameters
if (('local' | 'development') === Zend_SetupInit::$_env) {
$this->_front->throwExceptions(true);
}
}
示例2: _initPlugins
/**
* 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: setDebugMode
/**
* 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: __construct
/**
* 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: _route
/**
* 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: __construct
/**
* 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: 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);
}
示例8: setBootstrap
public function setBootstrap($bootstrap)
{
$this->bootstrap = $bootstrap;
$this->front = $this->bootstrap->getBootstrap()->getResource('frontcontroller');
$this->front->throwExceptions(true)->returnResponse(false);
}
示例9: setBootstrap
public function setBootstrap($bootstrap)
{
$this->bootstrap = $bootstrap;
$this->front = $this->bootstrap->getBootstrap()->getContainer()->frontcontroller;
$this->front->throwExceptions(false)->returnResponse(false);
}