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


PHP eZSys::hostName方法代码示例

本文整理汇总了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;
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:98,代码来源:ezstep_site_details.php

示例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';
             }
         }
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:22,代码来源:ezstep_site_access.php


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