本文整理汇总了PHP中Presenter::invalidLinkMode方法的典型用法代码示例。如果您正苦于以下问题:PHP Presenter::invalidLinkMode方法的具体用法?PHP Presenter::invalidLinkMode怎么用?PHP Presenter::invalidLinkMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Presenter
的用法示例。
在下文中一共展示了Presenter::invalidLinkMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleInvalidLink
/**
* Invalid link handler. Descendant can override this method to change default behaviour.
* @param InvalidLinkException
* @return string
* @throws InvalidLinkException
*/
protected function handleInvalidLink($e)
{
if (self::$invalidLinkMode === NULL) {
self::$invalidLinkMode = Environment::isProduction() ? self::INVALID_LINK_SILENT : self::INVALID_LINK_WARNING;
}
if (self::$invalidLinkMode === self::INVALID_LINK_SILENT) {
return '#';
} elseif (self::$invalidLinkMode === self::INVALID_LINK_WARNING) {
return 'error: ' . htmlSpecialChars($e->getMessage());
} else {
// self::INVALID_LINK_EXCEPTION
throw $e;
}
}
示例2: die
$loader->register();
/** 2e) load extension methods */
if (is_file(APP_DIR . '/extensions.php')) {
include_once APP_DIR . '/extensions.php';
}
/** 2f) enable DebugBar */
if ($mode == Debug::DEVELOPMENT) {
Debug::$showBar = TRUE;
}
/** 2g) Session setup [optional] */
if (Environment::getVariable('sessionDir') !== NULL && !is_writable(Environment::getVariable('sessionDir'))) {
die("Make directory '" . realpath(Environment::getVariable('sessionDir')) . "' writable!");
}
$session = Environment::getSession();
$session->setSavePath(Environment::getVariable('sessionDir'));
// Step 3: Configure application
/** 3a) Setup Application, ErrorPresenter & exceptions catching */
$application = Environment::getApplication();
Presenter::$invalidLinkMode = Environment::isProduction() ? Presenter::INVALID_LINK_SILENT : Presenter::INVALID_LINK_EXCEPTION;
Environment::setVariable('host', Environment::getHttpRequest()->getUri()->host);
/** 3b) establish database connection and initialize services */
$application->onStartup[] = 'Services::initialize';
$application->onStartup[] = 'BaseModel::initialize';
$application->onShutdown[] = 'BaseModel::disconnect';
// Step 4: Setup application router
$router = $application->getRouter();
$router[] = new Route('index.php', array('presenter' => 'Example', 'action' => 'default'), Route::ONE_WAY);
$router[] = new Route('<presenter>/<action>/', array('presenter' => 'Example', 'action' => 'default'));
$router[] = new SimpleRouter('Example:default');
// Step 5: Run the application!
$application->run();