class vB_Library_Facebook extends vB_Library

vB_Library_Facebook

Traits

Constants

FBVERSION

Properties

static protected $instance from vB_Library
static protected $sdk_failed
protected $facebookInitialized
protected $failureReason
protected $fb_session
protected $fb_session_tried
protected $fb_userinfo
protected $vb_userid

Methods

__sleep()

No description

__wakeup()

No description

__construct()

Constructor

static vB_PageCache
instance($class)

Returns singleton instance of self.

static 
getLibraryClassNameInternal($controller)

No description

static 
getContentInstance($contenttypeid)

No description

static 
clearCache()

No description

boolean
reinitialize()

Reintialize the facebook application

bool
isFacebookEnabled()

Is facebook enabled on this site.

string
getInitializeFailureMessage()

Get the reason why facebook failed to initialize

createSessionForLogin($info)

Associate a vb account with a facebook sesssion

none
clearSession()

Clear all stored information for the current user from vB This will not log the user out of either vB or Facebook (but is is expected that this will be called as part of logging the user out of the vBulletin)

none
disconnectUser(int $userid)

Disconnect the user's account from facebook

none
connectCurrentUser($accessToken = null)

Connects the currently logged in user to the currently logged in Facebook user

string|false
getFbProfileUrl()

Get the logged in user's profile url.

string|false
getFbProfilePicUrl()

Get the logged in user's profile picture url.

bool,
validateFBSession()

Makes sure local copy of FB session is in synch with actual FB session

bool
userIsLoggedIn(bool $ping = false)

Checks if the current user is logged into facebook

bool,
isValidAuthToken()

Verifies that the current session auth token is still valid with facebook - performs a Facebook roundtrip

mixed,
getLoggedInFbUserId()

Checks for a currrently logged in user through facebook api

array,
getFbUserInfo(bool, $force_reload = false)

Grabs logged in user info from faceboook if user is logged in

mixed,
getVbUseridFromFbUserid(int, $fb_userid = false)

Checks if current facebook user is associated with a vb user, and returns vb userid if so

apiGet($call, $type = 'Facebook\\GraphObject', $data = null)

No description

apiPost($call, $data, $type = 'Facebook\\GraphObject')

No description

handleFacebookException(Exception $e)

Handles facebook exceptions (expose the exception if in debug mode)

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 40
protected __construct()

Constructor

in vB_Library at line 35
static vB_PageCache instance($class)

Returns singleton instance of self.

Parameters

$class

Return Value

vB_PageCache
  • Reference to singleton instance of the cache handler

in vB_Library at line 52
static protected getLibraryClassNameInternal($controller)

Parameters

$controller

in vB_Library at line 91
static getContentInstance($contenttypeid)

Parameters

$contenttypeid

in vB_Library at line 99
static clearCache()

at line 57
boolean reinitialize()

Reintialize the facebook application

If for some reason the FB status changes during a script run (for example you enable it in the vb option) this will force an attempt to recheck its status. Otherwise we will store the status based on the first attempt.

If the intiailization fails, the reason can be determeined via vB_Library_Facebook::getInitializeFailureMessage();

Return Value

boolean false if it failed, true if not

at line 250
bool isFacebookEnabled()

Is facebook enabled on this site.

Return Value

bool true if the facebook system initialized properly, false otherwise note that if we get an error this may be false even if facebook is configured in the admincp.

at line 260
string getInitializeFailureMessage()

Get the reason why facebook failed to initialize

Return Value

string Reason why initialization failed

at line 290
createSessionForLogin($info)

Associate a vb account with a facebook sesssion

Parameters

$info

at line 348
none clearSession()

Clear all stored information for the current user from vB This will not log the user out of either vB or Facebook (but is is expected that this will be called as part of logging the user out of the vBulletin)

Will do nothing if facebook is not initialized.

Return Value

none

at line 381
none disconnectUser(int $userid)

Disconnect the user's account from facebook

Unlike previous behavior do not require that the user be logged in to facebook This causes a situation where if the user mucks with the association on the FB end they can screw it up to the point where it doesn't work. And they can't just reassociate the account because they can't log in to disconnect.

Parameters

int $userid the userid to be disconnected.

Return Value

none

at line 413
none connectCurrentUser($accessToken = null)

Connects the currently logged in user to the currently logged in Facebook user

Note that we don't allow connection of a non logged in account because we need to validate the FB login. Connecting somebody else's account to a FB just doesn't make sense as an action.

Parameters

$accessToken

Return Value

none

at line 476
string|false getFbProfileUrl()

Get the logged in user's profile url.

Return Value

string|false facebook profile url or false on failure (forex, there is no logged in FB user)

at line 495
string|false getFbProfilePicUrl()

Get the logged in user's profile picture url.

Return Value

string|false facebook profile picture url or false on failure (forex, there is no logged in FB user)

at line 515
protected bool, validateFBSession()

Makes sure local copy of FB session is in synch with actual FB session

Return Value

bool, fb userid if logged in, false otherwise

at line 531
bool userIsLoggedIn(bool $ping = false)

Checks if the current user is logged into facebook

Parameters

bool $ping Whether to ping Facebook (unused)

Return Value

bool

at line 548
bool, isValidAuthToken()

Verifies that the current session auth token is still valid with facebook - performs a Facebook roundtrip

Return Value

bool, true if auth token is still valid

at line 564
mixed, getLoggedInFbUserId()

Checks for a currrently logged in user through facebook api

Return Value

mixed, fb userid if logged in, false otherwise

at line 578
array, getFbUserInfo(bool, $force_reload = false)

Grabs logged in user info from faceboook if user is logged in

Parameters

bool, $force_reload forces a roundtrip to the facebook server, ie. dont use cached info

Return Value

array, fb userinfo array if logged in, false otherwise, see the facebook '/me' docs for details

at line 624
mixed, getVbUseridFromFbUserid(int, $fb_userid = false)

Checks if current facebook user is associated with a vb user, and returns vb userid if so

Parameters

int, $fb_userid facebook userid to check in vb database, if not there well user current logged in user

Return Value

mixed, vb userid if one is associated, false if not

at line 646
protected apiGet($call, $type = 'Facebook\\GraphObject', $data = null)

Parameters

$call
$type
$data

at line 657
protected apiPost($call, $data, $type = 'Facebook\\GraphObject')

Parameters

$call
$data
$type

at line 670
protected handleFacebookException(Exception $e)

Handles facebook exceptions (expose the exception if in debug mode)

Parameters

Exception $e The facebook exception