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


PHP Armory::realmData方法代码示例

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


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

示例1: InitializeArmory

 /**
  * Initialize database handlers, debug handler, sets up sql/site configs
  * @category Armory class
  * @access   public
  * @return   bool
  **/
 public static function InitializeArmory()
 {
     if (!(require __ARMORYDIRECTORY__ . '/includes/classes/configuration.php')) {
         die('<b>Error</b>: unable to load configuration file!');
     }
     if (!(require __ARMORYDIRECTORY__ . '/includes/classes/class.debug.php')) {
         die('<b>Error</b>: unable to load debug class!');
     }
     if (!(require __ARMORYDIRECTORY__ . '/includes/classes/mysql/class.databaseHandler.php')) {
         die('<b>Error</b>: unable to load database abstract class!');
     }
     if (!(require __ARMORYDIRECTORY__ . '/includes/classes/mysql/class.' . $ArmoryConfig['mysql']['DbExtension'] . 'Client.php')) {
         die('<b>Error</b>: unable to load mysql client class! (Unable to load: class.' . $ArmoryConfig['mysql']['DbExtension'] . 'Client.php');
     }
     self::$mysqlconfig = $ArmoryConfig['mysql'];
     self::$armoryconfig = $ArmoryConfig['settings'];
     self::$debugHandler = new ArmoryDebug(array('useDebug' => self::$armoryconfig['useDebug'], 'logLevel' => self::$armoryconfig['logLevel']));
     self::$realmData = $ArmoryConfig['multiRealm'];
     if (!defined('SKIP_DB')) {
         self::$dbClass = self::$mysqlconfig['DbExtension'] . 'Client';
         self::$aDB = new self::$dbClass(self::$mysqlconfig['host_armory'], self::$mysqlconfig['user_armory'], self::$mysqlconfig['pass_armory'], self::$mysqlconfig['port_armory'], self::$mysqlconfig['name_armory'], self::$mysqlconfig['charset_armory'], self::$armoryconfig['db_prefix']);
         self::$rDB = new self::$dbClass(self::$mysqlconfig['host_realmd'], self::$mysqlconfig['user_realmd'], self::$mysqlconfig['pass_realmd'], self::$mysqlconfig['port_realmd'], self::$mysqlconfig['name_realmd'], self::$mysqlconfig['charset_realmd']);
         if (isset($_GET['r'])) {
             if (preg_match('/,/', $_GET['r'])) {
                 // Achievements/statistics comparison cases
                 $rData = explode(',', $_GET['r']);
                 $realmName = urldecode($rData[0]);
             } else {
                 $realmName = urldecode($_GET['r']);
             }
             $realm_id = self::FindRealm($realmName);
             if (isset(self::$realmData[$realm_id])) {
                 self::$connectionData = self::$realmData[$realm_id];
                 self::$cDB = new self::$dbClass(self::$connectionData['host_characters'], self::$connectionData['user_characters'], self::$connectionData['pass_characters'], self::$connectionData['port_characters'], self::$connectionData['name_characters'], self::$connectionData['charset_characters']);
                 self::$currentRealmInfo = array('name' => self::$connectionData['name'], 'id' => $realm_id, 'type' => self::$connectionData['type'], 'connected' => true);
                 self::$wDB = new self::$dbClass(self::$connectionData['host_world'], self::$connectionData['user_world'], self::$connectionData['pass_world'], self::$connectionData['port_world'], self::$connectionData['name_world'], self::$connectionData['charset_world']);
             }
         }
         $realm_info = self::$realmData[1];
         if (self::$cDB == null) {
             self::$cDB = new self::$dbClass($realm_info['host_characters'], $realm_info['user_characters'], $realm_info['pass_characters'], $realm_info['port_characters'], $realm_info['name_characters'], $realm_info['charset_characters']);
         }
         if (self::$wDB == null) {
             self::$wDB = new self::$dbClass($realm_info['host_world'], $realm_info['user_world'], $realm_info['pass_world'], $realm_info['port_world'], $realm_info['name_world'], $realm_info['charset_world']);
         }
         if (!self::$currentRealmInfo) {
             self::$currentRealmInfo = array('name' => $realm_info['name'], 'id' => 1, 'type' => $realm_info['type'], 'connected' => true);
         }
         if (!self::$connectionData) {
             self::$connectionData = $realm_info;
         }
     }
     if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $user_locale = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
         if ($user_locale && ($http_locale = self::IsAllowedLocale($user_locale))) {
             self::$_locale = isset($_SESSION['armoryLocale']) ? $_SESSION['armoryLocale'] : $http_locale;
         }
     }
     if (!self::$_locale) {
         self::$_locale = isset($_SESSION['armoryLocale']) ? $_SESSION['armoryLocale'] : self::$armoryconfig['defaultLocale'];
     }
     switch (self::$_locale) {
         case 'en_gb':
         case 'en_us':
             self::$_loc = 0;
             break;
         case 'fr_fr':
             self::$_loc = 2;
             break;
         case 'de_de':
             self::$_loc = 3;
             break;
         case 'zh_cn':
             self::$_loc = 4;
             break;
         case 'es_es':
             self::$_loc = 6;
             break;
         case 'es_mx':
             self::$_loc = 7;
             break;
         case 'ru_ru':
             self::$_loc = 8;
             break;
     }
 }
开发者ID:saqar,项目名称:WoW-Armory,代码行数:92,代码来源:class.armory.php


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