PHP Class FacebookRestClient, aprilchild

Mostrar archivo Open project: aprilchild/aprilchild Class Usage Examples

Public Properties

Property Type Description
$added to save making the friends.get api call, this will get prepopulated on canvas pages
$api_key
$friends_list
$secret
$session_key

Public Methods

Method Description
__construct ( $api_key, $secret, string $session_key = null ) Create the client.
auth_getSession ( string $auth_token ) : assoc Returns the session information available after current user logs in.
call_method ( $method, $params ) * UTILITY FUNCTIONS
convert_simplexml_to_array ( $sxml )
events_get ( integer $uid, array $eids, integer $start_time, integer $end_time, string $rsvp_status ) : array Returns events according to the filters specified.
events_getMembers ( integer $eid ) : assoc Returns membership list data associated with an event
fbml_refreshImgSrc ( $url )
fbml_refreshRefUrl ( $url )
fbml_setRefHandle ( $handle, $fbml )
feed_publishActionOfUser ( $title, $body, $image_1 = null, $image_1_link = null, $image_2 = null, $image_2_link = null, $image_3 = null, $image_3_link = null, $image_4 = null, $image_4_link = null, $priority = 1 )
feed_publishStoryToUser ( $title, $body, $image_1 = null, $image_1_link = null, $image_2 = null, $image_2_link = null, $image_3 = null, $image_3_link = null, $image_4 = null, $image_4_link = null, $priority = 1 )
fql_query ( string $query ) : generalized Makes an FQL query. This is a generalized way of accessing all the data in the API, as an alternative to most of the other method calls. More info at http://developers.facebook.com/documentation.php?v=1.0&doc=fql
friends_areFriends ( $uids1, $uids2 ) : array Returns whether or not pairs of users are friends.
friends_get ( ) : array Returns the friends of the current session user.
friends_getAppUsers ( ) : array Returns the friends of the session user, who are also users of the calling application.
groups_get ( integer $uid, array $gids ) : array Returns groups according to the filters specified.
groups_getMembers ( integer $gid ) : assoc Returns the membership list of a group
notifications_get ( ) : assoc Returns the outstanding notifications for the session user.
notifications_send ( $to_ids, $markup, $no_email ) : string Sends an email notification to the specified user.
notifications_sendRequest ( array $to_ids, string $type, string $content, string $image, boolean $invite ) : string Sends a request to the specified user (e.g. "you have 1 event invitation")
photos_get ( integer $subj_id, integer $aid, array $pids ) : array Returns photos according to the filters specified.
photos_getAlbums ( integer $uid, array $aids ) Returns the albums created by the given user.
photos_getTags ( string $pids ) : array Returns the tags on all photos specified.
post_request ( $method, $params )
profile_getFBML ( $uid )
profile_setFBML ( string $markup, $uid = null ) : array Sets the FBML for the profile of the user attached to this session
users_getInfo ( array $uids, array $fields ) : array Returns the requested info fields for the requested set of users
users_getLoggedInUser ( ) : integer Returns the user corresponding to the current session object.
users_isAppAdded ( ) : boolean Returns whether or not the user corresponding to the current session object has the app installed

Method Details

__construct() public method

Create the client.
public __construct ( $api_key, $secret, string $session_key = null )
$session_key string if you haven't gotten a session key yet, leave this as null and then set it later by just directly accessing the $session_key member variable.

auth_getSession() public method

Returns the session information available after current user logs in.
public auth_getSession ( string $auth_token ) : assoc
$auth_token string the token returned by auth_createToken or passed back to your callback_url.
return assoc array containing session_key, uid

call_method() public method

* UTILITY FUNCTIONS
public call_method ( $method, $params )

convert_simplexml_to_array() public static method

public static convert_simplexml_to_array ( $sxml )

events_get() public method

Returns events according to the filters specified.
public events_get ( integer $uid, array $eids, integer $start_time, integer $end_time, string $rsvp_status ) : array
$uid integer Optional: User associated with events. A null parameter will default to the session user.
$eids array Optional: Filter by these event ids. A null parameter will get all events for the user.
$start_time integer Optional: Filter with this UTC as lower bound. A null or zero parameter indicates no lower bound.
$end_time integer Optional: Filter with this UTC as upper bound. A null or zero parameter indicates no upper bound.
$rsvp_status string Optional: Only show events where the given uid has this rsvp status. This only works if you have specified a value for $uid. Values are as in events.getMembers. Null indicates to ignore rsvp status when filtering.
return array of events

events_getMembers() public method

Returns membership list data associated with an event
public events_getMembers ( integer $eid ) : assoc
$eid integer : event id
return assoc array of four membership lists, with keys 'attending', 'unsure', 'declined', and 'not_replied'

fbml_refreshImgSrc() public method

public fbml_refreshImgSrc ( $url )

fbml_refreshRefUrl() public method

public fbml_refreshRefUrl ( $url )

fbml_setRefHandle() public method

public fbml_setRefHandle ( $handle, $fbml )

feed_publishActionOfUser() public method

