diff --git a/character-achievements.php b/character-achievements.php index a08df5172..346076422 100644 --- a/character-achievements.php +++ b/character-achievements.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 257 + * @revision 296 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -87,72 +87,143 @@ if($achievement['display'] == 0) { continue; } - $xml->XMLWriter()->startElement('achievement'); - if(isset($achievement['data'])) { - foreach($achievement['data'] as $a_data_key => $a_data_value) { - $xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value); + if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $a_data_value) { + $xml->XMLWriter()->writeRaw(' ' . $a_data_key . '="' . $a_data_value . '"'); + } } - } - if(isset($achievement['criteria']) && is_array($achievement['criteria'])) { - foreach($achievement['criteria'] as $criteria) { - $xml->XMLWriter()->startElement('criteria'); - foreach($criteria as $c_key => $c_value) { - $xml->XMLWriter()->writeAttribute($c_key, $c_value); + $xml->XMLWriter()->writeRaw('>'); + if(isset($achievement['criteria']) && is_array($achievement['criteria'])) { + foreach($achievement['criteria'] as $criteria) { + $xml->XMLWriter()->writeRaw(' $c_value) { + $xml->XMLWriter()->writeRaw(' ' . $c_key .'="' . $c_value .'"'); + } + $xml->XMLWriter()->writeRaw('/>'); //criteria + } + } + if(isset($achievement['achievement_tree'])) { + foreach($achievement['achievement_tree'] as $achievement_tree) { + $xml->XMLWriter()->writeRaw(' $a_tree_value) { + $xml->XMLWriter()->writeRaw(' ' . $a_tree_key . '="' . $a_tree_value . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //achievement } - $xml->XMLWriter()->endElement(); //criteria } + $xml->XMLWriter()->writeRaw(''); //achievement } - if(isset($achievement['achievement_tree'])) { - foreach($achievement['achievement_tree'] as $achievement_tree) { - $xml->XMLWriter()->startElement('achievement'); - foreach($achievement_tree as $a_tree_key => $a_tree_value) { - $xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value); + else { + $xml->XMLWriter()->startElement('achievement'); + if(isset($achievement['data'])) { + foreach($achievement['data'] as $a_data_key => $a_data_value) { + $xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value); } - $xml->XMLWriter()->endElement(); //achievement } + if(isset($achievement['criteria']) && is_array($achievement['criteria'])) { + foreach($achievement['criteria'] as $criteria) { + $xml->XMLWriter()->startElement('criteria'); + foreach($criteria as $c_key => $c_value) { + $xml->XMLWriter()->writeAttribute($c_key, $c_value); + } + $xml->XMLWriter()->endElement(); //criteria + } + } + if(isset($achievement['achievement_tree'])) { + foreach($achievement['achievement_tree'] as $achievement_tree) { + $xml->XMLWriter()->startElement('achievement'); + foreach($achievement_tree as $a_tree_key => $a_tree_value) { + $xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value); + } + $xml->XMLWriter()->endElement(); //achievement + } + } + $xml->XMLWriter()->writeRaw(''); //achievement } - $xml->XMLWriter()->endElement(); //achievement } } else { $armory->Log()->writeLog('character-achievements.php : player %d (%s) does not have any completed achievements in %d category', $characters->GetGUID(), $characters->GetName(), $achievement_category); } if(isset($achievements_page['incompleted'])) { - foreach($achievements_page['incompleted'] as $achievement) { - if(isset($achievement['display']) && $achievement['display'] == 0) { - continue; - } - $xml->XMLWriter()->startElement('achievement'); - if(isset($achievement['data'])) { - foreach($achievement['data'] as $a_data_key => $a_data_value) { - $xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value); + if($utils->IsWriteRaw()) { + foreach($achievements_page['incompleted'] as $achievement) { + if(isset($achievement['display']) && $achievement['display'] == 0) { + continue; } - } - else { - $armory->Log()->writeLog('character-achievements.php : achievement[data] not found (player: %d; %s)!', $characters->GetGUID(), $characters->GetName()); - } - if(isset($achievement['criteria']) && is_array($achievement['criteria'])) { - foreach($achievement['criteria'] as $criteria) { - $xml->XMLWriter()->startElement('criteria'); - foreach($criteria as $c_key => $c_value) { - $xml->XMLWriter()->writeAttribute($c_key, $c_value); + $xml->XMLWriter()->writeRaw(' $a_data_value) { + $xml->XMLWriter()->writeRaw(' ' . $a_data_key . '="' . $a_data_value . '"'); } - $xml->XMLWriter()->endElement(); //criteria } + else { + $armory->Log()->writeLog('character-achievements.php : achievement[data] not found (player: %d; %s)!', $characters->GetGUID(), $characters->GetName()); + } + $xml->XMLWriter()->writeRaw('>'); + if(isset($achievement['criteria']) && is_array($achievement['criteria'])) { + foreach($achievement['criteria'] as $criteria) { + $xml->XMLWriter()->writeRaw(' $c_value) { + $xml->XMLWriter()->writeRaw(' ' . $c_key . '="' . $c_value . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //criteria + } + } + else { + $armory->Log()->writeLog('character-achievements.php : achievement[critera] not found (player: %d; %s)!', $characters->GetGUID(), $characters->GetName()); + } + if(isset($achievement['achievement_tree'])) { + foreach($achievement['achievement_tree'] as $achievement_tree) { + $xml->XMLWriter()->writeRaw(' $a_tree_value) { + $xml->XMLWriter()->writeRaw(' ' . $a_tree_key . '="' . $a_tree_value . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //achievement + } + } + $xml->XMLWriter()->writeRaw(''); //achievement } - else { - $armory->Log()->writeLog('character-achievements.php : achievement[critera] not found (player: %d; %s)!', $characters->GetGUID(), $characters->GetName()); - } - if(isset($achievement['achievement_tree'])) { - foreach($achievement['achievement_tree'] as $achievement_tree) { - $xml->XMLWriter()->startElement('achievement'); - foreach($achievement_tree as $a_tree_key => $a_tree_value) { - $xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value); + } + else { + foreach($achievements_page['incompleted'] as $achievement) { + if(isset($achievement['display']) && $achievement['display'] == 0) { + continue; + } + $xml->XMLWriter()->startElement('achievement'); + if(isset($achievement['data'])) { + foreach($achievement['data'] as $a_data_key => $a_data_value) { + $xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value); + } + } + else { + $armory->Log()->writeLog('character-achievements.php : achievement[data] not found (player: %d; %s)!', $characters->GetGUID(), $characters->GetName()); + } + if(isset($achievement['criteria']) && is_array($achievement['criteria'])) { + foreach($achievement['criteria'] as $criteria) { + $xml->XMLWriter()->startElement('criteria'); + foreach($criteria as $c_key => $c_value) { + $xml->XMLWriter()->writeAttribute($c_key, $c_value); + } + $xml->XMLWriter()->endElement(); //criteria } - $xml->XMLWriter()->endElement(); //achievement } + else { + $armory->Log()->writeLog('character-achievements.php : achievement[critera] not found (player: %d; %s)!', $characters->GetGUID(), $characters->GetName()); + } + if(isset($achievement['achievement_tree'])) { + foreach($achievement['achievement_tree'] as $achievement_tree) { + $xml->XMLWriter()->startElement('achievement'); + foreach($achievement_tree as $a_tree_key => $a_tree_value) { + $xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value); + } + $xml->XMLWriter()->endElement(); //achievement + } + } + $xml->XMLWriter()->endElement(); //achievement } - $xml->XMLWriter()->endElement(); //achievement } } else { @@ -215,11 +286,20 @@ $xml->XMLWriter()->startElement('category'); $current_category = $achievements->GetSummaryAchievementData($achievement_category); if($current_category) { - $xml->XMLWriter()->startElement('c'); - foreach($current_category as $category_key => $category_value) { - $xml->XMLWriter()->writeAttribute($category_key, $category_value); + if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $category_value) { + $xml->XMLWriter()->writeRaw(' ' . $category_key .'="' . $category_value . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //c + } + else { + $xml->XMLWriter()->startElement('c'); + foreach($current_category as $category_key => $category_value) { + $xml->XMLWriter()->writeAttribute($category_key, $category_value); + } + $xml->XMLWriter()->endElement(); //c } - $xml->XMLWriter()->endElement(); //c } $xml->XMLWriter()->endElement(); //category } @@ -228,11 +308,20 @@ if(is_array($last_achievements)) { foreach($last_achievements as $l_achievement) { if(is_array($l_achievement)) { - $xml->XMLWriter()->startElement('achievement'); - foreach($l_achievement as $l_a_key => $l_a_value) { - $xml->XMLWriter()->writeAttribute($l_a_key, $l_a_value); + if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $l_a_value) { + $xml->XMLWriter()->writeRaw(' ' . $l_a_key .'="' . $l_a_value . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //achievement + } + else { + $xml->XMLWriter()->startElement('achievement'); + foreach($l_achievement as $l_a_key => $l_a_value) { + $xml->XMLWriter()->writeAttribute($l_a_key, $l_a_value); + } + $xml->XMLWriter()->endElement(); //achievement } - $xml->XMLWriter()->endElement(); //achievement } } } @@ -242,18 +331,41 @@ $root_categories = $achievements->BuildCategoriesTree(); if($root_categories && is_array($root_categories)) { foreach($root_categories as $category) { - $xml->XMLWriter()->startElement('category'); - $xml->XMLWriter()->writeAttribute('id', $category['id']); - $xml->XMLWriter()->writeAttribute('name', $category['name']); - if(isset($category['child']) && is_array($category['child'])) { - foreach($category['child'] as $category_child) { - $xml->XMLWriter()->startElement('category'); - $xml->XMLWriter()->writeAttribute('name', $category_child['name']); - $xml->XMLWriter()->writeAttribute('id', $category_child['id']); - $xml->XMLWriter()->endElement(); //category + if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' id="' . $category['id'] . '"'); + if($category['id'] == 168) { + $xml->XMLWriter()->writeRaw(' name="' . htmlspecialchars($category['name']) . '"'); + } + else { + $xml->XMLWriter()->writeRaw(' name="' . $category['name'] . '"'); + } + + $xml->XMLWriter()->writeRaw('>'); + if(isset($category['child']) && is_array($category['child'])) { + foreach($category['child'] as $category_child) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' name="' . $category_child['name'] . '"'); + $xml->XMLWriter()->writeRaw(' id="' . htmlspecialchars($category_child['id']) . '"'); + $xml->XMLWriter()->writeRaw('/>'); //category + } + } + $xml->XMLWriter()->writeRaw(''); //category + } + else { + $xml->XMLWriter()->startElement('category'); + $xml->XMLWriter()->writeAttribute('id', $category['id']); + $xml->XMLWriter()->writeAttribute('name', $category['name']); + if(isset($category['child']) && is_array($category['child'])) { + foreach($category['child'] as $category_child) { + $xml->XMLWriter()->startElement('category'); + $xml->XMLWriter()->writeAttribute('name', $category_child['name']); + $xml->XMLWriter()->writeAttribute('id', $category_child['id']); + $xml->XMLWriter()->endElement(); //category + } } + $xml->XMLWriter()->endElement(); //category } - $xml->XMLWriter()->endElement(); //category } } $xml->XMLWriter()->endElement(); //rootCategories diff --git a/character-reputation.php b/character-reputation.php index 7837e5102..6f0451cd8 100644 --- a/character-reputation.php +++ b/character-reputation.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 257 + * @revision 296 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -91,21 +91,41 @@ $xml->XMLWriter()->startElement('reputationTab'); $character_reputation = $characters->GetCharacterReputation(); if($character_reputation) { - $xml->XMLWriter()->startElement('faction'); - $header_faction = array( - 'header' => 1, 'iconKey' => 'classic', 'id' => 1118, 'key' => 'classic', 'name' => 'World of Warcraft' // hack - ); - foreach($header_faction as $head_key => $head_value) { - $xml->XMLWriter()->writeAttribute($head_key, $head_value); + if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' 1, 'iconKey' => 'classic', 'id' => 1118, 'key' => 'classic', 'name' => 'World of Warcraft' // hack + ); + foreach($header_faction as $head_key => $head_value) { + $xml->XMLWriter()->writeRaw(' ' . $head_key .'="' . $head_value .'"'); + } + $xml->XMLWriter()->writeRaw('>'); + foreach($character_reputation as $faction) { + $xml->XMLWriter()->writeRaw(' $rep_value) { + $xml->XMLWriter()->writeRaw(' ' . $rep_key .'="' . $rep_value .'"'); + } + $xml->XMLWriter()->writeRaw('/>'); + } + $xml->XMLWriter()->writeRaw(''); } - foreach($character_reputation as $faction) { + else { $xml->XMLWriter()->startElement('faction'); - foreach($faction as $rep_key => $rep_value) { - $xml->XMLWriter()->writeAttribute($rep_key, $rep_value); + $header_faction = array( + 'header' => 1, 'iconKey' => 'classic', 'id' => 1118, 'key' => 'classic', 'name' => 'World of Warcraft' // hack + ); + foreach($header_faction as $head_key => $head_value) { + $xml->XMLWriter()->writeAttribute($head_key, $head_value); + } + foreach($character_reputation as $faction) { + $xml->XMLWriter()->startElement('faction'); + foreach($faction as $rep_key => $rep_value) { + $xml->XMLWriter()->writeAttribute($rep_key, $rep_value); + } + $xml->XMLWriter()->endElement(); //faction } $xml->XMLWriter()->endElement(); //faction } - $xml->XMLWriter()->endElement(); //faction } $xml->XMLWriter()->endElement(); //reputationTab $xml->XMLWriter()->endElement(); //page diff --git a/character-sheet.php b/character-sheet.php index 4a92ab3b6..86751cb1d 100644 --- a/character-sheet.php +++ b/character-sheet.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 295 + * @revision 296 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -87,41 +87,78 @@ } $character_title = $characters->GetChosenTitleInfo(); $character_element = $characters->GetHeader($achievements); -$xml->XMLWriter()->startElement('characterInfo'); -$xml->XMLWriter()->startElement('character'); -foreach($character_element as $c_elem_name => $c_elem_value) { - $xml->XMLWriter()->writeAttribute($c_elem_name, $c_elem_value); -} $character_arenateams = $arenateams->GetCharacterArenaTeamInfo(); -if($character_arenateams && is_array($character_arenateams)) { - $xml->XMLWriter()->startElement('arenaTeams'); - foreach($character_arenateams as $arenateam) { - $xml->XMLWriter()->startElement('arenaTeam'); - foreach($arenateam['data'] as $team_key => $team_value) { - $xml->XMLWriter()->writeAttribute($team_key, $team_value); +$xml->XMLWriter()->startElement('characterInfo'); +if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $c_elem_value) { + if($c_elem_name == 'charUrl') { + $xml->XMLWriter()->writeRaw(' ' . $c_elem_name .'="' .htmlspecialchars($c_elem_value).'"'); } - $xml->XMLWriter()->startElement('emblem'); - foreach($arenateam['emblem'] as $emblem_key => $emblem_value) { - $xml->XMLWriter()->writeAttribute($emblem_key, $emblem_value); + else { + $xml->XMLWriter()->writeRaw(' ' . $c_elem_name .'="' .$c_elem_value.'"'); } - $xml->XMLWriter()->endElement(); //emblem - $xml->XMLWriter()->startElement('members'); - foreach($arenateam['members'] as $member) { - $xml->XMLWriter()->startElement('character'); - foreach($member as $member_key => $member_value) { - $xml->XMLWriter()->writeAttribute($member_key, $member_value); + } + if($character_arenateams && is_array($character_arenateams)) { + $xml->XMLWriter()->writeRaw('>'); // close tag before open new + foreach($character_arenateams as $arenateam) { + $xml->XMLWriter()->writeRaw(' $team_value) { + $xml->XMLWriter()->writeRaw(' ' . $team_key.'="' . htmlspecialchars($team_value).'"'); + } + $xml->XMLWriter()->writeRaw('> $emblem_value) { + $xml->XMLWriter()->writeRaw(' ' . $emblem_key.'="' . $emblem_value.'"'); + } + $xml->XMLWriter()->writeRaw('>'); + foreach($arenateam['members'] as $member) { + $xml->XMLWriter()->writeRaw(' $member_value) { + $xml->XMLWriter()->writeRaw(' ' . $member_key .'="' . htmlspecialchars($member_value) . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //member + } + $xml->XMLWriter()->writeRaw(''); + } + $xml->XMLWriter()->writeRaw(''); + } + $xml->XMLWriter()->writeRaw(''); +} +else { + $xml->XMLWriter()->startElement('character'); + foreach($character_element as $c_elem_name => $c_elem_value) { + $xml->XMLWriter()->writeAttribute($c_elem_name, $c_elem_value); + } + if($character_arenateams && is_array($character_arenateams)) { + $xml->XMLWriter()->startElement('arenaTeams'); + foreach($character_arenateams as $arenateam) { + $xml->XMLWriter()->startElement('arenaTeam'); + foreach($arenateam['data'] as $team_key => $team_value) { + $xml->XMLWriter()->writeAttribute($team_key, $team_value); + } + $xml->XMLWriter()->startElement('emblem'); + foreach($arenateam['emblem'] as $emblem_key => $emblem_value) { + $xml->XMLWriter()->writeAttribute($emblem_key, $emblem_value); } - $xml->XMLWriter()->endElement(); //character + $xml->XMLWriter()->endElement(); //emblem + $xml->XMLWriter()->startElement('members'); + foreach($arenateam['members'] as $member) { + $xml->XMLWriter()->startElement('character'); + foreach($member as $member_key => $member_value) { + $xml->XMLWriter()->writeAttribute($member_key, $member_value); + } + $xml->XMLWriter()->endElement(); //character + } + $xml->XMLWriter()->endElement(); //members + $xml->XMLWriter()->endElement(); //arenaTeam } - $xml->XMLWriter()->endElement(); //members - $xml->XMLWriter()->endElement(); //arenaTeam + $xml->XMLWriter()->endElement(); //arenaTeams } - $xml->XMLWriter()->endElement(); //arenaTeams + $xml->XMLWriter()->startElement('modelBasePath'); + $xml->XMLWriter()->writeAttribute('value', 'http://eu.media.battle.net.edgesuite.net/'); + $xml->XMLWriter()->endElement(); //modelBasePath + $xml->XMLWriter()->endElement(); //character } -$xml->XMLWriter()->startElement('modelBasePath'); -$xml->XMLWriter()->writeAttribute('value', 'http://eu.media.battle.net.edgesuite.net/'); -$xml->XMLWriter()->endElement(); //modelBasePath -$xml->XMLWriter()->endElement(); //character /** Character tab **/ $xml->XMLWriter()->startElement('characterTab'); $xml->XMLWriter()->startElement('talentSpecs'); @@ -145,11 +182,20 @@ } } foreach($talent_spec as $m_spec) { - $xml->XMLWriter()->startElement('talentSpec'); - foreach($m_spec as $spec_key => $spec_value) { - $xml->XMLWriter()->writeAttribute($spec_key, $spec_value); + if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $spec_value) { + $xml->XMLWriter()->writeRaw(' ' . $spec_key .'="' . $spec_value . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); + } + else { + $xml->XMLWriter()->startElement('talentSpec'); + foreach($m_spec as $spec_key => $spec_value) { + $xml->XMLWriter()->writeAttribute($spec_key, $spec_value); + } + $xml->XMLWriter()->endElement(); //talentSpec } - $xml->XMLWriter()->endElement(); //talentSpec } } else { @@ -173,11 +219,20 @@ $character_professions = $characters->GetCharacterProfessions(); if($character_professions) { foreach($character_professions as $char_professions) { - $xml->XMLWriter()->startElement('skill'); - foreach($char_professions as $profs_elem_name => $profs_elem_value) { - $xml->XMLWriter()->writeAttribute($profs_elem_name, $profs_elem_value); + if($utils->IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $profs_elem_value) { + $xml->XMLWriter()->writeRaw(' ' . $profs_elem_name . '="' . $profs_elem_value .'"'); + } + $xml->XMLWriter()->writeRaw('/>'); + } + else { + $xml->XMLWriter()->startElement('skill'); + foreach($char_professions as $profs_elem_name => $profs_elem_value) { + $xml->XMLWriter()->writeAttribute($profs_elem_name, $profs_elem_value); + } + $xml->XMLWriter()->endElement(); //skill } - $xml->XMLWriter()->endElement(); //skill } } $xml->XMLWriter()->endElement(); //professions diff --git a/includes/classes/class.characters.php b/includes/classes/class.characters.php index 21e3d555f..d7040177c 100644 --- a/includes/classes/class.characters.php +++ b/includes/classes/class.characters.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 295 + * @revision 296 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -609,9 +609,17 @@ public function GetRaceText() { * @return string **/ public function GetUrlString() { - $url = sprintf('r=%s&cn=%s', urlencode($this->realmName), urlencode($this->name)); - if($this->guild_id > 0) { - $url .= sprintf('&gn=%s', $this->guild_name); + if(Utils::IsWriteRaw()) { + $url = sprintf('r=%s&cn=%s', urlencode($this->realmName), urlencode($this->name)); + if($this->guild_id > 0) { + $url .= sprintf('&gn=%s', $this->guild_name); + } + } + else { + $url = sprintf('r=%s&cn=%s', urlencode($this->realmName), urlencode($this->name)); + if($this->guild_id > 0) { + $url .= sprintf('&gn=%s', $this->guild_name); + } } return $url; } @@ -667,6 +675,9 @@ public function GetHeader(Achievements $achievements) { 'suffix' => $this->character_title['suffix'], 'titleId' => $this->character_title['titleId'], ); + if(Utils::IsWriteRaw()) { + $header['guildUrl'] = ($this->guild_id > 0) ? sprintf('r=%s&gn=%s', urlencode($this->currentRealmInfo['name']), urlencode($this->guild_name)) : null; + } return $header; } diff --git a/includes/classes/class.items.php b/includes/classes/class.items.php index 8149f9efd..27dc907dd 100644 --- a/includes/classes/class.items.php +++ b/includes/classes/class.items.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 293 + * @revision 296 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -237,15 +237,21 @@ public function lootInfo($itemID) { } public function GetItemSetBonusInfo($itemsetdata) { + if($this->_locale == 'en_gb' || $this->_locale == 'ru_ru') { + $tmp_locale = $this->_locale; + } + else { + $tmp_locale = 'en_gb'; + } $itemSetBonuses = array(); for($i=1; $i<9; $i++) { if($itemsetdata['bonus'.$i] > 0) { $spell_tmp = array(); $spell_tmp = $this->aDB->selectRow("SELECT * FROM `armory_spell` WHERE `id`=?", $itemsetdata['bonus'.$i]); - if(!isset($spell_tmp['Description_'.$this->_locale])) { - $spell_tmp['Description_'.$this->_locale] = null; + if(!isset($spell_tmp['Description_'.$tmp_locale])) { + $spell_tmp['Description_'.$tmp_locale] = null; } - $itemSetBonuses[$i]['desc'] = self::spellReplace($spell_tmp, Utils::validateText($spell_tmp['Description_'.$this->_locale])); + $itemSetBonuses[$i]['desc'] = self::spellReplace($spell_tmp, Utils::validateText($spell_tmp['Description_'.$tmp_locale])); $itemSetBonuses[$i]['desc'] = str_replace('"', '"', $itemSetBonuses[$i]['desc']); $itemSetBonuses[$i]['threshold'] = $i; } @@ -1289,14 +1295,21 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character $xml->XMLWriter()->startElement('id'); $xml->XMLWriter()->text($itemID); $xml->XMLWriter()->endElement(); //id - $xml->XMLWriter()->startElement('name'); - if($this->_locale == 'en_gb' || $this->_locale == 'en_us') { - $xml->XMLWriter()->text($data['name']); + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw(Items::getItemName($itemID)); + $xml->XMLWriter()->writeRaw(''); } else { - $xml->XMLWriter()->text(Items::getItemName($itemID)); + $xml->XMLWriter()->startElement('name'); + if($this->_locale == 'en_gb' || $this->_locale == 'en_us') { + $xml->XMLWriter()->text($data['name']); + } + else { + $xml->XMLWriter()->text(Items::getItemName($itemID)); + } + $xml->XMLWriter()->endElement(); //name } - $xml->XMLWriter()->endElement(); //name $xml->XMLWriter()->startElement('icon'); $xml->XMLWriter()->text(Items::getItemIcon($itemID, $data['displayid'])); $xml->XMLWriter()->endElement(); //icon @@ -1377,9 +1390,16 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character $GemSpellItemEcnhID = $this->aDB->selectCell("SELECT `spellitemenchantement` FROM `armory_gemproperties` WHERE `id`=?", $data['GemProperties']); $GemText = $this->aDB->selectCell("SELECT `text_" . $this->_locale . "` FROM `armory_enchantment` WHERE `id`=?", $GemSpellItemEcnhID); if($GemText) { - $xml->XMLWriter()->startElement('gemProperties'); - $xml->XMLWriter()->text($GemText); - $xml->XMLWriter()->endElement(); //gemProperties + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($GemText); + $xml->XMLWriter()->writeRaw(''); + } + else { + $xml->XMLWriter()->startElement('gemProperties'); + $xml->XMLWriter()->text($GemText); + $xml->XMLWriter()->endElement(); //gemProperties + } } } if($data['block'] > 0) { @@ -1463,9 +1483,16 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character if(!$parent && $isCharacter && $itemSlotName) { $enchantment = $characters->getCharacterEnchant($itemSlotName); if($enchantment) { - $xml->XMLWriter()->startElement('enchant'); - $xml->XMLWriter()->text($this->aDB->selectCell("SELECT `text_" . $this->_locale ."` FROM `armory_enchantment` WHERE `id`=? LIMIT 1", $enchantment)); - $xml->XMLWriter()->endElement(); //enchant + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($this->aDB->selectCell("SELECT `text_" . $this->_locale ."` FROM `armory_enchantment` WHERE `id`=? LIMIT 1", $enchantment)); + $xml->XMLWriter()->writeRaw(''); //enchant + } + else { + $xml->XMLWriter()->startElement('enchant'); + $xml->XMLWriter()->text($this->aDB->selectCell("SELECT `text_" . $this->_locale ."` FROM `armory_enchantment` WHERE `id`=? LIMIT 1", $enchantment)); + $xml->XMLWriter()->endElement(); //enchant + } } } // Random property @@ -1483,14 +1510,30 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character } if($isCharacter && !$parent && is_array($rPropInfo)) { $xml->XMLWriter()->startElement('randomEnchantData'); - $xml->XMLWriter()->startElement('suffix'); - $xml->XMLWriter()->text($rPropInfo['suffix']); - $xml->XMLWriter()->endElement(); //enchant + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($rPropInfo['suffix']); + $xml->XMLWriter()->writeRaw(''); //suffix + } + else { + $xml->XMLWriter()->startElement('suffix'); + $xml->XMLWriter()->text($rPropInfo['suffix']); + $xml->XMLWriter()->endElement(); //suffix + } if(is_array($rPropInfo['data'])) { - foreach($rPropInfo['data'] as $randProp) { - $xml->XMLWriter()->startElement('enchant'); - $xml->XMLWriter()->text($randProp); - $xml->XMLWriter()->endElement(); //enchant + if(Utils::IsWriteRaw()) { + foreach($rPropInfo['data'] as $randProp) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($randProp); + $xml->XMLWriter()->writeRaw(''); //enchant + } + } + else { + foreach($rPropInfo['data'] as $randProp) { + $xml->XMLWriter()->startElement('enchant'); + $xml->XMLWriter()->text($randProp); + $xml->XMLWriter()->endElement(); //enchant + } } } $xml->XMLWriter()->endElement(); //randomEnchantData @@ -1554,11 +1597,20 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character break; } if(is_array($socket_data)) { - $xml->XMLWriter()->startElement('socket'); - foreach($socket_data as $socket_key => $socket_value) { - $xml->XMLWriter()->writeAttribute($socket_key, $socket_value); + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $socket_value) { + $xml->XMLWriter()->writeRaw(' ' . $socket_key .'="' . $socket_value .'"'); + } + $xml->XMLWriter()->writeRaw('/>'); + } + else { + $xml->XMLWriter()->startElement('socket'); + foreach($socket_data as $socket_key => $socket_value) { + $xml->XMLWriter()->writeAttribute($socket_key, $socket_value); + } + $xml->XMLWriter()->endElement(); //socket } - $xml->XMLWriter()->endElement(); //socket $color = false; } } @@ -1586,18 +1638,32 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character } if($data['socketBonus'] > 0) { $bonus_text = $this->aDB->selectCell("SELECT `text_".$this->_locale."` FROM `armory_enchantment` WHERE `id`=?", $data['socketBonus']); - $xml->XMLWriter()->startElement('socketMatchEnchant'); - $xml->XMLWriter()->text($bonus_text); - $xml->XMLWriter()->endElement(); //socketMatchEnchant + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($bonus_text); + $xml->XMLWriter()->writeRaw(''); //socketMatchEnchant + } + else { + $xml->XMLWriter()->startElement('socketMatchEnchant'); + $xml->XMLWriter()->text($bonus_text); + $xml->XMLWriter()->endElement(); //socketMatchEnchant + } } $xml->XMLWriter()->endElement(); //socketData $allowable_classes = Items::AllowableClasses($data['AllowableClass']); if($allowable_classes) { $xml->XMLWriter()->startElement('allowableClasses'); foreach($allowable_classes as $al_class) { - $xml->XMLWriter()->startElement('class'); - $xml->XMLWriter()->text($al_class); - $xml->XMLWriter()->endElement(); //class + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($al_class); + $xml->XMLWriter()->writeRaw(''); //class + } + else { + $xml->XMLWriter()->startElement('class'); + $xml->XMLWriter()->text($al_class); + $xml->XMLWriter()->endElement(); //class + } } $xml->XMLWriter()->endElement(); //allowableClasses } @@ -1605,23 +1671,46 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character if($allowable_races) { $xml->XMLWriter()->startElement('allowableRaces'); foreach($allowable_races as $al_race) { - $xml->XMLWriter()->startElement('race'); - $xml->XMLWriter()->text($al_race); - $xml->XMLWriter()->endElement(); //race + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($al_race); + $xml->XMLWriter()->writeRaw(''); //race + } + else { + $xml->XMLWriter()->startElement('race'); + $xml->XMLWriter()->text($al_race); + $xml->XMLWriter()->endElement(); //race + } } $xml->XMLWriter()->endElement(); //allowableRaces } if($data['RequiredSkill'] > 0) { - $xml->XMLWriter()->startElement('requiredSkill'); - $xml->XMLWriter()->writeAttribute('name', $this->aDB->selectCell("SELECT `name_".$this->_locale."` FROM `armory_skills` WHERE `id`=?", $data['RequiredSkill'])); - $xml->XMLWriter()->writeAttribute('rank', $data['RequiredSkillRank']); - $xml->XMLWriter()->endElement(); //requiredSkill + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' name="' . $this->aDB->selectCell("SELECT `name_".$this->_locale."` FROM `armory_skills` WHERE `id`=?", $data['RequiredSkill']) . '"'); + $xml->XMLWriter()->writeRaw(' rank="', $data['RequiredSkillRank'].'"'); + $xml->XMLWriter()->writeRaw('/>'); //requiredSkill + } + else { + $xml->XMLWriter()->startElement('requiredSkill'); + $xml->XMLWriter()->writeAttribute('name', $this->aDB->selectCell("SELECT `name_".$this->_locale."` FROM `armory_skills` WHERE `id`=?", $data['RequiredSkill'])); + $xml->XMLWriter()->writeAttribute('rank', $data['RequiredSkillRank']); + $xml->XMLWriter()->endElement(); //requiredSkill + } } if($data['RequiredReputationFaction'] > 0) { - $xml->XMLWriter()->startElement('requiredFaction'); - $xml->XMLWriter()->writeAttribute('name', $this->aDB->selectCell("SELECT `name_".$this->_locale."` FROM `armory_faction` WHERE `id`=?", $data['RequiredReputationFaction'])); - $xml->XMLWriter()->writeAttribute('rep', $data['RequiredReputationRank']); - $xml->XMLWriter()->endElement(); //requiredFaction + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' name="' . $this->aDB->selectCell("SELECT `name_".$this->_locale."` FROM `armory_faction` WHERE `id`=?", $data['RequiredReputationFaction']) . '"'); + $xml->XMLWriter()->writeRaw(' rep="' . $data['RequiredReputationRank'] . '"'); + $xml->XMLWriter()->writeRaw('/>'); //requiredFaction + } + else { + $xml->XMLWriter()->startElement('requiredFaction'); + $xml->XMLWriter()->writeAttribute('name', $this->aDB->selectCell("SELECT `name_".$this->_locale."` FROM `armory_faction` WHERE `id`=?", $data['RequiredReputationFaction'])); + $xml->XMLWriter()->writeAttribute('rep', $data['RequiredReputationRank']); + $xml->XMLWriter()->endElement(); //requiredFaction + } } $xml->XMLWriter()->startElement('requiredLevel'); $xml->XMLWriter()->text($data['RequiredLevel']); @@ -1632,9 +1721,16 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character if($data['itemset'] > 0) { $xml->XMLWriter()->startElement('setData'); $itemsetName = $this->aDB->selectCell("SELECT `name_" . $this->_locale ."` FROM `armory_itemsetinfo` WHERE `id`=?", $data['itemset']); - $xml->XMLWriter()->startElement('name'); - $xml->XMLWriter()->text($itemsetName); - $xml->XMLWriter()->endElement(); + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw($itemsetName); + $xml->XMLWriter()->writeRaw(''); + } + else { + $xml->XMLWriter()->startElement('name'); + $xml->XMLWriter()->text($itemsetName); + $xml->XMLWriter()->endElement(); + } $setdata = $this->aDB->selectRow("SELECT * FROM `armory_itemsetinfo` WHERE `id`=?", $data['itemset']); // t9/t10 Onyxia trinkets if($data['itemset'] >= 843 && $data['itemset'] != 881 && $data['itemset'] != 882) { @@ -1643,12 +1739,22 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character if($currentSetData) { for($i=1;$i<6;$i++) { if(Items::IsItemExists($currentSetData['item'.$i])) { - $xml->XMLWriter()->startElement('item'); - $xml->XMLWriter()->writeAttribute('name', Items::getItemName($currentSetData['item'.$i])); - if($characters->IsItemEquipped($currentSetData['item'.$i])) { - $xml->XMLWriter()->writeAttribute('equipped', 1); + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' name="' . Items::getItemName($currentSetData['item'.$i]).'"'); + if($characters->IsItemEquipped($currentSetData['item'.$i])) { + $xml->XMLWriter()->writeRaw(' equipped="' . 1 . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //item + } + else { + $xml->XMLWriter()->startElement('item'); + $xml->XMLWriter()->writeAttribute('name', Items::getItemName($currentSetData['item'.$i])); + if($characters->IsItemEquipped($currentSetData['item'.$i])) { + $xml->XMLWriter()->writeAttribute('equipped', 1); + } + $xml->XMLWriter()->endElement(); //item } - $xml->XMLWriter()->endElement(); //item } } } @@ -1656,19 +1762,34 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character else { for($i=1;$i<10;$i++) { if(isset($setdata['item'.$i]) && Items::IsItemExists($setdata['item'.$i])) { - $xml->XMLWriter()->startElement('item'); - $xml->XMLWriter()->writeAttribute('name', Items::getItemName($setdata['item'.$i])); - $xml->XMLWriter()->endElement(); //item + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' name="' . Items::getItemName($setdata['item'.$i]) . '"'); + $xml->XMLWriter()->writeRaw('/>'); //item + } + else { + $xml->XMLWriter()->startElement('item'); + $xml->XMLWriter()->writeAttribute('name', Items::getItemName($setdata['item'.$i])); + $xml->XMLWriter()->endElement(); //item + } } } } $itemsetbonus = Items::GetItemSetBonusInfo($setdata); if(is_array($itemsetbonus)) { foreach($itemsetbonus as $item_bonus) { - $xml->XMLWriter()->startElement('setBonus'); - $xml->XMLWriter()->writeAttribute('desc', $item_bonus['desc']); - $xml->XMLWriter()->writeAttribute('threshold', $item_bonus['threshold']); - $xml->XMLWriter()->endElement(); //setBonus + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' desc="' . $item_bonus['desc'] . '"'); + $xml->XMLWriter()->writeRaw(' threshold="' . $item_bonus['threshold'] . '"'); + $xml->XMLWriter()->writeRaw('/>'); //setBonus + } + else { + $xml->XMLWriter()->startElement('setBonus'); + $xml->XMLWriter()->writeAttribute('desc', $item_bonus['desc']); + $xml->XMLWriter()->writeAttribute('threshold', $item_bonus['threshold']); + $xml->XMLWriter()->endElement(); //setBonus + } } } $xml->XMLWriter()->endElement(); //setData @@ -1726,10 +1847,18 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character $spellreagents = $this->GetSpellItemCreateReagentsInfo($spell_tmp['EffectItemType_' . $k]); if(is_array($spellreagents)) { foreach($spellreagents as $reagent) { - $xml->XMLWriter()->startElement('reagent'); - $xml->XMLWriter()->writeAttribute('count', $reagent['count']); - $xml->XMLWriter()->writeAttribute('name', $reagent['name']); - $xml->XMLWriter()->endElement(); //reagent + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw('XMLWriter()->writeRaw(' count="' . $reagent['count'] . '"'); + $xml->XMLWriter()->writeRaw(' name="' . $reagent['name'] . '"'); + $xml->XMLWriter()->writeRaw('/>'); //reagent + } + else { + $xml->XMLWriter()->startElement('reagent'); + $xml->XMLWriter()->writeAttribute('count', $reagent['count']); + $xml->XMLWriter()->writeAttribute('name', $reagent['name']); + $xml->XMLWriter()->endElement(); //reagent + } } } else { @@ -1743,23 +1872,39 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character } $xml->XMLWriter()->endElement(); //spellData if(!empty($data['description']) && $data['description'] != $spellInfo && $spellData != 1) { - $xml->XMLWriter()->startElement('desc'); - if($this->_locale == 'en_gb' || $this->_locale == 'en_us') { - $xml->XMLWriter()->text($data['description']); + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(''); + $xml->XMLWriter()->writeRaw(Items::GetItemDescription($itemID)); + $xml->XMLWriter()->writeRaw(''); //desc } else { - $xml->XMLWriter()->text(Items::GetItemDescription($itemID)); + $xml->XMLWriter()->startElement('desc'); + if($this->_locale == 'en_gb' || $this->_locale == 'en_us') { + $xml->XMLWriter()->text($data['description']); + } + else { + $xml->XMLWriter()->text(Items::GetItemDescription($itemID)); + } + $xml->XMLWriter()->endElement(); //desc } - $xml->XMLWriter()->endElement(); //desc } if(!$parent) { $itemSource = Items::GetItemSource($itemID); if(is_array($itemSource)) { - $xml->XMLWriter()->startElement('itemSource'); - foreach($itemSource as $source_key => $source_value) { - $xml->XMLWriter()->writeAttribute($source_key, $source_value); - } - $xml->XMLWriter()->endElement(); //itemSource + if(Utils::IsWriteRaw()) { + $xml->XMLWriter()->writeRaw(' $source_value) { + $xml->XMLWriter()->writeRaw(' ' . $source_key .'="' . $source_value . '"'); + } + $xml->XMLWriter()->writeRaw('/>'); //itemSource + } + else { + $xml->XMLWriter()->startElement('itemSource'); + foreach($itemSource as $source_key => $source_value) { + $xml->XMLWriter()->writeAttribute($source_key, $source_value); + } + $xml->XMLWriter()->endElement(); //itemSource + } } if($itemSource['value'] == 'sourceType.vendor' && $reqArenaRating = Items::IsRequiredArenaRating($itemID)) { $xml->XMLWriter()->startElement('requiredPersonalArenaRating'); diff --git a/includes/classes/class.utils.php b/includes/classes/class.utils.php index b0886bac7..e303e07bf 100644 --- a/includes/classes/class.utils.php +++ b/includes/classes/class.utils.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release Candidate 1 - * @revision 294 + * @revision 296 * @copyright (c) 2009-2010 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -1091,5 +1091,12 @@ public function CheckConfigRealmData() { } return true; } + + public function IsWriteRaw() { + if($this->_locale == 'en_gb' || $this->_locale == 'en_us' || $this->_locale == 'ru_ru') { + return false; + } + return true; + } } ?> \ No newline at end of file diff --git a/includes/revision_nr.php b/includes/revision_nr.php index 5d11aeb96..02b6aaf94 100644 --- a/includes/revision_nr.php +++ b/includes/revision_nr.php @@ -1,6 +1,6 @@ \ No newline at end of file