@@ -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,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if(!session_id()) { |
| 3 | - session_start(); |
|
| 3 | + session_start(); |
|
| 4 | 4 | } |
| 5 | 5 | require_once 'appconfig.php'; |
| 6 | 6 | |
| 7 | 7 | $fb = new Facebook\Facebook([ |
| 8 | - 'app_id' => $appId, |
|
| 9 | - 'app_secret' => $appSecret, |
|
| 10 | - 'default_graph_version' => 'v3.2', |
|
| 11 | - ]); |
|
| 8 | + 'app_id' => $appId, |
|
| 9 | + 'app_secret' => $appSecret, |
|
| 10 | + 'default_graph_version' => 'v3.2', |
|
| 11 | + ]); |
|
| 12 | 12 | |
| 13 | 13 | $helper = $fb->getRedirectLoginHelper(); |
| 14 | 14 | |
@@ -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 |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | require_once 'appconfig.php'; |
| 3 | 3 | |
| 4 | 4 | if(isset($_SESSION['fb_access_token'])){ |
| 5 | - // Get access token from session |
|
| 6 | - $accessToken = (string) $_SESSION['fb_access_token']; |
|
| 5 | + // Get access token from session |
|
| 6 | + $accessToken = (string) $_SESSION['fb_access_token']; |
|
| 7 | 7 | /* |
| 8 | 8 | $fb = new Facebook\Facebook([ |
| 9 | 9 | 'app_id' => $appId, |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | }*/ |
| 19 | 19 | echo $accessToken; |
| 20 | 20 | |
| 21 | - echo 'Welcome, ' . $user['name']; |
|
| 22 | - echo '<a href="logout.php" >Logout</a>'; |
|
| 21 | + echo 'Welcome, ' . $user['name']; |
|
| 22 | + echo '<a href="logout.php" >Logout</a>'; |
|
| 23 | 23 | |
| 24 | 24 | // Get photo albums of Facebook page using Facebook Graph API |
| 25 | 25 | $fields = "id,name,description,link,cover_photo,count"; |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | //} |
| 59 | 59 | if(isset($_GET['album_id']) && isset($_GET['album_id'])){ |
| 60 | - $album_id = $_GET['album_id']; |
|
| 61 | - $album_name = $_GET['album_name']; //isset($_GET['album_name'])?:header('Location: fb-callback.php'); |
|
| 60 | + $album_id = $_GET['album_id']; |
|
| 61 | + $album_name = $_GET['album_name']; //isset($_GET['album_name'])?:header('Location: fb-callback.php'); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | <div style="text-align:center"> |
| 115 | 115 | <?php |
| 116 | - if (is_array($fbPhotoData) || is_object($fbPhotoData)) |
|
| 117 | - { |
|
| 116 | + if (is_array($fbPhotoData) || is_object($fbPhotoData)) |
|
| 117 | + { |
|
| 118 | 118 | foreach($fbPhotoData as $data){ |
| 119 | - echo "<span class='dot'></span>"; |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - ?> |
|
| 119 | + echo "<span class='dot'></span>"; |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + ?> |
|
| 123 | 123 | </div> |
| 124 | 124 | |
| 125 | 125 | </div> |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once 'appconfig.php'; |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['fb_access_token'])){ |
|
| 4 | +if (isset($_SESSION['fb_access_token'])) { |
|
| 5 | 5 | // Get access token from session |
| 6 | - $accessToken = (string) $_SESSION['fb_access_token']; |
|
| 6 | + $accessToken = (string)$_SESSION['fb_access_token']; |
|
| 7 | 7 | /* |
| 8 | 8 | $fb = new Facebook\Facebook([ |
| 9 | 9 | 'app_id' => $appId, |
@@ -34,29 +34,29 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | // Render all photo albums |
| 36 | 36 | echo "<br/><br/>"; |
| 37 | -foreach($fbAlbumData as $data){ |
|
| 38 | - $id = isset($data['id'])?$data['id']:''; |
|
| 39 | - $name = isset($data['name'])?$data['name']:''; |
|
| 40 | - $description = isset($data['description'])?$data['description']:''; |
|
| 41 | - $link = isset($data['link'])?$data['link']:''; |
|
| 42 | - $cover_photo_id = isset($data['cover_photo']['id'])?$data['cover_photo']['id']:''; |
|
| 43 | - $count = isset($data['count'])?$data['count']:''; |
|
| 37 | +foreach ($fbAlbumData as $data) { |
|
| 38 | + $id = isset($data['id']) ? $data['id'] : ''; |
|
| 39 | + $name = isset($data['name']) ? $data['name'] : ''; |
|
| 40 | + $description = isset($data['description']) ? $data['description'] : ''; |
|
| 41 | + $link = isset($data['link']) ? $data['link'] : ''; |
|
| 42 | + $cover_photo_id = isset($data['cover_photo']['id']) ? $data['cover_photo']['id'] : ''; |
|
| 43 | + $count = isset($data['count']) ? $data['count'] : ''; |
|
| 44 | 44 | |
| 45 | 45 | $pictureLink = "fb-callback.php?album_id={$id}&album_name={$name}"; |
| 46 | 46 | |
| 47 | 47 | echo "<a href='{$pictureLink}'>"; |
| 48 | - $cover_photo_id = (!empty($cover_photo_id ))?$cover_photo_id : 123456; |
|
| 48 | + $cover_photo_id = (!empty($cover_photo_id)) ? $cover_photo_id : 123456; |
|
| 49 | 49 | echo "<img width=100px height=100px src='https://graph.facebook.com/v3.2/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>"; |
| 50 | 50 | echo "</a>"; |
| 51 | 51 | echo "<p>{$name}</p>"; |
| 52 | 52 | |
| 53 | - $photoCount = ($count > 1)?$count. 'Photos':$count. 'Photo'; |
|
| 53 | + $photoCount = ($count > 1) ? $count . 'Photos' : $count . 'Photo'; |
|
| 54 | 54 | |
| 55 | 55 | echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>"; |
| 56 | 56 | echo "<p>{$description}</p>"; |
| 57 | 57 | } |
| 58 | 58 | //} |
| 59 | -if(isset($_GET['album_id']) && isset($_GET['album_id'])){ |
|
| 59 | +if (isset($_GET['album_id']) && isset($_GET['album_id'])) { |
|
| 60 | 60 | $album_id = $_GET['album_id']; |
| 61 | 61 | $album_name = $_GET['album_name']; //isset($_GET['album_name'])?:header('Location: fb-callback.php'); |
| 62 | 62 | } |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | // Facebook photos content |
| 71 | 71 | $fbPhotoData = $fbPhotoObj['data']; |
| 72 | 72 | |
| 73 | -echo "<h2>".$album_name."</h2>"; |
|
| 73 | +echo "<h2>" . $album_name . "</h2>"; |
|
| 74 | 74 | |
| 75 | 75 | // Render all photos |
| 76 | 76 | if (is_array($fbPhotoData) || is_object($fbPhotoData)) |
| 77 | 77 | { |
| 78 | - foreach($fbPhotoData as $data) |
|
| 78 | + foreach ($fbPhotoData as $data) |
|
| 79 | 79 | { |
| 80 | 80 | $imageData = end($data['images']); |
| 81 | - $imgSource = isset($imageData['source'])?$imageData['source']:''; |
|
| 82 | - $name = isset($data['name'])?$data['name']:''; |
|
| 81 | + $imgSource = isset($imageData['source']) ? $imageData['source'] : ''; |
|
| 82 | + $name = isset($data['name']) ? $data['name'] : ''; |
|
| 83 | 83 | |
| 84 | 84 | echo "<div class='item'>"; |
| 85 | 85 | echo "<img src='{$imgSource}' alt=''>"; |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | // Render all photos |
| 97 | 97 | if (is_array($fbPhotoData) || is_object($fbPhotoData)) |
| 98 | 98 | { |
| 99 | - foreach($fbPhotoData as $data){ |
|
| 99 | + foreach ($fbPhotoData as $data) { |
|
| 100 | 100 | $imageData = end($data['images']); |
| 101 | - $imgSource = isset($imageData['source'])?$imageData['source']:''; |
|
| 102 | - $name = isset($data['name'])?$data['name']:''; |
|
| 101 | + $imgSource = isset($imageData['source']) ? $imageData['source'] : ''; |
|
| 102 | + $name = isset($data['name']) ? $data['name'] : ''; |
|
| 103 | 103 | |
| 104 | 104 | echo "<div class='mySlides fade'>"; |
| 105 | 105 | echo "<img src='{$imgSource}' alt='' style='width:100%'>"; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | <?php |
| 116 | 116 | if (is_array($fbPhotoData) || is_object($fbPhotoData)) |
| 117 | 117 | { |
| 118 | - foreach($fbPhotoData as $data){ |
|
| 118 | + foreach ($fbPhotoData as $data) { |
|
| 119 | 119 | echo "<span class='dot'></span>"; |
| 120 | 120 | } |
| 121 | 121 | } |