Skip to content

Commit

Permalink
[440] Use static methods in Armory class
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadez committed Jan 2, 2011
1 parent 25f0819 commit c647db0
Show file tree
Hide file tree
Showing 75 changed files with 1,054 additions and 1,159 deletions.
26 changes: 13 additions & 13 deletions achievement-firsts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 365
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand All @@ -27,8 +27,8 @@
die('<b>Fatal error:</b> unable to load system files.');
}
header('Content-type: text/xml');
if($armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('achievement-firsts', $armory->currentRealmInfo['name']);
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('achievement-firsts', Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
Expand All @@ -39,12 +39,12 @@
$xml->LoadXSLT('serverfirsts.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'achievement-firsts.xml');
$realmName = (isset($_GET['r'])) ? urldecode($_GET['r']) : $armory->currentRealmInfo['name'];
$realmName = (isset($_GET['r'])) ? urldecode($_GET['r']) : Armory::$currentRealmInfo['name'];
$isRealm = $utils->IsRealm($realmName);
if($isRealm) {
$armory->Log()->writeLog('achievement-firsts.php : realm %s defined', $realmName);
Armory::Log()->writeLog('achievement-firsts.php : realm %s defined', $realmName);
$xml->XMLWriter()->startElement('realmInfo');
$xml->XMLWriter()->writeAttribute('realm', $realmName);
// Get achievements
Expand All @@ -64,32 +64,32 @@
$xml->XMLWriter()->writeAttribute('guild', $achievement_info['guildname']);
if(isset($achievement_info['guildname'])) {
$xml->XMLWriter()->writeAttribute('guildId', $achievement_info['guildid']);
$xml->XMLWriter()->writeAttribute('guildUrl', sprintf('gn=%s&r=%s', urlencode($achievement_info['guildname']), urlencode($armory->currentRealmInfo['name'])));
$xml->XMLWriter()->writeAttribute('guildUrl', sprintf('gn=%s&r=%s', urlencode($achievement_info['guildname']), urlencode(Armory::$currentRealmInfo['name'])));
}
$xml->XMLWriter()->writeAttribute('name', $achievement_info['charname']);
$xml->XMLWriter()->writeAttribute('raceId', $achievement_info['race']);
$xml->XMLWriter()->writeAttribute('realm', $armory->currentRealmInfo['name']);
$xml->XMLWriter()->writeAttribute('realmUrl', urlencode($armory->currentRealmInfo['name']));
$xml->XMLWriter()->writeAttribute('url', sprintf('r=%s&cn=%s', urlencode($armory->currentRealmInfo['name']), urlencode($achievement_info['charname'])));
$xml->XMLWriter()->writeAttribute('realm', Armory::$currentRealmInfo['name']);
$xml->XMLWriter()->writeAttribute('realmUrl', urlencode(Armory::$currentRealmInfo['name']));
$xml->XMLWriter()->writeAttribute('url', sprintf('r=%s&cn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($achievement_info['charname'])));
$xml->XMLWriter()->endElement(); //character
$xml->XMLWriter()->endElement(); //achievement
}
}
else {
$armory->Log()->writeError('achievement-firsts.php : achievement_firsts variable must be in array!');
Armory::Log()->writeError('achievement-firsts.php : achievement_firsts variable must be in array!');
}
$xml->XMLWriter()->endElement(); //realmInfo
}
else {
$armory->Log()->writeLog('Unable to find any achievement firsts');
Armory::Log()->writeLog('Unable to find any achievement firsts');
$xml->XMLWriter()->startElement('error');
$xml->XMLWriter()->writeAttribute('errCode', 'noData');
$xml->XMLWriter()->endElement(); //error
}
$xml->XMLWriter()->endElement(); //page
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
if($armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
$cache_data = $utils->GenerateCacheData(0, 0, 'achievement-firsts');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data);
Expand Down
4 changes: 2 additions & 2 deletions arena-calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 345
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -31,7 +31,7 @@
$xml->LoadXSLT('tools/arena-calculator.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'arena-calculator.xml');

$xml->XMLWriter()->startElement('selectTeamType');
Expand Down
12 changes: 6 additions & 6 deletions arena-game.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 345
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -40,15 +40,15 @@
$xml->LoadXSLT('error/error.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->startElement('errorhtml');
$xml->XMLWriter()->endElement(); //errorhtml
$xml->XMLWriter()->endElement(); //page
echo $xml->StopXML();
exit;
}
if($arenateams->GetGameID() > 0 && $armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('arena-game', $arenateams->GetGameID(), $armory->currentRealmInfo['name']);
if($arenateams->GetGameID() > 0 && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('arena-game', $arenateams->GetGameID(), Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id, 'arena')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
Expand All @@ -59,7 +59,7 @@
$xml->LoadXSLT('arena/arena-game.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'arena-game.xml');
$xml->XMLWriter()->startElement('game');
if(is_array($game_data['gameData'])) {
Expand Down Expand Up @@ -89,7 +89,7 @@
$xml->XMLWriter()->endElement(); //page
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
if($armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
$cache_data = $utils->GenerateCacheData($arenateams->GetGameID(), $arenateams->arenateamid, 'arena-game');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data, 'arena');
Expand Down
8 changes: 4 additions & 4 deletions arena-ladder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 345
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -52,10 +52,10 @@

$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'arena-ladder.xml');
$ladder_result = array(
'battleGroup' => $armory->armoryconfig['defaultBGName'],
'battleGroup' => Armory::$armoryconfig['defaultBGName'],
'filterField' => null,
'filterValue' => null,
'level' => 80,
Expand All @@ -64,7 +64,7 @@
'sortDir' => $sortDir,
'sortField' => $sortField,
'teamSize' => $current_type,
'url' => sprintf('b=%s&ts=%d', urlencode($armory->armoryconfig['defaultBGName']), $current_type),
'url' => sprintf('b=%s&ts=%d', urlencode(Armory::$armoryconfig['defaultBGName']), $current_type),
'xmlSchemaVersion' => '1.0'
);
$xml->XMLWriter()->startElement('arenaLadderPagedResult');
Expand Down
12 changes: 6 additions & 6 deletions arena-team-game-chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 395
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -48,15 +48,15 @@
$xml->LoadXSLT('error/error.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->startElement('errorhtml');
$xml->XMLWriter()->endElement(); //errorhtml
$xml->XMLWriter()->endElement(); //page
echo $xml->StopXML();
exit;
}
if($arenateams->teamname && $isTeam && $armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('arena-team-game-chart', $arenateams->teamname, $armory->currentRealmInfo['name']);
if($arenateams->teamname && $isTeam && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('arena-team-game-chart', $arenateams->teamname, Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id, 'arena')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
Expand All @@ -67,7 +67,7 @@
$xml->LoadXSLT('arena/arenareport-graph.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'arena-team-game-chart.xml');
$arenateams->InitTeam();
$team_info = $arenateams->GetArenaTeamInfo();
Expand Down Expand Up @@ -105,7 +105,7 @@
$xml->XMLWriter()->endElement(); //page
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
if($armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
$cache_data = $utils->GenerateCacheData($arenateams->teamname, $arenateams->arenateamid, 'arena-team-game-chart');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data, 'arena');
Expand Down
12 changes: 6 additions & 6 deletions arena-team-report-opposing-teams.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 365
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -48,15 +48,15 @@
$xml->LoadXSLT('error/error.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->startElement('errorhtml');
$xml->XMLWriter()->endElement(); //errorhtml
$xml->XMLWriter()->endElement(); //page
echo $xml->StopXML();
exit;
}
if($arenateams->teamname && $isTeam && $armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('arena-team-report-opposing-teams', $arenateams->teamname, $armory->currentRealmInfo['name']);
if($arenateams->teamname && $isTeam && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
$cache_id = $utils->GenerateCacheId('arena-team-report-opposing-teams', $arenateams->teamname, Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id, 'arena')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
Expand All @@ -67,7 +67,7 @@
$xml->LoadXSLT('arena/opposing-teams.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'arena-team-report-opposing-teams.xml');
$arenateams->InitTeam();
$team_info = $arenateams->GetArenaTeamInfo();
Expand Down Expand Up @@ -103,7 +103,7 @@
$xml->XMLWriter()->endElement(); //page
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
if($armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
$cache_data = $utils->GenerateCacheData($arenateams->teamname, $arenateams->arenateamid, 'arena-team-report-opposing-teams');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data, 'arena');
Expand Down
14 changes: 7 additions & 7 deletions battlegroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 345
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -32,22 +32,22 @@
/** Header **/
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'battlegroups.xml');
$xml->XMLWriter()->startElement('battlegroups');
$xml->XMLWriter()->startElement('battlegroup');
$current_BG = array(
'display' => $armory->armoryconfig['defaultBGName'],
'ladderUrl' => sprintf('b=%s', urlencode($armory->armoryconfig['defaultBGName'])),
'name' => strtolower($armory->armoryconfig['defaultBGName']),
'display' => Armory::$armoryconfig['defaultBGName'],
'ladderUrl' => sprintf('b=%s', urlencode(Armory::$armoryconfig['defaultBGName'])),
'name' => strtolower(Armory::$armoryconfig['defaultBGName']),
'sortPosition' => 1
);
foreach($current_BG as $bg_key => $bg_value) {
$xml->XMLWriter()->writeAttribute($bg_key, $bg_value);
}
$xml->XMLWriter()->startElement('realms');
if(is_array($armory->realmData)) {
foreach($armory->realmData as $realm) {
if(is_array(Armory::$realmData)) {
foreach(Armory::$realmData as $realm) {
$xml->XMLWriter()->startElement('realm');
$xml->XMLWriter()->writeAttribute('name', $realm['name']);
$xml->XMLWriter()->writeAttribute('nameEn', $realm['name']);
Expand Down
4 changes: 2 additions & 2 deletions bookmarks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 413
* @revision 440
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
Expand Down Expand Up @@ -48,7 +48,7 @@
/** Header **/
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', $armory->GetLocale());
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'bookmarks.xml');
$bookmarks_count = $utils->GetBookmarksCount();
$xml->XMLWriter()->startElement('characters');
Expand Down
Loading

0 comments on commit c647db0

Please sign in to comment.