Campustream 1.0
A social network MQP for WPI
|
Public Member Functions | |
__construct ($config) | |
setAppId ($appId) | |
getAppId () | |
setApiSecret ($apiSecret) | |
getApiSecret () | |
setCookieSupport ($cookieSupport) | |
useCookieSupport () | |
setBaseDomain ($domain) | |
getBaseDomain () | |
setFileUploadSupport ($fileUploadSupport) | |
useFileUploadSupport () | |
getSignedRequest () | |
setSession ($session=null, $write_cookie=true) | |
getSession () | |
getUser () | |
getAccessToken () | |
getLoginUrl ($params=array()) | |
getLogoutUrl ($params=array()) | |
getLoginStatusUrl ($params=array()) | |
api () | |
Data Fields | |
const | VERSION = '2.1.2' |
Static Public Attributes | |
static | $CURL_OPTS |
static | $DOMAIN_MAP |
Protected Member Functions | |
_restserver ($params) | |
_graph ($path, $method='GET', $params=array()) | |
_oauthRequest ($url, $params) | |
makeRequest ($url, $params, $ch=null) | |
getSessionCookieName () | |
setCookieFromSession ($session=null) | |
validateSessionObject ($session) | |
createSessionFromSignedRequest ($data) | |
parseSignedRequest ($signed_request) | |
getApiUrl ($method) | |
getUrl ($name, $path='', $params=array()) | |
getCurrentUrl () | |
Static Protected Member Functions | |
static | generateSignature ($params, $secret) |
static | errorLog ($msg) |
static | base64UrlDecode ($input) |
Protected Attributes | |
$appId | |
$apiSecret | |
$session | |
$signedRequest | |
$sessionLoaded = false | |
$cookieSupport = false | |
$baseDomain = '' | |
$fileUploadSupport = false | |
Static Protected Attributes | |
static | $DROP_QUERY_PARAMS |
Provides access to the Facebook Platform.
Definition at line 98 of file facebook.php.
__construct | ( | $ | config | ) |
Initialize a Facebook Application.
The configuration:
Array | $config | the application configuration |
Definition at line 186 of file facebook.php.
_graph | ( | $ | path, |
$ | method = 'GET' , |
||
$ | params = array() |
||
) | [protected] |
Invoke the Graph API.
String | $path | the path (required) |
String | $method | the http method (default 'GET') |
Array | $params | the query/post data |
FacebookApiException |
Definition at line 529 of file facebook.php.
_oauthRequest | ( | $ | url, |
$ | params | ||
) | [protected] |
Make a OAuth Request
String | $path | the path (required) |
Array | $params | the query/post data |
FacebookApiException |
Definition at line 564 of file facebook.php.
_restserver | ( | $ | params | ) | [protected] |
Invoke the old restserver.php endpoint.
Array | $params | method call object |
FacebookApiException |
Definition at line 503 of file facebook.php.
api | ( | ) |
Make an API call.
Array | $params | the API call parameters |
Definition at line 487 of file facebook.php.
static base64UrlDecode | ( | $ | input | ) | [static, protected] |
Base64 encoding that doesn't need to be urlencode()ed. Exactly the same as base64_encode except it uses
String | base64UrlEncodeded string |
Definition at line 960 of file facebook.php.
createSessionFromSignedRequest | ( | $ | data | ) | [protected] |
Returns something that looks like our JS session object from the signed token's data
TODO: Nuke this once the login flow uses OAuth2
Array | the output of getSignedRequest |
Definition at line 729 of file facebook.php.
static errorLog | ( | $ | msg | ) | [static, protected] |
Prints to the error log if you aren't in command line mode.
String | log message |
Definition at line 941 of file facebook.php.
static generateSignature | ( | $ | params, |
$ | secret | ||
) | [static, protected] |
Generate a signature for the given params and secret.
Array | $params | the parameters to sign |
String | $secret | the secret to sign with |
Definition at line 922 of file facebook.php.
getAccessToken | ( | ) |
Gets a OAuth access token.
Definition at line 394 of file facebook.php.
getApiSecret | ( | ) |
getApiUrl | ( | $ | method | ) | [protected] |
Build the URL for api given parameters.
$method | String the method name. |
Definition at line 787 of file facebook.php.
getAppId | ( | ) |
Get the Application ID.
Definition at line 215 of file facebook.php.
getBaseDomain | ( | ) |
Get the base domain for the Cookie.
Definition at line 272 of file facebook.php.
getCurrentUrl | ( | ) | [protected] |
Returns the Current URL, stripping it of known FB parameters that should not persist.
Definition at line 884 of file facebook.php.
getLoginStatusUrl | ( | $ | params = array() | ) |
Get a login status URL to fetch the status from facebook.
The parameters:
Array | $params | provide custom parameters |
Definition at line 467 of file facebook.php.
getLoginUrl | ( | $ | params = array() | ) |
Get a Login URL for use with redirects. By default, full page redirect is assumed. If you are using the generated URL with a window.open() call in JavaScript, you can pass in display=popup as part of the $params.
The parameters:
Array | $params | provide custom parameters |
Definition at line 418 of file facebook.php.
getLogoutUrl | ( | $ | params = array() | ) |
Get a Logout URL suitable for use with redirects.
The parameters:
Array | $params | provide custom parameters |
Definition at line 445 of file facebook.php.
getSession | ( | ) |
Get the session object. This will automatically look for a signed session sent via the signed_request, Cookie or Query Parameters if needed.
Definition at line 333 of file facebook.php.
getSessionCookieName | ( | ) | [protected] |
The name of the Cookie that contains the session.
Definition at line 641 of file facebook.php.
getSignedRequest | ( | ) |
Get the data from a signed_request token
Definition at line 300 of file facebook.php.
getUrl | ( | $ | name, |
$ | path = '' , |
||
$ | params = array() |
||
) | [protected] |
Build the URL for given domain alias, path and parameters.
$name | String the name of the domain |
$path | String optional path (without a leading slash) |
$params | Array optional query parameters |
Definition at line 864 of file facebook.php.
getUser | ( | ) |
Get the UID from the session.
Definition at line 384 of file facebook.php.
makeRequest | ( | $ | url, |
$ | params, | ||
$ | ch = null |
||
) | [protected] |
Makes an HTTP request. This method can be overriden by subclasses if developers want to do fancier things or use something other than curl to make the request.
String | $url | the URL to make the request to |
Array | $params | the parameters to use for the POST body |
CurlHandler | $ch | optional initialized curl handle |
Definition at line 588 of file facebook.php.
parseSignedRequest | ( | $ | signed_request | ) | [protected] |
Parses a signed_request and validates the signature. Then saves it in $this->signed_data
String | A signed token |
Boolean | Should we remove the parts of the payload that are used by the algorithm? |
Definition at line 758 of file facebook.php.
setApiSecret | ( | $ | apiSecret | ) |
Set the API Secret.
String | $appId | the API Secret |
Definition at line 224 of file facebook.php.
setAppId | ( | $ | appId | ) |
Set the Application ID.
String | $appId | the Application ID |
Definition at line 205 of file facebook.php.
setBaseDomain | ( | $ | domain | ) |
Set the base domain for the Cookie.
String | $domain | the base domain |
Definition at line 262 of file facebook.php.
setCookieFromSession | ( | $ | session = null | ) | [protected] |
Set a JS Cookie based on the _passed in_ session. It does not use the currently stored session -- you need to explicitly pass it in.
Array | $session | the session to use for setting the cookie |
Definition at line 651 of file facebook.php.
setCookieSupport | ( | $ | cookieSupport | ) |
Set the Cookie Support status.
Boolean | $cookieSupport | the Cookie Support status |
Definition at line 243 of file facebook.php.
setFileUploadSupport | ( | $ | fileUploadSupport | ) |
Set the file upload support status.
String | $domain | the base domain |
Definition at line 281 of file facebook.php.
setSession | ( | $ | session = null , |
$ | write_cookie = true |
||
) |
Set the Session.
Array | $session | the session |
Boolean | $write_cookie | indicate if a cookie should be written. this value is ignored if cookie support has been disabled. |
Definition at line 317 of file facebook.php.
useCookieSupport | ( | ) |
Get the Cookie Support status.
Definition at line 253 of file facebook.php.
useFileUploadSupport | ( | ) |
Get the file upload support status.
Definition at line 291 of file facebook.php.
validateSessionObject | ( | $ | session | ) | [protected] |
Validates a session_version=3 style session object.
Array | $session | the session object |
Definition at line 696 of file facebook.php.
$apiSecret [protected] |
The Application API Secret.
Definition at line 142 of file facebook.php.
$appId [protected] |
The Application ID.
Definition at line 137 of file facebook.php.
$baseDomain = '' [protected] |
Base domain for the Cookie.
Definition at line 167 of file facebook.php.
$cookieSupport = false [protected] |
Indicates if Cookie support should be enabled.
Definition at line 162 of file facebook.php.
$CURL_OPTS [static] |
array( CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, CURLOPT_USERAGENT => 'facebook-php-2.0', )
Default options for curl.
Definition at line 108 of file facebook.php.
$DOMAIN_MAP [static] |
array( 'api' => 'https://api.facebook.com/', 'api_read' => 'https://api-read.facebook.com/', 'graph' => 'https://graph.facebook.com/', 'www' => 'https://www.facebook.com/', )
Maps aliases to Facebook domains.
Definition at line 127 of file facebook.php.
$DROP_QUERY_PARAMS [static, protected] |
array( 'session', 'signed_request', )
List of query parameters that get automatically dropped when rebuilding the current URL.
Definition at line 119 of file facebook.php.
$fileUploadSupport = false [protected] |
Indicates if the CURL based @ syntax for file uploads is enabled.
Definition at line 172 of file facebook.php.
$session [protected] |
The active user session, if one is available.
Definition at line 147 of file facebook.php.
$sessionLoaded = false [protected] |
Indicates that we already loaded the session as best as we could.
Definition at line 157 of file facebook.php.
$signedRequest [protected] |
The data from the signed_request token.
Definition at line 152 of file facebook.php.
const VERSION = '2.1.2' |
Version.
Definition at line 103 of file facebook.php.