Instagram Gallery - Version 3.0.3

Version Description

  • Fix. new personal api limitations
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 Instagram Gallery
Version 3.0.3
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.3

includes/api/api.php CHANGED
@@ -17,7 +17,7 @@ abstract class QLIGG_API
17
  {
18
  global $qliggAPI;
19
 
20
- return $qliggAPI->FEED->setupMediaItems($data, $last_id);
21
  }
22
 
23
  function validateResponse($json = null)
17
  {
18
  global $qliggAPI;
19
 
20
+ return $qliggAPI->FEED->setupPersonalMediaItems($data, $last_id);
21
  }
22
 
23
  function validateResponse($json = null)
includes/api/apiFeed.php CHANGED
@@ -20,6 +20,64 @@ class QLIGG_API_Feed
20
  return self::$_instance;
21
  }
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  function setupMediaItems($data, $last_id = null)
24
  {
25
 
@@ -49,12 +107,12 @@ class QLIGG_API_Feed
49
  'type' => strtolower(str_replace('_ALBUM', '', $item['media_type'])),
50
  'media' => $media_url,
51
  'images' => array(
52
- 'standard' => "{$item['permalink']}media?size=l",
53
  'medium' => "{$item['permalink']}media?size=m",
54
  'small' => "{$item['permalink']}media?size=t",
55
  ),
56
  'videos' => array(
57
- 'standard' => "{$item['permalink']}media?size=l",
58
  'medium' => "{$item['permalink']}media?size=m",
59
  'small' => "{$item['permalink']}media?size=t",
60
  ),
@@ -76,7 +134,7 @@ class QLIGG_API_Feed
76
  }
77
 
78
  return $instagram_items;
79
- }
80
 
81
  // Return messages
82
  // ---------------------------------------------------------------------------
20
  return self::$_instance;
21
  }
22
 
23
+ function setupPersonalMediaItems($data, $last_id = null)
24
+ {
25
+
26
+ static $load = false;
27
+ static $i = 1;
28
+
29
+ if (!$last_id) {
30
+ $load = true;
31
+ }
32
+
33
+ $instagram_items = array();
34
+
35
+ if (is_array($data) && !empty($data)) {
36
+
37
+ foreach ($data as $item) {
38
+
39
+ if ($load) {
40
+
41
+ preg_match_all('/(?<!\S)#([0-9a-zA-Z]+)/', @$item['caption'], $hashtags);
42
+
43
+ $media_url = ($item['media_type'] === 'CAROUSEL_ALBUM') ? @$item['children']['data'][0]['media_url'] : @$item['media_url'];
44
+ $date = isset($item['timestamp']) ? date_i18n('j F, Y', strtotime(trim(str_replace(array('T', '+', ' 0000'), ' ', $item['timestamp'])))) : false;
45
+
46
+ $test = $instagram_items[] = array(
47
+ 'i' => $i,
48
+ 'id' => $item['id'],
49
+ 'type' => strtolower(str_replace('_ALBUM', '', $item['media_type'])),
50
+ 'media' => $media_url,
51
+ 'images' => array(
52
+ 'standard' => $item['media_url'],
53
+ 'medium' => $item['media_url'],
54
+ 'small' => $item['media_url'],
55
+ ),
56
+ 'videos' => array(
57
+ 'standard' => $item['media_url'],
58
+ 'medium' => $item['media_url'],
59
+ 'small' => $item['media_url'],
60
+ ),
61
+ 'likes' => isset($item['like_count']) ? $item['like_count'] : false,
62
+ 'comments' => isset($item['comments_count']) ? $item['comments_count'] : false,
63
+ 'caption' => preg_replace('/(?<!\S)#([0-9a-zA-Z]+)/', "<a href=\"{$this->instagram_url}/explore/tags/$1\">#$1</a>", htmlspecialchars(@$item['caption'])),
64
+ 'hashtags' => @$hashtags[1], //array_map('utf8_encode', (array) @$hashtags[1]), // issue with uft 8 encode breakes json_encode
65
+ 'link' => $item['permalink'],
66
+ 'date' => $date
67
+ );
68
+ }
69
+
70
+ if ($last_id && ($last_id == $i)) {
71
+ $i = $last_id;
72
+ $load = true;
73
+ }
74
+ $i++;
75
+ }
76
+ }
77
+
78
+ return $instagram_items;
79
+ }
80
+
81
  function setupMediaItems($data, $last_id = null)
