本文整理汇总了PHP中Navigation::path_component方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::path_component方法的具体用法?PHP Navigation::path_component怎么用?PHP Navigation::path_component使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::path_component方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: choose_page
function choose_page($page)
{
if ($page !== "" && $page[0] === "~") {
$xpage = Navigation::path_component(0, true);
Navigation::set_path("/" . $page . Navigation::path_suffix(1));
$page = Navigation::set_page($xpage ?: "index");
}
$i = strlen($page) - 4;
if ($i > 0 && substr($page, $i) === ".php") {
$page = substr($page, 0, $i);
}
if ($page === "index") {
return null;
}
if (is_readable($page . ".php") && strpos($page, "/") === false) {
return $page . ".php";
} else {
if (preg_match(',\\A(?:images|scripts|stylesheets)\\z,', $page)) {
$_REQUEST["file"] = $page . Navigation::path();
return "cacheable.php";
} else {
Navigation::redirect_site("index");
}
}
}
示例2:
<?php
// api.php -- HotCRP JSON API access page
// HotCRP and Peteramati are Copyright (c) 2006-2016 Eddie Kohler and others
// See LICENSE for open-source distribution terms
require_once "src/initweb.php";
// backward compatibility
if (!isset($_GET["fn"])) {
if (Navigation::path_component(0)) {
$_GET["fn"] = Navigation::path_component(0);
} else {
if (isset($_GET["jserror"])) {
$_GET["fn"] = "jserror";
} else {
if (isset($_GET["track"])) {
$_GET["fn"] = "track";
} else {
$_GET["fn"] = "deadlines";
}
}
}
}
$qreq = make_qreq();
if ($qreq->base !== null) {
$Conf->set_siteurl($qreq->base);
}
if ($qreq->fn === "jserror") {
$url = $qreq->url;
if (preg_match(',[/=]((?:script|jquery)[^/&;]*[.]js),', $url, $m)) {
$url = $m[1];
}
示例3: isset
}
if (isset($_REQUEST["update"]) && check_post() && !$Me->has_database_account() && $Me->can_start_paper()) {
$Me = $Me->activate_database_account();
}
$useRequest = isset($_REQUEST["after_login"]);
foreach (array("emailNote", "reason") as $x) {
if (isset($_REQUEST[$x]) && $_REQUEST[$x] == "Optional explanation") {
unset($_REQUEST[$x], $_GET[$x], $_POST[$x]);
}
}
if (!isset($_REQUEST["p"]) && !isset($_REQUEST["paperId"]) && preg_match(',\\A(?:new|\\d+)\\z,i', Navigation::path_component(0))) {
$_REQUEST["p"] = $_GET["p"] = Navigation::path_component(0);
if (!isset($_REQUEST["m"]) && ($x = Navigation::path_component(1))) {
$_REQUEST["m"] = $_GET["m"] = $x;
}
if (isset($_REQUEST["m"]) && $_REQUEST["m"] === "api" && !isset($_REQUEST["fn"]) && ($x = Navigation::path_component(2))) {
$_REQUEST["fn"] = $_GET["fn"] = $x;
}
} else {
if (!Navigation::path() && isset($_REQUEST["p"]) && $_REQUEST["p"] && ctype_digit($_REQUEST["p"]) && !check_post()) {
go(selfHref());
}
}
// header
function confHeader()
{
global $paperTable;
$mode = $paperTable ? $paperTable->mode : "p";
PaperTable::do_header($paperTable, "paper_" . ($mode == "edit" ? "edit" : "view"), $mode);
}
function errorMsgExit($msg)
示例4: redirectSelf
if ($Me->privChair && isset($_POST["signout_to_kiosk"]) && check_post()) {
LoginHelper::logout(false);
$Me->change_capability("tracker_kiosk", $kiosk_keys[@$_POST["buzzer_showpapers"] ? 1 : 0]);
redirectSelf();
}
function kiosk_lookup($key)
{
global $Conf, $Now;
$kiosks = (array) ($Conf->setting_json("__tracker_kiosk") ?: array());
if (@$kiosks[$key] && $kiosks[$key]->update_at >= $Now - 604800) {
return $kiosks[$key];
}
return null;
}
$kiosk = null;
if (!$Me->has_email() && !$Me->capability("tracker_kiosk") && ($key = Navigation::path_component(0)) && ($kiosk = kiosk_lookup($key))) {
$Me->change_capability("tracker_kiosk", $key);
} else {
if ($key = $Me->capability("tracker_kiosk")) {
$kiosk = kiosk_lookup($key);
}
}
if ($kiosk) {
$Me->tracker_kiosk_state = $kiosk->show_papers ? 2 : 1;
$show_papers = $kiosk->show_papers;
}
// user
if (!$Me->isPC && !$Me->tracker_kiosk_state) {
$Me->escape();
}
// header and script
示例5:
require_once "lib/navigation.php";
if (!isset($_GET["fn"])) {
if ($fn = Navigation::path_component(0, true)) {
$_GET["fn"] = $fn;
} else {
if (isset($_GET["track"])) {
$_GET["fn"] = "track";
} else {
$_GET["fn"] = "status";
}
}
}
if ($_GET["fn"] === "deadlines") {
$_GET["fn"] = "status";
}
if (!isset($_GET["p"]) && ($p = Navigation::path_component(1, true)) && ctype_digit($p)) {
$_GET["p"] = $p;
}
// trackerstatus is a special case: prevent session creation
global $Me;
if ($_GET["fn"] === "trackerstatus") {
$Me = false;
require_once "src/initweb.php";
MeetingTracker::trackerstatus_api();
exit;
}
// initialization
require_once "src/initweb.php";
$qreq = make_qreq();
if ($qreq->base !== null) {
$Conf->set_siteurl($qreq->base);