本文整理汇总了PHP中Hooks::addAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Hooks::addAction方法的具体用法?PHP Hooks::addAction怎么用?PHP Hooks::addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hooks
的用法示例。
在下文中一共展示了Hooks::addAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
\Hooks::addAction("head.begin,admin.head.begin", function () {
?>
<script>
window.tmp = {};
window.lobbyExtra = {
url: "<?php
echo L_URL;
?>
",
csrfToken: "<?php
echo CSRF::get();
?>
",
sysInfo: {
os: "<?php
echo \Lobby::getSysInfo("os");
?>
"
}
};
<?php
if (\Lobby\Apps::isAppRunning()) {
echo 'window.lobbyExtra["app"] = {
id: "' . \Lobby\Apps::getInfo("id") . '",
url: "' . \Lobby\Apps::getInfo("url") . '",
src: "' . \Lobby\Apps::getInfo("srcURL") . '"
};';
}
?>
</script>
<?php
});
示例2: loadTheme
/**
* Load a theme
*/
public static function loadTheme()
{
require_once self::$dir . "/Theme.php";
$className = "\\Lobby\\UI\\Themes\\" . self::$themeID;
self::$theme = new $className(self::$themeID, self::$dir);
self::$theme->init();
self::$theme->addStyle("/src/main/css/style.css");
self::$theme->addStyle("/src/main/css/icons.css");
/**
* Load Panel
*/
if (\Lobby::status("lobby.admin")) {
Hooks::addAction("admin.head.begin", function () {
self::$theme->panel(true);
self::$theme->addStyle("/src/main/css/admin.style.css");
});
\Hooks::addAction("admin.body.begin", function () {
echo self::$theme->inc("/src/panel/load.admin.php");
});
} else {
\Hooks::addAction("head.begin", function () {
self::$theme->panel(false);
});
\Hooks::addAction("body.begin", function () {
echo self::$theme->inc("/src/panel/load.php");
});
}
}