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


PHP Navigation::site_absolute方法代码示例

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


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

示例1: init

 static function init()
 {
     global $Opt;
     $confid = @$Opt["confid"];
     if (!$confid && PHP_SAPI == "cli") {
         $cliopt = getopt("n:", array("name:"));
         if (@$cliopt["n"]) {
             $confid = $cliopt["n"];
         } else {
             if (@$cliopt["name"]) {
                 $confid = $cliopt["name"];
             }
         }
     } else {
         if (!$confid) {
             $base = Navigation::site_absolute(true);
             if ($multis = @$Opt["multiconferenceAnalyzer"]) {
                 foreach (is_array($multis) ? $multis : array($multis) as $multi) {
                     list($match, $replace) = explode(" ", $multi);
                     if (preg_match("`\\A{$match}`", $base, $m)) {
                         $confid = $replace;
                         for ($i = 1; $i < count($m); ++$i) {
                             $confid = str_replace("\${$i}", $m[$i], $confid);
                         }
                         break;
                     }
                 }
             } else {
                 if (preg_match(',/([^/]+)/\\z,', $base, $m)) {
                     $confid = $m[1];
                 }
             }
         }
     }
     if (!@$confid) {
         $confid = "__nonexistent__";
     } else {
         if (!preg_match(',\\A[-a-zA-Z0-9_][-a-zA-Z0-9_.]*\\z,', $confid)) {
             $confid = "__invalid__";
         }
     }
     foreach (array("dbName", "dbUser", "dbPassword", "dsn") as $k) {
         if (isset($Opt[$k]) && is_string($Opt[$k])) {
             $Opt[$k] = preg_replace(',\\*|\\$\\{conf(?:id|name)\\}|\\$conf(?:id|name)\\b,', $confid, $Opt[$k]);
         }
     }
     if (!@$Opt["dbName"] && !@$Opt["dsn"]) {
         $Opt["dbName"] = $confid;
     }
     $Opt["confid"] = $confid;
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:51,代码来源:multiconference.php

示例2: init

 static function init()
 {
     global $Opt;
     assert(self::$original_opt === null);
     self::$original_opt = $Opt;
     $confid = get($Opt, "confid");
     if (!$confid && PHP_SAPI == "cli") {
         $cliopt = getopt("n:", array("name:"));
         if (get($cliopt, "n")) {
             $confid = $cliopt["n"];
         } else {
             if (get($cliopt, "name")) {
                 $confid = $cliopt["name"];
             }
         }
     } else {
         if (!$confid) {
             $base = Navigation::site_absolute(true);
             if ($multis = get($Opt, "multiconferenceAnalyzer")) {
                 foreach (is_array($multis) ? $multis : array($multis) as $multi) {
                     list($match, $replace) = explode(" ", $multi);
                     if (preg_match("`\\A{$match}`", $base, $m)) {
                         $confid = $replace;
                         for ($i = 1; $i < count($m); ++$i) {
                             $confid = str_replace("\${$i}", $m[$i], $confid);
                         }
                         break;
                     }
                 }
             } else {
                 if (preg_match(',/([^/]+)/\\z,', $base, $m)) {
                     $confid = $m[1];
                 }
             }
         }
     }
     if (!$confid) {
         $confid = "__nonexistent__";
     } else {
         if (!preg_match(',\\A[-a-zA-Z0-9_][-a-zA-Z0-9_.]*\\z,', $confid)) {
             $confid = "__invalid__";
         }
     }
     self::assign_confid($Opt, $confid);
 }
开发者ID:kohler,项目名称:peteramati,代码行数:45,代码来源:multiconference.php

示例3: crosscheck_options

 private function crosscheck_options()
 {
     global $Opt, $ConfSitePATH;
     // set longName, downloadPrefix, etc.
     $confid = $Opt["confid"];
     if ((!isset($Opt["longName"]) || $Opt["longName"] == "") && (!isset($Opt["shortName"]) || $Opt["shortName"] == "")) {
         $Opt["shortNameDefaulted"] = true;
         $Opt["longName"] = $Opt["shortName"] = $confid;
     } else {
         if (!isset($Opt["longName"]) || $Opt["longName"] == "") {
             $Opt["longName"] = $Opt["shortName"];
         } else {
             if (!isset($Opt["shortName"]) || $Opt["shortName"] == "") {
                 $Opt["shortName"] = $Opt["longName"];
             }
         }
     }
     if (!isset($Opt["downloadPrefix"]) || $Opt["downloadPrefix"] == "") {
         $Opt["downloadPrefix"] = $confid . "-";
     }
     self::$gShortName = $Opt["shortName"];
     self::$gLongName = $Opt["longName"];
     // expand ${confid}, ${confshortname}
     foreach (array("sessionName", "downloadPrefix", "conferenceSite", "paperSite", "defaultPaperSite", "contactName", "contactEmail", "docstore") as $k) {
         if (isset($Opt[$k]) && is_string($Opt[$k]) && strpos($Opt[$k], "\$") !== false) {
             $Opt[$k] = preg_replace(',\\$\\{confid\\}|\\$confid\\b,', $confid, $Opt[$k]);
             $Opt[$k] = preg_replace(',\\$\\{confshortname\\}|\\$confshortname\\b,', $Opt["shortName"], $Opt[$k]);
         }
     }
     foreach (array("emailFrom", "emailSender", "emailCc", "emailReplyTo") as $k) {
         if (isset($Opt[$k]) && is_string($Opt[$k]) && strpos($Opt[$k], "\$") !== false) {
             $Opt[$k] = preg_replace(',\\$\\{confid\\}|\\$confid\\b,', $confid, $Opt[$k]);
             if (strpos($Opt[$k], "confshortname") !== false) {
                 $v = rfc2822_words_quote($Opt["shortName"]);
                 if ($v[0] === "\"" && strpos($Opt[$k], "\"") !== false) {
                     $v = substr($v, 1, strlen($v) - 2);
                 }
                 $Opt[$k] = preg_replace(',\\$\\{confshortname\\}|\\$confshortname\\b,', $v, $Opt[$k]);
             }
         }
     }
     // remove final slash from $Opt["paperSite"]
     if (!isset($Opt["paperSite"]) || $Opt["paperSite"] == "") {
         $Opt["paperSite"] = Navigation::site_absolute();
     }
     if ($Opt["paperSite"] == "" && isset($Opt["defaultPaperSite"])) {
         $Opt["paperSite"] = $Opt["defaultPaperSite"];
     }
     $Opt["paperSite"] = preg_replace('|/+\\z|', "", $Opt["paperSite"]);
     // option name updates (backwards compatibility)
     foreach (array("assetsURL" => "assetsUrl", "jqueryURL" => "jqueryUrl", "jqueryCDN" => "jqueryCdn", "disableCSV" => "disableCsv") as $kold => $knew) {
         if (isset($Opt[$kold]) && !isset($Opt[$knew])) {
             $Opt[$knew] = $Opt[$kold];
         }
     }
     // set assetsUrl and scriptAssetsUrl
     if (!isset($Opt["scriptAssetsUrl"]) && isset($_SERVER["HTTP_USER_AGENT"]) && strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false) {
         $Opt["scriptAssetsUrl"] = Navigation::siteurl();
     }
     if (!isset($Opt["assetsUrl"])) {
         $Opt["assetsUrl"] = Navigation::siteurl();
     }
     if ($Opt["assetsUrl"] !== "" && !str_ends_with($Opt["assetsUrl"], "/")) {
         $Opt["assetsUrl"] .= "/";
     }
     if (!isset($Opt["scriptAssetsUrl"])) {
         $Opt["scriptAssetsUrl"] = $Opt["assetsUrl"];
     }
     Ht::$img_base = $Opt["assetsUrl"] . "images/";
     // set docstore
     if (get($Opt, "docstore") === true) {
         $Opt["docstore"] = "docs";
     } else {
         if (!get($Opt, "docstore") && get($Opt, "filestore")) {
             // backwards compat
             if (($Opt["docstore"] = $Opt["filestore"]) === true) {
                 $Opt["docstore"] = "filestore";
             }
             $Opt["docstoreSubdir"] = get($Opt, "filestoreSubdir");
         }
     }
     if (get($Opt, "docstore") && $Opt["docstore"][0] !== "/") {
         $Opt["docstore"] = $ConfSitePATH . "/" . $Opt["docstore"];
     }
     // handle timezone
     if (function_exists("date_default_timezone_set")) {
         if (isset($Opt["timezone"])) {
             if (!date_default_timezone_set($Opt["timezone"])) {
                 self::msg_error("Timezone option “" . htmlspecialchars($Opt["timezone"]) . "” is invalid; falling back to “America/New_York”.");
                 date_default_timezone_set("America/New_York");
             }
         } else {
             if (!ini_get("date.timezone") && !getenv("TZ")) {
                 date_default_timezone_set("America/New_York");
             }
         }
     }
     // set safePasswords
     if (!get($Opt, "safePasswords") || is_int($Opt["safePasswords"]) && $Opt["safePasswords"] < 1) {
         $Opt["safePasswords"] = 0;
//.........这里部分代码省略.........
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:101,代码来源:conference.php

示例4: contact_tracker_comet

 static function contact_tracker_comet($pids = null)
 {
     global $Opt, $Now;
     $comet_dir = get($Opt, "trackerCometUpdateDirectory");
     $comet_url = get($Opt, "trackerCometSite");
     if (!$comet_dir && !$comet_url) {
         return;
     }
     // calculate status
     $conference = Navigation::site_absolute();
     $tracker = self::lookup();
     // first drop notification json in trackerCometUpdateDirectory
     if ($comet_dir) {
         $j = array("ok" => true, "conference" => $conference, "tracker_status" => self::tracker_status($tracker), "tracker_status_at" => $tracker->position_at);
         if ($pids) {
             $j["pulse"] = true;
         }
         if (!str_ends_with($comet_dir, "/")) {
             $comet_dir .= "/";
         }
         $suffix = "";
         $count = 0;
         while (($f = @fopen($comet_dir . $Now . $suffix, "x")) === false && $count < 20) {
             $suffix = "x" . mt_rand(0, 65535);
             ++$count;
         }
         if ($f !== false) {
             fwrite($f, json_encode($j));
             fclose($f);
             return;
         } else {
             trigger_error("{$comet_dir} not writable", E_USER_WARNING);
         }
     }
     // second contact trackerCometSite
     if (!$comet_url) {
         return;
     }
     if (!preg_match(',\\Ahttps?:,', $comet_url)) {
         preg_match(',\\A(.*:)(//[^/]*),', $conference, $m);
         if ($comet_url[0] !== "/") {
             $comet_url = "/" . $comet_url;
         }
         if (preg_match(',\\A//,', $comet_url)) {
             $comet_url = $m[1] . $comet_url;
         } else {
             $comet_url = $m[1] . $m[2] . $comet_url;
         }
     }
     if (!str_ends_with($comet_url, "/")) {
         $comet_url .= "/";
     }
     $context = stream_context_create(array("http" => array("method" => "GET", "ignore_errors" => true, "content" => "", "timeout" => 1.0)));
     $comet_url .= "update?conference=" . urlencode($conference) . "&tracker_status=" . urlencode(self::tracker_status($tracker)) . "&tracker_status_at=" . $tracker->position_at;
     if ($pids) {
         $comet_url .= "&pulse=1";
     }
     $stream = @fopen($comet_url, "r", false, $context);
     if (!$stream) {
         $e = error_get_last();
         error_log($comet_url . ": " . $e["message"]);
         return false;
     }
     if (!($data = stream_get_contents($stream)) || !($data = json_decode($data))) {
         error_log($comet_url . ": read failure");
     }
     fclose($stream);
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:68,代码来源:meetingtracker.php

示例5: crosscheck_options

 private function crosscheck_options()
 {
     global $Opt, $ConfSiteBase;
     // set longName, downloadPrefix, etc.
     $confid = $Opt["confid"];
     if ((!isset($Opt["longName"]) || $Opt["longName"] == "") && (!isset($Opt["shortName"]) || $Opt["shortName"] == "")) {
         $Opt["shortNameDefaulted"] = true;
         $Opt["longName"] = $Opt["shortName"] = $confid;
     } else {
         if (!isset($Opt["longName"]) || $Opt["longName"] == "") {
             $Opt["longName"] = $Opt["shortName"];
         } else {
             if (!isset($Opt["shortName"]) || $Opt["shortName"] == "") {
                 $Opt["shortName"] = $Opt["longName"];
             }
         }
     }
     if (!isset($Opt["downloadPrefix"]) || $Opt["downloadPrefix"] == "") {
         $Opt["downloadPrefix"] = $confid . "-";
     }
     // expand ${confid}, ${confshortname}
     foreach (array("sessionName", "downloadPrefix", "conferenceSite", "paperSite", "defaultPaperSite", "contactName", "contactEmail", "emailFrom", "emailSender", "emailCc", "emailReplyTo") as $k) {
         if (isset($Opt[$k]) && is_string($Opt[$k]) && strpos($Opt[$k], "\$") !== false) {
             $Opt[$k] = preg_replace(',\\$\\{confid\\}|\\$confid\\b,', $confid, $Opt[$k]);
             $Opt[$k] = preg_replace(',\\$\\{confshortname\\}|\\$confshortname\\b,', $Opt["shortName"], $Opt[$k]);
         }
     }
     // remove final slash from $Opt["paperSite"]
     if (!isset($Opt["paperSite"]) || $Opt["paperSite"] == "") {
         $Opt["paperSite"] = Navigation::site_absolute();
     }
     if ($Opt["paperSite"] == "" && isset($Opt["defaultPaperSite"])) {
         $Opt["paperSite"] = $Opt["defaultPaperSite"];
     }
     $Opt["paperSite"] = preg_replace('|/+\\z|', "", $Opt["paperSite"]);
     // set assetsUrl and scriptAssetsUrl
     if (!isset($Opt["scriptAssetsUrl"]) && isset($_SERVER["HTTP_USER_AGENT"]) && strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false) {
         $Opt["scriptAssetsUrl"] = $ConfSiteBase;
     }
     if (!isset($Opt["assetsUrl"])) {
         $Opt["assetsUrl"] = $ConfSiteBase;
     }
     if ($Opt["assetsUrl"] !== "" && !str_ends_with($Opt["assetsUrl"], "/")) {
         $Opt["assetsUrl"] .= "/";
     }
     if (!isset($Opt["scriptAssetsUrl"])) {
         $Opt["scriptAssetsUrl"] = $Opt["assetsUrl"];
     }
     Ht::$img_base = $Opt["assetsUrl"] . "images/";
     // set docstore from filestore
     if (@$Opt["docstore"] === true) {
         $Opt["docstore"] = "docs";
     } else {
         if (!@$Opt["docstore"] && @$Opt["filestore"]) {
             if (($Opt["docstore"] = $Opt["filestore"]) === true) {
                 $Opt["docstore"] = "filestore";
             }
             $Opt["docstoreSubdir"] = @$Opt["filestoreSubdir"];
         }
     }
     // handle timezone
     if (function_exists("date_default_timezone_set")) {
         if (isset($Opt["timezone"])) {
             if (!date_default_timezone_set($Opt["timezone"])) {
                 $this->errorMsg("Timezone option “" . htmlspecialchars($Opt["timezone"]) . "” is invalid; falling back to “America/New_York”.");
                 date_default_timezone_set("America/New_York");
             }
         } else {
             if (!ini_get("date.timezone") && !getenv("TZ")) {
                 date_default_timezone_set("America/New_York");
             }
         }
     }
     // set safePasswords
     if (!@$Opt["safePasswords"] || is_int($Opt["safePasswords"]) && $Opt["safePasswords"] < 1) {
         $Opt["safePasswords"] = 0;
     } else {
         if ($Opt["safePasswords"] === true) {
             $Opt["safePasswords"] = 1;
         }
     }
 }
开发者ID:benesch,项目名称:peteramati,代码行数:82,代码来源:conference.php


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