Passed
Push — master ( e34333...86363a )
by Rakesh
42s queued 10s
created
lib/Google/Task/Runner.php 2 patches
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -22,52 +22,52 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class Google_Task_Runner
24 24
 {
25
-  const TASK_RETRY_NEVER = 0;
26
-  const TASK_RETRY_ONCE = 1;
27
-  const TASK_RETRY_ALWAYS = -1;
28
-
29
-  /**
30
-   * @var integer $maxDelay The max time (in seconds) to wait before a retry.
31
-   */
32
-  private $maxDelay = 60;
33
-  /**
34
-   * @var integer $delay The previous delay from which the next is calculated.
35
-   */
36
-  private $delay = 1;
37
-
38
-  /**
39
-   * @var integer $factor The base number for the exponential back off.
40
-   */
41
-  private $factor = 2;
42
-  /**
43
-   * @var float $jitter A random number between -$jitter and $jitter will be
44
-   * added to $factor on each iteration to allow for a better distribution of
45
-   * retries.
46
-   */
47
-  private $jitter = 0.5;
48
-
49
-  /**
50
-   * @var integer $attempts The number of attempts that have been tried so far.
51
-   */
52
-  private $attempts = 0;
53
-  /**
54
-   * @var integer $maxAttempts The max number of attempts allowed.
55
-   */
56
-  private $maxAttempts = 1;
57
-
58
-  /**
59
-   * @var callable $action The task to run and possibly retry.
60
-   */
61
-  private $action;
62
-  /**
63
-   * @var array $arguments The task arguments.
64
-   */
65
-  private $arguments;
66
-
67
-  /**
68
-   * @var array $retryMap Map of errors with retry counts.
69
-   */
70
-  protected $retryMap = [
25
+    const TASK_RETRY_NEVER = 0;
26
+    const TASK_RETRY_ONCE = 1;
27
+    const TASK_RETRY_ALWAYS = -1;
28
+
29
+    /**
30
+     * @var integer $maxDelay The max time (in seconds) to wait before a retry.
31
+     */
32
+    private $maxDelay = 60;
33
+    /**
34
+     * @var integer $delay The previous delay from which the next is calculated.
35
+     */
36
+    private $delay = 1;
37
+
38
+    /**
39
+     * @var integer $factor The base number for the exponential back off.
40
+     */
41
+    private $factor = 2;
42
+    /**
43
+     * @var float $jitter A random number between -$jitter and $jitter will be
44
+     * added to $factor on each iteration to allow for a better distribution of
45
+     * retries.
46
+     */
47
+    private $jitter = 0.5;
48
+
49
+    /**
50
+     * @var integer $attempts The number of attempts that have been tried so far.
51
+     */
52
+    private $attempts = 0;
53
+    /**
54
+     * @var integer $maxAttempts The max number of attempts allowed.
55
+     */
56
+    private $maxAttempts = 1;
57
+
58
+    /**
59
+     * @var callable $action The task to run and possibly retry.
60
+     */
61
+    private $action;
62
+    /**
63
+     * @var array $arguments The task arguments.
64
+     */
65
+    private $arguments;
66
+
67
+    /**
68
+     * @var array $retryMap Map of errors with retry counts.
69
+     */
70
+    protected $retryMap = [
71 71
     '500' => self::TASK_RETRY_ALWAYS,
72 72
     '503' => self::TASK_RETRY_ALWAYS,
73 73
     'rateLimitExceeded' => self::TASK_RETRY_ALWAYS,
@@ -77,70 +77,70 @@  discard block
 block discarded – undo
77 77
     28 => self::TASK_RETRY_ALWAYS,  // CURLE_OPERATION_TIMEOUTED
78 78
     35 => self::TASK_RETRY_ALWAYS,  // CURLE_SSL_CONNECT_ERROR
79 79
     52 => self::TASK_RETRY_ALWAYS   // CURLE_GOT_NOTHING
80
-  ];
81
-
82
-  /**
83
-   * Creates a new task runner with exponential backoff support.
84
-   *
85
-   * @param array $config The task runner config
86
-   * @param string $name The name of the current task (used for logging)
87
-   * @param callable $action The task to run and possibly retry
88
-   * @param array $arguments The task arguments
89
-   * @throws Google_Task_Exception when misconfigured
90
-   */
91
-  public function __construct(
92
-      $config,
93
-      $name,
94
-      $action,
95
-      array $arguments = array()
96
-  ) {
80
+    ];
81
+
82
+    /**
83
+     * Creates a new task runner with exponential backoff support.
84
+     *
85
+     * @param array $config The task runner config
86
+     * @param string $name The name of the current task (used for logging)
87
+     * @param callable $action The task to run and possibly retry
88
+     * @param array $arguments The task arguments
89
+     * @throws Google_Task_Exception when misconfigured
90
+     */
91
+    public function __construct(
92
+        $config,
93
+        $name,
94
+        $action,
95
+        array $arguments = array()
96
+    ) {
97 97
     if (isset($config['initial_delay'])) {
98
-      if ($config['initial_delay'] < 0) {
98
+        if ($config['initial_delay'] < 0) {
99 99
         throw new Google_Task_Exception(
100 100
             'Task configuration `initial_delay` must not be negative.'
101 101
         );
102
-      }
102
+        }
103 103
 
104
-      $this->delay = $config['initial_delay'];
104
+        $this->delay = $config['initial_delay'];
105 105
     }
106 106
 
107 107
     if (isset($config['max_delay'])) {
108
-      if ($config['max_delay'] <= 0) {
108
+        if ($config['max_delay'] <= 0) {
109 109
         throw new Google_Task_Exception(
110 110
             'Task configuration `max_delay` must be greater than 0.'
111 111
         );
112
-      }
112
+        }
113 113
 
114
-      $this->maxDelay = $config['max_delay'];
114
+        $this->maxDelay = $config['max_delay'];
115 115
     }
116 116
 
117 117
     if (isset($config['factor'])) {
118
-      if ($config['factor'] <= 0) {
118
+        if ($config['factor'] <= 0) {
119 119
         throw new Google_Task_Exception(
120 120
             'Task configuration `factor` must be greater than 0.'
121 121
         );
122
-      }
122
+        }
123 123
 
124
-      $this->factor = $config['factor'];
124
+        $this->factor = $config['factor'];
125 125
     }
126 126
 
127 127
     if (isset($config['jitter'])) {
128
-      if ($config['jitter'] <= 0) {
128
+        if ($config['jitter'] <= 0) {
129 129
         throw new Google_Task_Exception(
130 130
             'Task configuration `jitter` must be greater than 0.'
131 131
         );
132
-      }
132
+        }
133 133
 
134
-      $this->jitter = $config['jitter'];
134
+        $this->jitter = $config['jitter'];
135 135
     }
136 136
 
137 137
     if (isset($config['retries'])) {
138
-      if ($config['retries'] < 0) {
138
+        if ($config['retries'] < 0) {
139 139
         throw new Google_Task_Exception(
140 140
             'Task configuration `retries` must not be negative.'
141 141
         );
142
-      }
143
-      $this->maxAttempts += $config['retries'];
142
+        }
143
+        $this->maxAttempts += $config['retries'];
144 144
     }
145 145
 
146 146
     if (!is_callable($action)) {
@@ -151,131 +151,131 @@  discard block
 block discarded – undo
151 151
 
152 152
     $this->action = $action;
153 153
     $this->arguments = $arguments;
154
-  }
155
-
156
-  /**
157
-   * Checks if a retry can be attempted.
158
-   *
159
-   * @return boolean
160
-   */
161
-  public function canAttempt()
162
-  {
154
+    }
155
+
156
+    /**
157
+     * Checks if a retry can be attempted.
158
+     *
159
+     * @return boolean
160
+     */
161
+    public function canAttempt()
162
+    {
163 163
     return $this->attempts < $this->maxAttempts;
164
-  }
165
-
166
-  /**
167
-   * Runs the task and (if applicable) automatically retries when errors occur.
168
-   *
169
-   * @return mixed
170
-   * @throws Google_Task_Retryable on failure when no retries are available.
171
-   */
172
-  public function run()
173
-  {
164
+    }
165
+
166
+    /**
167
+     * Runs the task and (if applicable) automatically retries when errors occur.
168
+     *
169
+     * @return mixed
170
+     * @throws Google_Task_Retryable on failure when no retries are available.
171
+     */
172
+    public function run()
173
+    {
174 174
     while ($this->attempt()) {
175
-      try {
175
+        try {
176 176
         return call_user_func_array($this->action, $this->arguments);
177
-      } catch (Google_Service_Exception $exception) {
177
+        } catch (Google_Service_Exception $exception) {
178 178
         $allowedRetries = $this->allowedRetries(
179 179
             $exception->getCode(),
180 180
             $exception->getErrors()
181 181
         );
182 182
 
183 183
         if (!$this->canAttempt() || !$allowedRetries) {
184
-          throw $exception;
184
+            throw $exception;
185 185
         }
186 186
 
187 187
         if ($allowedRetries > 0) {
188
-          $this->maxAttempts = min(
189
-              $this->maxAttempts,
190
-              $this->attempts + $allowedRetries
191
-          );
188
+            $this->maxAttempts = min(
189
+                $this->maxAttempts,
190
+                $this->attempts + $allowedRetries
191
+            );
192
+        }
192 193
         }
193
-      }
194 194
     }
195
-  }
196
-
197
-  /**
198
-   * Runs a task once, if possible. This is useful for bypassing the `run()`
199
-   * loop.
200
-   *
201
-   * NOTE: If this is not the first attempt, this function will sleep in
202
-   * accordance to the backoff configurations before running the task.
203
-   *
204
-   * @return boolean
205
-   */
206
-  public function attempt()
207
-  {
195
+    }
196
+
197
+    /**
198
+     * Runs a task once, if possible. This is useful for bypassing the `run()`
199
+     * loop.
200
+     *
201
+     * NOTE: If this is not the first attempt, this function will sleep in
202
+     * accordance to the backoff configurations before running the task.
203
+     *
204
+     * @return boolean
205
+     */
206
+    public function attempt()
207
+    {
208 208
     if (!$this->canAttempt()) {
209
-      return false;
209
+        return false;
210 210
     }
211 211
 
212 212
     if ($this->attempts > 0) {
213
-      $this->backOff();
213
+        $this->backOff();
214 214
     }
215 215
 
216 216
     $this->attempts++;
217 217
     return true;
218
-  }
218
+    }
219 219
 
220
-  /**
221
-   * Sleeps in accordance to the backoff configurations.
222
-   */
223
-  private function backOff()
224
-  {
220
+    /**
221
+     * Sleeps in accordance to the backoff configurations.
222
+     */
223
+    private function backOff()
224
+    {
225 225
     $delay = $this->getDelay();
226 226
 
227 227
     usleep($delay * 1000000);
228
-  }
229
-
230
-  /**
231
-   * Gets the delay (in seconds) for the current backoff period.
232
-   *
233
-   * @return float
234
-   */
235
-  private function getDelay()
236
-  {
228
+    }
229
+
230
+    /**
231
+     * Gets the delay (in seconds) for the current backoff period.
232
+     *
233
+     * @return float
234
+     */
235
+    private function getDelay()
236
+    {
237 237
     $jitter = $this->getJitter();
238 238
     $factor = $this->attempts > 1 ? $this->factor + $jitter : 1 + abs($jitter);
239 239
 
240 240
     return $this->delay = min($this->maxDelay, $this->delay * $factor);
241
-  }
242
-
243
-  /**
244
-   * Gets the current jitter (random number between -$this->jitter and
245
-   * $this->jitter).
246
-   *
247
-   * @return float
248
-   */
249
-  private function getJitter()
250
-  {
241
+    }
242
+
243
+    /**
244
+     * Gets the current jitter (random number between -$this->jitter and
245
+     * $this->jitter).
246
+     *
247
+     * @return float
248
+     */
249
+    private function getJitter()
250
+    {
251 251
     return $this->jitter * 2 * mt_rand() / mt_getrandmax() - $this->jitter;
252
-  }
253
-
254
-  /**
255
-   * Gets the number of times the associated task can be retried.
256
-   *
257
-   * NOTE: -1 is returned if the task can be retried indefinitely
258
-   *
259
-   * @return integer
260
-   */
261
-  public function allowedRetries($code, $errors = array())
262
-  {
252
+    }
253
+
254
+    /**
255
+     * Gets the number of times the associated task can be retried.
256
+     *
257
+     * NOTE: -1 is returned if the task can be retried indefinitely
258
+     *
259
+     * @return integer
260
+     */
261
+    public function allowedRetries($code, $errors = array())
262
+    {
263 263
     if (isset($this->retryMap[$code])) {
264
-      return $this->retryMap[$code];
264
+        return $this->retryMap[$code];
265 265
     }
266 266
 
267 267
     if (
268 268
         !empty($errors) &&
269 269
         isset($errors[0]['reason'], $this->retryMap[$errors[0]['reason']])
270 270
     ) {
271
-      return $this->retryMap[$errors[0]['reason']];
271
+        return $this->retryMap[$errors[0]['reason']];
272 272
     }
273 273
 
274 274
     return 0;
275
-  }
275
+    }
276 276
 
277
-  public function setRetryMap($retryMap)
278
-  {
277
+    public function setRetryMap($retryMap)
278
+    {
279 279
     $this->retryMap = $retryMap;
280
-  }
280
+    }
281 281
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
slideshow.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
member.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -141,20 +141,20 @@
 block discarded – undo
141 141
             $cover_photo_id = isset($data['cover_photo']['id']) ? $data['cover_photo']['id'] : '';
142 142
             $count = isset($data['count']) ? $data['count'] : '';
143 143
           
144
-          $pictureLink = "slideshow.php?album_id={$id}&album_name={$name}";
145
-          echo "<div class='carding'>";
146
-          echo "<a target='_blank' href='{$pictureLink}'>";
147
-          $cover_photo_id = (!empty($cover_photo_id))?$cover_photo_id : 123456;
148
-          echo "<img width=200px height=200px src='https://graph.facebook.com/v3.3/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>";
149
-          echo "<p>{$name}</p>";
150
-          echo "</a>";
151
-          //echo "$images";
144
+            $pictureLink = "slideshow.php?album_id={$id}&album_name={$name}";
145
+            echo "<div class='carding'>";
146
+            echo "<a target='_blank' href='{$pictureLink}'>";
147
+            $cover_photo_id = (!empty($cover_photo_id))?$cover_photo_id : 123456;
148
+            echo "<img width=200px height=200px src='https://graph.facebook.com/v3.3/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>";
149
+            echo "<p>{$name}</p>";
150
+            echo "</a>";
151
+            //echo "$images";
152 152
           
153 153
             $photoCount = ($count > 1) ? $count . 'Photos' : $count . 'Photo';
154 154
           
155
-          echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>";
156
-          echo "<p>{$description}</p>";
157
-          ?>
155
+            echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>";
156
+            echo "<p>{$description}</p>";
157
+            ?>
158 158
 		<div class="caption">
159 159
 		  
160 160
 			<button rel="<?php echo $id.','.$name;?>" class="single-download btn btn-primary pull-left" title="Download Album">
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
functions.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 session_start();
3 3
 ini_set('max_execution_time', 300);
4
-	require_once 'appconfig.php';
4
+    require_once 'appconfig.php';
5 5
 
6
-		use Facebook\GraphNodes\GraphObject;
7
-		use Facebook\GraphNodes\GraphSessionInfo;
8
-		use Facebook\Authentication\AccessToken;
9
-		use Facebook\HttpClients\FacebookHttpable;
10
-		use Facebook\HttpClients\FacebookCurl;
11
-		use Facebook\HttpClients\FacebookCurlHttpClient;
12
-		use Facebook\FacebookSession;
13
-		use Facebook\Helpers\FacebookRedirectLoginHelper;
14
-		use Facebook\FacebookRequest;
15
-		use Facebook\FacebookResponse;
16
-		use Facebook\Exceptions\FacebookSDKException;
17
-		use Facebook\Exceptions\FacebookAuthorizationException;
6
+        use Facebook\GraphNodes\GraphObject;
7
+        use Facebook\GraphNodes\GraphSessionInfo;
8
+        use Facebook\Authentication\AccessToken;
9
+        use Facebook\HttpClients\FacebookHttpable;
10
+        use Facebook\HttpClients\FacebookCurl;
11
+        use Facebook\HttpClients\FacebookCurlHttpClient;
12
+        use Facebook\FacebookSession;
13
+        use Facebook\Helpers\FacebookRedirectLoginHelper;
14
+        use Facebook\FacebookRequest;
15
+        use Facebook\FacebookResponse;
16
+        use Facebook\Exceptions\FacebookSDKException;
17
+        use Facebook\Exceptions\FacebookAuthorizationException;
18 18
 
19 19
     $session = $_SESSION['fb_access_token'];
20 20
 
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
 
25 25
     function download_album($session, $album_download_directory, $album_id, $album_name) {
26 26
 
27
-		$request_album_photos = "https://graph.facebook.com/v3.3/{$album_id}/photos?fields=source,images,name&limit=500&access_token={$session}";
28
-		$response_album_photos = file_get_contents($request_album_photos);			
29
-		$album_photos = json_decode($response_album_photos, true, 512, JSON_BIGINT_AS_STRING);
27
+        $request_album_photos = "https://graph.facebook.com/v3.3/{$album_id}/photos?fields=source,images,name&limit=500&access_token={$session}";
28
+        $response_album_photos = file_get_contents($request_album_photos);			
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 ) ) {
33
-			mkdir($album_directory, 0777);
34
-		}
31
+        $album_directory = $album_download_directory.$album_name;
32
+        if ( !file_exists( $album_directory ) ) {
33
+            mkdir($album_directory, 0777);
34
+        }
35 35
 		
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') );
40
-			$i++;
41
-		}
42
-	}
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') );
40
+            $i++;
41
+        }
42
+    }
43 43
 
44
-	//---------- For 1 album download -------------------------------------------------//
45
-	if ( isset( $_GET['single_album'] ) && !empty ( $_GET['single_album'] ) ) {
44
+    //---------- For 1 album download -------------------------------------------------//
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]);
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 
65 65
             // graph api request for user data
66 66
 			
67
-			$request_albums = "https://graph.facebook.com/v3.3/me/albums?fields=id,name&access_token={$session}";
68
-			$response_albums = file_get_contents($request_albums);
67
+            $request_albums = "https://graph.facebook.com/v3.3/me/albums?fields=id,name&access_token={$session}";
68
+            $response_albums = file_get_contents($request_albums);
69 69
 			
70 70
             // get response
71 71
             $albums = json_decode($response_albums, true, 512, JSON_BIGINT_AS_STRING);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,21 +28,21 @@
 block discarded – undo
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]);
Please login to merge, or discard this patch.