本文整理汇总了PHP中eZSys::hostName方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::hostName方法的具体用法?PHP eZSys::hostName怎么用?PHP eZSys::hostName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::hostName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
$config = eZINI::instance('setup.ini');
$siteType = $this->chosenSiteType();
$availableDatabaseList = false;
if (isset($this->PersistenceList['database_info_available'])) {
$availableDatabaseList = $this->PersistenceList['database_info_available'];
}
$databaseList = $availableDatabaseList;
$databaseCounter = 0;
if (!isset($siteType['title'])) {
$siteType['title'] = $siteType['name'];
}
$siteType['errors'] = array();
if (!isset($siteType['url'])) {
$siteType['url'] = 'http://' . eZSys::hostName() . eZSys::indexDir(false);
}
if (!isset($siteType['site_access_illegal'])) {
$siteType['site_access_illegal'] = false;
}
if (!isset($siteType['db_already_chosen'])) {
$siteType['db_already_chosen'] = false;
}
if (!isset($siteType['db_not_empty'])) {
$siteType['db_not_empty'] = 0;
}
if (!isset($siteType['database'])) {
if (is_array($databaseList)) {
$matchedDBName = false;
// First try database name match
foreach ($databaseList as $databaseName) {
$dbName = trim(strtolower($databaseName));
$identifier = trim(strtolower($siteType['identifier']));
if ($dbName == $identifier) {
$matchedDBName = $databaseName;
break;
}
}
if (!$matchedDBName) {
$matchedDBName = $databaseList[$databaseCounter++];
}
$databaseList = array_values(array_diff($databaseList, array($matchedDBName)));
$siteType['database'] = $matchedDBName;
} else {
$siteType['database'] = '';
}
}
if (!isset($siteType['existing_database'])) {
$siteType['existing_database'] = eZStepInstaller::DB_DATA_APPEND;
}
$this->Tpl->setVariable('db_not_empty', 0);
$this->Tpl->setVariable('db_already_chosen', 0);
$this->Tpl->setVariable('db_charset_differs', 0);
$this->Tpl->setVariable('site_access_illegal', 0);
$this->Tpl->setVariable('site_access_illegal_name', 0);
// TODO: remove sites error array
if (isset($this->Error[0])) {
$error = $this->Error[0];
$type = 'site';
if (is_array($error)) {
$type = $error['type'];
$error = $error['error_code'];
}
if ($type == 'site') {
switch ($error) {
case eZStepInstaller::DB_ERROR_NOT_EMPTY:
$this->Tpl->setVariable('db_not_empty', 1);
$siteType['db_not_empty'] = 1;
break;
case eZStepInstaller::DB_ERROR_ALREADY_CHOSEN:
$this->Tpl->setVariable('db_already_chosen', 1);
$siteType['db_already_chosen'] = 1;
break;
case self::SITE_ACCESS_ILLEGAL:
$this->Tpl->setVariable('site_access_illegal', 1);
$siteType['site_access_illegal'] = 1;
break;
}
} else {
if ($type == 'db') {
if ($error == eZStepInstaller::DB_ERROR_CHARSET_DIFFERS) {
$this->Tpl->setVariable('db_charset_differs', 1);
}
$siteType['errors'][] = $this->databaseErrorInfo(array('error_code' => $error, 'database_info' => $this->PersistenceList['database_info'], 'site_type' => $siteType));
}
}
}
$this->storeSiteType($siteType);
$this->Tpl->setVariable('database_default', $config->variable('DatabaseSettings', 'DefaultName'));
$this->Tpl->setVariable('database_available', $availableDatabaseList);
$this->Tpl->setVariable('site_type', $siteType);
// Return template and data to be shown
$result = array();
// Display template
$result['content'] = $this->Tpl->fetch('design:setup/init/site_details.tpl');
$result['path'] = array(array('text' => ezpI18n::tr('design/standard/setup/init', 'Site details'), 'url' => false));
return $result;
}
示例2: setAccessValues
function setAccessValues(&$siteType)
{
$accessType = $siteType['access_type'];
if ($accessType == 'url') {
$siteType['access_type_value'] = $siteType['identifier'];
$siteType['admin_access_type_value'] = $siteType['identifier'] . '_admin';
} else {
if ($accessType == 'port') {
$siteType['access_type_value'] = 8080;
// default port values
$siteType['admin_access_type_value'] = 8081;
} else {
if ($accessType == 'hostname') {
$siteType['access_type_value'] = $siteType['identifier'] . '.' . eZSys::hostName();
$siteType['admin_access_type_value'] = $siteType['identifier'] . '-admin.' . eZSys::hostName();
} else {
$siteType['access_type_value'] = $accessType;
$siteType['admin_access_type_value'] = $accessType . '_admin';
}
}
}
}