@@ -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,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!session_id()) { |
|
| 2 | +if (!session_id()) { |
|
| 3 | 3 | session_start(); |
| 4 | 4 | } |
| 5 | 5 | require_once 'appconfig.php'; |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $helper = $fb->getRedirectLoginHelper(); |
| 14 | 14 | |
| 15 | -$permissions = ['email','user_photos','user_videos','user_posts','user_link','user_status','user_link']; // Optional permissions |
|
| 16 | -$loginUrl = $helper->getLoginUrl($CallbackUrl,$permissions); |
|
| 15 | +$permissions = ['email', 'user_photos', 'user_videos', 'user_posts', 'user_link', 'user_status', 'user_link']; // Optional permissions |
|
| 16 | +$loginUrl = $helper->getLoginUrl($CallbackUrl, $permissions); |
|
| 17 | 17 | |
| 18 | 18 | echo "<h3> Connect Clicking Below Facebook Icon Using Your Facebook Account.<h3>"; |
| 19 | -echo '<a href="' .htmlspecialchars($loginUrl).'"><img alt="Login With Facebook" src="images/fb_icon.png"></a>'; |
|
| 19 | +echo '<a href="' . htmlspecialchars($loginUrl) . '"><img alt="Login With Facebook" src="images/fb_icon.png"></a>'; |
|
| 20 | 20 | //} |
| 21 | 21 | ?> |
| 22 | 22 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!session_id()) { |
|
| 2 | +if (!session_id()) { |
|
| 3 | 3 | session_start(); |
| 4 | 4 | } |
| 5 | 5 | require_once 'appconfig.php'; |
@@ -10,21 +10,21 @@ discard block |
||
| 10 | 10 | 'default_graph_version' => 'v3.2', |
| 11 | 11 | ]); |
| 12 | 12 | $helper = $fb->getRedirectLoginHelper(); |
| 13 | -if(isset($_GET['state'])){ |
|
| 14 | - $helper->getPersistentDataHandler()->set('state',$_GET['state']); |
|
| 13 | +if (isset($_GET['state'])) { |
|
| 14 | + $helper->getPersistentDataHandler()->set('state', $_GET['state']); |
|
| 15 | 15 | } |
| 16 | 16 | try { |
| 17 | 17 | $accessToken = $helper->getAccessToken(); |
| 18 | -} catch(Facebook\Exceptions\FacebookResponseException $e) { |
|
| 18 | +} catch (Facebook\Exceptions\FacebookResponseException $e) { |
|
| 19 | 19 | // When Graph returns an error |
| 20 | 20 | echo 'Graph returned an error: ' . $e->getMessage(); |
| 21 | 21 | exit; |
| 22 | -} catch(Facebook\Exceptions\FacebookSDKException $e) { |
|
| 22 | +} catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
| 23 | 23 | // When validation fails or other local issues |
| 24 | 24 | echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
| 25 | 25 | exit; |
| 26 | 26 | } |
| 27 | -if (! isset($accessToken)) { |
|
| 27 | +if (!isset($accessToken)) { |
|
| 28 | 28 | if ($helper->getError()) { |
| 29 | 29 | header('HTTP/1.0 401 Unauthorized'); |
| 30 | 30 | echo "Error: " . $helper->getError() . "\n"; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | // If you know the user ID this access token belongs to, you can validate it here |
| 52 | 52 | //$tokenMetadata->validateUserId('123'); |
| 53 | 53 | $tokenMetadata->validateExpiration(); |
| 54 | -if (! $accessToken->isLongLived()) { |
|
| 54 | +if (!$accessToken->isLongLived()) { |
|
| 55 | 55 | // Exchanges a short-lived access token for a long-lived one |
| 56 | 56 | try { |
| 57 | 57 | $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken); |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | try { |
| 68 | 68 | // Returns a `Facebook\FacebookResponse` object |
| 69 | 69 | $response = $fb->get('/me?fields=id,name', $accessToken); |
| 70 | -} catch(Facebook\Exceptions\FacebookResponseException $e) { |
|
| 70 | +} catch (Facebook\Exceptions\FacebookResponseException $e) { |
|
| 71 | 71 | echo 'Graph returned an error: ' . $e->getMessage(); |
| 72 | 72 | exit; |
| 73 | -} catch(Facebook\Exceptions\FacebookSDKException $e) { |
|
| 73 | +} catch (Facebook\Exceptions\FacebookSDKException $e) { |
|
| 74 | 74 | echo 'Facebook SDK returned an error: ' . $e->getMessage(); |
| 75 | 75 | exit; |
| 76 | 76 | } |
| 77 | 77 | $user = $response->getGraphUser(); |
| 78 | 78 | |
| 79 | -echo 'ID: ' . $user['id'] ; |
|
| 79 | +echo 'ID: ' . $user['id']; |
|
| 80 | 80 | echo '<br/ >Welcome, ' . $user['name']; |
| 81 | 81 | echo '<a href="logout.php" > Logout </a>'; |
| 82 | 82 | |
@@ -93,22 +93,22 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // Render all photo albums |
| 95 | 95 | echo "<br/><br/>"; |
| 96 | -foreach($fbAlbumData as $data){ |
|
| 97 | - $id = isset($data['id'])?$data['id']:''; |
|
| 98 | - $name = isset($data['name'])?$data['name']:''; |
|
| 99 | - $description = isset($data['description'])?$data['description']:''; |
|
| 100 | - $link = isset($data['link'])?$data['link']:''; |
|
| 101 | - $cover_photo_id = isset($data['cover_photo']['id'])?$data['cover_photo']['id']:''; |
|
| 102 | - $count = isset($data['count'])?$data['count']:''; |
|
| 96 | +foreach ($fbAlbumData as $data) { |
|
| 97 | + $id = isset($data['id']) ? $data['id'] : ''; |
|
| 98 | + $name = isset($data['name']) ? $data['name'] : ''; |
|
| 99 | + $description = isset($data['description']) ? $data['description'] : ''; |
|
| 100 | + $link = isset($data['link']) ? $data['link'] : ''; |
|
| 101 | + $cover_photo_id = isset($data['cover_photo']['id']) ? $data['cover_photo']['id'] : ''; |
|
| 102 | + $count = isset($data['count']) ? $data['count'] : ''; |
|
| 103 | 103 | |
| 104 | 104 | $pictureLink = "slideshow.php?album_id={$id}&album_name={$name}"; |
| 105 | 105 | echo "<a href='{$pictureLink}'>"; |
| 106 | - $cover_photo_id = (!empty($cover_photo_id ))?$cover_photo_id : 123456; |
|
| 106 | + $cover_photo_id = (!empty($cover_photo_id)) ? $cover_photo_id : 123456; |
|
| 107 | 107 | echo "<img width=100px height=100px src='https://graph.facebook.com/v3.2/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>"; |
| 108 | 108 | echo "</a>"; |
| 109 | 109 | echo "<p>{$name}</p>"; |
| 110 | 110 | |
| 111 | - $photoCount = ($count > 1)?$count. 'Photos':$count. 'Photo'; |
|
| 111 | + $photoCount = ($count > 1) ? $count . 'Photos' : $count . 'Photo'; |
|
| 112 | 112 | |
| 113 | 113 | echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>"; |
| 114 | 114 | echo "<p>{$description}</p>"; |