@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $request->getProtocolVersion() |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - $content = (string) $request->getBody(); |
|
| 100 | + $content = (string)$request->getBody(); |
|
| 101 | 101 | |
| 102 | 102 | $headers = ''; |
| 103 | 103 | foreach ($request->getHeaders() as $name => $values) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $key, |
| 111 | 111 | $firstLine, |
| 112 | 112 | $headers, |
| 113 | - $content ? "\n".$content : '' |
|
| 113 | + $content ? "\n" . $content : '' |
|
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | 116 | $classes['response-' . $key] = $request->getHeaderLine('X-Php-Expected-Class'); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $body = (string) $response->getBody(); |
|
| 151 | + $body = (string)$response->getBody(); |
|
| 152 | 152 | if (!empty($body)) { |
| 153 | 153 | $body = str_replace("--$boundary--", "--$boundary", $body); |
| 154 | 154 | $parts = explode("--$boundary", $body); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $key = $headers['content-id']; |
| 177 | 177 | |
| 178 | 178 | try { |
| 179 | - $response = Google_Http_REST::decodeHttpResponse($response, $requests[$i-1]); |
|
| 179 | + $response = Google_Http_REST::decodeHttpResponse($response, $requests[$i - 1]); |
|
| 180 | 180 | } catch (Google_Service_Exception $e) { |
| 181 | 181 | // Store the exception as the response, so successful responses |
| 182 | 182 | // can be processed. |
@@ -242,8 +242,7 @@ discard block |
||
| 242 | 242 | } else { |
| 243 | 243 | $responseSegments = explode("\r\n\r\n", $respData, 2); |
| 244 | 244 | $responseHeaders = $responseSegments[0]; |
| 245 | - $responseBody = isset($responseSegments[1]) ? $responseSegments[1] : |
|
| 246 | - null; |
|
| 245 | + $responseBody = isset($responseSegments[1]) ? $responseSegments[1] : null; |
|
| 247 | 246 | } |
| 248 | 247 | |
| 249 | 248 | $responseHeaders = $this->parseRawHeaders($responseHeaders); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ) { |
| 47 | 47 | $runner = new Google_Task_Runner( |
| 48 | 48 | $config, |
| 49 | - sprintf('%s %s', $request->getMethod(), (string) $request->getUri()), |
|
| 49 | + sprintf('%s %s', $request->getMethod(), (string)$request->getUri()), |
|
| 50 | 50 | array(get_class(), 'doExecute'), |
| 51 | 51 | array($client, $request, $expectedClass) |
| 52 | 52 | ); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | // retry strategy |
| 113 | 113 | if (intVal($code) >= 400) { |
| 114 | 114 | // if we errored out, it should be safe to grab the response body |
| 115 | - $body = (string) $response->getBody(); |
|
| 115 | + $body = (string)$response->getBody(); |
|
| 116 | 116 | |
| 117 | 117 | // Check if we received errors, and add those to the Exception for convenience |
| 118 | 118 | throw new Google_Service_Exception($body, $code, null, self::getResponseErrors($body)); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | return ''; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - return (string) $response->getBody(); |
|
| 141 | + return (string)$response->getBody(); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | private static function determineExpectedClass($expectedClass, RequestInterface $request = null) |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $postBody = ''; |
| 217 | 217 | $contentType = false; |
| 218 | 218 | |
| 219 | - $meta = (string) $request->getBody(); |
|
| 219 | + $meta = (string)$request->getBody(); |
|
| 220 | 220 | $meta = is_string($meta) ? json_decode($meta, true) : $meta; |
| 221 | 221 | |
| 222 | 222 | $uploadType = $this->getUploadType($meta); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $message = $code; |
| 316 | - $body = json_decode((string) $this->request->getBody(), true); |
|
| 316 | + $body = json_decode((string)$this->request->getBody(), true); |
|
| 317 | 317 | if (isset($body['error']['errors'])) { |
| 318 | 318 | $message .= ': '; |
| 319 | 319 | foreach ($body['error']['errors'] as $error) { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | private function transformToUploadUrl() |
| 332 | 332 | { |
| 333 | - $parts = parse_url((string) $this->request->getUri()); |
|
| 333 | + $parts = parse_url((string)$this->request->getUri()); |
|
| 334 | 334 | if (!isset($parts['path'])) { |
| 335 | 335 | $parts['path'] = ''; |
| 336 | 336 | } |
@@ -72,10 +72,10 @@ |
||
| 72 | 72 | '503' => self::TASK_RETRY_ALWAYS, |
| 73 | 73 | 'rateLimitExceeded' => self::TASK_RETRY_ALWAYS, |
| 74 | 74 | 'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS, |
| 75 | - 6 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_RESOLVE_HOST |
|
| 76 | - 7 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_CONNECT |
|
| 77 | - 28 => self::TASK_RETRY_ALWAYS, // CURLE_OPERATION_TIMEOUTED |
|
| 78 | - 35 => self::TASK_RETRY_ALWAYS, // CURLE_SSL_CONNECT_ERROR |
|
| 75 | + 6 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_RESOLVE_HOST |
|
| 76 | + 7 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_CONNECT |
|
| 77 | + 28 => self::TASK_RETRY_ALWAYS, // CURLE_OPERATION_TIMEOUTED |
|
| 78 | + 35 => self::TASK_RETRY_ALWAYS, // CURLE_SSL_CONNECT_ERROR |
|
| 79 | 79 | 52 => self::TASK_RETRY_ALWAYS // CURLE_GOT_NOTHING |
| 80 | 80 | ]; |
| 81 | 81 | |
@@ -8,9 +8,9 @@ |
||
| 8 | 8 | <?php |
| 9 | 9 | session_start(); |
| 10 | 10 | require_once 'appconfig.php'; |
| 11 | - $helper->getPersistentDataHandler()->set('state',$_GET['state']); |
|
| 11 | + $helper->getPersistentDataHandler()->set('state', $_GET['state']); |
|
| 12 | 12 | |
| 13 | -if(isset($_SESSION['fb_access_token'])){ |
|
| 13 | +if (isset($_SESSION['fb_access_token'])) { |
|
| 14 | 14 | |
| 15 | 15 | $accessTokenJson = file_get_contents($graphActLink); |
| 16 | 16 | $accessTokenObj = json_decode($accessTokenJson); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $pictureLink = "slideshow.php?album_id={$id}&album_name={$name}"; |
| 145 | 145 | echo "<div class='carding'>"; |
| 146 | 146 | echo "<a target='_blank' href='{$pictureLink}'>"; |
| 147 | - $cover_photo_id = (!empty($cover_photo_id))?$cover_photo_id : 123456; |
|
| 147 | + $cover_photo_id = (!empty($cover_photo_id)) ? $cover_photo_id : 123456; |
|
| 148 | 148 | echo "<img width=200px height=200px src='https://graph.facebook.com/v3.3/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>"; |
| 149 | 149 | echo "<p>{$name}</p>"; |
| 150 | 150 | echo "</a>"; |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | ?> |
| 158 | 158 | <div class="caption"> |
| 159 | 159 | |
| 160 | - <button rel="<?php echo $id.','.$name;?>" class="single-download btn btn-primary pull-left" title="Download Album"> |
|
| 160 | + <button rel="<?php echo $id . ',' . $name; ?>" class="single-download btn btn-primary pull-left" title="Download Album"> |
|
| 161 | 161 | <span class="fas fa-download" ></span> |
| 162 | 162 | </button> |
| 163 | 163 | |
| 164 | - <input type="checkbox" class="select-album" value="<?php echo $id.','.$name;?>" /> |
|
| 165 | - <span rel="<?php echo $id.','.$name;?>" class="move-single-album btn btn-danger pull-right" title="Move to Google"> |
|
| 164 | + <input type="checkbox" class="select-album" value="<?php echo $id . ',' . $name; ?>" /> |
|
| 165 | + <span rel="<?php echo $id . ',' . $name; ?>" class="move-single-album btn btn-danger pull-right" title="Move to Google"> |
|
| 166 | 166 | <span class="fas fa-file-export"></span> |
| 167 | 167 | </span> |
| 168 | 168 | </div> |
@@ -28,21 +28,21 @@ |
||
| 28 | 28 | $response_album_photos = file_get_contents($request_album_photos); |
| 29 | 29 | $album_photos = json_decode($response_album_photos, true, 512, JSON_BIGINT_AS_STRING); |
| 30 | 30 | |
| 31 | - $album_directory = $album_download_directory.$album_name; |
|
| 32 | - if ( !file_exists( $album_directory ) ) { |
|
| 31 | + $album_directory = $album_download_directory . $album_name; |
|
| 32 | + if (!file_exists($album_directory)) { |
|
| 33 | 33 | mkdir($album_directory, 0777); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $i = 1; |
| 37 | - foreach ( $album_photos['data'] as $album_photo ) { |
|
| 38 | - $album_photo = (array) $album_photo; |
|
| 39 | - file_put_contents( $album_directory.'/'.$i.".jpg", fopen( $album_photo['source'], 'r') ); |
|
| 37 | + foreach ($album_photos['data'] as $album_photo) { |
|
| 38 | + $album_photo = (array)$album_photo; |
|
| 39 | + file_put_contents($album_directory . '/' . $i . ".jpg", fopen($album_photo['source'], 'r')); |
|
| 40 | 40 | $i++; |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | //---------- For 1 album download -------------------------------------------------// |
| 45 | - if ( isset( $_GET['single_album'] ) && !empty ( $_GET['single_album'] ) ) { |
|
| 45 | + if (isset($_GET['single_album']) && !empty ($_GET['single_album'])) { |
|
| 46 | 46 | |
| 47 | 47 | $single_album = explode(",", $_GET['single_album']); |
| 48 | 48 | download_album($session, $album_download_directory, $single_album[0], $single_album[1]); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | public function attachToken(ClientInterface $http, array $token, array $scopes) |
| 58 | 58 | { |
| 59 | - $tokenFunc = function ($scopes) use ($token) { |
|
| 59 | + $tokenFunc = function($scopes) use ($token) { |
|
| 60 | 60 | return $token['access_token']; |
| 61 | 61 | }; |
| 62 | 62 | |