PHP Класс FacebookRestClient, aprilchild

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$added to save making the friends.get api call, this will get prepopulated on canvas pages
$api_key
$friends_list
$secret
$session_key

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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() публичный Метод

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.
Результат assoc array containing session_key, uid

call_method() публичный Метод

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

convert_simplexml_to_array() публичный статический Метод

public static convert_simplexml_to_array ( $sxml )

events_get() публичный Метод

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.
Результат array of events

events_getMembers() публичный Метод

Returns membership list data associated with an event
public events_getMembers ( integer $eid ) : assoc
$eid integer : event id
Результат assoc array of four membership lists, with keys 'attending', 'unsure', 'declined', and 'not_replied'

fbml_refreshImgSrc() публичный Метод

public fbml_refreshImgSrc ( $url )

fbml_refreshRefUrl() публичный Метод

public fbml_refreshRefUrl ( $url )

fbml_setRefHandle() публичный Метод

public fbml_setRefHandle ( $handle, $fbml )

feed_publishActionOfUser() публичный Метод

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 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() публичный Метод

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
Результат generalized array representing the results

friends_areFriends() публичный Метод

Note that the Facebook friend relationship is symmetric.
public friends_areFriends ( $uids1, $uids2 ) : array
Результат 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() публичный Метод

Returns the friends of the current session user.
public friends_get ( ) : array
Результат array of friends

friends_getAppUsers() публичный Метод

Returns the friends of the session user, who are also users of the calling application.
public friends_getAppUsers ( ) : array
Результат array of friends

groups_get() публичный Метод

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.
Результат array of groups

groups_getMembers() публичный Метод

Returns the membership list of a group
public groups_getMembers ( integer $gid ) : assoc
$gid integer : Group id
Результат assoc array of four membership lists, with keys 'members', 'admins', 'officers', and 'not_replied'

notifications_get() публичный Метод

Returns the outstanding notifications for the session user.
public notifications_get ( ) : assoc
Результат 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() публичный Метод

Sends an email notification to the specified user.
public notifications_send ( $to_ids, $markup, $no_email ) : string
Результат string url which you should send the logged in user to to finalize the message.

notifications_sendRequest() публичный Метод

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"
Результат string url which you should send the logged in user to to finalize the message.

photos_get() публичный Метод

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.
Результат array of photo objects.

photos_getAlbums() публичный Метод

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() публичный Метод

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

post_request() публичный Метод

public post_request ( $method, $params )

profile_getFBML() публичный Метод

public profile_getFBML ( $uid )

profile_setFBML() публичный Метод

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
Результат array A list of strings describing any compile errors for the submitted FBML

users_getInfo() публичный Метод

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
Результат array of users

users_getLoggedInUser() публичный Метод

Returns the user corresponding to the current session object.
public users_getLoggedInUser ( ) : integer
Результат integer uid

users_isAppAdded() публичный Метод

Returns whether or not the user corresponding to the current session object has the app installed
public users_isAppAdded ( ) : boolean
Результат boolean

Описание свойств

$added публичное свойство

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

$api_key публичное свойство

public $api_key

$friends_list публичное свойство

public $friends_list

$secret публичное свойство

public $secret

$session_key публичное свойство

public $session_key