本文整理匯總了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());
}
}