Instagram Slider Widget - Version 1.4.2

Version Description

  • Minor fix for instagram json change
Download this release

Release Info

Developer jetonr
Plugin Icon 128x128 Instagram Slider Widget
Version 1.4.2
Comparing to
See all releases

Code changes from version 1.4.0 to 1.4.2

assets/css/jr-insta-admin.css CHANGED
@@ -1,6 +1,6 @@
1
  .jr-container .donate { padding: 5px 15px 10px; display: inline-block; position: relative; color: #000; background: #ffd751; -webkit-border-radius: 5px; border-radius: 5px; border: 1px solid #b4b4b4; font-weight: bold; font-size: 14px; text-decoration: none; }
2
  .jr-container .donate a { outline: 0; cursor: pointer }
3
- .jr-container .donate span:before { color: #ce1f00; font: 400 20px/1 dashicons; font-family: dashicons; font-size: 24px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; line-height: 1; content: '\f524'; position: relative; display: inline-block; top: 4px; margin-right: 4px; }
4
  .jr-container .pressthis a, .jr-container .pressthis-bookmarklet a,
5
  .jr-container .pressthis a:active, .jr-container .pressthis-bookmarklet a:active,
6
  .jr-container .pressthis a:focus, .jr-container .pressthis-bookmarklet a:focus,
@@ -26,4 +26,6 @@
26
  .jr-container input:focus + .slider { box-shadow: 0 0 1px #0085ba; }
27
  .jr-container input:checked + .slider:before { -webkit-transform: translateX(22px); -ms-transform: translateX(22px); transform: translateX(22px); }
28
  .jr-container .slider.round { border-radius: 34px; }
29
- .jr-container .slider.round:before { border-radius: 50%; }
 
 
1
  .jr-container .donate { padding: 5px 15px 10px; display: inline-block; position: relative; color: #000; background: #ffd751; -webkit-border-radius: 5px; border-radius: 5px; border: 1px solid #b4b4b4; font-weight: bold; font-size: 14px; text-decoration: none; }
2
  .jr-container .donate a { outline: 0; cursor: pointer }
3
+ .jr-container .donate span:before { color: #ce1f00; font: 400 20px/1 dashicons; font-family: dashicons; font-size: 24px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; line-height: 1; content: '\f487'; position: relative; display: inline-block; top: 4px; margin-right: 4px; }
4
  .jr-container .pressthis a, .jr-container .pressthis-bookmarklet a,
5
  .jr-container .pressthis a:active, .jr-container .pressthis-bookmarklet a:active,
6
  .jr-container .pressthis a:focus, .jr-container .pressthis-bookmarklet a:focus,
26
  .jr-container input:focus + .slider { box-shadow: 0 0 1px #0085ba; }
27
  .jr-container input:checked + .slider:before { -webkit-transform: translateX(22px); -ms-transform: translateX(22px); transform: translateX(22px); }
28
  .jr-container .slider.round { border-radius: 34px; }
29
+ .jr-container .slider.round:before { border-radius: 50%; }
30
+ .jr-container .donate-buttons { text-align: center }
31
+ .jr-container .donate-button-link { cursor: pointer }
assets/js/jr-insta-admin.js CHANGED
@@ -1,6 +1,12 @@
1
  (function($) {
2
 
3
  $(document).ready(function($){
 
 
 
 
 
 
4
 
5
  // Hide Custom Url if image link is not set to custom url
6
  $('body').on('change', '.jr-container select[id$="images_link"]', function(e){
@@ -29,19 +35,17 @@
29
  var search_for = $(this);
30
  if ( search_for.val() != 'username' ) {
31
  search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({opacity: 'hide' , height: 'hide'}, 200);
32
- search_for.closest('.jr-container').find('select[id$="images_link"] option[value="local_image_url"]').animate({opacity: 'hide' , height: 'hide'}, 200);
33
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="user_url"]').animate({opacity: 'hide' , height: 'hide'}, 200);
34
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'hide' , height: 'hide'}, 200);
35
- search_for.closest('.jr-container').find('select[id$="images_link"]').val('image_url');
36
  search_for.closest('.jr-container').find('select[id$="description"] option[value="username"]').animate({opacity: 'hide' , height: 'hide'}, 200);
37
  search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({opacity: 'show' , height: 'show'}, 200);
38
 
39
  } else {
40
  search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({opacity: 'show' , height: 'show'}, 200);
41
- search_for.closest('.jr-container').find('select[id$="images_link"] option[value="local_image_url"]').animate({opacity: 'show' , height: 'show'}, 200);
42
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="user_url"]').animate({opacity: 'show' , height: 'show'}, 200);
43
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'show' , height: 'show'}, 200);
44
- search_for.closest('.jr-container').find('select[id$="images_link"]').val('image_url');
45
  search_for.closest('.jr-container').find('select[id$="description"] option[value="username"]').animate({opacity: 'show' , height: 'show'}, 200);
46
  search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({opacity: 'hide' , height: 'hide'}, 200);
47
 
@@ -52,15 +56,11 @@
52
  $('body').on('change', '.jr-container [id$="attachment"]:checkbox', function(e){
53
  var attachment = $(this);
54
  if ( this.checked ) {
55
- attachment.closest('.jr-container').find('.blocked-wrap').animate({opacity: 'show' , height: 'show'}, 200);
56
- attachment.closest('.jr-container').find('select[id$="images_link"] option[value="local_image_url"]').animate({opacity: 'show' , height: 'show'}, 200);
57
  attachment.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'show' , height: 'show'}, 200);
58
- attachment.closest('.jr-container').find('select[id$="images_link"]').val('image_url');
59
  } else {
60
- attachment.closest('.jr-container').find('.blocked-wrap').animate({opacity: 'hide' , height: 'hide'}, 200);
61
- attachment.closest('.jr-container').find('select[id$="images_link"] option[value="local_image_url"]').animate({opacity: 'hide' , height: 'hide'}, 200);
62
  attachment.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'hide' , height: 'hide'}, 200);
63
- attachment.closest('.jr-container').find('select[id$="images_link"]').val('image_url');
64
  }
65
  });
66
 
@@ -75,7 +75,7 @@
75
  $(this).html('[ + Open ]');
76
  }
77
  advanced_container.toggle();
78
- });
79
 
80
  // Remove blocked images with ajax
81
  $('body').on('click', '.jr-container .jr-delete-instagram-dupes', function(e){
1
  (function($) {
2
 
3
  $(document).ready(function($){
4
+ $('.donate-bitcoin-qr-address').hide();
5
+ $('.donate-button-link').on('click', function (e) {
6
+ e.preventDefault();
7
+ //$(this).slideUp(100);
8
+ $('.donate-bitcoin-qr-address').slideToggle();
9
+ });
10
 
11
  // Hide Custom Url if image link is not set to custom url
12
  $('body').on('change', '.jr-container select[id$="images_link"]', function(e){
35
  var search_for = $(this);
36
  if ( search_for.val() != 'username' ) {
37
  search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({opacity: 'hide' , height: 'hide'}, 200);
 
38
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="user_url"]').animate({opacity: 'hide' , height: 'hide'}, 200);
39
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'hide' , height: 'hide'}, 200);
40
+ search_for.closest('.jr-container').find('select[id$="images_link"]').val('image_link');
41
  search_for.closest('.jr-container').find('select[id$="description"] option[value="username"]').animate({opacity: 'hide' , height: 'hide'}, 200);
42
  search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({opacity: 'show' , height: 'show'}, 200);
43
 
44
  } else {
45
  search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({opacity: 'show' , height: 'show'}, 200);
 
46
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="user_url"]').animate({opacity: 'show' , height: 'show'}, 200);
47
  search_for.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'show' , height: 'show'}, 200);
48
+ search_for.closest('.jr-container').find('select[id$="images_link"]').val('image_link');
49
  search_for.closest('.jr-container').find('select[id$="description"] option[value="username"]').animate({opacity: 'show' , height: 'show'}, 200);
50
  search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({opacity: 'hide' , height: 'hide'}, 200);
51
 
56
  $('body').on('change', '.jr-container [id$="attachment"]:checkbox', function(e){
57
  var attachment = $(this);
58
  if ( this.checked ) {
 
 
59
  attachment.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'show' , height: 'show'}, 200);
60
+ attachment.closest('.jr-container').find('select[id$="images_link"]').val('image_link');
61
  } else {
 
 
62
  attachment.closest('.jr-container').find('select[id$="images_link"] option[value="attachment"]').animate({opacity: 'hide' , height: 'hide'}, 200);
63
+ attachment.closest('.jr-container').find('select[id$="images_link"]').val('image_link');
64
  }
65
  });
66
 
75
  $(this).html('[ + Open ]');
76
  }
77
  advanced_container.toggle();
78
+ });
79
 
80
  // Remove blocked images with ajax