82
  {
83
 
107
  'type' => strtolower(str_replace('_ALBUM', '', $item['media_type'])),
108
  'media' => $media_url,
109
  'images' => array(
110
+ 'standard' => "{$item['media_url']}",
111
  'medium' => "{$item['permalink']}media?size=m",
112
  'small' => "{$item['permalink']}media?size=t",
113
  ),
114
  'videos' => array(
115
+ 'standard' => "{$item['media_url']}",
116
  'medium' => "{$item['permalink']}media?size=m",
117
  'small' => "{$item['permalink']}media?size=t",
118
  ),
134
  }
135
 
136
  return $instagram_items;
137
+ }
138
 
139
  // Return messages
140
  // ---------------------------------------------------------------------------
includes/view/backend/pages/modals/feed/panel-feed-image.php CHANGED
@@ -11,10 +11,10 @@
11
  </p>
12
  </div>
13
 
14
- <# if ( data.resolution=='standard' ) {#>
15
  <div class="disabled-feature options_group">
16
  <p class="form-field">
17
- Unfortunatelly the new Instagram API dosent allow us to recover 640px images. The new standar size is 1080px and this could cause perfomance issues in the feed load. We strongly recommend to switch to the medium size.
18
  </p>
19
  </div>
20
  <# }#>
11
  </p>
12
  </div>
13
 
14
+ <# if ( data.resolution!='standard' ) {#>
15
  <div class="disabled-feature options_group">
16
  <p class="form-field">
17
+ Unfortunatelly the new Instagram Personal API dosent allow us to recover small and medium images. The new standar size is 1080px and this could cause perfomance issues in the feed load. We strongly recommend to switch to business.
18
  </p>
19
  </div>
20
  <# }#>
insta-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Social Feed Gallery
5
  * Plugin URI: https://quadlayers.com/portfolio/instagram-feed-gallery/
6
  * Description: Display beautiful and responsive galleries on your website from your Instagram feed account.
7
- * Version: 3.0.2
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -19,7 +19,7 @@ if (!defined('QLIGG_PLUGIN_NAME')) {
19
  define('QLIGG_PLUGIN_NAME', 'Social Feed Gallery');
20
  }
21
  if (!defined('QLIGG_PLUGIN_VERSION')) {
22
- define('QLIGG_PLUGIN_VERSION', '3.0.2');
23
  }
24
  if (!defined('QLIGG_PLUGIN_FILE')) {
25
  define('QLIGG_PLUGIN_FILE', __FILE__);
4
  * Plugin Name: Social Feed Gallery
5
  * Plugin URI: https://quadlayers.com/portfolio/instagram-feed-gallery/
6
  * Description: Display beautiful and responsive galleries on your website from your Instagram feed account.
7
+ * Version: 3.0.3
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
19
  define('QLIGG_PLUGIN_NAME', 'Social Feed Gallery');
20
  }
21
  if (!defined('QLIGG_PLUGIN_VERSION')) {
22
+ define('QLIGG_PLUGIN_VERSION', '3.0.3');
23
  }
24
  if (!defined('QLIGG_PLUGIN_FILE')) {
25
  define('QLIGG_PLUGIN_FILE', __FILE__);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/portfolio/instagram-gallery/
4
  Tags: Instagram, Instagram feed, Instagram gallery, Instagram photos, Instagram widget, Instagram pictures
5
  Requires at least: 3.4
6
  Tested up to: 5.5.0
7
- Stable tag: 3.0.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -105,6 +105,9 @@ There may be some other plugins(like: fancybox, elementor) which also uses image
105
 
106
  == Changelog ==
107
 
 
 
 
108
  = 3.0.2 =
109
  * Fix. small CSS fixes
110
 
4
  Tags: Instagram, Instagram feed, Instagram gallery, Instagram photos, Instagram widget, Instagram pictures
5
  Requires at least: 3.4
6
  Tested up to: 5.5.0
7
+ Stable tag: 3.0.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
105
 
106
  == Changelog ==
107
 
108
+ = 3.0.3 =
109
+ * Fix. new personal api limitations
110
+
111
  = 3.0.2 =
112
  * Fix. small CSS fixes
113