Photo Gallery by Supsystic - Version 1.15.4

Version Description

Download this release

Release Info

Developer supsystic.com
Plugin Icon 128x128 Photo Gallery by Supsystic
Version 1.15.4
Comparing to
See all releases

Code changes from version 1.15.3 to 1.15.4

index.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Plugin Name: Photo Gallery by Supsystic
5
  * Description: Easy to use Gallery by Supsystic with professional gallery templates. Show off your best design, photography and creative work
6
- * Version: 1.15.3
7
  * Author: supsystic.com
8
  * Author URI: https://supsystic.com
9
  * Text Domain: grid-gallery
@@ -11,5 +11,5 @@
11
 
12
  require_once dirname(__FILE__) . '/app/SupsysticGallery.php';
13
 
14
- $supsysticGallery = new SupsysticGallery('1.15.3');
15
  $supsysticGallery->run();
3
  /**
4
  * Plugin Name: Photo Gallery by Supsystic
5
  * Description: Easy to use Gallery by Supsystic with professional gallery templates. Show off your best design, photography and creative work
6
+ * Version: 1.15.4
7
  * Author: supsystic.com
8
  * Author URI: https://supsystic.com
9
  * Text Domain: grid-gallery
11
 
12
  require_once dirname(__FILE__) . '/app/SupsysticGallery.php';
13
 
14
+ $supsysticGallery = new SupsysticGallery('1.15.4');
15
  $supsysticGallery->run();
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: supsystic.com
3
  Donate link: https://supsystic.com/plugins/gallery
4
  Tags: gallery, wordpress gallery plugin, photo gallery, grid gallery, image gallery, video gallery, responsive gallery, polaroid gallery
5
- Tested up to: 5.7
6
- Stable tag: 1.15.3
7
 
8
  Photo Gallery with template editor to build amazing media gallery. Responsive mobile gallery with grid, masonry, carousel, polaroid and more gallery
9
 
@@ -176,6 +176,10 @@ Add watermark on each image in your gallery and you protect your photos from the
176
  14. Photo gallery plugin admin area. Captions and Icons tab. Create impressive gallery with icons and fantastic caption effect.
177
 
178
  == Changelog ==
 
 
 
 
179
 
180
  = Gallery 1.15.3 / 22.06.2021 =
181
  * Minor fixes
2
  Contributors: supsystic.com
3
  Donate link: https://supsystic.com/plugins/gallery
4
  Tags: gallery, wordpress gallery plugin, photo gallery, grid gallery, image gallery, video gallery, responsive gallery, polaroid gallery
5
+ Tested up to: 5.8
6
+ Stable tag: 1.15.4
7
 
8
  Photo Gallery with template editor to build amazing media gallery. Responsive mobile gallery with grid, masonry, carousel, polaroid and more gallery
9
 
176
  14. Photo gallery plugin admin area. Captions and Icons tab. Create impressive gallery with icons and fantastic caption effect.
177
 
178
  == Changelog ==
179
+ = Gallery 1.15.4 / 06.12.2021 =
180
+ * Add fixes for Mosaic Type Gallery
181
+ * Add fix for Facebook API
182
+ * Add fix for Instagram API
183
 
184
  = Gallery 1.15.3 / 22.06.2021 =
185
  * Minor fixes
src/GridGallery/Insta/Client.php CHANGED
@@ -10,7 +10,7 @@ class GridGallery_Insta_Client
10
  const AUTH_URL = 'https://api.instagram.com/oauth';
11
 
12
  /** Base API URL */
13
- const API_URL = 'https://api.instagram.com/v1';
14
 
15
  /**
16
  * @var string
@@ -38,12 +38,12 @@ class GridGallery_Insta_Client
38
  private $state;
39
 
40
  /**
41
- * @var array
42
  */
43
  private $user;
44
 
45
  /**
46
- * @var string
47
  */
48
 
