本文整理汇总了PHP中Armory::GetLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Armory::GetLocale方法的具体用法?PHP Armory::GetLocale怎么用?PHP Armory::GetLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armory
的用法示例。
在下文中一共展示了Armory::GetLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
}
// Get page cache
if ($guilds->GetGuildID() > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('guild-info', $guilds->GetGuildName(), Armory::$currentRealmInfo['name']);
if ($cache_data = $utils->GetCache($cache_id, 'guilds')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
exit;
}
}
// Load XSLT template
$xml->LoadXSLT('guild/roster.xsl');
/** Header **/
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'guild-info.xml');
$xml->XMLWriter()->startElement('tabInfo');
$xml->XMLWriter()->writeAttribute('subTab', 'guildRoster');
$xml->XMLWriter()->writeAttribute('tab', 'guild');
$xml->XMLWriter()->writeAttribute('tabGroup', 'guild');
$xml->XMLWriter()->writeAttribute('tabUrl', $isGuild ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())) : null);
$xml->XMLWriter()->endElement();
//tabInfo
if (!$isGuild) {
$xml->XMLWriter()->startElement('characterInfo');
$xml->XMLWriter()->writeAttribute('errCode', 'noCharacter');
$xml->XMLWriter()->endElement();
// characterInfo
$xml->XMLWriter()->endElement();
//page
示例2: IsWriteRaw
/**
* Returns true if script should use XMLWriter::WriteRaw() instead of special methods.
* Required for fr/de/es locales.
* @category Utils class
* @access public
* @retunr bool
**/
public static function IsWriteRaw()
{
if (Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'en_us' || Armory::GetLocale() == 'ru_ru') {
return false;
}
return true;
}
示例3: isset
$_SESSION['armoryLocale'] = 'de_de';
$_SESSION['armoryLocaleId'] = 3;
break;
case 'fr_fr':
case 'frfr':
case 'fr':
$_SESSION['armoryLocale'] = 'fr_fr';
$_SESSION['armoryLocaleId'] = 2;
break;
case 'en_us':
case 'enus':
$_SESSION['armoryLocale'] = 'en_us';
$_SESSION['armoryLocaleId'] = 0;
break;
}
$_locale = isset($_SESSION['armoryLocale']) ? $_SESSION['armoryLocale'] : $armory->GetLocale();
$armory->SetLocale($_locale, $_SESSION['armoryLocaleId']);
if (isset($_SERVER['HTTP_REFERER'])) {
$returnUrl = $_SERVER['HTTP_REFERER'];
} else {
$returnUrl = $_SESSION['last_url'];
}
header('Location: ' . $returnUrl);
}
$_locale = isset($_SESSION['armoryLocale']) ? $_SESSION['armoryLocale'] : $armory->GetLocale();
if (defined('load_characters_class')) {
if (!@(include 'classes/class.characters.php')) {
die('<b>Error:</b> unable to load characters class!');
}
$characters = new Characters($armory);
}
示例4: define
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**/
define('__ARMORY__', true);
if (!@(include 'includes/armory_loader.php')) {
die('<b>Fatal error:</b> unable to load system files.');
}
header('Content-type: text/xml');
$page_element = array('globalSearch' => 1, 'lang' => Armory::GetLocale(), 'requestUrl' => 'login-status.xml');
$xml->XMLWriter()->startElement('page');
foreach ($page_element as $page_key => $page_value) {
$xml->XMLWriter()->writeAttribute($page_key, $page_value);
}
$xml->XMLWriter()->startElement('loginStatus');
if (isset($_SESSION['username'])) {
$xml->XMLWriter()->writeAttribute('username', $_SESSION['username']);
} else {
$xml->XMLWriter()->writeAttribute('username', null);
}
$xml->XMLWriter()->endElement();
//loginStatus
$xml->XMLWriter()->endElement();
//page
echo $xml->StopXML();
示例5: isset
<!-- CONTENT START -->
<div class="grid_16" id="content">
<!-- CONTENT TITLE -->
<div class="grid_9">
<h1 class="content_edit">News Manager</h1>
</div>
<!-- TEXT CONTENT OR ANY OTHER CONTENT START -->
<div class="grid_15" id="textcontent">
<?php
$news_item = Template::GetPageData('news_item');
if (is_array($news_item)) {
$title = '';
if (isset($news_item['title_' . Armory::GetLocale()]) && $news_item['title_' . Armory::GetLocale()] != null) {
$title = $news_item['title_' . Armory::GetLocale()];
} else {
$title = isset($news_item['title_en_gb']) ? $news_item['title_en_gb'] : null;
}
echo '<h2>' . $title . '</h2>';
} else {
echo '<h2><a href="?action=news&subaction=add">Add New Item</a><br />Select Item to Edit:</h2>';
$armory_news = Utils::GetArmoryNews(true);
if (is_array($armory_news)) {
$count = count($armory_news);
echo '<ul>';
for ($i = 0; $i < $count; ++$i) {
echo sprintf('<li><a href="?action=news&subaction=edit&itemid=%d">%s</a> (%s)</li>', $armory_news[$i]['id'], $armory_news[$i]['title'], $armory_news[$i]['date']);
}
echo '</ul>';
}
}
?>
示例6: die
if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.arenateams.php')) {
die('<b>Error:</b> unable to load arenateams class!');
}
$arenateams = new Arenateams();
}
if (defined('load_search_class')) {
if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.search.php')) {
die('<b>Error:</b> unable to load search engine class!');
}
$search = new SearchMgr();
}
if (defined('load_itemprototype_class')) {
if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.itemprototype.php')) {
die('<b>Error:</b> unable to load ItemPrototype class!');
}
// Do not create class instance here. It should be created in Characters or Items classes.
}
if (defined('load_item_class')) {
if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.item.php')) {
die('<b>Error:</b> unable to load Item class!');
}
// Do not create class instance here. It should be created in Characters or Items classes.
}
// Start XML parser
if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.xmlhandler.php')) {
die('<b>Error:</b> unable to load XML Handler class!');
}
$xml = new XMLHandler(Armory::GetLocale());
if (!defined('RSS_FEED')) {
$xml->StartXML();
}
示例7: GetNpcInfo
/**
* Returns NPC info (infoType)
* @category Mangos class
* @access public
* @param int $npc
* @param string $infoType
* @return mixed
**/
public function GetNpcInfo($npc, $infoType)
{
$info = null;
switch ($infoType) {
case 'maxlevel':
$info = Armory::$wDB->selectCell("SELECT `maxlevel` FROM `creature_template` WHERE `entry`=%d", $npc);
break;
case 'minlevel':
$info = Armory::$wDB->selectCell("SELECT `minlevel` FROM `creature_template` WHERE `entry`=%d", $npc);
break;
case 'map':
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $npc);
if (!$mapID) {
$killCredit = Armory::$wDB->selectRow("SELECT `KillCredit1`, `KillCredit2` FROM `creature_template` WHERE `entry`=%d", $npc);
if ($killCredit['KillCredit1'] > 0) {
$kc_entry = $killCredit['KillCredit1'];
} elseif ($killCredit['KillCredit2'] > 0) {
$kc_entry = $killCredit['KillCredit2'];
} else {
$kc_entry = false;
}
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $kc_entry);
if (!$mapID) {
return false;
}
}
if ($info = Armory::$aDB->selectCell("SELECT `name_%s` FROM `ARMORYDBPREFIX_instance_template` WHERE `map`=%d", Armory::GetLocale(), $mapID)) {
return $info;
} else {
$info = Armory::$aDB->selectCell("SELECT `name_%s` FROM `ARMORYDBPREFIX_maps` WHERE `id`=%d", Armory::GetLocale(), $mapID);
}
break;
case 'areaUrl':
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $npc);
if (!$mapID) {
$killCredit = Armory::$wDB->selectRow("SELECT `KillCredit1`, `KillCredit2` FROM `creature_template` WHERE `entry`=%d", $npc);
if ($killCredit['KillCredit1'] > 0) {
$kc_entry = $killCredit['KillCredit1'];
} elseif ($killCredit['KillCredit2'] > 0) {
$kc_entry = $killCredit['KillCredit2'];
} else {
$kc_entry = false;
}
$mapID = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $kc_entry);
if (!$mapID) {
return false;
}
}
if ($info = Armory::$aDB->selectCell("SELECT `key` FROM `ARMORYDBPREFIX_instance_template` WHERE `map`=%d", $mapID)) {
$areaUrl = sprintf('source=dungeon&dungeon=%s&boss=all&difficulty=all', $info);
return $areaUrl;
}
break;
case 'mapID':
$info = Armory::$wDB->selectCell("SELECT `map` FROM `creature` WHERE `id`=%d LIMIT 1", $npc);
break;
case 'rank':
return Armory::$wDB->selectCell("SELECT `rank` FROM `creature_template` WHERE `entry`=%d", $npc);
break;
case 'subname':
if (Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'en_us') {
return Armory::$wDB->selectCell("SELECT `subname` FROM `creature_template` WHERE `entry`=%d LIMIT 1", $npc);
} else {
$info = Armory::$wDB->selectCell("SELECT `subname_loc%d` FROM `locales_creature` WHERE `entry`=%d LIMIT 1", Armory::GetLoc(), $npc);
if (!$info) {
$killCredit = Armory::$wDB->selectRow("SELECT `KillCredit1`, `KillCredit2` FROM `creature_template` WHERE `entry`=%d", $npc);
$kc_entry = false;
if ($killCredit['KillCredit1'] > 0) {
$kc_entry = $killCredit['KillCredit1'];
} elseif ($killCredit['KillCredit2'] > 0) {
$kc_entry = $killCredit['KillCredit2'];
}
if ($kc_entry) {
$info = Armory::$wDB->selectCell("SELECT `subname_loc%d` FROM `locales_creature` WHERE `entry`=%d LIMIT 1", Armory::GetLoc(), $kc_entry);
}
if (!$info) {
$info = Armory::$wDB->selectCell("SELECT `subname_loc%d` FROM `locales_creature` WHERE `entry`=%d LIMIT 1", Armory::GetLoc(), $npc);
}
}
}
break;
case 'dungeonlevel':
$query = Armory::$wDB->selectRow("\n\t\t\t\tSELECT `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`\n\t\t\t\t\tFROM `creature_template`\n\t\t\t\t\t\tWHERE `entry`=%d AND `difficulty_entry_1` > 0 or `difficulty_entry_2` > 0 or `difficulty_entry_3` > 0", $npc);
if (!$query) {
// 10 Normal or 5 Normal
return 0;
}
if ($query['difficulty_entry_1'] > 0) {
// 25 Normal or 5 Heroic
return 1;
} elseif ($query['difficulty_entry_2'] > 0) {
// 10 Heroic
//.........这里部分代码省略.........
示例8: GetGameInfo
/**
* Generates game info (by ID (this->gameid))
* @category Arenateams class
* @access public
* @return array
**/
public function GetGameInfo()
{
if (!$this->gameid || $this->gameid === 0) {
Armory::Log()->writeError('%s : gameid not provided', __METHOD__);
return false;
}
$game_info = Armory::$cDB->select("\n SELECT\n `armory_game_chart`.`teamid`,\n `armory_game_chart`.`guid`,\n `armory_game_chart`.`changeType`,\n `armory_game_chart`.`ratingChange`,\n `armory_game_chart`.`teamRating`,\n `armory_game_chart`.`damageDone`,\n `armory_game_chart`.`deaths`,\n `armory_game_chart`.`healingDone`,\n `armory_game_chart`.`damageTaken`,\n `armory_game_chart`.`healingTaken`,\n `armory_game_chart`.`killingBlows`,\n `armory_game_chart`.`mapId`,\n `armory_game_chart`.`start` as `matchLength`,\n `armory_game_chart`.`date` as `end`,\n `characters`.`race` AS `raceId`,\n `characters`.`class` AS `classId`,\n `characters`.`gender` AS `genderId`,\n `characters`.`name` AS `characterName`,\n `arena_team`.`BackgroundColor` AS `emblemBackground`,\n `arena_team`.`BorderColor` AS `emblemBorderColor`,\n `arena_team`.`BorderStyle` AS `emblemBorderStyle`,\n `arena_team`.`EmblemColor` AS `emblemIconColor`,\n `arena_team`.`EmblemStyle` AS `emblemIconStyle`,\n `arena_team`.`type`,\n `arena_team`.`name`\n FROM `armory_game_chart` AS `armory_game_chart`\n LEFT JOIN `characters` AS `characters` ON `characters`.`guid`=`armory_game_chart`.`guid`\n LEFT JOIN `arena_team` AS `arena_team` ON `arena_team`.`arenateamid`=`armory_game_chart`.`teamid`\n WHERE `armory_game_chart`.`gameid`=%d", $this->gameid);
if (!$game_info) {
Armory::Log()->writeError('%s : unable to get data from characters DB for gameID %d', __METHOD__, $this->gameid);
return false;
}
$game_info[0]['end'] = strtotime($game_info[0]['end']) * 1000;
$game_info[0]['start'] = $game_info[0]['end'] - $game_info[0]['matchLength'];
$chart_teams = array();
$chart_teams['gameData'] = array('battleGroup' => Armory::$armoryconfig['defaultBGName'], 'id' => $this->gameid, 'map' => Armory::$aDB->selectCell("SELECT `name_%s` FROM `ARMORYDBPREFIX_maps` WHERE `id`=%d LIMIT 1", Armory::GetLocale(), $game_info[0]['mapId']), 'start' => $game_info[0]['start'], 'matchStartTime' => $game_info[0]['start'], 'matchLength' => $game_info[0]['matchLength'], 'realmOffset' => 8 * 3600 * 1000, 'teamSize' => $game_info[0]['type']);
foreach ($game_info as $team_member) {
$temp_id = $team_member['teamid'];
if (!isset($chart_teams[$temp_id])) {
$chart_teams[$temp_id] = array();
$chart_teams[$temp_id]['teamData'] = array('deleted' => $this->TeamExists($temp_id) ? 'false' : 'true', 'emblemBackground' => $team_member['emblemBackground'], 'emblemBorderColor' => $team_member['emblemBorderColor'], 'emblemBorderStyle' => $team_member['emblemBorderStyle'], 'emblemIconColor' => $team_member['emblemIconColor'], 'emblemIconStyle' => $team_member['emblemIconStyle'], 'name' => $team_member['name'], 'ratingDelta' => $team_member['changeType'] == 1 ? $team_member['ratingChange'] : '-' . $team_member['ratingChange'], 'ratingNew' => $team_member['changeType'] == 1 ? $team_member['teamRating'] + $team_member['ratingChange'] : $team_member['teamRating'] - $team_member['ratingChange'], 'realm' => Armory::$currentRealmInfo['name'], 'result' => $team_member['changeType'] == 1 ? 'win' : 'loss', 'teamUrl' => sprintf('r=%s&ts=%d&t=%s', urlencode(Armory::$currentRealmInfo['name']), $team_member['type'], urlencode($team_member['name'])));
}
$chart_teams[$temp_id]['members'][] = array('characterName' => $team_member['characterName'], 'classId' => $team_member['classId'], 'damageDone' => $team_member['damageDone'], 'damageTaken' => $team_member['damageTaken'], 'deleted' => 'false', 'died' => $team_member['deaths'] == 0 ? 'false' : 'true', 'genderId' => $team_member['genderId'], 'healingDone' => $team_member['healingDone'], 'healingTaken' => $team_member['healingTaken'], 'killingBlows' => $team_member['killingBlows'], 'raceId' => $team_member['raceId'], 'url' => sprintf('r=%s&cn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($team_member['characterName'])));
}
return $chart_teams;
}
示例9: strtolower
$xml->XMLWriter()->endElement();
//title
$xml->XMLWriter()->startElement('updated');
$xml->XMLWriter()->text($fdate);
$xml->XMLWriter()->endElement();
//updated
$xml->XMLWriter()->startElement('published');
$xml->XMLWriter()->text($fdate);
$xml->XMLWriter()->endElement();
//published
$xml->XMLWriter()->startElement('id');
$xml->XMLWriter()->text(sprintf('%s@%s_%s_%s', strtolower(urlencode($characters->GetName())), strtolower(urlencode($characters->GetRealmName())), $feed['hard_data'], date('dmYHis', $feed['hard_date'])));
$xml->XMLWriter()->endElement();
//id
$xml->XMLWriter()->startElement('link');
$xml->XMLWriter()->writeAttribute('href', sprintf('character-feed.xml?r=%s&cn=%s&locale=%s', urldecode($characters->GetRealmName()), urldecode($characters->GetName()), Armory::GetLocale()));
$xml->XMLWriter()->endElement();
//link
$xml->XMLWriter()->startElement('content');
$xml->XMLWriter()->writeAttribute('type', 'html');
$xml->XMLWriter()->writeCData($feed['desc']);
$xml->XMLWriter()->endElement();
//content
$xml->XMLWriter()->endElement();
//entry
}
$xml->XMLWriter()->endElement();
//feed
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
if (Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
示例10: GetCharacterItemInfo
/**
* Returns array with data for item placed in $slot['slot']
* @category Character class
* @access public
* @param array $slot
* @return array
**/
public function GetCharacterItemInfo($slot)
{
if (!$this->guid) {
Armory::Log()->writeError('%s : player guid not provided', __METHOD__);
return false;
}
if (!isset($this->m_items[$slot['slotid']])) {
Armory::Log()->writeError('%s : slot %d is empty (nothing equipped?)', __METHOD__, $slot['slotid']);
return false;
}
$item = $this->m_items[$slot['slotid']];
$gems = array('g0' => $item->GetSocketInfo(1), 'g1' => $item->GetSocketInfo(2), 'g2' => $item->GetSocketInfo(3));
$durability = $item->GetItemDurability();
$item_data = Armory::$wDB->selectRow("SELECT `name`, `displayid`, `ItemLevel`, `Quality` FROM `item_template` WHERE `entry`=%d", $item->GetEntry());
$enchantment = $item->GetEnchantmentId();
$originalSpell = 0;
$enchItemData = array();
$enchItemDisplayId = 0;
if ($enchantment > 0) {
$originalSpell = Armory::$aDB->selectCell("SELECT `id` FROM `ARMORYDBPREFIX_spellenchantment` WHERE `Value`=%d", $enchantment);
if ($originalSpell > 0) {
$enchItemData = Armory::$wDB->selectRow("SELECT `entry`, `displayid` FROM `item_template` WHERE `spellid_1`=%d LIMIT 1", $originalSpell);
if ($enchItemData) {
// Item
$enchItemDisplayId = Armory::$aDB->selectCell("SELECT `icon` FROM `ARMORYDBPREFIX_icons` WHERE `displayid`=%d", $enchItemData['displayid']);
} else {
// Spell
$spellEnchData = Items::GenerateEnchantmentSpellData($originalSpell);
}
}
}
$item_info = array('displayInfoId' => $item_data['displayid'], 'durability' => $durability['current'], 'icon' => Items::GetItemIcon($item->GetEntry(), $item_data['displayid']), 'id' => $item->GetEntry(), 'level' => $item_data['ItemLevel'], 'maxDurability' => $durability['max'], 'name' => Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'en_us' ? $item_data['name'] : Items::GetItemName($item->GetEntry()), 'permanentenchant' => $enchantment, 'pickUp' => 'PickUpLargeChain', 'putDown' => 'PutDownLArgeChain', 'randomPropertiesId' => 0, 'rarity' => $item_data['Quality'], 'seed' => $item->GetGUID(), 'slot' => $slot['slotid']);
if (is_array($gems)) {
for ($i = 0; $i < 3; $i++) {
if ($gems['g' . $i]['item'] > 0) {
$item_info['gem' . $i . 'Id'] = $gems['g' . $i]['item'];
$item_info['gemIcon' . $i] = $gems['g' . $i]['icon'];
}
}
}
if (is_array($enchItemData) && isset($enchItemData['entry'])) {
$item_info['permanentEnchantIcon'] = $enchItemDisplayId;
$item_info['permanentEnchantItemId'] = $enchItemData['entry'];
} elseif (isset($spellEnchData) && is_array($spellEnchData) && isset($spellEnchData['name'])) {
$item_info['permanentEnchantIcon'] = 'trade_engraving';
$item_info['permanentEnchantSpellName'] = $spellEnchData['name'];
$item_info['permanentEnchantSpellDesc'] = $spellEnchData['desc'];
}
return $item_info;
}
示例11: GetSocketInfo
/**
* @return array
**/
public function GetSocketInfo($num)
{
if ($num <= 0 || $num > 4) {
return 0;
}
if (isset($this->m_socketInfo[$num])) {
return $this->m_socketInfo[$num];
}
$data = array();
switch ($this->m_server) {
case SERVER_MANGOS:
$socketfield = array(1 => ITEM_FIELD_ENCHANTMENT_3_2, 2 => ITEM_FIELD_ENCHANTMENT_4_2, 3 => ITEM_FIELD_ENCHANTMENT_5_2);
$socketInfo = $this->GetUInt32Value($socketfield[$num] - 1);
break;
case SERVER_TRINITY:
$socketfield = array(1 => 6, 2 => 9, 3 => 12);
$socketInfo = $this->tc_ench[$socketfield[$num]];
break;
default:
Armory::Log()->writeError('%s : unknown server type (%d)', __METHOD__, $this->m_server);
return false;
break;
}
if ($socketInfo > 0) {
$gemData = Armory::$aDB->selectRow("SELECT `text_%s` AS `text`, `gem` FROM `ARMORYDBPREFIX_enchantment` WHERE `id`=%d", Armory::GetLocale(), $socketInfo);
$data['enchant_id'] = $socketInfo;
$data['item'] = $gemData['gem'];
$data['icon'] = Items::GetItemIcon($data['item']);
$data['enchant'] = $gemData['text'];
$data['color'] = Armory::$aDB->selectCell("SELECT `color` FROM `ARMORYDBPREFIX_gemproperties` WHERE `spellitemenchantement`=%d", $socketInfo);
$this->m_socketInfo[$num] = $data;
// Is it neccessary?
return $data;
}
return false;
}
示例12: GetItemSourceArray
/**
* Returns array with item sources (for search results)
* @category Search class
* @access private
* @param array $items
* @return array
**/
private function GetItemSourceArray($items)
{
// Get item IDs first
$result_ids = array();
foreach ($items as $item) {
$curr_item_id = 0;
if (!isset($item['id']) && !isset($item['entry'])) {
continue;
} elseif (isset($item['id'])) {
$curr_item_id = $item['id'];
} elseif (isset($item['entry'])) {
$curr_item_id = $item['entry'];
}
if ($curr_item_id == 0) {
continue;
}
$result_ids[] = $curr_item_id;
}
// Get item sources
$data = Armory::$aDB->select("\n SELECT\n `ARMORYDBPREFIX_source`.`item`,\n `ARMORYDBPREFIX_source`.`source`,\n `ARMORYDBPREFIX_source`.`areaKey`,\n `ARMORYDBPREFIX_source`.`areaUrl`,\n `ARMORYDBPREFIX_source`.`isHeroic`,\n `ARMORYDBPREFIX_instance_template`.`name_%s` AS `areaName`,\n `ARMORYDBPREFIX_instance_template`.`id` AS `areaId`\n FROM `ARMORYDBPREFIX_source` AS `ARMORYDBPREFIX_source`\n LEFT JOIN `ARMORYDBPREFIX_instance_template` AS `ARMORYDBPREFIX_instance_template` ON `ARMORYDBPREFIX_instance_template`.`key`=`ARMORYDBPREFIX_source`.`areaKey`\n WHERE `ARMORYDBPREFIX_source`.`item` IN (%s)", Armory::GetLocale(), $result_ids);
if (!$data) {
Armory::Log()->writeError('%s : unable to get item sources from DB!', __METHOD__);
return false;
}
$sources_result = array();
foreach ($data as $entry) {
if (!isset($sources_result[$entry['item']])) {
$sources_result[$entry['item']] = $entry;
}
}
return $sources_result;
}
示例13: GetSummaryDataForStatisticsPage
public function GetSummaryDataForStatisticsPage()
{
if (!$this->guid) {
Armory::Log()->writeError('%s : player guid not defined!');
return false;
}
$summary_info = Armory::$aDB->select("SELECT `id`, `name_%s` AS `name` FROM `ARMORYDBPREFIX_achievement` WHERE `id` IN (1745, 1741, 1748, 178, 339)", Armory::GetLocale());
if (!$summary_info) {
return false;
}
$data = array();
foreach ($summary_info as $info) {
$this->achId = $info['id'];
$data[$this->achId] = $info;
$data[$this->achId]['quantity'] = self::GetCriteriaValue();
}
return $data;
}
示例14: foreach
$xml->XMLWriter()->writeAttribute('name', Armory::$aDB->selectCell("SELECT `name_" . Armory::GetLocale() . "` FROM `ARMORYDBPREFIX_petcalc` WHERE `id` < 0 AND `key`='tenacity'"));
$xml->XMLWriter()->writeAttribute('order', 1);
$pet_tenacity = $utils->GetPetTalentCalculatorData('tenacity');
foreach ($pet_tenacity as $tenacity) {
$xml->XMLWriter()->startElement('family');
foreach ($tenacity as $tenacity_key => $tenacity_value) {
$xml->XMLWriter()->writeAttribute($tenacity_key, $tenacity_value);
}
$xml->XMLWriter()->endElement();
//family
}
$xml->XMLWriter()->endElement();
//petTalentTab
$xml->XMLWriter()->startElement('petTalentTab');
$xml->XMLWriter()->writeAttribute('key', 'Ferocity');
$xml->XMLWriter()->writeAttribute('name', Armory::$aDB->selectCell("SELECT `name_" . Armory::GetLocale() . "` FROM `ARMORYDBPREFIX_petcalc` WHERE `id` < 0 AND `key`='ferocity'"));
$xml->XMLWriter()->writeAttribute('order', 0);
$pet_ferocity = $utils->GetPetTalentCalculatorData('ferocity');
foreach ($pet_ferocity as $ferocity) {
$xml->XMLWriter()->startElement('family');
foreach ($ferocity as $ferocity_key => $ferocity_value) {
$xml->XMLWriter()->writeAttribute($ferocity_key, $ferocity_value);
}
$xml->XMLWriter()->endElement();
//family
}
$xml->XMLWriter()->endElement();
//petTalentTab
}
$xml->XMLWriter()->endElement();
//talentTabs or petTalentTabs
示例15: array
$xml->LoadXSLT('items/info.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'item-info.xml');
$xml->XMLWriter()->writeAttribute('requestQuery', 'i=' . $itemID);
if (!$items->IsItemExists($itemID)) {
$xml->XMLWriter()->startElement('itemInfo');
$xml->XMLWriter()->endElement();
//itemInfo
echo $xml->StopXML();
exit;
}
// Do not query all rows - item data generated by item-tooltip.php
$data = $items->GetItemData($itemID);
$item_data = array('icon' => $items->GetItemIcon($itemID, $data['displayid']), 'id' => $itemID, 'level' => $data['ItemLevel'], 'name' => Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'en_us' ? $data['name'] : $items->GetItemName($itemID), 'quality' => $data['Quality'], 'type' => null);
$xml->XMLWriter()->startElement('itemInfo');
$xml->XMLWriter()->startElement('item');
foreach ($item_data as $item_data_key => $item_data_value) {
$xml->XMLWriter()->writeAttribute($item_data_key, $item_data_value);
}
$extended_cost = $mangos->GetVendorExtendedCost($itemID);
if ($data['SellPrice'] > 0 || $data['BuyPrice'] || $extended_cost > 0) {
$xml->XMLWriter()->startElement('cost');
if ($data['SellPrice'] > 0) {
$xml->XMLWriter()->writeAttribute('sellPrice', $data['SellPrice']);
}
if ($data['BuyPrice'] > 0 && $items->IsVendorItem($itemID)) {
$xml->XMLWriter()->writeAttribute('buyPrice', $data['BuyPrice']);
}
$cost_info = $mangos->GetExtendedCost($extended_cost);