81
  $('body').on('click', '.jr-container .jr-delete-instagram-dupes', function(e){
instaram_slider.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Instagram Slider Widget
4
  Plugin URI: http://instagram.jrwebstudio.com/
5
- Version: 1.4.0
6
  Description: Instagram Slider Widget is a responsive slider widget that shows 12 latest images from a public Instagram user and up to 18 images from a hashtag.
7
  Author: jetonr
8
  Author URI: http://jrwebstudio.com/
@@ -14,16 +14,6 @@ License: GPLv2 or later
14
  */
15
  add_action( 'widgets_init', array( 'JR_InstagramSlider', 'register_widget' ) );
16
 
17
- if ( !ini_get( 'max_execution_time' ) || ini_get( 'max_execution_time' ) < 300 ) {
18
-
19
- ini_set( 'max_execution_time', 300 );
20
-
21
- $disabled = explode( ',', ini_get( 'disable_functions' ) );
22
- if ( !in_array( 'set_time_limit', $disabled ) ) {
23
- set_time_limit( 300 );
24
- }
25
- }
26
-
27
  /**
28
  * JR_InstagramSlider Class
29
  */
@@ -34,7 +24,11 @@ class JR_InstagramSlider extends WP_Widget {
34
  *
35
  * @var string
36
  */
37
- const VERSION = '1.4.0';
 
 
 
 
38
 
39
  /**
40
  * Initialize the plugin by registering widget and loading public scripts
@@ -49,9 +43,6 @@ class JR_InstagramSlider extends WP_Widget {
49
  )
50
  );
51
 
52
- // Add new Image Size
53
- add_image_size( 'jr_insta_square', 640, 640, true );
54
-
55
  // Shortcode
56
  add_shortcode( 'jr_instagram', array( $this, 'shortcode' ) );
57
 
@@ -71,7 +62,7 @@ class JR_InstagramSlider extends WP_Widget {
71
  add_filter( 'attachment_fields_to_edit', array( $this, 'insta_attachment_fields' ) , 10, 2 );
72
 
73
  // Add action for single cron events
74
- add_action( 'jr_insta_cron', array( $this, 'jr_cron_trigger' ), 10 , 3 );
75
  }
76
 
77
  /**
@@ -83,8 +74,8 @@ class JR_InstagramSlider extends WP_Widget {
83
  'name' => __( 'Instagram Slider - Shortcode Generator', 'jrinstaslider' ),
84
  'id' => 'jr-insta-shortcodes',
85
  'description' => __( "1. Drag Instagram Slider widget here. 2. Fill in the fields and hit save. 3. Copy the shortocde generated at the bottom of the widget form and use it on posts or pages.", 'jrinstaslider' )
86
- )
87
- );
88
  }
89
 
90
  /**
@@ -109,8 +100,7 @@ class JR_InstagramSlider extends WP_Widget {
109
  }
110
 
111
  wp_enqueue_style( 'jr-insta-admin-styles', plugins_url( 'assets/css/jr-insta-admin.css', __FILE__ ), array(), self::VERSION );
112
-
113
- wp_enqueue_script( 'jr-insta-admin-script', plugins_url( 'assets/js/jr-insta-admin.js', __FILE__ ), array( 'jquery' ), self::VERSION, true );
114
  }
115
 
116
  /**
@@ -196,7 +186,7 @@ class JR_InstagramSlider extends WP_Widget {
196
  'images_number' => 5,
197
  'columns' => 4,
198
  'refresh_hour' => 5,
199
- 'image_size' => 'jr_insta_square',
200
  'image_link_rel' => '',
201
  'image_link_class' => '',
202
  'no_pin' => 0,
@@ -206,7 +196,7 @@ class JR_InstagramSlider extends WP_Widget {
206
  'slidespeed' => 7000,
207
  'description' => array( 'username', 'time','caption' ),
208
  'support_author' => 0
209
- );
210
 
211
  $instance = wp_parse_args( (array) $instance, $defaults );
212
 
@@ -226,7 +216,7 @@ class JR_InstagramSlider extends WP_Widget {
226
  <input class="widefat" id="<?php echo $this->get_field_id( 'blocked_users' ); ?>" name="<?php echo $this->get_field_name( 'blocked_users' ); ?>" value="<?php echo $instance['blocked_users']; ?>" />
227
  <span class="jr-description"><?php _e( 'Enter usernames separated by commas whose images you don\'t want to show', 'jrinstaslider' ); ?></span>
228
  </p>
229
- <p class="<?php if ( 'username' != $instance['search_for'] ) echo 'hidden'; ?>"><strong><?php _e( 'Save and Display Images from Media Library: ', 'jrinstaslider' ); ?></strong>
230
  <label class="switch" for="<?php echo $this->get_field_id( 'attachment' ); ?>">
231
  <input class="widefat" id="<?php echo $this->get_field_id( 'attachment' ); ?>" name="<?php echo $this->get_field_name( 'attachment' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['attachment'] ); ?> /><span class="slider round"></span></label>
232
  <br><span class="jr-description"><?php _e( ' Turn on to save Instagram Images into WordPress media library.', 'jrinstaslider') ?></span>
@@ -237,157 +227,161 @@ class JR_InstagramSlider extends WP_Widget {
237
  wp_nonce_field( 'jr_delete_instagram_dupes', 'delete_insta_dupes_nonce' );
238
  }
239
  ?>
240
- </p>
241
- <p>
242
- <label for="<?php echo $this->get_field_id( 'images_number' ); ?>"><strong><?php _e( 'Number of images to show:', 'jrinstaslider' ); ?></strong>
243
- <input class="small-text" id="<?php echo $this->get_field_id( 'images_number' ); ?>" name="<?php echo $this->get_field_name( 'images_number' ); ?>" value="<?php echo $instance['images_number']; ?>" />
244
- </label>
245
- </p>
246
- <p>
247
- <label for="<?php echo $this->get_field_id( 'refresh_hour' ); ?>"><strong><?php _e( 'Check for new images every:', 'jrinstaslider' ); ?></strong>
248
- <input class="small-text" id="<?php echo $this->get_field_id( 'refresh_hour' ); ?>" name="<?php echo $this->get_field_name( 'refresh_hour' ); ?>" value="<?php echo $instance['refresh_hour']; ?>" />
249
- <span><?php _e('hours', 'jrinstaslider'); ?></span>
250
- </label>
251
- </p>
252
- <p>
253
- <label for="<?php echo $this->get_field_id( 'template' ); ?>"><strong><?php _e( 'Template', 'jrinstaslider' ); ?></strong>
254
- <select class="widefat" name="<?php echo $this->get_field_name( 'template' ); ?>" id="<?php echo $this->get_field_id( 'template' ); ?>">
255
- <option value="slider" <?php echo ($instance['template'] == 'slider') ? ' selected="selected"' : ''; ?>><?php _e( 'Slider - Normal', 'jrinstaslider' ); ?></option>
256
- <option value="slider-overlay" <?php echo ($instance['template'] == 'slider-overlay') ? ' selected="selected"' : ''; ?>><?php _e( 'Slider - Overlay Text', 'jrinstaslider' ); ?></option>
257
- <option value="thumbs" <?php echo ($instance['template'] == 'thumbs') ? ' selected="selected"' : ''; ?>><?php _e( 'Thumbnails', 'jrinstaslider' ); ?></option>
258
- <option value="thumbs-no-border" <?php echo ($instance['template'] == 'thumbs-no-border') ? ' selected="selected"' : ''; ?>><?php _e( 'Thumbnails - Without Border', 'jrinstaslider' ); ?></option>
259
- </select>
260
- </label>
261
- </p>
262
- <p class="<?php if ( 'thumbs' != $instance['template'] && 'thumbs-no-border' != $instance['template'] ) echo 'hidden'; ?>">
263
- <label for="<?php echo $this->get_field_id( 'columns' ); ?>"><strong><?php _e( 'Number of Columns:', 'jrinstaslider' ); ?></strong>
264
- <input class="small-text" id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" value="<?php echo $instance['columns']; ?>" />
265
- <span class='jr-description'><?php _e('max is 10 ( only for thumbnails template )', 'jrinstaslider'); ?></span>
266
- </label>
267
- </p>
268
- <p>
269
- <label for="<?php echo $this->get_field_id( 'image_size' ); ?>"><strong><?php _e( 'Image format', 'jrinstaslider' ); ?></strong></label>
270
- <select class="widefat" id="<?php echo $this->get_field_id( 'image_size' ); ?>" name="<?php echo $this->get_field_name( 'image_size' ); ?>">
271
- <option value="jr_insta_square" <?php echo ($instance['image_size'] == 'jr_insta_square') ? ' selected="selected"' : ''; ?>><?php _e( 'Square - Cropped', 'jrinstaslider' ); ?></option>
272
- <option value="full" <?php echo ($instance['image_size'] == 'full') ? ' selected="selected"' : ''; ?>><?php _e( 'Original - No Crop', 'jrinstaslider' ); ?></option>
273
- </select>
274
- <span class="jr-description"><?php _e( '<strong>Square - Cropped</strong> - option will show square cropped images in 640x640 pixels. <br/><strong>Original - No Crop</strong> - will display the original user uploaded image size.', 'jrinstaslider' ); ?></span>
275
- </p>
276
- <p>
277
- <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><strong><?php _e( 'Order by', 'jrinstaslider' ); ?></strong>
278
- <select class="widefat" name="<?php echo $this->get_field_name( 'orderby' ); ?>" id="<?php echo $this->get_field_id( 'orderby' ); ?>">
279
- <option value="date-ASC" <?php selected( $instance['orderby'], 'date-ASC', true); ?>><?php _e( 'Date - Ascending', 'jrinstaslider' ); ?></option>
280
- <option value="date-DESC" <?php selected( $instance['orderby'], 'date-DESC', true); ?>><?php _e( 'Date - Descending', 'jrinstaslider' ); ?></option>
281
- <option value="popular-ASC" <?php selected( $instance['orderby'], 'popular-ASC', true); ?>><?php _e( 'Popularity - Ascending', 'jrinstaslider' ); ?></option>
282
- <option value="popular-DESC" <?php selected( $instance['orderby'], 'popular-DESC', true); ?>><?php _e( 'Popularity - Descending', 'jrinstaslider' ); ?></option>
283
- <option value="rand" <?php selected( $instance['orderby'], 'rand', true); ?>><?php _e( 'Random', 'jrinstaslider' ); ?></option>
284
- </select>
285
- </label>
286
- </p>
287
- <p>
288
- <label for="<?php echo $this->get_field_id( 'images_link' ); ?>"><strong><?php _e( 'Link to', 'jrinstaslider' ); ?></strong>
289
- <select class="widefat" name="<?php echo $this->get_field_name( 'images_link' ); ?>" id="<?php echo $this->get_field_id( 'images_link' ); ?>">
290
- <option value="image_url" <?php selected( $instance['images_link'], 'image_url', true); ?>><?php _e( 'Instagram Image', 'jrinstaslider' ); ?></option>
291
- <option class="<?php if ( 'hashtag' == $instance['search_for'] ) echo 'hidden'; ?>" value="user_url" <?php selected( $instance['images_link'], 'user_url', true); ?>><?php _e( 'Instagram Profile', 'jrinstaslider' ); ?></option>
292
- <option class="<?php if ( ( !$instance['attachment'] ) || 'hashtag' == $instance['search_for'] ) echo 'hidden'; ?>" value="local_image_url" <?php selected( $instance['images_link'], 'local_image_url', true); ?>><?php _e( 'Locally Saved Image', 'jrinstaslider' ); ?></option>
293
- <option class="<?php if ( ( !$instance['attachment'] ) || 'hashtag' == $instance['search_for'] ) echo 'hidden'; ?>" value="attachment" <?php selected( $instance['images_link'], 'attachment', true); ?>><?php _e( 'Attachment Page', 'jrinstaslider' ); ?></option>
294
- <option value="custom_url" <?php selected( $instance['images_link'], 'custom_url', true ); ?>><?php _e( 'Custom Link', 'jrinstaslider' ); ?></option>
295
- <option value="none" <?php selected( $instance['images_link'], 'none', true); ?>><?php _e( 'None', 'jrinstaslider' ); ?></option>
296
- </select>
297
- </label>
298
- </p>
299
- <p class="<?php if ( 'custom_url' != $instance['images_link'] ) echo 'hidden'; ?>">
300
- <label for="<?php echo $this->get_field_id( 'custom_url' ); ?>"><?php _e( 'Custom link:', 'jrinstaslider'); ?></label>
301
- <input class="widefat" id="<?php echo $this->get_field_id( 'custom_url' ); ?>" name="<?php echo $this->get_field_name( 'custom_url' ); ?>" value="<?php echo $instance['custom_url']; ?>" />
302
- <span><?php _e('* use this field only if the above option is set to <strong>Custom Link</strong>', 'jrinstaslider'); ?></span>
303
- </p>
304
- <p>
305
- <strong>Advanced Options</strong>
306
- <?php
307
- $advanced_class = '';
308
- $advanced_text = '[ - Close ]';
309
- if ( '' == trim( $instance['image_link_rel'] ) && '' == trim( $instance['image_link_class'] ) && '' == trim( $instance['image_size'] ) ) {
310
- $advanced_class = 'hidden';
311
- $advanced_text = '[ + Open ]';
312
- }
313
- ?>
314
- <a href="#" class="jr-advanced"><?php echo $advanced_text; ?></a>
315
- </p>
316
- <div class="jr-advanced-input <?php echo $advanced_class; ?>">
317
- <div class="jr-image-options">
318
- <h4 class="jr-advanced-title"><?php _e( 'Advanced Image Options', 'jrinstaslider'); ?></h4>
319
- <p>
320
- <label for="<?php echo $this->get_field_id( 'image_link_rel' ); ?>"><?php _e( 'Image Link rel attribute', 'jrinstaslider' ); ?>:</label>
321
- <input class="widefat" id="<?php echo $this->get_field_id( 'image_link_rel' ); ?>" name="<?php echo $this->get_field_name( 'image_link_rel' ); ?>" value="<?php echo $instance['image_link_rel']; ?>" />
322
- <span class="jr-description"><?php _e( 'Specifies the relationship between the current page and the linked website', 'jrinstaslider' ); ?></span>
323
- </p>
324
- <p>
325
- <label for="<?php echo $this->get_field_id( 'image_link_class' ); ?>"><?php _e( 'Image Link class', 'jrinstaslider' ); ?>:</label>
326
- <input class="widefat" id="<?php echo $this->get_field_id( 'image_link_class' ); ?>" name="<?php echo $this->get_field_name( 'image_link_class' ); ?>" value="<?php echo $instance['image_link_class']; ?>" />
327
- <span class="jr-description"><?php _e( 'Usefull if you are using jQuery lightbox plugins to open links', 'jrinstaslider' ); ?></span>
328
- </p>
329
- <p><strong><?php _e( 'Disable Pinning:', 'jrinstaslider' ); ?></strong>
330
- <label class="switch" for="<?php echo $this->get_field_id( 'no_pin' ); ?>">
331
- <input class="widefat" id="<?php echo $this->get_field_id( 'no_pin' ); ?>" name="<?php echo $this->get_field_name( 'no_pin' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['no_pin'] ); ?> /><span class="slider round"></span></label>
332
- <br><span class="jr-description"><?php _e( 'Disable pinning for Pinterest on all images from this widget!', 'jrinstaslider') ?></span>
333
- </p>
334
- </div>
335
- <div class="jr-slider-options <?php if ( 'thumbs' == $instance['template'] || 'thumbs-no-border' == $instance['template'] ) echo 'hidden'; ?>">
336
- <h4 class="jr-advanced-title"><?php _e( 'Advanced Slider Options', 'jrinstaslider'); ?></h4>
337
  <p>
338
- <?php _e( 'Slider Navigation Controls:', 'jrinstaslider' ); ?><br>
339
- <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" value="prev_next" <?php checked( 'prev_next', $instance['controls'] ); ?> /> <?php _e( 'Prev & Next', 'jrinstaslider' ); ?></label>
340
- <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" value="numberless" <?php checked( 'numberless', $instance['controls'] ); ?> /> <?php _e( 'Dotted', 'jrinstaslider' ); ?></label>
341
- <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" value="none" <?php checked( 'none', $instance['controls'] ); ?> /> <?php _e( 'No Navigation', 'jrinstaslider' ); ?></label>
342
  </p>
343
  <p>
344
- <?php _e( 'Slider Animation:', 'jrinstaslider' ); ?><br>
345
- <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'animation' ); ?>" name="<?php echo $this->get_field_name( 'animation' ); ?>" value="slide" <?php checked( 'slide', $instance['animation'] ); ?> /> <?php _e( 'Slide', 'jrinstaslider' ); ?></label>
346
- <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'animation' ); ?>" name="<?php echo $this->get_field_name( 'animation' ); ?>" value="fade" <?php checked( 'fade', $instance['animation'] ); ?> /> <?php _e( 'Fade', 'jrinstaslider' ); ?></label>
347
  </p>
348
- <p>
349
- <label for="<?php echo $this->get_field_id( 'caption_words' ); ?>"><?php _e( 'Number of words in caption:', 'jrinstaslider' ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
  <input class="small-text" id="<?php echo $this->get_field_id( 'caption_words' ); ?>" name="<?php echo $this->get_field_name( 'caption_words' ); ?>" value="<?php echo $instance['caption_words']; ?>" />
351
  </label>
352
  </p>
353
  <p>
354
  <label for="<?php echo $this->get_field_id( 'slidespeed' ); ?>"><?php _e( 'Slide Speed:', 'jrinstaslider' ); ?>
355
- <input class="small-text" id="<?php echo $this->get_field_id( 'slidespeed' ); ?>" name="<?php echo $this->get_field_name( 'slidespeed' ); ?>" value="<?php echo $instance['slidespeed']; ?>" />
356
- <span><?php _e('milliseconds', 'jrinstaslider'); ?></span>
357
- <span class='jr-description'><?php _e('1000 milliseconds = 1 second', 'jrinstaslider'); ?></span>
358
- </label>
359
- </p>
360
- <p>
361
- <label for="<?php echo $this->get_field_id('description'); ?>"><?php _e( 'Slider Text Description:', 'jrinstaslider' ); ?></label>
362
- <select size=3 class='widefat' id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>[]" multiple="multiple">
363
- <option class="<?php if ( 'hashtag' == $instance['search_for'] ) echo 'hidden'; ?>" value='username' <?php $this->selected( $instance['description'], 'username' ); ?>><?php _e( 'Username', 'jrinstaslider'); ?></option>
364
- <option value='time'<?php $this->selected( $instance['description'], 'time' ); ?>><?php _e( 'Time', 'jrinstaslider'); ?></option>
365
- <option value='caption'<?php $this->selected( $instance['description'], 'caption' ); ?>><?php _e( 'Caption', 'jrinstaslider'); ?></option>
366
- </select>
367
- <span class="jr-description"><?php _e( 'Hold ctrl and click the fields you want to show/hide on your slider. Leave all unselected to hide them all. Default all selected.', 'jrinstaslider') ?></span>
368
- </p>
369
- </div>
370
  </div>
371
- <?php $widget_id = preg_replace( '/[^0-9]/', '', $this->id ); if ( $widget_id != '' ) : ?>
372
- <p>
373
- <label for="jr_insta_shortcode"><?php _e('Shortcode of this Widget:', 'jrinstaslider'); ?></label>
374
- <input id="jr_insta_shortcode" onclick="this.setSelectionRange(0, this.value.length)" type="text" class="widefat" value="[jr_instagram id=&quot;<?php echo $widget_id ?>&quot;]" readonly="readonly" style="border:none; color:black; font-family:monospace;">
375
- <span class="jr-description"><?php _e( 'Use this shortcode in any page or post to display images with this widget configuration!', 'jrinstaslider') ?></span>
376
- </p>
377
- <?php endif; ?>
378
- <div class="jr-advanced-input">
379
- <div class="jr-image-options">
380
- <h4 class="jr-advanced-title"><?php _e( 'Help us, help you!', 'jrinstaslider'); ?></h4>
 
381
  <p><strong><?php _e( 'Show "Powered by Link"', 'jrinstaslider' ); ?></strong>
382
  <label class="switch" for="<?php echo $this->get_field_id( 'support_author' ); ?>">
383
  <input class="widefat" id="<?php echo $this->get_field_id( 'support_author' ); ?>" name="<?php echo $this->get_field_name( 'support_author' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['support_author'] ); ?> /><span class="slider round"></span></label>
384
  <br><span class="jr-description"><?php _e( 'When enabled, the author is notified and a backlink website is visible at the bottom of the plugin. <br> <strong>If you enable this option you will have privileged support from our team!</strong>', 'jrinstaslider') ?></span>
385
  </p>
386
- <a target="_blank" title="Buy me movie tickets!" href="https://goo.gl/MpqlUU"><p class="donate"><span></span>Buy me movie tickets!</p></a>
387
- </div></div>
388
- </div><br>
389
- <?php
390
- }
 
 
391
 
392
  /**
393
  * Selected array function echoes selected if in array
@@ -420,6 +414,16 @@ class JR_InstagramSlider extends WP_Widget {
420
  }
421
  }
422
 
 
 
 
 
 
 
 
 
 
 
423
 
424
  /**
425
  * Cron Trigger Function
@@ -429,24 +433,11 @@ class JR_InstagramSlider extends WP_Widget {
429
  * @return [type] [description]
430
  */
431
  public function jr_cron_trigger( $username, $refresh_hour, $images ) {
432
- $search_for= array();
433
  $search_for['username'] = $username;
434
  $this->instagram_data( $search_for, $refresh_hour, $images, true );
435
  }
436
 
437
-
438
- /**
439
- * Echoes the Display Instagram Images method
440
- *
441
- * @param array $args
442
- *
443
- * @return void
444
- */
445
- public function instagram_images( $args ) {
446
- echo $this->display_images( $args );
447
- }
448
-
449
-
450
  /**
451
  * Runs the query for images and returns the html
452
  *
@@ -462,12 +453,12 @@ class JR_InstagramSlider extends WP_Widget {
462
  $attachment = isset( $args['attachment'] ) ? true : false;
463
  $template = isset( $args['template'] ) ? $args['template'] : 'slider';
464
  $orderby = isset( $args['orderby'] ) ? $args['orderby'] : 'rand';
465
- $images_link = isset( $args['images_link'] ) ? $args['images_link'] : 'local_image_url';
466
  $custom_url = isset( $args['custom_url'] ) ? $args['custom_url'] : '';
467
  $images_number = isset( $args['images_number'] ) ? absint( $args['images_number'] ) : 5;
468
  $columns = isset( $args['columns'] ) ? absint( $args['columns'] ) : 4;
469
  $refresh_hour = isset( $args['refresh_hour'] ) ? absint( $args['refresh_hour'] ) : 5;
470
- $image_size = isset( $args['image_size'] ) ? $args['image_size'] : 'jr_insta_square';
471
  $image_link_rel = isset( $args['image_link_rel'] ) ? $args['image_link_rel'] : '';
472
  $no_pin = isset( $args['no_pin'] ) ? $args['no_pin'] : 0;
473
  $image_link_class = isset( $args['image_link_class'] ) ? $args['image_link_class'] : '';
@@ -504,7 +495,7 @@ class JR_InstagramSlider extends WP_Widget {
504
  'link_class' => $image_link_class,
505
  'no_pin' => $no_pin,
506
  'caption_words' => $caption_words
507
- );
508
 
509
  $images_div_class = 'jr-insta-thumb';
510
  $ul_class = ( $template == 'thumbs-no-border' ) ? 'thumbnails no-border jr_col_' . $columns : 'thumbnails jr_col_' . $columns;
@@ -566,13 +557,9 @@ class JR_InstagramSlider extends WP_Widget {
566
  $output = __( 'No images found! <br> Try some other hashtag or username', 'jrinstaslider' );
567
 
568
  if ( ( $search == 'user' && $attachment ) ) {
569
-
570
- if ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) {
571
- $this->instagram_data( $search_for, $refresh_hour, $images_number, true );
572
- } else {
573
- if ( !wp_next_scheduled( 'jr_insta_cron', array( $search_for['username'], $refresh_hour, $images_number ) ) ) {
574
- wp_schedule_single_event( time() + 20, 'jr_insta_cron', array( $search_for['username'], $refresh_hour, $images_number ) );
575
- }
576
  }
577
 
578
  $opt_name = 'jr_insta_' . md5( $search . '_' . $search_for['username'] );
@@ -584,7 +571,7 @@ class JR_InstagramSlider extends WP_Widget {
584
  'post_mime_type' => 'image',
585
  'posts_per_page' => $images_number,
586
  'no_found_rows' => true
587
- );
588
 
589
  if ( $orderby != 'rand' ) {
590
 
@@ -595,8 +582,8 @@ class JR_InstagramSlider extends WP_Widget {
595
  $query_args['orderby'] = 'meta_value_num';
596
  $query_args['order'] = $orderby[1];
597
  }
598
-
599
- if ( isset( $attachment_ids['saved_images'] ) ) {
600
 
601
  $query_args['post__in'] = $attachment_ids['saved_images'];
602
 
@@ -607,8 +594,8 @@ class JR_InstagramSlider extends WP_Widget {
607
  'key' => 'jr_insta_username',
608
  'value' => $username,
609
  'compare' => '='
610
- )
611
- );
612
  }
613
 
614
  $instagram_images = new WP_Query( $query_args );
@@ -619,21 +606,24 @@ class JR_InstagramSlider extends WP_Widget {
619
 
620
  while ( $instagram_images->have_posts() ) : $instagram_images->the_post();
621
 
622
- $id = get_the_id();
623
-
624
- if ( 'image_url' == $images_link ) {
625
- $template_args['link_to'] = get_post_meta( $id, 'jr_insta_link', true );
626
- } elseif ( 'user_url' == $images_link ) {
627
- $template_args['link_to'] = 'https://www.instagram.com/' . $username . '/';
628
- } elseif ( 'local_image_url' == $images_link ) {
629
- $template_args['link_to'] = wp_get_attachment_url( $id );
630
- } elseif ( 'attachment' == $images_link ) {
631
- $template_args['link_to'] = get_permalink( $id );
632
- } elseif ( 'custom_url' == $images_link ) {
633
- $template_args['link_to'] = $custom_url;
634
- }
635
 
636
- $output .= $this->get_template( $template, $template_args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
 
638
  endwhile;
639
 
@@ -660,26 +650,21 @@ class JR_InstagramSlider extends WP_Widget {
660
 
661
  foreach ( $images_data as $image_data ) {
662
 
663
- if ( 'image_url' == $images_link ) {
664
  $template_args['link_to'] = $image_data['link'];
665
  } elseif ( 'user_url' == $images_link ) {
666
  $template_args['link_to'] = 'https://www.instagram.com/' . $username . '/';
 
 
667
  } elseif ( 'custom_url' == $images_link ) {
668
  $template_args['link_to'] = $custom_url;
669
  }
670
 
671
- if ( $image_size == 'jr_insta_square' ) {
672
- $template_args['image'] = $image_data['url_thumbnail'];
673
- } elseif( $image_size == 'full' ) {
674
- $template_args['image'] = $image_data['url'];
675
- } else {
676
- $template_args['image'] = $image_data['url'];
677
- }
678
-
679
- $template_args['caption'] = $image_data['caption'];
680
- $template_args['timestamp'] = $image_data['timestamp'];
681
- $template_args['username'] = $image_data['username'];
682
- $template_args['attachment'] = false;
683
 
684
  $output .= $this->get_template( $template, $template_args );
685
  }
@@ -713,25 +698,20 @@ class JR_InstagramSlider extends WP_Widget {
713
 
714
  foreach ( $images_data as $image_data ) {
715
 
716
- if ( 'image_url' == $images_link ) {
717
  $template_args['link_to'] = $image_data['link'];
718
  } elseif ( 'user_url' == $images_link ) {
719
  $template_args['link_to'] = 'https://www.instagram.com/' . $username . '/';
 
 
720
  } elseif ( 'custom_url' == $images_link ) {
721
  $template_args['link_to'] = $custom_url;
722
  }
723
 
724
- if ( $image_size == 'jr_insta_square' ) {
725
- $template_args['image'] = $image_data['url_thumbnail'];
726
- } elseif( $image_size == 'full' ) {
727
- $template_args['image'] = $image_data['url'];
728
- } else {
729
- $template_args['image'] = $image_data['url'];
730
- }
731
-
732
- $template_args['caption'] = $image_data['caption'];
733
- $template_args['timestamp'] = $image_data['timestamp'];
734
- $template_args['username'] = $image_data['username'];
735
 
736
  $output .= $this->get_template( $template, $template_args );
737
  }
@@ -756,24 +736,22 @@ class JR_InstagramSlider extends WP_Widget {
756
  private function get_template( $template, $args ) {
757
 
758
  $link_to = isset( $args['link_to'] ) ? $args['link_to'] : false;
 
759
 
760
  if ( ( $args['search_for'] == 'user' && $args['attachment'] !== true ) || $args['search_for'] == 'hashtag' ) {
761
  $caption = $args['caption'];
762
  $time = $args['timestamp'];
763
  $username = $args['username'];
764
- $image_url = $args['image'];
765
  } else {
766
  $attach_id = get_the_id();
767
  $caption = get_the_excerpt();
768
  $time = get_post_meta( $attach_id, 'jr_insta_timestamp', true );
769
  $username = get_post_meta( $attach_id, 'jr_insta_username', true );
770
- $image_url = wp_get_attachment_image_src( $attach_id, $args['image_size'] );
771
- $image_url = $image_url[0];
772
  }
773
 
774
- $short_caption = wp_trim_words( $caption, 10 );
775
  $short_caption = preg_replace("/[^A-Za-z0-9?! ]/","", $short_caption);
776
- $caption = wp_trim_words( $caption, $args['caption_words'], $more = null );
777
  $nopin = ( 1 == $args['no_pin'] ) ? 'nopin="nopin"' : '';
778
 
779
  $image_src = '<img src="' . $image_url . '" alt="' . $short_caption . '" title="' . $short_caption . '" '. $nopin . '/>';
@@ -923,13 +901,12 @@ class JR_InstagramSlider extends WP_Widget {
923
  function powered_by_link( $support_author ) {
924
 
925
  if ( $support_author ) {
926
-
927
  $link = $this->domain_data();
928
 
929
  if ( isset( $link['text'] ) && !empty( $link['text'] ) && isset( $link['domain'] ) && !empty( $link['domain'] ) ) {
930
- $link = '<div style="clear:both;text-align:right;font-size:10px;" ><a href="'.$link['domain'].'" target="_blank">'.$link['text'].'</a></div>';
931
  } else if ( isset( $link['text'] ) && !empty( $link['text'] ) ) {
932
- $link = '<div style="clear:both;text-align:right;font-size:10px;" >'.$link['text'].'</div>';
933
  } else {
934
  $link = '';
935
  }
@@ -951,6 +928,7 @@ class JR_InstagramSlider extends WP_Widget {
951
  */
952
  private function instagram_data( $search_for, $cache_hours, $nr_images, $attachment ) {
953
 
 
954
  $blocked_users = isset( $search_for['blocked_users'] ) && !empty( $search_for['blocked_users'] ) ? $search_for['blocked_users'] : false;
955
  if ( isset( $search_for['username'] ) && !empty( $search_for['username'] ) ) {
956
  $search = 'user';
@@ -973,7 +951,7 @@ class JR_InstagramSlider extends WP_Widget {
973
  'cache_hours' => $cache_hours,
974
  'nr_images' => $nr_images,
975
  'attachment' => $attachment
976
- );
977
 
978
  if ( true === $this->trigger_refresh_data( $instaData, $old_opts, $new_opts ) ) {
979
 
@@ -984,11 +962,13 @@ class JR_InstagramSlider extends WP_Widget {
984
  $old_opts['cache_hours'] = $cache_hours;
985
  $old_opts['nr_images'] = $nr_images;
986
  $old_opts['attachment'] = $attachment;
987
-
988
  if ( 'user' == $search ) {
989
- $response = wp_remote_get( 'https://www.instagram.com/' . trim( $search_string ), array( 'sslverify' => false, 'timeout' => 60 ) );
 
990
  } else {
991
- $response = wp_remote_get( 'https://www.instagram.com/explore/tags/' . trim( $search_string ), array( 'sslverify' => false, 'timeout' => 60 ) );
 
992
 
993
  }
994
 
@@ -998,72 +978,51 @@ class JR_InstagramSlider extends WP_Widget {
998
  }
999
 
1000
  if ( $response['response']['code'] == 200 ) {
1001
-
1002
- $json = str_replace( 'window._sharedData = ', '', strstr( $response['body'], 'window._sharedData = ' ) );
1003
-
1004
- // Compatibility for version of php where strstr() doesnt accept third parameter
1005
- if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
1006
- $json = strstr( $json, '</script>', true );
1007
- } else {
1008
- $json = substr( $json, 0, strpos( $json, '</script>' ) );
1009
- }
1010
-
1011
- $json = rtrim( $json, ';' );
1012
-
1013
- // Function json_last_error() is not available before PHP * 5.3.0 version
1014
- if ( function_exists( 'json_last_error' ) ) {
1015
-
1016
- ( $results = json_decode( $json, true ) ) && json_last_error() == JSON_ERROR_NONE;
1017
-
1018
- } else {
1019
-
1020
- $results = json_decode( $json, true );
1021
- }
1022
-
1023
  if ( $results && is_array( $results ) ) {
1024
 
1025
  if ( 'user' == $search ) {
1026
- $entry_data = isset( $results['entry_data']['ProfilePage'][0]['user']['media']['nodes'] ) ? $results['entry_data']['ProfilePage'][0]['user']['media']['nodes'] : array();
1027
  } else {
1028
- $entry_data = isset( $results['entry_data']['TagPage'][0]['tag']['media']['nodes'] ) ? $results['entry_data']['TagPage'][0]['tag']['media']['nodes'] : array();
1029
  }
1030
 
1031
 
1032
  if ( empty( $entry_data ) ) {
1033
  return __( 'No images found', 'jrinstaslider');
1034
  }
1035
-
1036
- $count = count($entry_data);
1037
-
1038
- foreach ( $entry_data as $current => $result ) {
1039
 
1040
- if ( $result['is_video'] == true ) {
1041
- $nr_images++;
1042
- continue;
1043
- }
1044
 
 
 
 
1045
  if ( 'hashtag' == $search ) {
 
1046
  if ( in_array( $result['owner']['id'], $blocked_users_array ) ) {
1047
  $nr_images++;
1048
  continue;
1049
- }
 
 
 
 
 
1050
  }
1051
 
 
1052
  if ( $current >= $nr_images ) {
1053
  break;
1054
  }
1055
-
1056
- $image_data['code'] = $result['code'];
1057
- $image_data['username'] = 'user' == $search ? $search_string : false;
1058
- $image_data['user_id'] = $result['owner']['id'];
1059
- $image_data['caption'] = isset( $result['caption'] ) ? $this->sanitize( $result['caption'] ) : '';
1060
- $image_data['id'] = $result['id'];
1061
- $image_data['link'] = 'https://www.instagram.com/p/'. $result['code'] . '/';
1062
- $image_data['popularity'] = (int) ( $result['comments']['count'] ) + ( $result['likes']['count'] );
1063
- $image_data['timestamp'] = (float) $result['date'];
1064
- $image_data['url'] = $result['display_src'];
1065
- $image_data['url_thumbnail'] = $result['thumbnail_src'];
1066
 
 
 
 
 
 
 
1067
  if ( ( $search == 'hashtag' ) || ( $search == 'user' && !$attachment ) ) {
1068
 
1069
  $instaData[] = $image_data;
@@ -1077,7 +1036,10 @@ class JR_InstagramSlider extends WP_Widget {
1077
  $this->update_wp_attachment( $old_opts['saved_images'][$image_data['id']], $image_data );
1078
 
1079
  $instaData[$image_data['id']] = $old_opts['saved_images'][$image_data['id']];
1080
- }
 
 
 
1081
 
1082
  } else {
1083
 
@@ -1120,6 +1082,109 @@ class JR_InstagramSlider extends WP_Widget {
1120
  return $instaData;
1121
  }
1122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1123
  /**
1124
  * Remove Duplicates
1125
  * @return [type] [description]
@@ -1137,9 +1202,9 @@ class JR_InstagramSlider extends WP_Widget {
1137
  'key' => 'jr_insta_username',
1138
  'compare' => '=',
1139
  'value' => $username
1140
- ),
1141
  ),
1142
- );
 
1143
 
1144
  $savedinsta = new WP_Query( $savedinsta_args );
1145
 
@@ -1177,7 +1242,7 @@ class JR_InstagramSlider extends WP_Widget {
1177
  $post = $_POST;
1178
  $return = array(
1179
  'deleted' => $this->clean_duplicates( $post['username'] )
1180
- );
1181
 
1182
  wp_send_json( $return );
1183
  }
@@ -1200,8 +1265,9 @@ class JR_InstagramSlider extends WP_Widget {
1200
  if ( isset( $user_ids[$user] ) ) {
1201
  continue;
1202
  }
1203
-
1204
- $response = wp_remote_get( 'https://www.instagram.com/' . trim( $user ), array( 'sslverify' => false, 'timeout' => 60 ) );
 
1205
 
1206
  if ( is_wp_error( $response ) ) {
1207
 
@@ -1210,30 +1276,11 @@ class JR_InstagramSlider extends WP_Widget {
1210
 
1211
  if ( $response['response']['code'] == 200 ) {
1212
 
1213
- $json = str_replace( 'window._sharedData = ', '', strstr( $response['body'], 'window._sharedData = ' ) );
1214
-
1215
- // Compatibility for version of php where strstr() doesnt accept third parameter
1216
- if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
1217
- $json = strstr( $json, '</script>', true );
1218
- } else {
1219
- $json = substr( $json, 0, strpos( $json, '</script>' ) );
1220
- }
1221
-
1222
- $json = rtrim( $json, ';' );
1223
-
1224
- // Function json_last_error() is not available before PHP * 5.3.0 version
1225
- if ( function_exists( 'json_last_error' ) ) {
1226
-
1227
- ( $results = json_decode( $json, true ) ) && json_last_error() == JSON_ERROR_NONE;
1228
-
1229
- } else {
1230
-
1231
- $results = json_decode( $json, true );
1232
- }
1233
 
1234
  if ( $results && is_array( $results ) ) {
1235
 
1236
- $user_id = isset( $results['entry_data']['ProfilePage'][0]['user']['id'] ) ? $results['entry_data']['ProfilePage'][0]['user']['id'] : false;
1237
 
1238
  if ( $user_id ) {
1239
 
@@ -1262,9 +1309,10 @@ class JR_InstagramSlider extends WP_Widget {
1262
  * @param array image_data
1263
  * @return void
1264
  */
1265
- private function update_wp_attachment( $attachment_ID, $image_data ) {
1266
-
1267
  update_post_meta( $attachment_ID, 'jr_insta_popularity', $image_data['popularity'] );
 
 
1268
  }
1269
 
1270
  /**
@@ -1278,48 +1326,24 @@ class JR_InstagramSlider extends WP_Widget {
1278
  */
1279
  private function save_wp_attachment( $image_data ) {
1280
 
1281
- // Remove Instagram chace key from url
1282
- $clean_url = esc_url( remove_query_arg( 'ig_cache_key', $image_data['url'] ) );
1283
-
1284
- $image_info = pathinfo( $clean_url );
1285
 
1286
- if ( !in_array( $image_info['extension'], array( 'jpg', 'jpe', 'jpeg', 'gif', 'png' ) ) ) {
1287
  return false;
1288
  }
1289
-
1290
- // These files need to be included as dependencies when on the front end.
1291
- if( !function_exists( 'download_url' ) || !function_exists( 'media_handle_sideload' ) ) {
1292
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
1293
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
1294
- require_once( ABSPATH . 'wp-admin/includes/media.php' );
1295
- }
1296
 
1297
- $tmp = download_url( $clean_url );
1298
-
1299
- $file_array = array();
1300
- $file_array['name'] = $image_info['basename'];
1301
- $file_array['tmp_name'] = $tmp;
 
1302
 
1303
- // If error storing temporarily, unlink
1304
- if ( is_wp_error( $tmp ) ) {
1305
-
1306
- @unlink( $file_array['tmp_name'] );
1307
- $file_array['tmp_name'] = '';
1308
 
1309
- return $tmp->get_error_message();
1310
- }
1311
-
1312
- $id = media_handle_sideload( $file_array, 0, NULL, array(
1313
- 'post_excerpt' => $image_data['caption']
1314
- ) );
1315
-
1316
- // If error storing permanently, unlink
1317
- if ( is_wp_error( $id ) ) {
1318
-
1319
- @unlink( $file_array['tmp_name'] );
1320
-
1321
- return $id->get_error_message();
1322
- }
1323
 
1324
  unset( $image_data['caption'] );
1325
 
@@ -1348,7 +1372,7 @@ class JR_InstagramSlider extends WP_Widget {
1348
  "label" => __( "Instagram Username" ),
1349
  "input" => "html",
1350
  "html" => "<span style='line-height:31px'><a target='_blank' href='https://www.instagram.com/{$instagram_username}/'>{$instagram_username}</a></span>"
1351
- );
1352
 
1353
  $instagram_link = get_post_meta( $post->ID, 'jr_insta_link', true );
1354
  if ( !empty( $instagram_link ) ) {
@@ -1356,7 +1380,7 @@ class JR_InstagramSlider extends WP_Widget {
1356
  "label" => __( "Instagram Image" ),
1357
  "input" => "html",
1358
  "html" => "<span style='line-height:31px'><a target='_blank' href='{$instagram_link}'>{$instagram_link}</a></span>"
1359
- );
1360
  }
1361
 
1362
  $instagram_date = get_post_meta( $post->ID, 'jr_insta_timestamp', true );
@@ -1366,7 +1390,7 @@ class JR_InstagramSlider extends WP_Widget {
1366
  "label" => __( "Posted on Instagram" ),
1367
  "input" => "html",
1368
  "html" => "<span style='line-height:31px'>{$instagram_date}</span>"
1369
- );
1370
  }
1371
  }
1372
 
2
  /*
3
  Plugin Name: Instagram Slider Widget
4
  Plugin URI: http://instagram.jrwebstudio.com/
5
+ Version: 1.4.2
6
  Description: Instagram Slider Widget is a responsive slider widget that shows 12 latest images from a public Instagram user and up to 18 images from a hashtag.
7
  Author: jetonr
8
  Author URI: http://jrwebstudio.com/
14
  */
15
  add_action( 'widgets_init', array( 'JR_InstagramSlider', 'register_widget' ) );
16
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * JR_InstagramSlider Class
19
  */
24
  *
25
  * @var string
26
  */
27
+ const VERSION = '1.4.2';
28
+
29
+ const USERNAME_URL = 'https://www.instagram.com/{username}/?__a=1';
30
+
31
+ const TAG_URL = 'https://www.instagram.com/explore/tags/{tag}/?__a=1';
32
 
33
  /**
34
  * Initialize the plugin by registering widget and loading public scripts
43
  )
44
  );
45
 
 
 
 
46
  // Shortcode
47
  add_shortcode( 'jr_instagram', array( $this, 'shortcode' ) );
48
 
62
  add_filter( 'attachment_fields_to_edit', array( $this, 'insta_attachment_fields' ) , 10, 2 );
63
 
64
  // Add action for single cron events
65
+ add_action( 'jr_insta_cron', array( $this, 'jr_cron_trigger' ), 10 , 3 );
66
  }
67
 
68
  /**
74
  'name' => __( 'Instagram Slider - Shortcode Generator', 'jrinstaslider' ),
75
  'id' => 'jr-insta-shortcodes',
76
  'description' => __( "1. Drag Instagram Slider widget here. 2. Fill in the fields and hit save. 3. Copy the shortocde generated at the bottom of the widget form and use it on posts or pages.", 'jrinstaslider' )
77
+ )
78
+ );
79
  }
80
 
81
  /**
100
  }
101
 
102
  wp_enqueue_style( 'jr-insta-admin-styles', plugins_url( 'assets/css/jr-insta-admin.css', __FILE__ ), array(), self::VERSION );
103
+ wp_enqueue_script( 'jr-insta-admin-script', plugins_url( 'assets/js/jr-insta-admin.js', __FILE__ ), array( 'jquery' ), self::VERSION, true );
 
104
  }
105
 
106
  /**
186
  'images_number' => 5,
187
  'columns' => 4,
188
  'refresh_hour' => 5,
189
+ 'image_size' => 'standard',
190
  'image_link_rel' => '',
191
  'image_link_class' => '',
192
  'no_pin' => 0,
196
  'slidespeed' => 7000,
197
  'description' => array( 'username', 'time','caption' ),
198
  'support_author' => 0
199
+ );
200
 
201
  $instance = wp_parse_args( (array) $instance, $defaults );
202
 
216
  <input class="widefat" id="<?php echo $this->get_field_id( 'blocked_users' ); ?>" name="<?php echo $this->get_field_name( 'blocked_users' ); ?>" value="<?php echo $instance['blocked_users']; ?>" />
217
  <span class="jr-description"><?php _e( 'Enter usernames separated by commas whose images you don\'t want to show', 'jrinstaslider' ); ?></span>
218
  </p>
219
+ <p class="<?php if ( 'username' != $instance['search_for'] ) echo 'hidden'; ?>"><strong><?php _e( 'Save in Media Library: ', 'jrinstaslider' ); ?></strong>
220
  <label class="switch" for="<?php echo $this->get_field_id( 'attachment' ); ?>">
221
  <input class="widefat" id="<?php echo $this->get_field_id( 'attachment' ); ?>" name="<?php echo $this->get_field_name( 'attachment' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['attachment'] ); ?> /><span class="slider round"></span></label>
222
  <br><span class="jr-description"><?php _e( ' Turn on to save Instagram Images into WordPress media library.', 'jrinstaslider') ?></span>
227
  wp_nonce_field( 'jr_delete_instagram_dupes', 'delete_insta_dupes_nonce' );
228
  }
229
  ?>
230
+ </p>
231
+ <p>
232
+ <label for="<?php echo $this->get_field_id( 'images_number' ); ?>"><strong><?php _e( 'Number of images to show:', 'jrinstaslider' ); ?></strong>
233
+ <input class="small-text" id="<?php echo $this->get_field_id( 'images_number' ); ?>" name="<?php echo $this->get_field_name( 'images_number' ); ?>" value="<?php echo $instance['images_number']; ?>" />
234
+ </label>
235
+ </p>
236
+ <p>
237
+ <label for="<?php echo $this->get_field_id( 'refresh_hour' ); ?>"><strong><?php _e( 'Check for new images every:', 'jrinstaslider' ); ?></strong>
238
+ <input class="small-text" id="<?php echo $this->get_field_id( 'refresh_hour' ); ?>" name="<?php echo $this->get_field_name( 'refresh_hour' ); ?>" value="<?php echo $instance['refresh_hour']; ?>" />
239
+ <span><?php _e('hours', 'jrinstaslider'); ?></span>
240
+ </label>
241
+ </p>
242
+ <p>
243
+ <label for="<?php echo $this->get_field_id( 'template' ); ?>"><strong><?php _e( 'Template', 'jrinstaslider' ); ?></strong>
244
+ <select class="widefat" name="<?php echo $this->get_field_name( 'template' ); ?>" id="<?php echo $this->get_field_id( 'template' ); ?>">
245
+ <option value="slider" <?php echo ($instance['template'] == 'slider') ? ' selected="selected"' : ''; ?>><?php _e( 'Slider - Normal', 'jrinstaslider' ); ?></option>
246
+ <option value="slider-overlay" <?php echo ($instance['template'] == 'slider-overlay') ? ' selected="selected"' : ''; ?>><?php _e( 'Slider - Overlay Text', 'jrinstaslider' ); ?></option>
247
+ <option value="thumbs" <?php echo ($instance['template'] == 'thumbs') ? ' selected="selected"' : ''; ?>><?php _e( 'Thumbnails', 'jrinstaslider' ); ?></option>
248
+ <option value="thumbs-no-border" <?php echo ($instance['template'] == 'thumbs-no-border') ? ' selected="selected"' : ''; ?>><?php _e( 'Thumbnails - Without Border', 'jrinstaslider' ); ?></option>
249
+ </select>
250
+ </label>
251
+ </p>
252
+ <p class="<?php if ( 'thumbs' != $instance['template'] && 'thumbs-no-border' != $instance['template'] ) echo 'hidden'; ?>">
253
+ <label for="<?php echo $this->get_field_id( 'columns' ); ?>"><strong><?php _e( 'Number of Columns:', 'jrinstaslider' ); ?></strong>
254
+ <input class="small-text" id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" value="<?php echo $instance['columns']; ?>" />
255
+ <span class='jr-description'><?php _e('max is 10 ( only for thumbnails template )', 'jrinstaslider'); ?></span>
256
+ </label>
257
+ </p>
258
+ <p>
259
+ <label for="<?php echo $this->get_field_id( 'image_size' ); ?>"><strong><?php _e( 'Image format', 'jrinstaslider' ); ?></strong></label>
260
+ <select class="widefat" id="<?php echo $this->get_field_id( 'image_size' ); ?>" name="<?php echo $this->get_field_name( 'image_size' ); ?>">
261
+ <option value="thumbnail" <?php echo ($instance['image_size'] == 'thumbnail') ? ' selected="selected"' : ''; ?>><?php _e( 'Thumbnail - 150x150', 'jrinstaslider' ); ?></option>
262
+ <option value="low" <?php echo ($instance['image_size'] == 'low') ? ' selected="selected"' : ''; ?>><?php _e( 'Low - 320x320', 'jrinstaslider' ); ?></option>
263
+ <option value="standard" <?php echo ($instance['image_size'] == 'standard') ? ' selected="selected"' : ''; ?>><?php _e( 'Standard - 640x640', 'jrinstaslider' ); ?></option>
264
+ <option value="full" <?php echo ($instance['image_size'] == 'full') ? ' selected="selected"' : ''; ?>><?php _e( 'Full Size', 'jrinstaslider' ); ?></option>
265
+ </select>
266
+ <span class="jr-description"><?php _e( '<strong>Square - Cropped</strong> - option will show square cropped images in 640x640 pixels. <br/><strong>Original - No Crop</strong> - will display the original user uploaded image size.', 'jrinstaslider' ); ?></span>
267
+ </p>
268
+ <p>
269
+ <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><strong><?php _e( 'Order by', 'jrinstaslider' ); ?></strong>
270
+ <select class="widefat" name="<?php echo $this->get_field_name( 'orderby' ); ?>" id="<?php echo $this->get_field_id( 'orderby' ); ?>">
271
+ <option value="date-ASC" <?php selected( $instance['orderby'], 'date-ASC', true); ?>><?php _e( 'Date - Ascending', 'jrinstaslider' ); ?></option>
272
+ <option value="date-DESC" <?php selected( $instance['orderby'], 'date-DESC', true); ?>><?php _e( 'Date - Descending', 'jrinstaslider' ); ?></option>
273
+ <option value="popular-ASC" <?php selected( $instance['orderby'], 'popular-ASC', true); ?>><?php _e( 'Popularity - Ascending', 'jrinstaslider' ); ?></option>
274
+ <option value="popular-DESC" <?php selected( $instance['orderby'], 'popular-DESC', true); ?>><?php _e( 'Popularity - Descending', 'jrinstaslider' ); ?></option>
275
+ <option value="rand" <?php selected( $instance['orderby'], 'rand', true); ?>><?php _e( 'Random', 'jrinstaslider' ); ?></option>
276
+ </select>
277
+ </label>
278
+ </p>
279
+ <p>
280
+ <label for="<?php echo $this->get_field_id( 'images_link' ); ?>"><strong><?php _e( 'Link to', 'jrinstaslider' ); ?></strong>
281
+ <select class="widefat" name="<?php echo $this->get_field_name( 'images_link' ); ?>" id="<?php echo $this->get_field_id( 'images_link' ); ?>">
282
+ <option value="image_link" <?php selected( $instance['images_link'], 'image_link', true); ?>><?php _e( 'Instagram Image', 'jrinstaslider' ); ?></option>
283
+ <option class="<?php if ( 'hashtag' == $instance['search_for'] ) echo 'hidden'; ?>" value="user_url" <?php selected( $instance['images_link'], 'user_url', true); ?>><?php _e( 'Instagram Profile', 'jrinstaslider' ); ?></option>
284
+ <option value="image_url" <?php selected( $instance['images_link'], 'image_url', true); ?>><?php _e( 'Image URL', 'jrinstaslider' ); ?></option>
285
+ <option class="<?php if ( ( !$instance['attachment'] ) || 'hashtag' == $instance['search_for'] ) echo 'hidden'; ?>" value="attachment" <?php selected( $instance['images_link'], 'attachment', true); ?>><?php _e( 'Attachment Page', 'jrinstaslider' ); ?></option>
286
+ <option value="custom_url" <?php selected( $instance['images_link'], 'custom_url', true ); ?>><?php _e( 'Custom Link', 'jrinstaslider' ); ?></option>
287
+ <option value="none" <?php selected( $instance['images_link'], 'none', true); ?>><?php _e( 'None', 'jrinstaslider' ); ?></option>
288
+ </select>
289
+ </label>
290
+ </p>
291
+ <p class="<?php if ( 'custom_url' != $instance['images_link'] ) echo 'hidden'; ?>">
292
+ <label for="<?php echo $this->get_field_id( 'custom_url' ); ?>"><?php _e( 'Custom link:', 'jrinstaslider'); ?></label>
293
+ <input class="widefat" id="<?php echo $this->get_field_id( 'custom_url' ); ?>" name="<?php echo $this->get_field_name( 'custom_url' ); ?>" value="<?php echo $instance['custom_url']; ?>" />
294
+ <span><?php _e('* use this field only if the above option is set to <strong>Custom Link</strong>', 'jrinstaslider'); ?></span>
295
+ </p>
296
+ <p>
297
+ <strong>Advanced Options</strong>
298
+ <?php
299
+ $advanced_class = '';
300
+ $advanced_text = '[ - Close ]';
301
+ if ( '' == trim( $instance['image_link_rel'] ) && '' == trim( $instance['image_link_class'] ) && '' == trim( $instance['image_size'] ) ) {
302
+ $advanced_class = 'hidden';
303
+ $advanced_text = '[ + Open ]';
304
+ }
305
+ ?>
306
+ <a href="#" class="jr-advanced"><?php echo $advanced_text; ?></a>
307
+ </p>
308
+ <div class="jr-advanced-input <?php echo $advanced_class; ?>">
309
+ <div class="jr-image-options">
310
+ <h4 class="jr-advanced-title"><?php _e( 'Advanced Image Options', 'jrinstaslider'); ?></h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  <p>
312
+ <label for="<?php echo $this->get_field_id( 'image_link_rel' ); ?>"><?php _e( 'Image Link rel attribute', 'jrinstaslider' ); ?>:</label>
313
+ <input class="widefat" id="<?php echo $this->get_field_id( 'image_link_rel' ); ?>" name="<?php echo $this->get_field_name( 'image_link_rel' ); ?>" value="<?php echo $instance['image_link_rel']; ?>" />
314
+ <span class="jr-description"><?php _e( 'Specifies the relationship between the current page and the linked website', 'jrinstaslider' ); ?></span>
 
315
  </p>
316
  <p>
317
+ <label for="<?php echo $this->get_field_id( 'image_link_class' ); ?>"><?php _e( 'Image Link class', 'jrinstaslider' ); ?>:</label>
318
+ <input class="widefat" id="<?php echo $this->get_field_id( 'image_link_class' ); ?>" name="<?php echo $this->get_field_name( 'image_link_class' ); ?>" value="<?php echo $instance['image_link_class']; ?>" />
319
+ <span class="jr-description"><?php _e( 'Usefull if you are using jQuery lightbox plugins to open links', 'jrinstaslider' ); ?></span>
320
  </p>
321
+ <p><strong><?php _e( 'Disable Pinning:', 'jrinstaslider' ); ?></strong>
322
+ <label class="switch" for="<?php echo $this->get_field_id( 'no_pin' ); ?>">
323
+ <input class="widefat" id="<?php echo $this->get_field_id( 'no_pin' ); ?>" name="<?php echo $this->get_field_name( 'no_pin' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['no_pin'] ); ?> /><span class="slider round"></span></label>
324
+ <br><span class="jr-description"><?php _e( 'Disable pinning for Pinterest on all images from this widget!', 'jrinstaslider') ?></span>
325
+ </p>
326
+ </div>
327
+ <div class="jr-slider-options <?php if ( 'thumbs' == $instance['template'] || 'thumbs-no-border' == $instance['template'] ) echo 'hidden'; ?>">
328
+ <h4 class="jr-advanced-title"><?php _e( 'Advanced Slider Options', 'jrinstaslider'); ?></h4>
329
+ <p>
330
+ <?php _e( 'Slider Navigation Controls:', 'jrinstaslider' ); ?><br>
331
+ <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" value="prev_next" <?php checked( 'prev_next', $instance['controls'] ); ?> /> <?php _e( 'Prev & Next', 'jrinstaslider' ); ?></label>
332
+ <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" value="numberless" <?php checked( 'numberless', $instance['controls'] ); ?> /> <?php _e( 'Dotted', 'jrinstaslider' ); ?></label>
333
+ <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'controls' ); ?>" name="<?php echo $this->get_field_name( 'controls' ); ?>" value="none" <?php checked( 'none', $instance['controls'] ); ?> /> <?php _e( 'No Navigation', 'jrinstaslider' ); ?></label>
334
+ </p>
335
+ <p>
336
+ <?php _e( 'Slider Animation:', 'jrinstaslider' ); ?><br>
337
+ <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'animation' ); ?>" name="<?php echo $this->get_field_name( 'animation' ); ?>" value="slide" <?php checked( 'slide', $instance['animation'] ); ?> /> <?php _e( 'Slide', 'jrinstaslider' ); ?></label>
338
+ <label class="jr-radio"><input type="radio" id="<?php echo $this->get_field_id( 'animation' ); ?>" name="<?php echo $this->get_field_name( 'animation' ); ?>" value="fade" <?php checked( 'fade', $instance['animation'] ); ?> /> <?php _e( 'Fade', 'jrinstaslider' ); ?></label>
339
+ </p>
340
+ <p>
341
+ <label for="<?php echo $this->get_field_id( 'caption_words' ); ?>"><?php _e( 'Number of words in caption:', 'jrinstaslider' ); ?>
342
  <input class="small-text" id="<?php echo $this->get_field_id( 'caption_words' ); ?>" name="<?php echo $this->get_field_name( 'caption_words' ); ?>" value="<?php echo $instance['caption_words']; ?>" />
343
  </label>
344
  </p>
345
  <p>
346
  <label for="<?php echo $this->get_field_id( 'slidespeed' ); ?>"><?php _e( 'Slide Speed:', 'jrinstaslider' ); ?>
347
+ <input class="small-text" id="<?php echo $this->get_field_id( 'slidespeed' ); ?>" name="<?php echo $this->get_field_name( 'slidespeed' ); ?>" value="<?php echo $instance['slidespeed']; ?>" />
348
+ <span><?php _e('milliseconds', 'jrinstaslider'); ?></span>
349
+ <span class='jr-description'><?php _e('1000 milliseconds = 1 second', 'jrinstaslider'); ?></span>
350
+ </label>
351
+ </p>
352
+ <p>
353
+ <label for="<?php echo $this->get_field_id('description'); ?>"><?php _e( 'Slider Text Description:', 'jrinstaslider' ); ?></label>
354
+ <select size=3 class='widefat' id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>[]" multiple="multiple">
355
+ <option class="<?php if ( 'hashtag' == $instance['search_for'] ) echo 'hidden'; ?>" value='username' <?php $this->selected( $instance['description'], 'username' ); ?>><?php _e( 'Username', 'jrinstaslider'); ?></option>
356
+ <option value='time'<?php $this->selected( $instance['description'], 'time' ); ?>><?php _e( 'Time', 'jrinstaslider'); ?></option>
357
+ <option value='caption'<?php $this->selected( $instance['description'], 'caption' ); ?>><?php _e( 'Caption', 'jrinstaslider'); ?></option>
358
+ </select>
359
+ <span class="jr-description"><?php _e( 'Hold ctrl and click the fields you want to show/hide on your slider. Leave all unselected to hide them all. Default all selected.', 'jrinstaslider') ?></span>
360
+ </p>
 
361
  </div>
362
+ </div>
363
+ <?php $widget_id = preg_replace( '/[^0-9]/', '', $this->id ); if ( $widget_id != '' ) : ?>
364
+ <p>
365
+ <label for="jr_insta_shortcode"><?php _e('Shortcode of this Widget:', 'jrinstaslider'); ?></label>
366
+ <input id="jr_insta_shortcode" onclick="this.setSelectionRange(0, this.value.length)" type="text" class="widefat" value="[jr_instagram id=&quot;<?php echo $widget_id ?>&quot;]" readonly="readonly" style="border:none; color:black; font-family:monospace;">
367
+ <span class="jr-description"><?php _e( 'Use this shortcode in any page or post to display images with this widget configuration!', 'jrinstaslider') ?></span>
368
+ </p>
369
+ <?php endif; ?>
370
+ <div class="jr-advanced-input">
371
+ <div class="jr-image-options">
372
+ <h4 class="jr-advanced-title"><?php _e( 'Help us, help you!', 'jrinstaslider'); ?></h4>
373
  <p><strong><?php _e( 'Show "Powered by Link"', 'jrinstaslider' ); ?></strong>
374
  <label class="switch" for="<?php echo $this->get_field_id( 'support_author' ); ?>">
375
  <input class="widefat" id="<?php echo $this->get_field_id( 'support_author' ); ?>" name="<?php echo $this->get_field_name( 'support_author' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['support_author'] ); ?> /><span class="slider round"></span></label>
376
  <br><span class="jr-description"><?php _e( 'When enabled, the author is notified and a backlink website is visible at the bottom of the plugin. <br> <strong>If you enable this option you will have privileged support from our team!</strong>', 'jrinstaslider') ?></span>
377
  </p>
378
+ <div class="donate-buttons">
379
+ <a target="_blank" title="Donate with Paypal!" href="http://bit.ly/2EseW2p"><p class="donate"><span></span>Donate with Paypal!</p></a>
380
+ </div>
381
+ </div></div>
382
+ </div><br>
383
+ <?php
384
+ }
385
 
386
  /**
387
  * Selected array function echoes selected if in array
414
  }
415
  }
416
 
417
+ /**
418
+ * Echoes the Display Instagram Images method
419
+ *
420
+ * @param array $args
421
+ *
422
+ * @return void
423
+ */
424
+ public function instagram_images( $args ) {
425
+ echo $this->display_images( $args );
426
+ }
427
 
428
  /**
429
  * Cron Trigger Function
433
  * @return [type] [description]
434
  */
435
  public function jr_cron_trigger( $username, $refresh_hour, $images ) {
436
+ $search_for = array();
437
  $search_for['username'] = $username;
438
  $this->instagram_data( $search_for, $refresh_hour, $images, true );
439
  }
440
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  /**
442
  * Runs the query for images and returns the html
443
  *
453
  $attachment = isset( $args['attachment'] ) ? true : false;
454
  $template = isset( $args['template'] ) ? $args['template'] : 'slider';
455
  $orderby = isset( $args['orderby'] ) ? $args['orderby'] : 'rand';
456
+ $images_link = isset( $args['images_link'] ) ? $args['images_link'] : 'image_url';
457
  $custom_url = isset( $args['custom_url'] ) ? $args['custom_url'] : '';
458
  $images_number = isset( $args['images_number'] ) ? absint( $args['images_number'] ) : 5;
459
  $columns = isset( $args['columns'] ) ? absint( $args['columns'] ) : 4;
460
  $refresh_hour = isset( $args['refresh_hour'] ) ? absint( $args['refresh_hour'] ) : 5;
461
+ $image_size = isset( $args['image_size'] ) ? $args['image_size'] : 'standard';
462
  $image_link_rel = isset( $args['image_link_rel'] ) ? $args['image_link_rel'] : '';
463
  $no_pin = isset( $args['no_pin'] ) ? $args['no_pin'] : 0;
464
  $image_link_class = isset( $args['image_link_class'] ) ? $args['image_link_class'] : '';
495
  'link_class' => $image_link_class,
496
  'no_pin' => $no_pin,
497
  'caption_words' => $caption_words
498
+ );
499
 
500
  $images_div_class = 'jr-insta-thumb';
501
  $ul_class = ( $template == 'thumbs-no-border' ) ? 'thumbnails no-border jr_col_' . $columns : 'thumbnails jr_col_' . $columns;
557
  $output = __( 'No images found! <br> Try some other hashtag or username', 'jrinstaslider' );
558
 
559
  if ( ( $search == 'user' && $attachment ) ) {
560
+
561
+ if ( !wp_next_scheduled( 'jr_insta_cron', array( $search_for['username'], $refresh_hour, $images_number ) ) ) {
562
+ wp_schedule_single_event( time(), 'jr_insta_cron', array( $search_for['username'], $refresh_hour, $images_number ) );
 
 
 
 
563
  }
564
 
565
  $opt_name = 'jr_insta_' . md5( $search . '_' . $search_for['username'] );
571
  'post_mime_type' => 'image',
572
  'posts_per_page' => $images_number,
573
  'no_found_rows' => true
574
+ );
575
 
576
  if ( $orderby != 'rand' ) {
577
 
582
  $query_args['orderby'] = 'meta_value_num';
583
  $query_args['order'] = $orderby[1];
584
  }
585
+
586
+ if ( isset( $attachment_ids['saved_images'] ) && !empty( $attachment_ids['saved_images'] ) ) {
587
 
588
  $query_args['post__in'] = $attachment_ids['saved_images'];
589
 
594
  'key' => 'jr_insta_username',
595
  'value' => $username,
596
  'compare' => '='
597
+ )
598
+ );
599
  }
600
 
601
  $instagram_images = new WP_Query( $query_args );
606
 
607
  while ( $instagram_images->have_posts() ) : $instagram_images->the_post();
608
 
609
+ $id = get_the_id();
 
 
 
 
 
 
 
 
 
 
 
 
610
 
611
+ if ( 'image_link' == $images_link ) {
612
+ $template_args['link_to'] = get_post_meta( $id, 'jr_insta_link', true );
613
+ } elseif ( 'user_url' == $images_link ) {
614
+ $template_args['link_to'] = 'https://www.instagram.com/' . $username . '/';
615
+ } elseif ( 'image_url' == $images_link ) {
616
+ $template_args['link_to'] = wp_get_attachment_url( $id );
617
+ } elseif ( 'attachment' == $images_link ) {
618
+ $template_args['link_to'] = get_permalink( $id );
619
+ } elseif ( 'custom_url' == $images_link ) {
620
+ $template_args['link_to'] = $custom_url;
621
+ }
622
+
623
+ $image_thumb_url = get_post_meta( $id, 'jr_insta_sizes', true );
624
+ $template_args['image'] = $image_thumb_url[$image_size];
625
+
626
+ $output .= $this->get_template( $template, $template_args );
627
 
628
  endwhile;
629
 
650
 
651
  foreach ( $images_data as $image_data ) {
652
 
653
+ if ( 'image_link' == $images_link ) {
654
  $template_args['link_to'] = $image_data['link'];
655
  } elseif ( 'user_url' == $images_link ) {
656
  $template_args['link_to'] = 'https://www.instagram.com/' . $username . '/';
657
+ } elseif ( 'image_url' == $images_link ) {
658
+ $template_args['link_to'] = $image_data['url'];
659
  } elseif ( 'custom_url' == $images_link ) {
660
  $template_args['link_to'] = $custom_url;
661
  }
662
 
663
+ $template_args['image'] = $image_data['sizes'][$image_size];
664
+ $template_args['caption'] = $image_data['caption'];
665
+ $template_args['timestamp'] = $image_data['timestamp'];
666
+ $template_args['username'] = isset( $image_data['username'] ) ? $image_data['username'] : '';
667
+ $template_args['attachment'] = false;
 
 
 
 
 
 
 
668
 
669
  $output .= $this->get_template( $template, $template_args );
670
  }
698
 
699
  foreach ( $images_data as $image_data ) {
700
 
701
+ if ( 'image_link' == $images_link ) {
702
  $template_args['link_to'] = $image_data['link'];
703
  } elseif ( 'user_url' == $images_link ) {
704
  $template_args['link_to'] = 'https://www.instagram.com/' . $username . '/';
705
+ } elseif ( 'image_url' == $images_link ) {
706
+ $template_args['link_to'] = $image_data['url'];
707
  } elseif ( 'custom_url' == $images_link ) {
708
  $template_args['link_to'] = $custom_url;
709
  }
710
 
711
+ $template_args['image'] = $image_data['sizes'][$image_size];
712
+ $template_args['caption'] = $image_data['caption'];
713
+ $template_args['timestamp'] = $image_data['timestamp'];
714
+ $template_args['username'] = isset( $image_data['username'] ) ? $image_data['username'] : '';
 
 
 
 
 
 
 
715
 
716
  $output .= $this->get_template( $template, $template_args );
717
  }
736
  private function get_template( $template, $args ) {
737
 
738
  $link_to = isset( $args['link_to'] ) ? $args['link_to'] : false;
739
+ $image_url = isset( $args['image'] ) ? $args['image'] : false;
740
 
741
  if ( ( $args['search_for'] == 'user' && $args['attachment'] !== true ) || $args['search_for'] == 'hashtag' ) {
742
  $caption = $args['caption'];
743
  $time = $args['timestamp'];
744
  $username = $args['username'];
 
745
  } else {
746
  $attach_id = get_the_id();
747
  $caption = get_the_excerpt();
748
  $time = get_post_meta( $attach_id, 'jr_insta_timestamp', true );
749
  $username = get_post_meta( $attach_id, 'jr_insta_username', true );
 
 
750
  }
751
 
752
+ $short_caption = wp_trim_words( $caption, 10, '' );
753
  $short_caption = preg_replace("/[^A-Za-z0-9?! ]/","", $short_caption);
754
+ $caption = wp_trim_words( $caption, $args['caption_words'], '' );
755
  $nopin = ( 1 == $args['no_pin'] ) ? 'nopin="nopin"' : '';
756
 
757
  $image_src = '<img src="' . $image_url . '" alt="' . $short_caption . '" title="' . $short_caption . '" '. $nopin . '/>';
901
  function powered_by_link( $support_author ) {
902
 
903
  if ( $support_author ) {
 
904
  $link = $this->domain_data();
905
 
906
  if ( isset( $link['text'] ) && !empty( $link['text'] ) && isset( $link['domain'] ) && !empty( $link['domain'] ) ) {
907
+ $link = '<div style="clear:both;text-align:right;font-size:10px;" >Powered by <a href="'.$link['domain'].'" target="_blank">'.$link['text'].'</a></div>';
908
  } else if ( isset( $link['text'] ) && !empty( $link['text'] ) ) {
909
+ $link = '<div style="clear:both;text-align:right;font-size:10px;" >Powered by '.$link['text'].'</div>';
910
  } else {
911
  $link = '';
912
  }
928
  */
929
  private function instagram_data( $search_for, $cache_hours, $nr_images, $attachment ) {
930
 
931
+ $nr_images = $nr_images <= 12 ? $nr_images : 12;
932
  $blocked_users = isset( $search_for['blocked_users'] ) && !empty( $search_for['blocked_users'] ) ? $search_for['blocked_users'] : false;
933
  if ( isset( $search_for['username'] ) && !empty( $search_for['username'] ) ) {
934
  $search = 'user';
951
  'cache_hours' => $cache_hours,
952
  'nr_images' => $nr_images,
953
  'attachment' => $attachment
954
+ );
955
 
956
  if ( true === $this->trigger_refresh_data( $instaData, $old_opts, $new_opts ) ) {
957
 
962
  $old_opts['cache_hours'] = $cache_hours;
963
  $old_opts['nr_images'] = $nr_images;
964
  $old_opts['attachment'] = $attachment;
965
+
966
  if ( 'user' == $search ) {
967
+ $url = str_replace( '{username}', urlencode( trim( $search_string ) ), self::USERNAME_URL );
968
+ $response = wp_remote_get( $url, array( 'sslverify' => false, 'timeout' => 60 ) );
969
  } else {
970
+ $url = str_replace( '{tag}', urlencode( trim( $search_string ) ), self::TAG_URL );
971
+ $response = wp_remote_get( $url, array( 'sslverify' => false, 'timeout' => 60 ) );
972
 
973
  }
974
 
978
  }
979
 
980
  if ( $response['response']['code'] == 200 ) {
981
+
982
+ $results = json_decode( $response['body'], true );
983
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984
  if ( $results && is_array( $results ) ) {
985
 
986
  if ( 'user' == $search ) {
987
+ $entry_data = isset($results['graphql']['user']['edge_owner_to_timeline_media']['edges']) ? $results['graphql']['user']['edge_owner_to_timeline_media']['edges'] : array();
988
  } else {
989
+ $entry_data = isset( $results['graphql']['hashtag']['edge_hashtag_to_media']['edges'] ) ? $results['graphql']['hashtag']['edge_hashtag_to_media']['edges'] : array();
990
  }
991
 
992
 
993
  if ( empty( $entry_data ) ) {
994
  return __( 'No images found', 'jrinstaslider');
995
  }
 
 
 
 
996
 
997
+ foreach ( $entry_data as $current => $result ) {
 
 
 
998
 
999
+
1000
+ $result = $result['node'];
1001
+
1002
  if ( 'hashtag' == $search ) {
1003
+
1004
  if ( in_array( $result['owner']['id'], $blocked_users_array ) ) {
1005
  $nr_images++;
1006
  continue;
1007
+ }
1008
+ }
1009
+
1010
+ if ( $result['is_video'] == true ) {
1011
+ $nr_images++;
1012
+ continue;
1013
  }
1014
 
1015
+
1016
  if ( $current >= $nr_images ) {
1017
  break;
1018
  }
 
 
 
 
 
 
 
 
 
 
 
1019
 
1020
+ $image_data = $this->media_model( $result );
1021
+
1022
+ if ( 'user' == $search ) {
1023
+ $image_data['username'] = $search_string;
1024
+ }
1025
+
1026
  if ( ( $search == 'hashtag' ) || ( $search == 'user' && !$attachment ) ) {
1027
 
1028
  $instaData[] = $image_data;
1036
  $this->update_wp_attachment( $old_opts['saved_images'][$image_data['id']], $image_data );
1037
 
1038
  $instaData[$image_data['id']] = $old_opts['saved_images'][$image_data['id']];
1039
+
1040
+ } else {
1041
+ unset( $old_opts['saved_images'][$image_data['id']] );
1042
+ }
1043
 
1044
  } else {
1045
 
1082
  return $instaData;
1083
  }
1084
 
1085
+
1086
+ /**
1087
+ * @param string $imageUrl
1088
+ *
1089
+ * @return array
1090
+ */
1091
+ private function get_thumbnail_urls( $thumbnails ) {
1092
+
1093
+ $image_thumbnails = array();
1094
+
1095
+ foreach ( $thumbnails as $thumbnail ) {
1096
+
1097
+ switch ( $thumbnail['config_width'] ) {
1098
+ case '150':
1099
+ $image_thumbnails['thumbnail'] = $thumbnail['src'];
1100
+ break;
1101
+ case '320':
1102
+ $image_thumbnails['low'] = $thumbnail['src'];
1103
+ break;
1104
+ case '640':
1105
+ $image_thumbnails['standard'] = $thumbnail['src'];
1106
+ break;
1107
+ }
1108
+ }
1109
+
1110
+ return $image_thumbnails;
1111
+ }
1112
+
1113
+
1114
+ /**
1115
+ * Media Model
1116
+ * @param [type] $medias_array [description]
1117
+ * @return [type] [description]
1118
+ */
1119
+ private function media_model( $medias_array ) {
1120
+
1121
+ $medias_model = array();
1122
+
1123
+ foreach ( $medias_array as $prop => $value ) {
1124
+
1125
+ switch ( $prop ) {
1126
+ case 'id':
1127
+ $medias_model['id'] = $value;
1128
+ break;
1129
+ case 'code':
1130
+ case 'shortcode':
1131
+ $medias_model['code'] = $value;
1132
+ $medias_model['link'] = 'https://www.instagram.com/p/'. $value . '/';
1133
+ break;
1134
+ case 'owner':
1135
+ $medias_model['user_id'] = $value['id'];
1136
+ break;
1137
+ case 'caption':
1138
+ $medias_model['caption'] = $this->sanitize( $value );
1139
+ break;
1140
+ case 'edge_media_to_caption':
1141
+ if ( !empty( $value['edges'] ) ) {
1142
+ $first_caption = $value['edges'][0];
1143
+ if ( isset( $first_caption['node']['text'] ) ) {
1144
+ $medias_model['caption'] = $this->sanitize( $value['edges'][0]['node']['text'] );
1145
+ }
1146
+ }
1147
+ break;
1148
+ case 'date':
1149
+ case 'taken_at_timestamp':
1150
+ $medias_model['timestamp'] = (float) $value;
1151
+ break;
1152
+ case 'dimensions':
1153
+ $medias_model['height'] = $value['height'];
1154
+ $medias_model['width'] = $value['width'];
1155
+ break;
1156
+ case 'display_url':
1157
+ case 'display_src':
1158
+ $medias_model['url'] = $value;
1159
+ if ( isset( $medias_model['sizes'] ) ) {
1160
+ $medias_model['sizes']['full'] = $value;
1161
+ }
1162
+ break;
1163
+ case 'edge_liked_by':
1164
+ case 'likes':
1165
+ $medias_model['likes_count'] = $value['count'];
1166
+ break;
1167
+ case 'edge_media_to_comment':
1168
+ case 'comments':
1169
+ $medias_model['comment_count'] = $value['count'];
1170
+ break;
1171
+ case 'thumbnail_resources':
1172
+ $medias_model['sizes'] = $this->get_thumbnail_urls( $value );
1173
+ if ( isset( $medias_model['url'] ) ) {
1174
+ $medias_model['sizes']['full'] = $medias_model['url'];
1175
+ }
1176
+ break;
1177
+ }
1178
+
1179
+ if ( isset( $medias_model['comment_count'] ) && isset( $medias_model['likes_count'] ) ) {
1180
+ $medias_model['popularity'] = (int) ( $medias_model['comment_count'] ) + ( $medias_model['likes_count'] );
1181
+ }
1182
+ }
1183
+
1184
+ return $medias_model;
1185
+ }
1186
+
1187
+
1188
  /**
1189
  * Remove Duplicates
1190
  * @return [type] [description]
1202
  'key' => 'jr_insta_username',
1203
  'compare' => '=',
1204
  'value' => $username
 
1205
  ),
1206
+ ),
1207
+ );
1208
 
1209
  $savedinsta = new WP_Query( $savedinsta_args );
1210
 
1242
  $post = $_POST;
1243
  $return = array(
1244
  'deleted' => $this->clean_duplicates( $post['username'] )
1245
+ );
1246
 
1247
  wp_send_json( $return );
1248
  }
1265
  if ( isset( $user_ids[$user] ) ) {
1266
  continue;
1267
  }
1268
+
1269
+ $url = str_replace( '{username}', urlencode( trim( $user ) ), self::USERNAME_URL );
1270
+ $response = wp_remote_get( $url, array( 'sslverify' => false, 'timeout' => 60 ) );
1271
 
1272
  if ( is_wp_error( $response ) ) {
1273
 
1276
 
1277
  if ( $response['response']['code'] == 200 ) {
1278
 
1279
+ $results = json_decode( $response['body'], true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1280
 
1281
  if ( $results && is_array( $results ) ) {
1282
 
1283
+ $user_id = isset( $results['user']['id'] ) ? $results['user']['id'] : false;
1284
 
1285
  if ( $user_id ) {
1286
 
1309
  * @param array image_data
1310
  * @return void
1311
  */
1312
+ private function update_wp_attachment( $attachment_ID, $image_data ) {
 
1313
  update_post_meta( $attachment_ID, 'jr_insta_popularity', $image_data['popularity'] );
1314
+ update_post_meta( $attachment_ID, 'jr_insta_likes_count', $image_data['likes_count'] );
1315
+ update_post_meta( $attachment_ID, 'jr_insta_comment_count', $image_data['comment_count'] );
1316
  }
1317
 
1318
  /**
1326
  */
1327
  private function save_wp_attachment( $image_data ) {
1328
 
1329
+ $image_info = pathinfo( $image_data['url'] );
 
 
 
1330
 
1331
+ if ( !in_array( $image_info['extension'], array( 'jpg', 'jpe', 'jpeg' ) ) ) {
1332
  return false;
1333
  }
 
 
 
 
 
 
 
1334
 
1335
+ $attachment = array(
1336
+ 'guid' => $image_data['url'],
1337
+ 'post_mime_type' => 'image/jpeg',
1338
+ 'post_title' => preg_replace( '/\.[^.]+$/', '', $image_info['basename'] ),
1339
+ 'post_excerpt' => $image_data['caption']
1340
+ );
1341
 
1342
+ $attachment_metadata = array( 'width' => $image_data['width'], 'height' => $image_data['height'], 'file' => $image_info['basename'] );
1343
+ $attachment_metadata['sizes'] = array( 'full' => $attachment_metadata );
1344
+ $id = wp_insert_attachment( $attachment );
1345
+ wp_update_attachment_metadata( $id, $attachment_metadata );
 
1346
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1347
 
1348
  unset( $image_data['caption'] );
1349
 
1372
  "label" => __( "Instagram Username" ),
1373
  "input" => "html",
1374
  "html" => "<span style='line-height:31px'><a target='_blank' href='https://www.instagram.com/{$instagram_username}/'>{$instagram_username}</a></span>"
1375
+ );
1376
 
1377
  $instagram_link = get_post_meta( $post->ID, 'jr_insta_link', true );
1378
  if ( !empty( $instagram_link ) ) {
1380
  "label" => __( "Instagram Image" ),
1381
  "input" => "html",
1382
  "html" => "<span style='line-height:31px'><a target='_blank' href='{$instagram_link}'>{$instagram_link}</a></span>"
1383
+ );
1384
  }
1385
 
1386
  $instagram_date = get_post_meta( $post->ID, 'jr_insta_timestamp', true );
1390
  "label" => __( "Posted on Instagram" ),
1391
  "input" => "html",
1392
  "html" => "<span style='line-height:31px'>{$instagram_date}</span>"
1393
+ );
1394
  }
1395
  }
1396
 
readme.txt CHANGED
@@ -1,29 +1,30 @@
1
  === Instagram Slider Widget ===
2
  Contributors: jetonr
3
  Tags: instagram, slider, widget, images
4
- Donate link: http://goo.gl/RZiu34
5
  Requires at least: 3.5
6
- Tested up to: 4.7.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Instagram Slider Widget is a responsive slider widget that shows 12 latest images from a public instagram user or up to 18 images from a hashtag.
11
 
12
  == Description ==
13
- = Instagram Slider Widget is a responsive slider widget that shows 12 latest images from a public instagram user or up to 18 images from a hashtag. =
14
 
15
 
16
  = Features =
17
  * Images from Instagram are imported as WordPress attachments
18
  * Display Images in Slider or Thumbnails
19
  * No API Key Needed
20
- * Link images to user profile, image URL, locally saved image, attachment URL, custom URL or none
21
  * Sort images Randomly, Popularity, Date
22
  * For more info visit http://instagram.jrwebstudio.com
23
 
24
  = Where can I get support =
25
  I will try to respond to all on plugin support forum but users showing back-link on their website will be more privileged!
26
 
 
27
  = If you like this plugin. Rate it and Donate =
28
 
29
  == Installation ==
@@ -45,6 +46,15 @@ I will try to respond to all on plugin support forum but users showing back-link
45
  3. Backend Configuration
46
 
47
  == Changelog ==
 
 
 
 
 
 
 
 
 
48
  = 1.4.0 =
49
  * Fixed the issue where duplicate images were being inserted into Media Library
50
  * Added a button in widget to remove previously created duplicate images
1
  === Instagram Slider Widget ===
2
  Contributors: jetonr
3
  Tags: instagram, slider, widget, images
4
+ Donate link: http://bit.ly/2EseW2p
5
  Requires at least: 3.5
6
+ Tested up to: 4.9.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Instagram Slider Widget is a responsive slider widget that shows 12 latest images from a public instagram user or a hashtag.
11
 
12
  == Description ==
13
+ = Instagram Slider Widget is a responsive slider widget that shows 12 latest images from a public instagram user or a hashtag. =
14
 
15
 
16
  = Features =
17
  * Images from Instagram are imported as WordPress attachments
18
  * Display Images in Slider or Thumbnails
19
  * No API Key Needed
20
+ * Link images to user profile, image URL, attachment URL, custom URL or none
21
  * Sort images Randomly, Popularity, Date
22
  * For more info visit http://instagram.jrwebstudio.com
23
 
24
  = Where can I get support =
25
  I will try to respond to all on plugin support forum but users showing back-link on their website will be more privileged!
26
 
27
+
28
  = If you like this plugin. Rate it and Donate =
29
 
30
  == Installation ==
46
  3. Backend Configuration
47
 
48
  == Changelog ==
49
+
50
+ = 1.4.2 =
51
+ * Minor fix for instagram json change
52
+
53
+ = 1.4.1 =
54
+ * Fixed Instagram update that stoped hashtags from working
55
+ * Fixed hellip that showed when using wp trim words
56
+ * Modified the function that saved images localy to only save as attachments
57
+
58
  = 1.4.0 =
59
  * Fixed the issue where duplicate images were being inserted into Media Library
60
  * Added a button in widget to remove previously created duplicate images