@@ -97,10 +97,10 @@ |
||
| 97 | 97 | case 1363037: |
| 98 | 98 | $previousException = new FacebookResumableUploadException($message, $code); |
| 99 | 99 | |
| 100 | - $startOffset = isset($data['error']['error_data']['start_offset']) ? (int) $data['error']['error_data']['start_offset'] : null; |
|
| 100 | + $startOffset = isset($data['error']['error_data']['start_offset']) ? (int)$data['error']['error_data']['start_offset'] : null; |
|
| 101 | 101 | $previousException->setStartOffset($startOffset); |
| 102 | 102 | |
| 103 | - $endOffset = isset($data['error']['error_data']['end_offset']) ? (int) $data['error']['error_data']['end_offset'] : null; |
|
| 103 | + $endOffset = isset($data['error']['error_data']['end_offset']) ? (int)$data['error']['error_data']['end_offset'] : null; |
|
| 104 | 104 | $previousException->setEndOffset($endOffset); |
| 105 | 105 | |
| 106 | 106 | return new static($response, $previousException); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | public function __construct($id, $secret) |
| 48 | 48 | { |
| 49 | 49 | if (!is_string($id) |
| 50 | - // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false |
|
| 50 | + // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false |
|
| 51 | 51 | && !is_int($id)) { |
| 52 | 52 | throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.'); |
| 53 | 53 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.'); |
| 53 | 53 | } |
| 54 | 54 | // We cast as a string in case a valid int was set on a 64-bit system and this is unserialised on a 32-bit system |
| 55 | - $this->id = (string) $id; |
|
| 55 | + $this->id = (string)$id; |
|
| 56 | 56 | $this->secret = $secret; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -602,8 +602,8 @@ |
||
| 602 | 602 | } while (!$chunk->isLastChunk()); |
| 603 | 603 | |
| 604 | 604 | return [ |
| 605 | - 'video_id' => $chunk->getVideoId(), |
|
| 606 | - 'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata), |
|
| 605 | + 'video_id' => $chunk->getVideoId(), |
|
| 606 | + 'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata), |
|
| 607 | 607 | ]; |
| 608 | 608 | } |
| 609 | 609 | |
@@ -593,7 +593,7 @@ |
||
| 593 | 593 | $graphVersion = $graphVersion ?: $this->defaultGraphVersion; |
| 594 | 594 | |
| 595 | 595 | $uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion); |
| 596 | - $endpoint = '/'.$target.'/videos'; |
|
| 596 | + $endpoint = '/' . $target . '/videos'; |
|
| 597 | 597 | $file = $this->videoToUpload($pathToFile); |
| 598 | 598 | $chunk = $uploader->start($endpoint, $file); |
| 599 | 599 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * |
| 45 | 45 | * @return void |
| 46 | 46 | */ |
| 47 | -spl_autoload_register(function ($class) { |
|
| 47 | +spl_autoload_register(function($class) { |
|
| 48 | 48 | // project-specific namespace prefix |
| 49 | 49 | $prefix = 'Facebook\\'; |
| 50 | 50 | |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | { |
| 86 | 86 | $items = $this->asArray(); |
| 87 | 87 | |
| 88 | - return array_map(function ($v) { |
|
| 88 | + return array_map(function($v) { |
|
| 89 | 89 | if ($v instanceof \DateTime) { |
| 90 | 90 | return $v->format(\DateTime::ISO8601); |
| 91 | 91 | } |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | */ |
| 129 | 129 | public function asArray() |
| 130 | 130 | { |
| 131 | - return array_map(function ($value) { |
|
| 131 | + return array_map(function($value) { |
|
| 132 | 132 | return $value instanceof Collection ? $value->asArray() : $value; |
| 133 | 133 | }, $this->items); |
| 134 | 134 | } |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | { |
| 107 | 107 | // https://tools.ietf.org/html/rfc7230#section-3.1.2 |
| 108 | 108 | list($version, $status, $reason) = array_pad(explode(' ', $rawResponseHeader, 3), 3, null); |
| 109 | - $this->httpResponseCode = (int) $status; |
|
| 109 | + $this->httpResponseCode = (int)$status; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -1,43 +1,43 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if(!session_id()) { |
| 4 | - session_start(); |
|
| 4 | + session_start(); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | require_once 'lib\Facebook\autoload.php'; |
| 8 | 8 | |
| 9 | 9 | $fb = new Facebook\Facebook([ |
| 10 | - 'app_id' => '362540437809242', // My Facebook App ID |
|
| 11 | - 'app_secret' => '538cd04f971479ff14dc409df2fbcf3b', |
|
| 12 | - 'default_graph_version' => 'v3.2', |
|
| 13 | - ]); |
|
| 10 | + 'app_id' => '362540437809242', // My Facebook App ID |
|
| 11 | + 'app_secret' => '538cd04f971479ff14dc409df2fbcf3b', |
|
| 12 | + 'default_graph_version' => 'v3.2', |
|
| 13 | + ]); |
|
| 14 | 14 | |
| 15 | 15 | $helper = $fb->getRedirectLoginHelper(); |
| 16 | 16 | |
| 17 | 17 | try { |
| 18 | - $accessToken = $helper->getAccessToken(); |
|
| 18 | + $accessToken = $helper->getAccessToken(); |
|
| 19 | 19 | } catch(Facebook\Exceptions\FacebookResponseException $e) { |
| 20 | - // When Graph returns an error |
|
| 21 | - echo 'Graph returned an error: ' . $e->getMessage(); |
|
| 22 | - exit; |
|
| 20 | + // When Graph returns an error |
|
| 21 | + echo 'Graph returned an error: ' . $e->getMessage(); |
|
| 22 | + exit; |
|
| 23 | 23 | } catch(Facebook\Exceptions\FacebookSDKException $e) { |
| 24 | - // When validation fails or other local issues |
|
| 25 | - echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
| 26 | - exit; |
|
| 24 | + // When validation fails or other local issues |
|
| 25 | + echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
| 26 | + exit; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if (! isset($accessToken)) { |
| 30 | - if ($helper->getError()) { |
|
| 30 | + if ($helper->getError()) { |
|
| 31 | 31 | header('HTTP/1.0 401 Unauthorized'); |
| 32 | 32 | echo "Error: " . $helper->getError() . "\n"; |
| 33 | 33 | echo "Error Code: " . $helper->getErrorCode() . "\n"; |
| 34 | 34 | echo "Error Reason: " . $helper->getErrorReason() . "\n"; |
| 35 | 35 | echo "Error Description: " . $helper->getErrorDescription() . "\n"; |
| 36 | - } else { |
|
| 36 | + } else { |
|
| 37 | 37 | header('HTTP/1.0 400 Bad Request'); |
| 38 | 38 | echo 'Bad request'; |
| 39 | - } |
|
| 40 | - exit; |
|
| 39 | + } |
|
| 40 | + exit; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Logged in |
@@ -59,29 +59,29 @@ discard block |
||
| 59 | 59 | $tokenMetadata->validateExpiration(); |
| 60 | 60 | |
| 61 | 61 | if (! $accessToken->isLongLived()) { |
| 62 | - // Exchanges a short-lived access token for a long-lived one |
|
| 63 | - try { |
|
| 62 | + // Exchanges a short-lived access token for a long-lived one |
|
| 63 | + try { |
|
| 64 | 64 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
| 65 | - } catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
| 65 | + } catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
| 66 | 66 | echo "<p>Error getting long-lived access token: " . $e->getMessage() . "</p>\n\n"; |
| 67 | 67 | exit; |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - echo '<h3>Long-lived</h3>'; |
|
| 71 | - var_dump($accessToken->getValue()); |
|
| 70 | + echo '<h3>Long-lived</h3>'; |
|
| 71 | + var_dump($accessToken->getValue()); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $_SESSION['fb_access_token'] = (string) $accessToken; |
| 75 | 75 | |
| 76 | 76 | try { |
| 77 | - // Returns a `Facebook\FacebookResponse` object |
|
| 78 | - $response = $fb->get('/me?fields=id,name', $accessToken); |
|
| 77 | + // Returns a `Facebook\FacebookResponse` object |
|
| 78 | + $response = $fb->get('/me?fields=id,name', $accessToken); |
|
| 79 | 79 | } catch(Facebook\Exceptions\FacebookResponseException $e) { |
| 80 | - echo 'Graph returned an error: ' . $e->getMessage(); |
|
| 81 | - exit; |
|
| 80 | + echo 'Graph returned an error: ' . $e->getMessage(); |
|
| 81 | + exit; |
|
| 82 | 82 | } catch(Facebook\Exceptions\FacebookSDKException $e) { |
| 83 | - echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
| 84 | - exit; |
|
| 83 | + echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
| 84 | + exit; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $user = $response->getGraphUser(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!session_id()) { |
|
| 3 | +if (!session_id()) { |
|
| 4 | 4 | session_start(); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | try { |
| 18 | 18 | $accessToken = $helper->getAccessToken(); |
| 19 | -} catch(Facebook\Exceptions\FacebookResponseException $e) { |
|
| 19 | +} catch (Facebook\Exceptions\FacebookResponseException $e) { |
|
| 20 | 20 | // When Graph returns an error |
| 21 | 21 | echo 'Graph returned an error: ' . $e->getMessage(); |
| 22 | 22 | exit; |
| 23 | -} catch(Facebook\Exceptions\FacebookSDKException $e) { |
|
| 23 | +} catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
| 24 | 24 | // When validation fails or other local issues |
| 25 | 25 | echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
| 26 | 26 | exit; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -if (! isset($accessToken)) { |
|
| 29 | +if (!isset($accessToken)) { |
|
| 30 | 30 | if ($helper->getError()) { |
| 31 | 31 | header('HTTP/1.0 401 Unauthorized'); |
| 32 | 32 | echo "Error: " . $helper->getError() . "\n"; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | //$tokenMetadata->validateUserId('123'); |
| 59 | 59 | $tokenMetadata->validateExpiration(); |
| 60 | 60 | |
| 61 | -if (! $accessToken->isLongLived()) { |
|
| 61 | +if (!$accessToken->isLongLived()) { |
|
| 62 | 62 | // Exchanges a short-lived access token for a long-lived one |
| 63 | 63 | try { |
| 64 | 64 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | var_dump($accessToken->getValue()); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | -$_SESSION['fb_access_token'] = (string) $accessToken; |
|
| 74 | +$_SESSION['fb_access_token'] = (string)$accessToken; |
|
| 75 | 75 | |
| 76 | 76 | try { |
| 77 | 77 | // Returns a `Facebook\FacebookResponse` object |
| 78 | 78 | $response = $fb->get('/me?fields=id,name', $accessToken); |
| 79 | -} catch(Facebook\Exceptions\FacebookResponseException $e) { |
|
| 79 | +} catch (Facebook\Exceptions\FacebookResponseException $e) { |
|
| 80 | 80 | echo 'Graph returned an error: ' . $e->getMessage(); |
| 81 | 81 | exit; |
| 82 | -} catch(Facebook\Exceptions\FacebookSDKException $e) { |
|
| 82 | +} catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
| 83 | 83 | echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
| 84 | 84 | exit; |
| 85 | 85 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if(!session_id()) { |
| 4 | - session_start(); |
|
| 4 | + session_start(); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | require_once 'lib\Facebook\autoload.php'; |
| 8 | 8 | |
| 9 | 9 | $fb = new Facebook\Facebook([ |
| 10 | - 'app_id' => '362540437809242', // my facebook app id |
|
| 11 | - 'app_secret' => '538cd04f971479ff14dc409df2fbcf3b', |
|
| 12 | - 'default_graph_version' => 'v3.2', |
|
| 13 | - ]); |
|
| 10 | + 'app_id' => '362540437809242', // my facebook app id |
|
| 11 | + 'app_secret' => '538cd04f971479ff14dc409df2fbcf3b', |
|
| 12 | + 'default_graph_version' => 'v3.2', |
|
| 13 | + ]); |
|
| 14 | 14 | |
| 15 | 15 | $helper = $fb->getRedirectLoginHelper(); |
| 16 | 16 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!session_id()) { |
|
| 3 | +if (!session_id()) { |
|
| 4 | 4 | session_start(); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -18,5 +18,5 @@ discard block |
||
| 18 | 18 | $loginUrl = $helper->getLoginUrl('https://localhost/rtCamp/fb-callback.php', $permissions); |
| 19 | 19 | |
| 20 | 20 | echo "<h3> Connect Clicking Below Facebook Icon Using Your Facebook Account.<h3>"; |
| 21 | -echo '<a href="' .htmlspecialchars($loginUrl).'"><img alt="Login With Facebook" src="images/fb_icon.png"></a>'; |
|
| 21 | +echo '<a href="' . htmlspecialchars($loginUrl) . '"><img alt="Login With Facebook" src="images/fb_icon.png"></a>'; |
|
| 22 | 22 | ?> |
| 23 | 23 | \ No newline at end of file |