@@ -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 | /** |
@@ -10,37 +10,37 @@ discard block |
||
10 | 10 | require_once 'appconfig.php'; |
11 | 11 | |
12 | 12 | $fb = new Facebook\Facebook([ |
13 | - 'app_id' => $appId, // variable with My Facebook App ID |
|
14 | - 'app_secret' => $appSecret, |
|
15 | - 'default_graph_version' => 'v3.2', |
|
16 | - ]); |
|
13 | + 'app_id' => $appId, // variable with My Facebook App ID |
|
14 | + 'app_secret' => $appSecret, |
|
15 | + 'default_graph_version' => 'v3.2', |
|
16 | + ]); |
|
17 | 17 | $helper = $fb->getRedirectLoginHelper(); |
18 | 18 | if(isset($_GET['state'])){ |
19 | - $helper->getPersistentDataHandler()->set('state',$_GET['state']); |
|
19 | + $helper->getPersistentDataHandler()->set('state',$_GET['state']); |
|
20 | 20 | } |
21 | 21 | try { |
22 | - $accessToken = $helper->getAccessToken(); |
|
22 | + $accessToken = $helper->getAccessToken(); |
|
23 | 23 | } catch(Facebook\Exceptions\FacebookResponseException $e) { |
24 | - // When Graph returns an error |
|
25 | - echo 'Graph returned an error: ' . $e->getMessage(); |
|
26 | - exit; |
|
24 | + // When Graph returns an error |
|
25 | + echo 'Graph returned an error: ' . $e->getMessage(); |
|
26 | + exit; |
|
27 | 27 | } catch(Facebook\Exceptions\FacebookSDKException $e) { |
28 | - // When validation fails or other local issues |
|
29 | - echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
30 | - exit; |
|
28 | + // When validation fails or other local issues |
|
29 | + echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
|
30 | + exit; |
|
31 | 31 | } |
32 | 32 | if (!isset($accessToken)) { |
33 | - if ($helper->getError()) { |
|
33 | + if ($helper->getError()) { |
|
34 | 34 | header('HTTP/1.0 401 Unauthorized'); |
35 | 35 | echo "Error: " . $helper->getError() . "\n"; |
36 | 36 | echo "Error Code: " . $helper->getErrorCode() . "\n"; |
37 | 37 | echo "Error Reason: " . $helper->getErrorReason() . "\n"; |
38 | 38 | echo "Error Description: " . $helper->getErrorDescription() . "\n"; |
39 | - } else { |
|
39 | + } else { |
|
40 | 40 | header('HTTP/1.0 400 Bad Request'); |
41 | 41 | echo 'Bad request hihihih'; |
42 | - } |
|
43 | - exit; |
|
42 | + } |
|
43 | + exit; |
|
44 | 44 | } |
45 | 45 | // Logged in |
46 | 46 | echo '<h3>Access Token</h3>'; |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | //$tokenMetadata->validateUserId('123'); |
58 | 58 | $tokenMetadata->validateExpiration(); |
59 | 59 | if (! $accessToken->isLongLived()) { |
60 | - // Exchanges a short-lived access token for a long-lived one |
|
61 | - try { |
|
60 | + // Exchanges a short-lived access token for a long-lived one |
|
61 | + try { |
|
62 | 62 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
63 | - } catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
63 | + } catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
64 | 64 | echo "<p>Error getting long-lived access token: " . $e->getMessage() . "</p>\n\n"; |
65 | 65 | exit; |
66 | - } |
|
67 | - echo '<h3>Long-lived</h3>'; |
|
68 | - var_dump($accessToken->getValue()); |
|
66 | + } |
|
67 | + echo '<h3>Long-lived</h3>'; |
|
68 | + var_dump($accessToken->getValue()); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $_SESSION['fb_access_token'] = (string) $accessToken; |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | 'default_graph_version' => 'v3.2', |
16 | 16 | ]); |
17 | 17 | $helper = $fb->getRedirectLoginHelper(); |
18 | -if(isset($_GET['state'])){ |
|
19 | - $helper->getPersistentDataHandler()->set('state',$_GET['state']); |
|
18 | +if (isset($_GET['state'])) { |
|
19 | + $helper->getPersistentDataHandler()->set('state', $_GET['state']); |
|
20 | 20 | } |
21 | 21 | try { |
22 | 22 | $accessToken = $helper->getAccessToken(); |
23 | -} catch(Facebook\Exceptions\FacebookResponseException $e) { |
|
23 | +} catch (Facebook\Exceptions\FacebookResponseException $e) { |
|
24 | 24 | // When Graph returns an error |
25 | 25 | echo 'Graph returned an error: ' . $e->getMessage(); |
26 | 26 | exit; |
27 | -} catch(Facebook\Exceptions\FacebookSDKException $e) { |
|
27 | +} catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
28 | 28 | // When validation fails or other local issues |
29 | 29 | echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
30 | 30 | exit; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // If you know the user ID this access token belongs to, you can validate it here |
57 | 57 | //$tokenMetadata->validateUserId('123'); |
58 | 58 | $tokenMetadata->validateExpiration(); |
59 | -if (! $accessToken->isLongLived()) { |
|
59 | +if (!$accessToken->isLongLived()) { |
|
60 | 60 | // Exchanges a short-lived access token for a long-lived one |
61 | 61 | try { |
62 | 62 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | var_dump($accessToken->getValue()); |
69 | 69 | } |
70 | 70 | |
71 | -$_SESSION['fb_access_token'] = (string) $accessToken; |
|
71 | +$_SESSION['fb_access_token'] = (string)$accessToken; |
|
72 | 72 | |
73 | 73 | //echo $_SESSION['fb_access_token']; |
74 | 74 |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | </head> |
7 | 7 | <body> |
8 | 8 | <?php |
9 | - session_start(); |
|
9 | + session_start(); |
|
10 | 10 | require_once 'appconfig.php'; |
11 | 11 | require_once 'fb-callback.php'; |
12 | 12 | |
13 | 13 | if(isset($_SESSION['fb_access_token'])){ |
14 | 14 | |
15 | - $accessToken = (string) $_SESSION['fb_access_token']; |
|
15 | + $accessToken = (string) $_SESSION['fb_access_token']; |
|
16 | 16 | } |
17 | - $graphActLink = "https://graph.facebook.com/oauth/access_token?client_id={$appId}&client_secret={$appSecret}&grant_type=client_credentials"; |
|
17 | + $graphActLink = "https://graph.facebook.com/oauth/access_token?client_id={$appId}&client_secret={$appSecret}&grant_type=client_credentials"; |
|
18 | 18 | // Retrieve access token |
19 | 19 | $accessTokenJson = file_get_contents($graphActLink); |
20 | 20 | $accessTokenObj = json_decode($accessTokenJson); |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | $_SESSION['fb_access_token'] = $accessToken; |
25 | 25 | |
26 | 26 | if(isset($_GET['album_id']) && isset($_GET['album_name'])){ |
27 | - $album_id = $_GET['album_id']; |
|
28 | - $album_name = $_GET['album_name']; |
|
27 | + $album_id = $_GET['album_id']; |
|
28 | + $album_name = $_GET['album_name']; |
|
29 | 29 | |
30 | 30 | // Get photos of Facebook page album using Facebook Graph API |
31 | 31 | $graphPhoLink = "https://graph.facebook.com/v3.2/{$album_id}/photos?fields=source,images,name&access_token={$accessToken}"; |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | echo '</div>'; |
58 | 58 | echo '<br/>'; |
59 | 59 | echo '<div style="text-align:center">'; |
60 | - foreach($fbPhotoData as $data){ |
|
61 | - echo '<span class="dot"></span>'; |
|
60 | + foreach($fbPhotoData as $data){ |
|
61 | + echo '<span class="dot"></span>'; |
|
62 | 62 | } |
63 | 63 | echo '</div>'; |
64 | 64 | }else{ |
65 | - echo "We care for your privacy. Only public photos will be displayed !"; |
|
65 | + echo "We care for your privacy. Only public photos will be displayed !"; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | //} |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | require_once 'appconfig.php'; |
11 | 11 | require_once 'fb-callback.php'; |
12 | 12 | |
13 | -if(isset($_SESSION['fb_access_token'])){ |
|
13 | +if (isset($_SESSION['fb_access_token'])) { |
|
14 | 14 | |
15 | - $accessToken = (string) $_SESSION['fb_access_token']; |
|
15 | + $accessToken = (string)$_SESSION['fb_access_token']; |
|
16 | 16 | } |
17 | 17 | $graphActLink = "https://graph.facebook.com/oauth/access_token?client_id={$appId}&client_secret={$appSecret}&grant_type=client_credentials"; |
18 | 18 | // Retrieve access token |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | // Store access token in session |
24 | 24 | $_SESSION['fb_access_token'] = $accessToken; |
25 | 25 | |
26 | -if(isset($_GET['album_id']) && isset($_GET['album_name'])){ |
|
27 | - $album_id = $_GET['album_id']; |
|
26 | +if (isset($_GET['album_id']) && isset($_GET['album_name'])) { |
|
27 | + $album_id = $_GET['album_id']; |
|
28 | 28 | $album_name = $_GET['album_name']; |
29 | 29 | |
30 | 30 | // Get photos of Facebook page album using Facebook Graph API |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | // Facebook photos content |
36 | 36 | $fbPhotoData = $fbPhotoObj['data']; |
37 | 37 | |
38 | -if(empty($fbPhotoData)){}else{echo "<h2>" . $album_name . "</h2>";} |
|
38 | +if (empty($fbPhotoData)) {} else {echo "<h2>" . $album_name . "</h2>"; } |
|
39 | 39 | |
40 | 40 | |
41 | 41 | echo '<div class="slideshow-container">'; |
42 | 42 | |
43 | 43 | // Render all photos |
44 | -if (is_array($fbPhotoData) || is_object($fbPhotoData) && $fbPhotoData!=null) |
|
44 | +if (is_array($fbPhotoData) || is_object($fbPhotoData) && $fbPhotoData != null) |
|
45 | 45 | { |
46 | -foreach($fbPhotoData as $data){ |
|
46 | +foreach ($fbPhotoData as $data) { |
|
47 | 47 | $imageData = end($data['images']); |
48 | - $imgSource = isset($imageData['source'])?$imageData['source']:''; |
|
49 | - $name = isset($data['name'])?$data['name']:''; |
|
48 | + $imgSource = isset($imageData['source']) ? $imageData['source'] : ''; |
|
49 | + $name = isset($data['name']) ? $data['name'] : ''; |
|
50 | 50 | |
51 | 51 | echo '<div class="mySlides fade">'; |
52 | 52 | echo "<img src='{$imgSource}' alt='' style='width:90%;height:80%' />"; |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | echo '</div>'; |
58 | 58 | echo '<br/>'; |
59 | 59 | echo '<div style="text-align:center">'; |
60 | - foreach($fbPhotoData as $data){ |
|
60 | + foreach ($fbPhotoData as $data) { |
|
61 | 61 | echo '<span class="dot"></span>'; |
62 | 62 | } |
63 | 63 | echo '</div>'; |
64 | -}else{ |
|
64 | +} else { |
|
65 | 65 | echo "We care for your privacy. Only public photos will be displayed !"; |
66 | 66 | } |
67 | 67 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | // Facebook photos content |
36 | 36 | $fbPhotoData = $fbPhotoObj['data']; |
37 | 37 | |
38 | -if(empty($fbPhotoData)){}else{echo "<h2>" . $album_name . "</h2>";} |
|
38 | +if(empty($fbPhotoData)){} else{echo "<h2>" . $album_name . "</h2>";} |
|
39 | 39 | |
40 | 40 | |
41 | 41 | echo '<div class="slideshow-container">'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | echo '<span class="dot"></span>'; |
62 | 62 | } |
63 | 63 | echo '</div>'; |
64 | -}else{ |
|
64 | +} else{ |
|
65 | 65 | echo "We care for your privacy. Only public photos will be displayed !"; |
66 | 66 | } |
67 | 67 | } |