本文整理汇总了PHP中KTUtil::getServerName方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::getServerName方法的具体用法?PHP KTUtil::getServerName怎么用?PHP KTUtil::getServerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::getServerName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: KTDownloadManager
/**
* Constructor for the download manager.
*
* @param KTAPI_Session $session
* @return KTDownloadManager
*/
function KTDownloadManager()
{
$config =& KTConfig::getSingleton();
$this->age = $config->get('webservice/downloadExpiry', 5);
$protocol = $config->get('KnowledgeTree/sslEnabled') ? 'https' : 'http';
$server = KTUtil::getServerName(TRUE);
$url = $config->get('webservice/downloadUrl');
$this->download_url = $protocol . '://' . $server . $url;
$this->random = $config->get('webservice/randomKeyText', 'jhsdf8q1jkjpoiudfs7sd3ds1');
}
示例2: getDynamicConfigSettings
function getDynamicConfigSettings()
{
$oKTConfig =& KTConfig::getSingleton();
// Override the config setting - KT_DIR is resolved on page load
$oKTConfig->setdefaultns('KnowledgeTree', 'fileSystemRoot', KT_DIR);
// Set ssl to enabled if using https - if the server variable is not set, allow the config setting to take precedence
if (array_key_exists('HTTPS', $_SERVER)) {
if (strtolower($_SERVER['HTTPS']) === 'on') {
$oKTConfig->setdefaultns('KnowledgeTree', 'sslEnabled', 'true');
}
}
$oKTConfig->setdefaultns('KnowledgeTree', 'serverName', $_SERVER['HTTP_HOST']);
// Check for the config setting before overriding with the resolved setting
$serverName = $oKTConfig->get('KnowledgeTree/serverName');
$rootUrl = $oKTConfig->get('KnowledgeTree/rootUrl');
$execSearchPath = $oKTConfig->get('KnowledgeTree/execSearchPath');
$magicDatabase = $oKTConfig->get('KnowledgeTree/magicDatabase');
// base server name
if (empty($serverName) || $serverName == 'default') {
$oKTConfig->setdefaultns('KnowledgeTree', 'serverName', KTUtil::getServerName());
}
// the sub directory or root url
if (empty($rootUrl) || $rootUrl == 'default') {
$oKTConfig->setdefaultns('KnowledgeTree', 'rootUrl', $this->guessRootUrl());
}
// path to find the executable binaries
if (empty($execSearchPath) || $execSearchPath == 'default') {
$oKTConfig->setdefaultns('KnowledgeTree', 'execSearchPath', $_SERVER['PATH']);
}
// path to magic database
if (empty($magicDatabase) || $magicDatabase == 'default') {
$oKTConfig->setdefaultns('KnowledgeTree', 'magicDatabase', KTInit::detectMagicFile());
}
}