public function testLanguageSupport() { $foursquare = new FoursquareApi(CLIENT_ID, CLIENT_SECRET, '', 'v2', 'fr'); $categories = json_decode($foursquare->GetPublic('venues/categories')); foreach ($categories->response->categories as $category) { if ($category->id == '4d4b7104d754a06370d81259') { $this->assertEquals($category->name, 'Culture et loisirs', "Locale failed or \"{$category->name}\" is a new translation"); $run = true; break; } } $this->assertEquals($run, true, 'Test category no longer exists in fr locale, update test.'); // Ensure we get a success response $this->assertLessThan(400, $venues->meta->code, $venues->meta->errorDetail); }
<form action="" method="GET"> <input type="text" name="location"/> <input type="submit" value="Search!"/> </form> <p>Searching for venues near <?php echo $location; ?> </p> <hr/> <?php // Generate a latitude/longitude pair using Google Maps API list($lat, $lng) = $foursquare->GeoLocate($location); // Prepare parameters $params = ["ll" => "{$lat},{$lng}"]; // Perform a request to a public resource $response = $foursquare->GetPublic("venues/search", $params); $venues = json_decode($response); ?> <?php foreach ($venues->response->venues as $venue) { ?> <div class="venue"> <?php if (isset($venue->categories['0'])) { echo '<image class="icon" src="' . $venue->categories['0']->icon->prefix . '88.png"/>'; } else { echo '<image class="icon" src="https://foursquare.com/img/categories/building/default_88.png"/>'; } echo '<a href="https://foursquare.com/v/' . $venue->id . '" target="_blank"/><b>'; echo $venue->name;