49
  /**
@@ -78,6 +78,7 @@ class GridGallery_Insta_Client
78
  'client_id' => $this->getClientId(),
79
  'redirect_uri' => $this->getRedirectUri(),
80
  'state' => $this->getState(),
 
81
  'response_type' => 'code',
82
  )
83
  );
@@ -93,6 +94,8 @@ class GridGallery_Insta_Client
93
  */
94
  public function requestAccessToken($code)
95
  {
 
 
96
  if (!$this->getClientSecret()) {
97
  throw new Exception('Client secret is not specified.');
98
  }
@@ -126,6 +129,7 @@ class GridGallery_Insta_Client
126
 
127
  $data = $this->getResponseBody($response);
128
 
 
129
  if (!isset($data['access_token'])) {
130
  throw new RuntimeException('Failed to get access token.');
131
  }
@@ -134,20 +138,20 @@ class GridGallery_Insta_Client
134
  }
135
 
136
  //added to get images from any user
137
- public function getUserData()
138
- {
139
- if ($this->accessToken && $this->userName) {
140
- $response = wp_remote_get(
141
- self::API_URL . "/users/search?q={$this->userName}&access_token={$this->accessToken}"
142
- );
143
- $data = $this->getResponseBody($response);
144
- $this->user = $data;
145
- $this->userId = $data['data'][0]['id'];
146
- } else {
147
- //error mesage
148
- }
149
- return false;
150
- }
151
 
152
  public function getUserThumbnails()
153
  {
@@ -155,38 +159,59 @@ class GridGallery_Insta_Client
155
  $this->accessToken = get_option('insta_token');
156
  $this->user = get_option('insta_user');
157
  }
158
-
159
- return $this->getAllInstagramImages(self::API_URL . "/users/{$this->user['id']}/media/recent/?access_token={$this->accessToken}");
160
  }
161
 
162
  public function getAllInstagramImages($url) {
163
  $imagesUrls = array();
164
  $response = wp_remote_get($url);
165
  $result = $this->getResponseBody($response);
166
- foreach ($result['data'] as $post) {
167
- $imagesUrls[] = $post['images']['standard_resolution']['url'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  }
169
- if ($result['pagination']) {
170
- array_splice($imagesUrls, -1, 0,
171
- $this->getAllInstagramImages($result['pagination']['next_url']));
172
  }
173
  return $imagesUrls;
174
  }
175
 
176
- public function getUserImages()
177
- {
178
- $user = get_option('insta_user');
179
- $token = get_option('insta_token');
180
- $response = wp_remote_get(
181
- self::API_URL . "/users/{$user['id']}/media/recent/?access_token={$token}"
182
- );
183
- $result = $this->getResponseBody($response);
184
- $imagesUrls = array();
185
- foreach ($result['data'] as $post) {
186
- $imagesUrls[] = $post['images'];
187
- }
188
- return $imagesUrls;
189
- }
190
 
191
  /**
192
  * @param string $accessToken
@@ -298,4 +323,4 @@ class GridGallery_Insta_Client
298
  {
299
  return json_decode(wp_remote_retrieve_body($response), true);
300
  }
301
- }
10
  const AUTH_URL = 'https://api.instagram.com/oauth';
11
 
12
  /** Base API URL */
13
+ const API_URL = 'https://graph.instagram.com/';
14
 
15
  /**
16
  * @var string
38
  private $state;
39
 
40
  /**
41
+ * @var integer
42
  */
43
  private $user;
44
 
45
  /**
46
+ * @var integer
47
  */
48
 
49
  /**
78
  'client_id' => $this->getClientId(),
79
  'redirect_uri' => $this->getRedirectUri(),
80
  'state' => $this->getState(),
81
+ 'scope' => 'user_profile,user_media',
82
  'response_type' => 'code',
83
  )
84
  );
94
  */
95
  public function requestAccessToken($code)
96
  {
97
+
98
+
99
  if (!$this->getClientSecret()) {
100
  throw new Exception('Client secret is not specified.');
101
  }
129
 
130
  $data = $this->getResponseBody($response);
131
 
132
+
133
  if (!isset($data['access_token'])) {
134
  throw new RuntimeException('Failed to get access token.');
135
  }
138
  }
139
 
140
  //added to get images from any user
141
+ // public function getUserData()
142
+ // {
143
+ // if ($this->accessToken && $this->userName) {
144
+ // $response = wp_remote_get(
145
+ // self::API_URL . "/users/search?q={$this->userName}&access_token={$this->accessToken}"
146
+ // );
147
+ // $data = $this->getResponseBody($response);
148
+ // $this->user = $data;
149
+ // $this->userId = $data['data'][0]['id'];
150
+ // } else {
151
+ // //error mesage
152
+ // }
153
+ // return false;
154
+ // }
155
 
156
  public function getUserThumbnails()
157
  {
159
  $this->accessToken = get_option('insta_token');
160
  $this->user = get_option('insta_user');
161
  }
162
+ return $this->getAllInstagramImages(self::API_URL . "/me/media?fields=id,caption&access_token={$this->accessToken}");
 
163
  }