public feed_publishActionOfUser ( $title, $body, $image_1 = null, $image_1_link = null, $image_2 = null, $image_2_link = null, $image_3 = null, $image_3_link = null, $image_4 = null, $image_4_link = null, $priority = 1 )

feed_publishStoryToUser() public method

public feed_publishStoryToUser ( $title, $body, $image_1 = null, $image_1_link = null, $image_2 = null, $image_2_link = null, $image_3 = null, $image_3_link = null, $image_4 = null, $image_4_link = null, $priority = 1 )

fql_query() public method

Makes an FQL query. This is a generalized way of accessing all the data in the API, as an alternative to most of the other method calls. More info at http://developers.facebook.com/documentation.php?v=1.0&doc=fql
public fql_query ( string $query ) : generalized
$query string the query to evaluate
return generalized array representing the results

friends_areFriends() public method

Note that the Facebook friend relationship is symmetric.
public friends_areFriends ( $uids1, $uids2 ) : array
return array of uid pairs with bool, true if pair are friends, e.g. array( 0 => array('uid1' => id_1, 'uid2' => id_A, 'are_friends' => 1), 1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0) ...)

friends_get() public method

Returns the friends of the current session user.
public friends_get ( ) : array
return array of friends

friends_getAppUsers() public method

Returns the friends of the session user, who are also users of the calling application.
public friends_getAppUsers ( ) : array
return array of friends

groups_get() public method

Returns groups according to the filters specified.
public groups_get ( integer $uid, array $gids ) : array
$uid integer Optional: User associated with groups. A null parameter will default to the session user.
$gids array Optional: group ids to query. A null parameter will get all groups for the user.
return array of groups

groups_getMembers() public method

Returns the membership list of a group
public groups_getMembers ( integer $gid ) : assoc
$gid integer : Group id
return assoc array of four membership lists, with keys 'members', 'admins', 'officers', and 'not_replied'

notifications_get() public method

Returns the outstanding notifications for the session user.
public notifications_get ( ) : assoc
return assoc array of notification count objects for 'messages', 'pokes' and 'shares', a uid list of 'friend_requests', a gid list of 'group_invites', and an eid list of 'event_invites'

notifications_send() public method

Sends an email notification to the specified user.
public notifications_send ( $to_ids, $markup, $no_email ) : string
return string url which you should send the logged in user to to finalize the message.

notifications_sendRequest() public method

Sends a request to the specified user (e.g. "you have 1 event invitation")
public notifications_sendRequest ( array $to_ids, string $type, string $content, string $image, boolean $invite ) : string
$to_ids array user ids to receive the request (must be friends with sender, capped at 10)
$type string type of request, e.g. "event" (as in "You have an event invitation.")
$content string fbml content of the request. really stripped down fbml - just text/names/links. also, use the special tag to specify the buttons to be included.
$image string url of an image to show beside the request
$invite boolean whether to call it an "invitation" or a "request"
return string url which you should send the logged in user to to finalize the message.

photos_get() public method

Returns photos according to the filters specified.
public photos_get ( integer $subj_id, integer $aid, array $pids ) : array
$subj_id integer Optional: Filter by uid of user tagged in the photos.
$aid integer Optional: Filter by an album, as returned by photos_getAlbums.
$pids array Optional: Restrict to a list of pids Note that at least one of these parameters needs to be specified, or an error is returned.
return array of photo objects.

photos_getAlbums() public method

Returns the albums created by the given user.
public photos_getAlbums ( integer $uid, array $aids )
$uid integer Optional: the uid of the user whose albums you want. A null value will return the albums of the session user.
$aids array Optional: a list of aids to restrict the query. Note that at least one of the (uid, aids) parameters must be specified.

photos_getTags() public method

Returns the tags on all photos specified.
public photos_getTags ( string $pids ) : array
$pids string : a list of pids to query
return array of photo tag objects, with include pid, subject uid, and two floating-point numbers (xcoord, ycoord) for tag pixel location

post_request() public method

public post_request ( $method, $params )

profile_getFBML() public method

public profile_getFBML ( $uid )

profile_setFBML() public method

Sets the FBML for the profile of the user attached to this session
public profile_setFBML ( string $markup, $uid = null ) : array
$markup string The FBML that describes the profile presence of this app for the user
return array A list of strings describing any compile errors for the submitted FBML

users_getInfo() public method

Returns the requested info fields for the requested set of users
public users_getInfo ( array $uids, array $fields ) : array
$uids array an array of user ids
$fields array an array of strings describing the info fields desired
return array of users

users_getLoggedInUser() public method

Returns the user corresponding to the current session object.
public users_getLoggedInUser ( ) : integer
return integer uid

users_isAppAdded() public method

Returns whether or not the user corresponding to the current session object has the app installed
public users_isAppAdded ( ) : boolean
return boolean

Property Details

$added public_oe property

to save making the friends.get api call, this will get prepopulated on canvas pages
public $added

$api_key public_oe property

public $api_key

$friends_list public_oe property

public $friends_list

$secret public_oe property

public $secret

$session_key public_oe property

public $session_key