Library: facebook
Overview
Library for building facebook apps.
Importing facebook will automatically make all known FBML tags available as functional HTML tags, with : replaced with _. For example, the you can create a FB:FRIEND-SELECTOR tag by calling FB_FRIEND_SELECTOR(). See: http://wiki.developers.facebook.com/index.php/Category:FBML_tags
Importing facebook will automatically make all known FBML tags available as functional HTML tags, with : replaced with _. For example, the you can create a FB:FRIEND-SELECTOR tag by calling FB_FRIEND_SELECTOR(). See: http://wiki.developers.facebook.com/index.php/Category:FBML_tags
source: facebook.js
Functions
Tells facebook to redirect the user to a new URL. For FBML facebook apps, use
this instead of response.redirect(), so that it redirects the facebook user
instead of the facebook server.
parameters
| string | url? | The new URL to direct the user to. If you do not set this parameter, the user will be redirected to the main canvas page. |
Ensures that the current user has added this app. If the current user of the app
has already added it, this does nothing. Otherwise, it immediately redirects the
user to the add page.
Every facebook app should call fb.init() immediately after import("facebook").
It will first make sure the AppJet app is configured as a valid facebook app. Next, if
the request path starts with "/callback/", it will
authenticate that the request from facebook and then set up all the fb.* properties.
Executes a remote facebook API call. See the Facebok API
Methods wiki page for a list of all methods.
parameters
| string | cmd | The name of the command, e.g. "facebook.profile.setFBML". |
| object | params | The set of parameters to pass to this call. Note: api_key, sesion_key, call_id, v, and format, and sig will be automatically set for you. However, you can override any of these if you like. |
returns
| object | The call result, as a javascript object. |
examples
fb.requireAdd();
print(fb.call("users.getInfo",
{ uids: [700577, 550505927],
fields: ["birthday", "about_me"] }));
Convenience function for sending a notification to 1 or more users.
See:
Facebook's docs for facebook.notifications.send.
parameters
| array or string | users | Array of uids or single uid of those to receive this notification. |
| string | notificationFBML | The FBML content of the notification. |
Convenience function for setting a user's profile FBML.
See Facebook's
docs for facebook.profile.setFBML.
parameters
| string | uid | The uid of the profile to set. |
| string | markup | The text of the FBML to set. |
examples
fb.requireAdd();
fb.setProfileFBML(fb.uid,
DIV(CENTER(
"Here is another picture of me:",
BR(),
FB_PROFILE_PIC({uid: fb.uid}))));
Checks post parameters against fb_sig to verify that the reqest
came from facebook servers and not a haxxor. Note: this method is called automatically by
fb.init(), so you usually do not need to call it directly.
returns
| boolean | true if the request is from facebook and legit; false otherwise. |
Objects
string
The current facebook sessionKey. This will only be set if the session user has added the
app and is logged in to it. Otherwise, it will be undefined.
array[string]
List of the uids of the current user's friends. This will only be filled in
if the session user has added the app and is logged in to it.