164
 
165
  public function getAllInstagramImages($url) {
166
  $imagesUrls = array();
167
  $response = wp_remote_get($url);
168
  $result = $this->getResponseBody($response);
169
+ if (!empty($result['data'])) {
170
+ foreach ($result['data'] as $post) {
171
+ $imageUrl = self::API_URL . $post['id'] . "?fields=id,media_type,media_url,username,timestamp&access_token={$this->accessToken}";
172
+ $imageUrlResponse = wp_remote_get($imageUrl);
173
+ $imageUrlRes = $this->getResponseBody($imageUrlResponse);
174
+ if ($imageUrlRes['media_type'] == 'CAROUSEL_ALBUM') {
175
+ $childrenUrl = self::API_URL . $imageUrlRes['id'] . "/children?access_token={$this->accessToken}";
176
+ $childrenUrlResponse = wp_remote_get($childrenUrl);
177
+ $childrenUrlRes = $this->getResponseBody($childrenUrlResponse);
178
+ if (!empty($childrenUrlRes['data'])) {
179
+ foreach ($childrenUrlRes['data'] as $carousel_children) {
180
+ $carousel_childrenUrl = self::API_URL . $carousel_children['id'] . "?fields=id,media_type,media_url,username,timestamp&access_token={$this->accessToken}";
181
+ $carousel_childrenUrlResponse = wp_remote_get($carousel_childrenUrl);
182
+ $carousel_childrenUrlRes = $this->getResponseBody($carousel_childrenUrlResponse);
183
+ if (!empty($carousel_childrenUrlRes['media_url'])) {
184
+ $imagesUrls[] = $carousel_childrenUrlRes['media_url'];
185
+ }
186
+ }
187
+ }
188
+ }
189
+ if (!empty($imageUrlRes['media_url'])) {
190
+ $imagesUrls[] = $imageUrlRes['media_url'];
191
+ }
192
+ }
193
  }
194
+ if (!empty($result['paging']['next'])) {
195
+ array_splice($imagesUrls, -1, 0,
196
+ $this->getAllInstagramImages($result['paging']['next']));
197
  }
198
  return $imagesUrls;
199
  }
200
 
201
+ // public function getUserImages()
202
+ // {
203
+ // $user = get_option('insta_user');
204
+ // $token = get_option('insta_token');
205
+ // $response = wp_remote_get(
206
+ // self::API_URL . "/users/{$user['id']}/media/recent/?access_token={$token}"
207
+ // );
208
+ // $result = $this->getResponseBody($response);
209
+ // $imagesUrls = array();
210
+ // foreach ($result['data'] as $post) {
211
+ // $imagesUrls[] = $post['images'];
212
+ // }
213
+ // return $imagesUrls;
214
+ // }
215
 
