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


PHP Zibo::triggerEvent方法代碼示例

本文整理匯總了PHP中zibo\core\Zibo::triggerEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zibo::triggerEvent方法的具體用法?PHP Zibo::triggerEvent怎麽用?PHP Zibo::triggerEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zibo\core\Zibo的用法示例。


在下文中一共展示了Zibo::triggerEvent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dispatch

 /**
  * Dispatches a request to the action of a controller
  * @param Request $request The request to dispatch
  * @param Response $response The response to dispatch the request to
  * @return mixed The return value of the action
  * @throws zibo\ZiboException when the action is not invokable
  */
 public function dispatch(Request $request, Response $response)
 {
     $controller = $this->getController($request);
     $actionName = $request->getActionName();
     $parameters = $request->getParameters();
     $callback = $this->processAction($controller, $actionName, $parameters);
     $this->prepareController($controller, $request, $response, $actionName, $parameters);
     $this->zibo->triggerEvent(self::EVENT_PRE_DISPATCH, $controller, $actionName, $parameters);
     $controller->preAction();
     $returnValue = $callback->invokeWithArrayArguments($parameters);
     $controller->postAction();
     $this->zibo->triggerEvent(self::EVENT_POST_DISPATCH, $controller, $actionName, $parameters);
     return $returnValue;
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:21,代碼來源:GenericDispatcher.php

示例2: Zibo

    $zibo = new Zibo($fileBrowser, $configIO);
    $zibo->setEnvironment($environment);
    $zibo->setDefaultTimeZone('Europe/Brussels');
    $zibo->setDefaultLocale(array('en_IE.utf8', 'en_IE', 'en'));
    // run Zibo
    $zibo->bootModules();
    $zibo->main();
} catch (Exception $exception) {
    // uncaught exception
    $class = get_class($exception);
    $message = $exception->getMessage();
    $trace = $exception->getTraceAsString();
    // try to log the exception
    try {
        if (isset($zibo)) {
            $zibo->triggerEvent(Zibo::EVENT_LOG, $class . ($message ? ': ' . $message : ''), $trace);
        }
    } catch (Exception $e) {
    }
    $title = 'Uncaught exception (' . $class . ')' . ($message ? ': ' . $message : '');
    if (php_sapi_name() == 'cli') {
        echo "\n" . $title . "\n\n" . $trace;
        exit;
    }
    $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
    header($protocol . ' 500');
    echo '<div style="background-color: #fdf5d9; padding: 14px; border: 1px solid #fceec1; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; color: #404040; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);">';
    echo '<strong>' . $title . '</strong>';
    echo '<pre>' . $trace . '</pre>';
    echo '</div>';
}
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:31,代碼來源:index.php

示例3: testTriggerEventThrowsExceptionWhenSystemEventNameIsPassed

 /**
  * @expectedException zibo\ZiboException
  */
 public function testTriggerEventThrowsExceptionWhenSystemEventNameIsPassed()
 {
     $zibo = new Zibo($this->getBrowserMock(), $this->getConfigIOMock());
     $zibo->triggerEvent(Zibo::EVENT_PRE_ROUTE);
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:8,代碼來源:ZiboTest.php

示例4: loadConnectionsFromConfig

 /**
  * Loads the database connections from the Zibo configuration
  * @param zibo\core\Zibo $zibo Instance of Zibo
  * @return null
  * @throws zibo\library\database\exception\DatabaseException when the configuration contains an invalid connection
  * @throws zibo\library\database\exception\DatabaseException when the default connection does not exist
  */
 private function loadConnectionsFromConfig(Zibo $zibo)
 {
     $zibo->triggerEvent(Zibo::EVENT_LOG, 'Loading database connections', '', 0, self::LOG_NAME);
     $connections = $zibo->getConfigValue(self::CONFIG_CONNECTION, array());
     if (!is_array($connections)) {
         $connections = array(self::NAME_DEFAULT => $connections);
     }
     $defaultConnectionName = null;
     foreach ($connections as $name => $dsn) {
         if ($name == self::NAME_DEFAULT) {
             $defaultConnectionName = $name;
         }
         try {
             $dsn = new Dsn($dsn);
             $this->registerConnection($name, $dsn);
         } catch (DatabaseException $e) {
             if ($name == self::NAME_DEFAULT) {
                 $defaultConnectionName = $dsn;
             } else {
                 throw $e;
             }
         }
     }
     if ($defaultConnectionName != null) {
         $this->setDefaultConnectionName($defaultConnectionName);
     }
 }
開發者ID:BGCX261,項目名稱:zibo-svn-to-git,代碼行數:34,代碼來源:DatabaseManager.php


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