Enjoy Instagram feed on website with WordPress Widget and Shortcode - Version 2.0

Version Description

  • New Instagram API

=

Download this release

Release Info

Developer mediabeta
Plugin Icon 128x128 Enjoy Instagram feed on website with WordPress Widget and Shortcode
Version 2.0
Comparing to
See all releases

Code changes from version 1.6.5 to 2.0

css/swipebox.css CHANGED
File without changes
enjoyinstagram.php CHANGED
@@ -3,13 +3,12 @@
3
  Plugin Name: Enjoy Instagram
4
  Plugin URI: http://www.mediabeta.com/enjoy-instagram/
5
  Description: Instagram Responsive Images Gallery and Carousel, works with Shortcodes and Widgets.
6
- Version: 1.6.5
7
  Author: F. Prestipino, F. Di Pane - Mediabeta Srl
8
  Author URI: http://www.mediabeta.com/team/
9
  */
10
 
11
  require_once('library/enjoyinstagram_shortcode.php');
12
- require_once('library/instagram.class.php');
13
  class Settings_enjoyinstagram_Plugin {
14
 
15
  private $enjoyinstagram_general_settings_key = 'enjoyinstagram_general_settings';
@@ -139,43 +138,21 @@ class Settings_enjoyinstagram_Plugin {
139
  <?php
140
  if($tab == 'enjoyinstagram_general_settings') {
141
 
142
- if(isset($_GET['code']) && $_GET['code']!=''){
143
 
144
- // get access token
 
145
 
146
- $client_id = get_option('enjoyinstagram_client_id');
147
- $client_secret = get_option('enjoyinstagram_client_secret');
148
- $redirect_uri = admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings');
149
- $code = sanitize_text_field($_GET['code']);
150
 
151
- $apiData = array(
152
- 'client_id' => $client_id,
153
- 'client_secret' => $client_secret,
154
- 'grant_type' => 'authorization_code',
155
- 'redirect_uri' => $redirect_uri,
156
- 'code' => $code
157
- );
158
 
159
 
160
- $apiHost = 'https://api.instagram.com/oauth/access_token';
161
-
162
- $ch = curl_init();
163
- curl_setopt($ch, CURLOPT_URL, $apiHost);
164
- curl_setopt($ch, CURLOPT_POST, count($apiData));
165
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiData));
166
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
167
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
168
- $jsonData = curl_exec($ch);
169
- curl_close($ch);
170
- $user = json_decode($jsonData,true);
171
-
172
- $enjoyinstagram_user_id = $user['user']['id'];
173
- $enjoyinstagram_user_username = replace4byte($user['user']['username']);
174
- $enjoyinstagram_user_profile_picture = $user['user']['profile_picture'];
175
- $enjoyinstagram_user_fullname = replace4byte($user['user']['full_name']);
176
- $enjoyinstagram_user_website = $user['user']['website'];
177
- $enjoyinstagram_user_bio = replace4byte($user['user']['bio']);
178
- $enjoyinstagram_access_token = $user['access_token'];
179
 
180
  update_option( 'enjoyinstagram_user_id', $enjoyinstagram_user_id );
181
  update_option( 'enjoyinstagram_user_username', $enjoyinstagram_user_username );
@@ -219,6 +196,170 @@ class Settings_enjoyinstagram_Plugin {
219
  }
220
  };
221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  function replace4byte($string) {
223
  return preg_replace('%(?:
224
  \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
@@ -226,6 +367,7 @@ function replace4byte($string) {
226
  | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
227
  )%xs', '', $string);
228
  }
 
229
  // Initialize the plugin
230
  add_action( 'plugins_loaded', create_function( '', '$Settings_enjoyinstagram_Plugin = new Settings_enjoyinstagram_Plugin;' ) );
231
 
@@ -341,12 +483,11 @@ function aggiungo_javascript_in_pannello_amministrazione() {
341
  function post_to_url(path, method) {
342
  method = method || "get";
343
  var params = new Array();
344
- var client_id = document.getElementById('enjoyinstagram_client_id').value;
345
- var client_secret = document.getElementById('enjoyinstagram_client_secret').value;
346
  params['client_id'] = client_id;
347
- params['redirect_uri'] = '<?php echo admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings'); ?>';
348
- params['scope'] = 'likes';
349
- params['response_type'] = 'code';
350
 
351
  var form = document.createElement("form");
352
  form.setAttribute("method", method);
@@ -432,8 +573,8 @@ function add_option_client_ajax() {
432
  <script type="text/javascript" >
433
 
434
  jQuery('#button_autorizza_instagram').click(function() {
435
- var client_id = document.getElementById('enjoyinstagram_client_id').value;
436
- var client_secret = document.getElementById('enjoyinstagram_client_secret').value;
437
  var data = {
438
  action: 'user_option_ajax',
439
  client_id_value: client_id,
3
  Plugin Name: Enjoy Instagram
4
  Plugin URI: http://www.mediabeta.com/enjoy-instagram/
5
  Description: Instagram Responsive Images Gallery and Carousel, works with Shortcodes and Widgets.
6
+ Version: 2.0
7
  Author: F. Prestipino, F. Di Pane - Mediabeta Srl
8
  Author URI: http://www.mediabeta.com/team/
9
  */
10
 
11
  require_once('library/enjoyinstagram_shortcode.php');
 
12
  class Settings_enjoyinstagram_Plugin {
13
 
14
  private $enjoyinstagram_general_settings_key = 'enjoyinstagram_general_settings';
138
  <?php
139
  if($tab == 'enjoyinstagram_general_settings') {
140
 
141
+ if(isset($_GET['access_token']) && $_GET['access_token']!=''){
142
 
143
+ $user = array();
144
+ $user = get_user_info($_GET['access_token']);
145
 
 
 
 
 
146
 
 
 
 
 
 
 
 
147
 
148
 
149
+ $enjoyinstagram_user_id = $user['data']['id'];
150
+ $enjoyinstagram_user_username = replace4byte($user['data']['username']);
151
+ $enjoyinstagram_user_profile_picture = $user['data']['profile_picture'];
152
+ $enjoyinstagram_user_fullname = replace4byte($user['data']['full_name']);
153
+ $enjoyinstagram_user_website = $user['data']['website'];
154
+ $enjoyinstagram_user_bio = replace4byte($user['data']['bio']);
155
+ $enjoyinstagram_access_token = $_GET['access_token'];
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
  update_option( 'enjoyinstagram_user_id', $enjoyinstagram_user_id );
158
  update_option( 'enjoyinstagram_user_username', $enjoyinstagram_user_username );
196
  }
197
  };
198
 
199
+
200
+
201
+
202
+ function get_user_info($access_token){
203
+ $url = 'https://api.instagram.com/v1/users/self/?access_token='.$access_token;
204
+ try {
205
+ $curl_connection = curl_init($url);
206
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
207
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
208
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
209
+
210
+ //Data are stored in $data
211
+ $data = json_decode(curl_exec($curl_connection), true);
212
+ curl_close($curl_connection);
213
+ return $data;
214
+ } catch(Exception $e) {
215
+ return $e->getMessage();
216
+ }
217
+
218
+ }
219
+ function get_hash($hashtag,$count){
220
+
221
+ $access_token = get_option('enjoyinstagram_access_token');
222
+
223
+
224
+ $url = 'https://api.instagram.com/v1/tags/'.$hashtag.'/media/recent?count='.$count.'&access_token='.$access_token;
225
+ try {
226
+ $curl_connection = curl_init($url);
227
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
228
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
229
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
230
+
231
+ //Data are stored in $data
232
+ $result = json_decode(curl_exec($curl_connection), true);
233
+ curl_close($curl_connection);
234
+ return $result;
235
+ } catch(Exception $e) {
236
+ return $e->getMessage();
237
+ }
238
+
239
+ }
240
+ function get_hash_code($hashtag,$count){
241
+
242
+ $access_token = get_option('enjoyinstagram_access_token');
243
+
244
+
245
+ $url = 'https://api.instagram.com/v1/tags/'.$hashtag.'/media/recent?count='.$count.'&access_token='.$access_token;
246
+ try {
247
+ $curl_connection = curl_init($url);
248
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
249
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
250
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
251
+
252
+ //Data are stored in $data
253
+ $result = json_decode(curl_exec($curl_connection), true);
254
+ $code = $result['meta']['code'];
255
+ curl_close($curl_connection);
256
+ return $code;
257
+ } catch(Exception $e) {
258
+ return $e->getMessage();
259
+ }
260
+
261
+ }
262
+ function get_user($user,$count){
263
+
264
+
265
+
266
+ $access_token = get_option('enjoyinstagram_access_token');
267
+
268
+
269
+ $url = 'https://api.instagram.com/v1/users/self/media/recent?count='.$count.'&access_token='.$access_token;
270
+ try {
271
+ $curl_connection = curl_init($url);
272
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
273
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
274
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
275
+
276
+ //Data are stored in $data
277
+ $result = json_decode(curl_exec($curl_connection), true);
278
+ curl_close($curl_connection);
279
+ return $result;
280
+ } catch(Exception $e) {
281
+ return $e->getMessage();
282
+ }
283
+
284
+ }
285
+ function get_user_code($user,$count){
286
+
287
+ $access_token = get_option('enjoyinstagram_access_token');
288
+
289
+
290
+ $url = 'https://api.instagram.com/v1/users/self/media/recent?count='.$count.'&access_token='.$access_token;
291
+ try {
292
+ $curl_connection = curl_init($url);
293
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
294
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
295
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
296
+
297
+ //Data are stored in $data
298
+ $result = json_decode(curl_exec($curl_connection), true);
299
+ $code = $result['meta']['code'];
300
+ curl_close($curl_connection);
301
+ return $code;
302
+ } catch(Exception $e) {
303
+ return $e->getMessage();
304
+ }
305
+
306
+ }
307
+ function get_media($user,$media){
308
+
309
+ $access_token = get_option('enjoyinstagram_access_token');
310
+
311
+
312
+ $url = 'https://api.instagram.com/v1/media/'.$media.'?access_token='.$access_token;
313
+ try {
314
+ $curl_connection = curl_init($url);
315
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
316
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
317
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
318
+
319
+ //Data are stored in $data
320
+ $result = json_decode(curl_exec($curl_connection), true);
321
+ curl_close($curl_connection);
322
+ return $result;
323
+ } catch(Exception $e) {
324
+ return $e->getMessage();
325
+ }
326
+
327
+ }
328
+ function get_likes($user,$count){
329
+ $access_token = get_option('enjoyinstagram_access_token');
330
+ $url = 'https://api.instagram.com/v1/users/self/media/liked?count='.$count.'&access_token='.$access_token;
331
+ try {
332
+ $curl_connection = curl_init($url);
333
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
334
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
335
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
336
+
337
+ //Data are stored in $data
338
+ $result = json_decode(curl_exec($curl_connection), true);
339
+ curl_close($curl_connection);
340
+ return $result;
341
+ } catch(Exception $e) {
342
+ return $e->getMessage();
343
+ }
344
+ }
345
+ function get_likes_code($user,$count){
346
+ $access_token = get_option('enjoyinstagram_access_token');
347
+ $url = 'https://api.instagram.com/v1/users/self/media/liked?count='.$count.'&access_token='.$access_token;
348
+ try {
349
+ $curl_connection = curl_init($url);
350
+ curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
351
+ curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
352
+ curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
353
+
354
+ //Data are stored in $data
355
+ $result = json_decode(curl_exec($curl_connection), true);
356
+ $code = $result['meta']['code'];
357
+ curl_close($curl_connection);
358
+ return $code;
359
+ } catch(Exception $e) {
360
+ return $e->getMessage();
361
+ }
362
+ }
363
  function replace4byte($string) {
364
  return preg_replace('%(?:
365
  \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
367
  | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
368
  )%xs', '', $string);
369
  }
370
+
371
  // Initialize the plugin
372
  add_action( 'plugins_loaded', create_function( '', '$Settings_enjoyinstagram_Plugin = new Settings_enjoyinstagram_Plugin;' ) );
373
 
483
  function post_to_url(path, method) {
484
  method = method || "get";
485
  var params = new Array();
486
+ var client_id = '1f1bf91b383647749df62b59526d9be1';
487
+ var client_secret = 'c1e2c0d890bf4602ac5786b3073288d4';
488
  params['client_id'] = client_id;
489
+ params['redirect_uri'] = 'http://www.mediabetaprojects.com/put_access_token.php?url_redirect=<?php echo admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings'); ?>';
490
+ params['response_type'] = 'token';
 
491
 
492
  var form = document.createElement("form");
493
  form.setAttribute("method", method);
573
  <script type="text/javascript" >
574
 
575
  jQuery('#button_autorizza_instagram').click(function() {
576
+ var client_id = '1f1bf91b383647749df62b59526d9be1';
577
+ var client_secret = 'c1e2c0d890bf4602ac5786b3073288d4';
578
  var data = {
579
  action: 'user_option_ajax',
580
  client_id_value: client_id,
img/icons.png CHANGED
File without changes
img/icons.svg CHANGED
File without changes
img/loader.gif CHANGED
File without changes
js/jquery.swipebox.js CHANGED
File without changes
library/autenticazione.php CHANGED
@@ -80,77 +80,14 @@ display:inline-block;
80
 
81
  </style>
82
 
83
- <dl class="enjoy_accordion">
84
- <h3>Follow these 2 simple steps to configure the plugin and... enjoy it!</h3>
85
- <dt><a href=""><span class="step_number">01</span> Create an Instagram Application </a></dt>
86
- <dd><ol>
87
- <li>Once you're logged in with your Instagram account go to <a href="http://instagram.com/developer/" target="_blank" rel="nofollow">http://instagram.com/developer/</a></li>
88
- <li>Enter the data related to your site and the information required by Instagram. Accept API Terms of Use and Brand Guidelines</li>
89
- <li>Click "Register Your Application" button.</li>
90
- <li>Click "Register a New Client".</li>
91
- <li>
92
- Once you've verified your account fill the form with:
93
-
94
- <ul>
95
- <li><br /><strong>Application Name</strong>: Your App Name (Your WebSite for example)</li>
96
- <li><strong>Description</strong>: Your App Description</li>
97
- <li><span><strong>Website URL</strong> (copy it exactly as shown below) :</span>
98
- <br /><font style="font-size:12px; color:#0074A2; font-weight:bold;"><?php echo get_home_url(); ?></font></li>
99
-
100
- <li><strong>OAuth redirect_uri</strong> (copy it exactly as shown below) : <br /><font style="font-size:12px; color:#0074A2; font-weight:bold;"><?php echo admin_url('options-general.php?page=enjoyinstagram_plugin_options&tab=enjoyinstagram_general_settings'); ?></font><br /></li>
101
- </ul>
102
- </li>
103
- <li><b>Click the "Register" button. Copy Client ID and Client Secret values for the next step.</b></li>
104
- </ol></dd>
105
-
106
-
107
-
108
-
109
- <dt><a href=""> <span class="step_number">02</span> Enter Your Client ID and Client Secret</a></dt>
110
- <dd>
111
-
112
-
113
-
114
 
115
  <form method="post" action="options.php">
116
- <?php settings_fields('enjoyinstagram_options_group_auth'); ?>
117
-
118
-
119
-
120
- <div style="margin-top: 20px;
121
- padding: 20px;
122
- border: 1px solid #DDDDDD;"
123
- >
124
- Insert your <u>Client ID</u> and your <u>Client Secret</u>
125
- <p>
126
 
127
- <label class="enjoy_label" for="enjoyinstagram_client_id"><strong>Client ID:</strong></label>
128
- <input type="text" id="enjoyinstagram_client_id" value="<?php echo get_option('enjoyinstagram_client_id'); ?>" name="enjoyinstagram_client_id" />
129
- <span class="description">
130
- Your Client ID </span></p>
131
- <p>
132
- <label class="enjoy_label" for="enjoyinstagram_client_secret"><strong>Client Secret:</strong></label>
133
- <input type="text" id="enjoyinstagram_client_secret" value="<?php echo get_option('enjoyinstagram_client_secret'); ?>" name="enjoyinstagram_client_secret" />
134
- <span class="description">
135
- Your Client Secret </span>
136
- </p>
137
- </div>
138
- <p>
139
- By clicking this button this plugin will be activated!</p><p>
140
- <input type="button" class="button-primary" id="button_autorizza_instagram" name="button_autorizza_instagram" value="Authorize Application" />
141
- </p>
142
-
143
- </form>
144
-
145
-
146
-
147
- </dd>
148
-
149
 
150
-
151
-
152
- </dl>
153
-
154
-
155
 
156
 
80
 
81
  </style>
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  <form method="post" action="options.php">
85
+ <?php settings_fields('enjoyinstagram_options_group_auth'); ?>
 
 
 
 
 
 
 
 
 
86
 
87
+ <p>
88
+ <input type="button" class="button-primary" id="button_autorizza_instagram" name="button_autorizza_instagram" value="Connect your Account" />
89
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ </form>
 
 
 
 
92
 
93
 
library/enjoyinstagram_shortcode.php CHANGED
@@ -45,34 +45,37 @@ jQuery("#owl-<?php echo $i; ?>").owlCarousel({
45
  });
46
  </script>
47
  <?php
48
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
49
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
50
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
51
- $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
 
52
  }else{
53
- $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
 
54
  }
55
  $pre_shortcode_content = "<div id=\"owl-".$i."\" class=\"owl-example\" style=\"display:none;\">";
56
 
57
 
58
  if (isHttps()) {
59
- foreach ($result->data as $entry) {
60
- $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
61
- $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
62
  }
63
  }
64
 
65
 
66
- foreach ($result->data as $entry) {
67
- if(!empty($entry->caption)) {
68
- $caption = $entry->caption->text;
 
 
69
  }else{
70
  $caption = '';
71
  }
72
  if(get_option('enjoyinstagram_carousel_items_number')!='1'){
73
- $shortcode_content .= "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img src=\"{$entry->images->standard_resolution->url}\"></a></div>";
74
  }else{
75
- $shortcode_content .= "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img style=\"width:100%;\" src=\"{$entry->images->standard_resolution->url}\"></a></div>";
76
  }
77
  }
78
 
45
  });
46
  </script>
47
  <?php
48
+
 
49
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
50
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
51
+ $result = $result['data'];
52
  }else{
53
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
54
+ $result = $result['data'];
55
  }
56
  $pre_shortcode_content = "<div id=\"owl-".$i."\" class=\"owl-example\" style=\"display:none;\">";
57
 
58
 
59
  if (isHttps()) {
60
+ foreach ($result as $entry) {
61
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry['images']['thumbnail']['url']);
62
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
63
  }
64
  }
65
 
66
 
67
+
68
+
69
+ foreach ($result as $entry) {
70
+ if(!empty($entry['caption'])) {
71
+ $caption = $entry['caption']['text'];
72
  }else{
73
  $caption = '';
74
  }
75
  if(get_option('enjoyinstagram_carousel_items_number')!='1'){
76
+ $shortcode_content .= "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img src=\"{$entry['images']['standard_resolution']['url']}\"></a></div>";
77
  }else{
78
+ $shortcode_content .= "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img style=\"width:100%;\" src=\"{$entry['images']['standard_resolution']['url']}\"></a></div>";
79
  }
80
  }
81
 
library/enjoyinstagram_shortcode_grid.php CHANGED
@@ -5,12 +5,13 @@ function enjoyinstagram_mb_shortcode_grid() {
5
  STATIC $i = 1;
6
  if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
7
 
8
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
9
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
10
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
11
- $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
 
12
  }else{
13
- $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
 
14
  }
15
 
16
  $pre_shortcode_content = "<div id=\"grid-".$i."\" class=\"ri-grid ri-grid-size-2 ri-shadow\" style=\"display:none;\"><ul>";
@@ -18,22 +19,22 @@ $pre_shortcode_content = "<div id=\"grid-".$i."\" class=\"ri-grid ri-grid-size-2
18
 
19
 
20
  if (isHttps()) {
21
- foreach ($result->data as $entry) {
22
- $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
23
- $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
24
  }
25
  }
26
 
27
 
28
 
29
 
30
- foreach ($result->data as $entry) {
31
- if(!empty($entry->caption)) {
32
- $caption = $entry->caption->text;
33
  }else{
34
  $caption = '';
35
  }
36
- $shortcode_content .= "<li><a title=\"{$caption}\" class=\"swipebox_grid\" href=\"{$entry->images->standard_resolution->url}\"><img src=\"{$entry->images->standard_resolution->url}\"></a></li>";
37
 
38
  }
39
 
5
  STATIC $i = 1;
6
  if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_id') != '') {
7
 
8
+
 
9
  if(get_option('enjoyinstagram_user_or_hashtag')=='hashtag'){
10
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
11
+ $result = $result['data'];
12
  }else{
13
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
14
+ $result = $result['data'];
15
  }
16
 
17
  $pre_shortcode_content = "<div id=\"grid-".$i."\" class=\"ri-grid ri-grid-size-2 ri-shadow\" style=\"display:none;\"><ul>";
19
 
20
 
21
  if (isHttps()) {
22
+ foreach ($result as $entry) {
23
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry['images']['thumbnail']['url']);
24
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
25
  }
26
  }
27
 
28
 
29
 
30
 
31
+ foreach ($result as $entry) {
32
+ if(!empty($entry['caption'])) {
33
+ $caption = $entry['caption']['text'];
34
  }else{
35
  $caption = '';
36
  }
37
+ $shortcode_content .= "<li><a title=\"{$caption}\" class=\"swipebox_grid\" href=\"{$entry['images']['standard_resolution']['url']}\"><img src=\"{$entry['images']['standard_resolution']['url']}\"></a></li>";
38
 
39
  }
40
 
library/enjoyinstagram_shortcode_grid_widget.php CHANGED
@@ -8,21 +8,22 @@ if(get_option('enjoyinstagram_client_id') || get_option('enjoyinstagram_client_i
8
  'n_r' => '2',
9
  'u_or_h' => 'user'
10
  ), $atts ) );
11
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
12
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
13
  if("{$u_or_h}"=='hashtag'){
14
- $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
 
15
  }else{
16
- $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
 
17
  }
18
  ?>
19
 
20
  <?php
21
 
22
  if (isHttps()) {
23
- foreach ($result->data as $entry) {
24
- $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
25
- $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
26
  }
27
  }
28
 
@@ -33,15 +34,15 @@ $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id'
33
  <ul>
34
  <?php
35
 
36
- if($result->data){
37
- foreach ($result->data as $entry) {
38
- if(!empty($entry->caption)) {
39
- $caption = $entry->caption->text;
40
  }else{
41
  $caption = '';
42
  }
43
- if(!empty($entry->images)) {
44
- $image = $entry->images->standard_resolution->url;
45
  }else{
46
  $image = '';
47
  }
8
  'n_r' => '2',
9
  'u_or_h' => 'user'
10
  ), $atts ) );
11
+
 
12
  if("{$u_or_h}"=='hashtag'){
13
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
14
+ $result = $result['data'];
15
  }else{
16
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
17
+ $result = $result['data'];
18
  }
19
  ?>
20
 
21
  <?php
22
 
23
  if (isHttps()) {
24
+ foreach ($result as $entry) {
25
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry->images->thumbnail->url);
26
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
27
  }
28
  }
29
 
34
  <ul>
35
  <?php
36
 
37
+ if($result){
38
+ foreach ($result as $entry) {
39
+ if(!empty($entry['caption'])) {
40
+ $caption = $entry['caption']['text'];
41
  }else{
42
  $caption = '';
43
  }
44
+ if(!empty($entry['images'])) {
45
+ $image = $entry['images']['standard_resolution']['url'];
46
  }else{
47
  $image = '';
48
  }
library/enjoyinstagram_shortcode_widget.php CHANGED
@@ -37,36 +37,36 @@ function enjoyinstagram_mb_shortcode_widget($atts) {
37
  });
38
  </script>
39
  <?php
40
- $instagram = new Enjoy_Instagram(get_option('enjoyinstagram_client_id'));
41
- $instagram->setAccessToken(get_option('enjoyinstagram_access_token'));
42
  if ("{$u_or_h}" == 'hashtag') {
43
- $result = $instagram->getTagMedia(urlencode(get_option('enjoyinstagram_hashtag')));
 
44
  } else {
45
- $result = $instagram->getUserMedia(urlencode(get_option('enjoyinstagram_user_id')));
 
46
  }
47
 
48
 
49
  if (isHttps()){
50
- foreach ($result->data as $entry) {
51
- $entry->images->thumbnail->url = str_replace('http://', 'https://', $entry->images->thumbnail->url);
52
- $entry->images->standard_resolution->url = str_replace('http://', 'https://', $entry->images->standard_resolution->url);
53
  }
54
  }
55
 
56
  ?>
57
  <div id="owl-<?php echo "{$id}"; ?>" class="owl-example">
58
  <?php
59
- if($result->data){
60
- foreach ($result->data as $entry) {
61
- if(!empty($entry->caption)) {
62
- $caption = $entry->caption->text;
63
  }else{
64
  $caption = '';
65
  }
66
  if(get_option('enjoyinstagram_carousel_items_number')!='1'){
67
- echo "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img src=\"{$entry->images->thumbnail->url}\"></a></div>";
68
  }else{
69
- echo "<div class=\"box\"><a title=\"{$entry->caption->text}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry->images->standard_resolution->url}\"><img style=\"width:100%;\" src=\"{$entry->images->standard_resolution->url}\"></a></div>";
70
  }
71
  }
72
  }
37
  });
38
  </script>
39
  <?php
 
 
40
  if ("{$u_or_h}" == 'hashtag') {
41
+ $result = get_hash(urlencode(get_option('enjoyinstagram_hashtag')),20);
42
+ $result = $result['data'];
43
  } else {
44
+ $result = get_user(urlencode(get_option('enjoyinstagram_user_username')),20);
45
+ $result = $result['data'];
46
  }
47
 
48
 
49
  if (isHttps()){
50
+ foreach ($result as $entry) {
51
+ $entry['images']['thumbnail']['url'] = str_replace('http://', 'https://', $entry['images']['thumbnail']['url']);
52
+ $entry['images']['standard_resolution']['url'] = str_replace('http://', 'https://', $entry['images']['standard_resolution']['url']);
53
  }
54
  }
55
 
56
  ?>
57
  <div id="owl-<?php echo "{$id}"; ?>" class="owl-example">
58
  <?php
59
+ if($result){
60
+ foreach ($result as $entry) {
61
+ if(!empty($entry['caption'])) {
62
+ $caption = $entry['caption']['text'];
63
  }else{
64
  $caption = '';
65
  }
66
  if(get_option('enjoyinstagram_carousel_items_number')!='1'){
67
+ echo "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img src=\"{$entry['images']['thumbnail']['url']}\"></a></div>";
68
  }else{
69
+ echo "<div class=\"box\"><a title=\"{$caption}\" rel=\"gallery_swypebox\" class=\"swipebox\" href=\"{$entry['images']['standard_resolution']['url']}\"><img style=\"width:100%;\" src=\"{$entry['images']['standard_resolution']['url']}\"></a></div>";
70
  }
71
  }
72
  }
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: (mediabeta, frafra85, fabiodipa)
3
  Donate link: https://www.google.com/url?q=https%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3D8MXZ37DWHAX46&sa=D&sntz=1&usg=AFQjCNFHixLdowdc2AAEXDYmM9tQBl-TXQ
4
  Tags: Instagram plugin, Instagram, Instagram gallery, Instagram images, Lightbox Instagram,Grid Instagram view, Instagram responsive, Instagram touch, Instagram photos,Instagram posts, Instagram page, Instagram widgets
5
  Requires at least: 3.0.1
6
- Tested up to: 4.3
7
- Version: 1.6.5
8
- Stable tag: 1.6.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -131,6 +131,8 @@ Repeat Step 01 and Step 02 again.
131
  * Bug Fix
132
  = 1.6.5 =
133
  * Bug Fix
 
 
134
 
135
  == Upgrade Notice ==
136
 
@@ -165,4 +167,6 @@ Repeat Step 01 and Step 02 again.
165
  = 1.6.4 =
166
  * Bug Fix
167
  = 1.6.5 =
168
- * Bug Fix
 
 
3
  Donate link: https://www.google.com/url?q=https%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3D8MXZ37DWHAX46&sa=D&sntz=1&usg=AFQjCNFHixLdowdc2AAEXDYmM9tQBl-TXQ
4
  Tags: Instagram plugin, Instagram, Instagram gallery, Instagram images, Lightbox Instagram,Grid Instagram view, Instagram responsive, Instagram touch, Instagram photos,Instagram posts, Instagram page, Instagram widgets
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.4
7
+ Version: 2
8
+ Stable tag: 2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
131
  * Bug Fix
132
  = 1.6.5 =
133
  * Bug Fix
134
+ = 2.0 =
135
+ * New Instagram API
136
 
137
  == Upgrade Notice ==
138
 
167
  = 1.6.4 =
168
  * Bug Fix
169
  = 1.6.5 =
170
+ * Bug Fix
171
+ = 2.0 =
172
+ * New Instagram API