本文整理汇总了PHP中templates::render_user_panel方法的典型用法代码示例。如果您正苦于以下问题:PHP templates::render_user_panel方法的具体用法?PHP templates::render_user_panel怎么用?PHP templates::render_user_panel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类templates
的用法示例。
在下文中一共展示了templates::render_user_panel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: microtime
<?php
$exec_start = microtime(true);
if (!defined("WALAFUNT_ENTRY_POINT")) {
exit("This script isn't meant to be run directly.");
}
$params = utils::apply_default_params($_GET, ["language" => "all", "tags" => "all", "sort" => "timestamp", "sort_dir" => "asc", "page" => "1"]);
$tags = array_map("trim", explode(",", $params["tags"]));
if ($params["language"] == "all") {
$params["language"] = "*";
}
if ($params["tags"] == "all") {
$params["tags"] = "*";
}
$offset = ($params["page"] - 1) * $settings->snippets_per_page;
$snippets = sqlite_gateway::query("select * from code_snippets; limit {$settings->snippets_per_page} offset {$offset};");
if ($snippets === false) {
// Make sure that the return of the query is always iterable
$snippets = [];
}
$tag_str = templates::format_tags($tags);
$components = ["{prefix}" => ucwords(($params["tags"] == "*" ? "" : $tags_str . " - ") . ($params["language"] == "*" ? "all snippets" : $params["language"] . " - ")), "{code-snippets-list}" => templates::render_snippets($snippets), "{user-panel}" => templates::render_user_panel(env::$username, env::$role)];
header("x-time-taken: " . (microtime(true) - $exec_start));
echo templates::render_html("main.html", $components);