本文整理匯總了PHP中Hook::TriggerEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Hook::TriggerEvent方法的具體用法?PHP Hook::TriggerEvent怎麽用?PHP Hook::TriggerEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Hook
的用法示例。
在下文中一共展示了Hook::TriggerEvent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_footer
function get_footer()
{
Hook::TriggerEvent(Hook::GENERATE_FOOTER);
}
示例2: Exception
}
}
throw new Exception("Load {$name} failed.");
});
// 加載輔助函數
include_once LIB_DIR . "/password.php";
include_once CLASSES_DIR . "/functions.php";
include_once CLASSES_DIR . "/setup_env.php";
setup_encoding();
define('BLOG_URL', get_app_url());
// load plugins
foreach (glob(APP_DIR . "/plugins/*/main.php") as $filename) {
include $filename;
}
// 全局的配置
$config = new Config(DATA_DIR . '/config.php');
setup_default_config();
// 配置完成
Hook::TriggerEvent(Hook::CONFIG_COMPLETE, array($config));
// 使用配置來設置環境
setup_env_by_config();
$postHelper = new FilePostHelper(CACHE_DIR . '/post.meta');
$tellets = new Tellets();
// 添加預定義動作
include_once CLASSES_DIR . '/predefined_hooks.php';
// 添加預定義解析器
ParserFactory::RegisterParser(MarkdownParser::EXTENSION, 'MarkdownParser');
ParserFactory::RegisterParser(HTMLParser::EXTENSION, 'HTMLParser');
// 啟動完成
Hook::TriggerEvent(Hook::BOOTSTRAP, array());
示例3: session_start
<?php
session_start();
require_once __DIR__ . '/app/bootstrap.php';
if (false === isset($config['password'])) {
goto FIRST_RUN;
}
$request = new Request(@$_GET['params']);
Hook::TriggerEvent(Hook::RESOLVE_REQUEST, array($request));
function renderContext()
{
global $request, $config, $postHelper;
$post = $request->getSinglePost();
$posts = $request->getPosts();
$configt =& $config[Config::NS_TEMPLATE];
$configp =& $config[Config::NS_PLUGINS];
// display
if ($posts) {
if ($request->isHome()) {
include TEMPLATE_DIR . '/index.php';
} else {
include TEMPLATE_DIR . '/posts.php';
}
} elseif ($post) {
include TEMPLATE_DIR . '/post.php';
} else {
include TEMPLATE_DIR . '/message.php';
}
}
renderContext();
exit;
示例4: resolvePost
public function resolvePost($name)
{
/**
* @var Post
*/
$post = NULL;
Hook::TriggerEvent(Hook::RESOLVE_POST, array(&$post, $name));
return $post;
}