當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Presenter::invalidLinkMode方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:jakubkulhan,項目名稱:shopaholic,代碼行數:20,代碼來源:Presenter.php

示例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();
開發者ID:romansklenar,項目名稱:nette-datagrid,代碼行數:31,代碼來源:bootstrap.php


注:本文中的Presenter::invalidLinkMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。