当前位置: 首页>>代码示例>>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;未经允许,请勿转载。