/** * Requests info about the application from Facebook. * * The 'id' field will always be returned. If there was an error, this will * be the only field in the returned array. */ public function getInfo() { if (empty(self::$info)) { global $facebook; // Generate an array of the fields we wish to fetch $fields = array('name', 'link', 'description', 'icon_url', 'logo_url', 'daily_active_users', 'weekly_active_users', 'monthly_active_users', 'namespace', 'app_domains', 'auth_dialog_description', 'auth_dialog_headline', 'auth_dialog_perms_explanation', 'contact_email', 'creator_uid', 'deauth_callback_url', 'privacy_policy_url', 'terms_of_service_url', 'user_support_email', 'website_url'); // Calls to an app's properties must be made with an app access token // https://developers.facebook.com/docs/reference/api/application/#application_access_tokens $user_access_token = $facebook->getAccessToken(); $facebook->setAccessToken($this->id . '|' . $this->secret); try { self::$info = $facebook->api("/{$this->id}?fields=" . implode(',', $fields)); // Fill in missing fields with false values foreach ($fields as $field) { if (!isset(self::$info[$field])) { self::$info[$field] = false; } } } catch (FacebookApiException $e) { error_log($e->getMessage()); self::$info = array('id' => $this->id); } // Restore the user access_token $facebook->setAccessToken($user_access_token); } return self::$info; }