/** * Return Facebook events for the given username with a limit. * * @param string $name Facebook username to get events from * @param int $limit Number of events to get * @param array Query parameters to filter events e.g. "since" => "yesterday" (future events) or "until" => "yesterday" (past events) */ public static function get($name, $limit, $query = array()) { $api = new FBAPI(); $results = $api->graph($name, 'events', $query); if ($results instanceof FBAPI_Exception) { return false; } // return false when there's no data if (empty($results['data'])) { return false; } $output = new DataObjectSet(); $count = 0; foreach ($results['data'] as $record) { if ($limit && $count >= $limit) { break; } // we have to do another request to get the detail of the event. $detail = $api->graph($record['id']); $record = array_merge($record, $detail); $output->push(new FBEvent($record)); $count++; } return $output; }
public static function get($name, $limit) { if (!$name) { return false; } $api = new FBAPI(); $results = $api->graph($name, 'photos'); // @todo figure out what to do with exceptions. Log them using SS_Log::log()? if ($results instanceof FBAPI_Exception) { return false; } // return false when there's no data if (empty($results['data'])) { return false; } $output = new DataObjectSet(); $count = 0; foreach ($results['data'] as $record) { if ($limit && $count >= $limit) { break; } $output->push(new FBPhoto($record)); $count++; } return $output; }