@@ -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); |
@@ -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 |
@@ -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,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!session_id()) { |
|
2 | +if (!session_id()) { |
|
3 | 3 | session_start(); |
4 | 4 | } |
5 | 5 | require_once 'lib\Facebook\autoload.php'; |
6 | 6 | |
7 | -if(isset($_SESSION['fb_access_token'])){ |
|
7 | +if (isset($_SESSION['fb_access_token'])) { |
|
8 | 8 | // Get access token from session |
9 | 9 | $accessToken = $_SESSION['fb_access_token']; |
10 | 10 | //header('location:member.php'); |
11 | -}else{ |
|
12 | - $appId='362540437809242'; |
|
13 | - $appSecret='538cd04f971479ff14dc409df2fbcf3b'; |
|
11 | +} else { |
|
12 | + $appId = '362540437809242'; |
|
13 | + $appSecret = '538cd04f971479ff14dc409df2fbcf3b'; |
|
14 | 14 | |
15 | 15 | $fb = new Facebook\Facebook([ |
16 | 16 | 'app_id' => $appId, // variable with My Facebook App ID |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | |
23 | 23 | try { |
24 | 24 | $accessToken = $helper->getAccessToken(); |
25 | -} catch(Facebook\Exceptions\FacebookResponseException $e) { |
|
25 | +} catch (Facebook\Exceptions\FacebookResponseException $e) { |
|
26 | 26 | // When Graph returns an error |
27 | 27 | echo 'Graph returned an error: ' . $e->getMessage(); |
28 | 28 | exit; |
29 | -} catch(Facebook\Exceptions\FacebookSDKException $e) { |
|
29 | +} catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
30 | 30 | // When validation fails or other local issues |
31 | 31 | echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
32 | 32 | exit; |
33 | 33 | } |
34 | 34 | |
35 | -if (! isset($accessToken)) { |
|
35 | +if (!isset($accessToken)) { |
|
36 | 36 | |
37 | 37 | if ($helper->getError()) { |
38 | 38 | header('HTTP/1.0 401 Unauthorized'); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | //$tokenMetadata->validateUserId('123'); |
66 | 66 | $tokenMetadata->validateExpiration(); |
67 | 67 | |
68 | -if (! $accessToken->isLongLived()) { |
|
68 | +if (!$accessToken->isLongLived()) { |
|
69 | 69 | // Exchanges a short-lived access token for a long-lived one |
70 | 70 | try { |
71 | 71 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
@@ -78,24 +78,24 @@ discard block |
||
78 | 78 | var_dump($accessToken->getValue()); |
79 | 79 | } |
80 | 80 | |
81 | -$_SESSION['fb_access_token'] = (string) $accessToken; |
|
81 | +$_SESSION['fb_access_token'] = (string)$accessToken; |
|
82 | 82 | |
83 | 83 | try { |
84 | 84 | // Returns a `Facebook\FacebookResponse` object |
85 | 85 | $response = $fb->get('/me?fields=id,name', $accessToken); |
86 | -} catch(Facebook\Exceptions\FacebookResponseException $e) { |
|
86 | +} catch (Facebook\Exceptions\FacebookResponseException $e) { |
|
87 | 87 | echo 'Graph returned an error: ' . $e->getMessage(); |
88 | 88 | exit; |
89 | -} catch(Facebook\Exceptions\FacebookSDKException $e) { |
|
89 | +} catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
90 | 90 | echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
91 | 91 | exit; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $_SESSION['user'] = $response->getGraphUser(); |
95 | 95 | |
96 | -if(isset($_SESSION['user']) && isset($_SESSION['fb_access_token'])){ |
|
96 | +if (isset($_SESSION['user']) && isset($_SESSION['fb_access_token'])) { |
|
97 | 97 | header('Location:member.php'); |
98 | -}else{ |
|
98 | +} else { |
|
99 | 99 | header('Location:index.php'); |
100 | 100 | } |
101 | 101 | } |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!session_id()) { |
|
2 | +if (!session_id()) { |
|
3 | 3 | session_start(); |
4 | 4 | } |
5 | 5 | |
6 | 6 | require_once 'lib\Facebook\autoload.php'; |
7 | 7 | |
8 | -if(isset($_SESSION['fb_access_token'])){ |
|
8 | +if (isset($_SESSION['fb_access_token'])) { |
|
9 | 9 | // Get access token from session |
10 | 10 | $accessToken = $_SESSION['fb_access_token']; |
11 | 11 | header('Location:fb-callback.php'); |
12 | -}else{ |
|
12 | +} else { |
|
13 | 13 | $fb = new Facebook\Facebook([ |
14 | 14 | 'app_id' => '362540437809242', // my facebook app id |
15 | 15 | 'app_secret' => '538cd04f971479ff14dc409df2fbcf3b', |
@@ -22,6 +22,6 @@ discard block |
||
22 | 22 | $loginUrl = $helper->getLoginUrl('https://localhost/rtCamp/fb-callback.php', $permissions); |
23 | 23 | |
24 | 24 | echo "<h3> Connect Clicking Below Facebook Icon Using Your Facebook Account.<h3>"; |
25 | -echo '<a href="' .htmlspecialchars($loginUrl).'"><img alt="Login With Facebook" src="images/fb_icon.png"></a>'; |
|
25 | +echo '<a href="' . htmlspecialchars($loginUrl) . '"><img alt="Login With Facebook" src="images/fb_icon.png"></a>'; |
|
26 | 26 | } |
27 | 27 | ?> |
28 | 28 | \ No newline at end of file |