216
  /**
217
  * @param string $accessToken
323
  {
324
  return json_decode(wp_remote_retrieve_body($response), true);
325
  }
326
+ }
src/GridGallery/Insta/Controller.php CHANGED
@@ -74,7 +74,7 @@ class GridGallery_Insta_Controller extends GridGallery_Core_BaseController
74
  public function completeAction(Rsc_Http_Request $request)
75
  {
76
  $code = $request->query->get('code');
77
- $galleryId = $request->query->get('id');
78
 
79
  if (!$code) {
80
  $message = $this->translate('Authorization code is not specified.');
@@ -90,7 +90,7 @@ class GridGallery_Insta_Controller extends GridGallery_Core_BaseController
90
  try {
91
  $client = $this->getClient();
92
  $tmp_arr = $client->requestAccessToken($code);
93
- $client->setUser($tmp_arr['user']);
94
  $client->setAccessToken($tmp_arr['access_token']);
95
 
96
  update_option('insta_token', $client->getAccessToken());
@@ -157,4 +157,4 @@ class GridGallery_Insta_Controller extends GridGallery_Core_BaseController
157
  return $insta->getClient($galleryId);
158
  }
159
 
160
- }
74
  public function completeAction(Rsc_Http_Request $request)
75
  {
76
  $code = $request->query->get('code');
77
+ $galleryId = $request->query->get('id');
78
 
79
  if (!$code) {
80
  $message = $this->translate('Authorization code is not specified.');
90
  try {
91
  $client = $this->getClient();
92
  $tmp_arr = $client->requestAccessToken($code);
93
+ $client->setUser($tmp_arr['user_id']);
94
  $client->setAccessToken($tmp_arr['access_token']);
95
 
96
  update_option('insta_token', $client->getAccessToken());
157
  return $insta->getClient($galleryId);
158
  }
159
 
160
+ }
src/GridGallery/Insta/Module.php CHANGED
@@ -15,13 +15,15 @@ class GridGallery_Insta_Module extends Rsc_Mvc_Module
15
  $config = $environment->getConfig();
16
 
17
  // Client ID
18
- $config->add('instagram_id', '91a34ccb7e2d4f18b2281547df0da4b3');
 
19
 
20
  // Client Secret
21
- $config->add('instagram_secret', '7cd9ac3a1f664723b1b79316bb56fb2f');
 
22
 
23
  // Authenticator's Instagram URL
24
- $config->add('instagram_redirect', 'http://supsystic.com/authenticator/index.php/authenticator/instagram');
25
 
26
  // Authenticator redirect uri
27
  /*$config->add(
@@ -53,6 +55,7 @@ class GridGallery_Insta_Module extends Rsc_Mvc_Module
53
 
54
  $this->client->setState($environment->generateUrl('insta', 'complete', array('id' => $galleryId, '_wpnonce' => wp_create_nonce('supsystic-gallery'))));
55
 
 
56
  return $this->client;
57
  }
58
- }
15
  $config = $environment->getConfig();
16
 
17
  // Client ID
18
+ //$config->add('instagram_id', '91a34ccb7e2d4f18b2281547df0da4b3');
19
+ $config->add('instagram_id', '1069819613799612');
20
 
21
  // Client Secret
22
+ //$config->add('instagram_secret', '7cd9ac3a1f664723b1b79316bb56fb2f');
23
+ $config->add('instagram_secret', '458215a67c657223e5573adfe50b7bdf');
24
 
25
  // Authenticator's Instagram URL
26
+ $config->add('instagram_redirect', 'https://supsystic.com/authenticator/index.php/authenticator/instagram');
27
 
28
  // Authenticator redirect uri
29
  /*$config->add(
55
 
56
  $this->client->setState($environment->generateUrl('insta', 'complete', array('id' => $galleryId, '_wpnonce' => wp_create_nonce('supsystic-gallery'))));
57
 
58
+
59
  return $this->client;
60
  }
61
+ }