当前位置: 首页>>代码示例>>PHP>>正文


PHP Hook::trigger方法代码示例

本文整理汇总了PHP中Hook::trigger方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::trigger方法的具体用法?PHP Hook::trigger怎么用?PHP Hook::trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hook的用法示例。


在下文中一共展示了Hook::trigger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: route

 public static function route($uri)
 {
     self::_loadModules();
     Hook::trigger(__CLASS__, 'preDispatch', array('uri' => $uri));
     $parsed = parse_url($uri);
     $parts = explode('/', substr($parsed['path'], 1));
     Controller::route($parts);
     //        $routeName = str_replace('/', '_', substr($parsed['path'], 1));
     //        print_r($routeName); exit;
     //
     //        print_r($_GET); exit;
     switch ($parts[0]) {
         case 'page':
             self::routePage($parts);
             break;
     }
 }
开发者ID:natewilliford,项目名称:cmsexp,代码行数:17,代码来源:Application.php

示例2: startup

$autoloader->init();
/* get instance */
$registry = Registry::getInstance();
$request = Request::getInstance();
$config = Config::getInstance();
/* request and config */
$request->init();
$config->init();
/* database */
Db::construct($config);
Db::init();
/* startup and registry */
startup();
$registry->init();
/* refresh */
$request->refreshSession();
/* detector */
$detectorLanguage = new Detector\Language($registry, $request);
$detectorTemplate = new Detector\Template($registry, $request);
/* set language and template */
$registry->set('language', $detectorLanguage->getOutput());
$registry->set('template', $detectorTemplate->getOutput());
/* language */
$language = Language::getInstance();
$language->init($registry->get('language'));
/* hook */
if ($registry->get('dbStatus') === 2) {
    Hook::construct($registry);
    Hook::init();
    Hook::trigger('init');
}
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:31,代码来源:bootstrap.php

示例3: renderPage

 public function renderPage(Page $page)
 {
     $rendered = false;
     $cacheId = 'page-' . static::$DI['Request']->getRoute();
     if (empty($page->nocache)) {
         $rendered = static::$DI['Cache\\PageCache']->get($cacheId);
     }
     if (false === $rendered) {
         $content = new \stdClass();
         $content->string = '';
         try {
             if (empty($page->layout)) {
                 $content = $page->getSegment(0);
                 $content->string = Hook::trigger(Hook::FILTER, 'renderContent', $content->string, $page->getData());
             } else {
                 $content->string = Hook::trigger(Hook::FILTER, 'renderLayout', $page);
             }
         } catch (\Exception $e) {
             $page->setError($e);
             $content->string = Hook::trigger(Hook::FILTER, 'renderLayout', $page);
         }
         if (empty($page->nocache)) {
             static::$DI['Cache\\PageCache']->set($cacheId, $content->string);
         }
         $rendered = $content->string;
     }
     $response = new Http\Response($rendered);
     $response->setStatus($page->getStatusCode());
     $response->setHeader('Content-Type', $page->content_type);
     return $response;
 }
开发者ID:getherbie,项目名称:herbie,代码行数:31,代码来源:Application.php

示例4: header

include_once 'includes/bootstrap.php';
/* get instance */
$registry = Registry::getInstance();
/* redirect to install */
if ($registry->get('dbStatus') < 2 && file_exists('install.php')) {
    header('location: install.php');
    exit;
}
/* render */
Hook::trigger('renderStart');
if ($registry->get('renderBreak')) {
    return;
}
if ($registry->get('routerBreak')) {
    $registry->set('contentError', false);
}
if ($registry->get('contentError')) {
    header('http/1.0 404 not found');
}
/* template */
$template = Hook::collect('renderTemplate');
if (array_key_exists('header', $template)) {
    header($template['header']);
}
if (array_key_exists('content', $template)) {
    echo $template['content'];
} else {
    include_once 'templates/' . $registry->get('template') . '/index.phtml';
}
Hook::trigger('renderEnd');
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:30,代码来源:index.php

示例5: render

 /**
  * render
  *
  * @since 3.0.0
  *
  * @param string $type type of the flash
  * @param mixed $message message of the flash
  * @param string $title title of the flash
  *
  * @return string
  */
 public function render($type = null, $message = null, $title = null)
 {
     $output = Hook::trigger('messengerStart');
     $outputItem = null;
     /* html elements */
     if ($title) {
         $titleElement = new Html\Element();
         $titleElement->init('h2', ['class' => $this->_optionArray['className']['title'] . ' ' . $this->_optionArray['className']['notes'][$type]])->text($title);
     }
     $boxElement = new Html\Element();
     $boxElement->init('div', ['class' => $this->_optionArray['className']['box'] . ' ' . $this->_optionArray['className']['notes'][$type]]);
     /* create a list */
     if (is_array($message) && count($message) > 1) {
         $listElement = new Html\Element();
         $listElement->init('ul', ['class' => $this->_optionArray['className']['list']]);
         /* collect item output */
         foreach ($message as $value) {
             $outputItem .= '<li>' . $value . '</li>';
         }
         $boxElement->html($listElement->html($outputItem));
     } else {
         $boxElement->html(array_key_exists(0, $message) ? $message[0] : $message);
     }
     /* collect output */
     $output .= $titleElement . $boxElement . $this->_renderAction($type);
     $output .= Hook::trigger('messengerEnd');
     return $output;
 }
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:39,代码来源:Messenger.php


注:本文中的Hook::trigger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。