<html>
<head>
<meta charset="ISO-8859-1" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="keywords" content="" />
</head>
<body>
<?php
// Konfiguration
$iMaxEntries = 3; // Anzahl der maximalen Einträge pro Zeile
$sCacheFile = 'cache.sth';
$aGuildData = array();
$zeit = filemtime ($sCacheFile);
$aClassNames = array('<img src="warrior.jpg" />', '<img src="paladin.jpg" />', '<img src="hunter.jpg" />', '<img src="rogue.jpg" />', '<img src="priest.jpg" />', '<img src="deathknight.jpg" />', '<img src="shaman.jpg" />', '<img src="mage.jpg" />', '<img src="warlock.jpg" />', '<img src="monk.jpg" />', '<img src="druid.jpg" />');
$aClassRaces = array('Mensch', 'Orc', 'Zwerg', 'Nachtelf', 'Untoter', 'Taure', 'Gnom', 'Troll', 'Goblin', 'Blutelf', 'Draenei', '', '', '', '', '', '', '', '', '', '', 'Worg', '', '', 'Pandare');
$aClassColors = array('#ffffff','#C69B6D', '#F48CBA','#AAD372','#FFF468','#F0EBE0','#C41E3B','#2359FF','#68CCEF','#9382C9','#00FFBA','#FF7C0A');
$aClassText = array('#FFFFFF');
$sOutput = '';
if (file_exists($sCacheFile))
$aGuildData = json_decode(file_get_contents($sCacheFile), true);
// Prüfe Rückgabe
if ( sizeof($aGuildData) ) {
$sOutput .= '<p align="center"><table border="1">';
$sOutput .= '<tr><td><h2><font color="#990000">Gildeninformationen</font></h2></td>';
$sOutput .= "<td><p align='center'><img src='logo.png' width='50' height='50' /></p></td></tr>";
$sOutput .= '<tr><td><b><font color="#33FF00">Gildenname:</b></td><td style="color: #33FF00;" align="center"> '.$aGuildData['name'].'</font><br /></td></tr>';
$sOutput .= '<tr><td><b><font color="#33FF00">Realm:</b></td><td style="color: #33FF00;" align="center"> '.$aGuildData['realm'].'</font><br /></td></tr>';
$sOutput .= '<tr><td><b><font color="#33FF00">Gildenstufe:</b></td><td style="color: #33FF00;" align="center"> '.$aGuildData['level'].'</font><br /></td></tr>';
$sOutput .= '<tr><td><b><font color="#33FF00">Mitgliederanzahl:</b></td><td style="color: #33FF00;" align="center"> '.count($aGuildData['members']).'</font><br /></td></tr>';
$sOutput .= '<tr><td><b><font color="#33FF00">Gildenerfolgspunkte:</b></td><td style="color: #33FF00;" align="center"> '.$aGuildData['achievementPoints'].'</font><br /></td></tr>';
$sOutput .= '<tr><td colspan="2" style="background-color: #FF0000;" align="center">Letzte Aktualisierung: '. gmdate ( 'd M Y H:i:s', $zeit ).' Uhr</td></tr>';
$sOutput .= '</table></p>';
$sOutput .= '<div>';
$iColumn = 0;
foreach ($aGuildData['members'] as $aMemberItem ) {
$sOutput .= '<a href="http://eu.battle.net/wow/de/character/lothar/'.htmlentities($aMemberItem['name'], ENT_COMPAT, 'UTF-8').'/simple" target="_blank"><div style="float:left">';
$sOutput .= '<p align="center"><table border="1" width="205px" style=\'background-color:'.$aClassColors[$aMemberItem['class']].'\'>';
$sOutput .= '<tr><td align="center"><h3>'.htmlentities($aMemberItem['name'], ENT_COMPAT, 'UTF-8').'</h3></td><td align="center"> ';
$sOutput .= '<font>'.$aClassNames[$aMemberItem['class'] - 1].'</font></td></tr>';
$sOutput .= '<tr><td><b>Level:</b></td><td align="center"> '.$aMemberItem['level'].'</td></tr>';
$sOutput .= '<tr><td><b>Volk:</b></td><td align="center"> ';
$sOutput .= '<font>'.$aClassRaces[$aMemberItem['race'] - 1].'</font></td></tr>';
$sOutput .= '<tr><td><b>Erfolgspunkte:</b></td><td align="center"> '.$aMemberItem['achievementPoints'].'</td></tr>';
$sOutput .= '</ br></table></p>';
$sOutput .= '</div></a>';
$iColumn++;
if( $iColumn > $iMaxEntries-1 ) {
$sOutput .= '<div style="clear:both"></div>';
$iColumn = 0;
}
}
$sOutput .= '</div>';
}
echo $sOutput;
unset($aGuildData, $aMemberItem, $aMemberItem, $sOutput);
?>
</body>
</html>