本文整理汇总了PHP中Api::queryLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::queryLocation方法的具体用法?PHP Api::queryLocation怎么用?PHP Api::queryLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::queryLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
private function authenticate()
{
$Out = Out::getInstance();
try {
// Google authentication process
// For details see the Google PHP API documentation
if ($this->mClient == null) {
$KeyFile = dirname(__FILE__) . '/../../config/key.google.p12';
if (!file_exists($KeyFile)) {
throw new Exception('Missing key file "lib/config/key.google.p12"');
}
$Certificate = file_get_contents($KeyFile);
$this->mClient = new Google_Client();
$this->mClient->setApplicationName('ppxraidplaner');
$this->mCalService = new Google_Service_Calendar($this->mClient);
$AssertCredentials = new Google_Auth_AssertionCredentials(GOOGLE_SERVICE_MAIL, array(Google_Service_Calendar::CALENDAR), $Certificate);
$this->mClient->setAssertionCredentials($AssertCredentials);
}
if ($this->mClient->getAuth()->isAccessTokenExpired()) {
$this->mClient->getAuth()->refreshTokenWithAssertion($AssertCredentials);
}
$this->mToken = $this->mClient->getAccessToken();
// Get locations
// This is an initial setup step upon first call of this function.
$Locations = Api::queryLocation(null);
$this->mLocations = array();
foreach ($Locations as $Location) {
$this->mLocations[$Location['Id']] = $Location['Name'];
}
return true;
} catch (Exception $Ex) {
// Make sure any exceptions are properly passed to the UI
$this->mClient = null;
$Out->pushError($Ex->getMessage());
}
return false;
}
示例2: Out
$Out = new Out();
$Out->pushValue("title", "Raidplaner RSS feed");
$Out->pushValue("link", $BaseURL . "index.php");
$Out->pushValue("description", "Upcoming raids for the next 2 weeks.");
$Out->pushValue("language", "en-en");
$Out->pushValue("copyright", "packedpixel");
$Out->pushValue("pubDate", date(DATE_RSS));
// Requires private token to be visible
$Token = isset($_REQUEST["token"]) ? $_REQUEST["token"] : null;
if (Api::testPrivateToken($Token)) {
// Setting the correct timezones
$Timezone = isset($_REQUEST["timezone"]) ? $_REQUEST["timezone"] : date_default_timezone_get();
// Query API
date_default_timezone_set("UTC");
$Parameters = array("start" => time() - 24 * 60 * 60, "end" => time() + 14 * 24 * 60 * 60, "limit" => 0, "closed" => true, "canceled" => true);
$Locations = Api::queryLocation(null);
$Raids = Api::queryRaid($Parameters);
$LocationName = array();
foreach ($Locations as $Location) {
$LocationName[$Location["Id"]] = $Location["Name"];
}
// Generate RSS content
date_default_timezone_set($Timezone);
foreach ($Raids as $Raid) {
$Start = date("H:i", intval($Raid["Start"]));
$End = date("H:i", intval($Raid["End"]));
$Out->pushValue("item", array("title" => $LocationName[$Raid["LocationId"]] . " (" . $Raid["Size"] . ")", "description" => "Status: " . $Raid["Status"] . "\nFrom " . $Start . " to " . $End . "\n" . $Raid["Description"], "link" => $BaseURL . "index.php#raid," . $Raid["RaidId"], "author" => "Raidplaner", "guid" => $Raid["RaidId"], "pubDate" => date(DATE_RSS, intval($Raid["Start"]))));
}
}
$Out->flushXML("channel");
echo '</rss>';