コード例 #1
0
<link rel="stylesheet" type="text/css" href="css/wvwscore.css">
<?php 
require_once "../helpers/gw2api/Service.php";
// Instantiate a new service object and specify cache path and TTL settings
$gw2 = new PhpGw2Api\Service('../cache', 5);
// Set how to return the JSON
$gw2->returnAssoc(true);
$world_home_id = 1009;
#-- fort aspenwood
$matches = $gw2->getMatches();
#// find the match for our world
foreach ($matches['wvw_matches'] as $match) {
    if ($match['red_world_id'] == $world_home_id || $match['green_world_id'] == $world_home_id || $match['blue_world_id'] == $world_home_id) {
        break;
    }
}
echo "<div>";
$scores = $gw2->getMatchDetails(array('match_id' => $match['wvw_match_id']));
// Consult the name of the world through the ID (temporal API Anet crash)
$world_names = $gw2->getWorldNames();
foreach ($world_names as $world) {
    if ($world['id'] == $match['red_world_id']) {
        $red_world_name = $world['name'];
    }
    if ($world['id'] == $match['blue_world_id']) {
        $blue_world_name = $world['name'];
    }
    if ($world['id'] == $match['green_world_id']) {
        $green_world_name = $world['name'];
    }
    if ($match['red_world_id'] == $world_home_id) {
コード例 #2
0
 function __construct($c)
 {
     $this->c = $c;
     parent::__construct($this->c["cacheDIR"], $this->c["cacheTTL"]);
 }