WD Instagram Feed – Instagram Gallery - Version 1.1.17

Version Description

New: Option in feed settings to show small size images and low-bandwidth videos when viewed in mobile devices
Fixed: Escaping in custom JS
Change: WP 4.7 compatibility - language of frontend content in AJAX response

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 WD Instagram Feed – Instagram Gallery
Version 1.1.17
Comparing to
See all releases

Code changes from version 1.1.16 to 1.1.17

admin-functions.php CHANGED
@@ -169,6 +169,8 @@ function wdi_install(){
169
  show_username_on_thumb varchar(32) NOT NULL,
170
  conditional_filter_enable varchar(1) NOT NULL,
171
  liked_feed varchar(30) NOT NULL,
 
 
172
  UNIQUE KEY id (id)
173
  ) $charset_collate;";
174
 
169
  show_username_on_thumb varchar(32) NOT NULL,
170
  conditional_filter_enable varchar(1) NOT NULL,
171
  liked_feed varchar(30) NOT NULL,
172
+ mobile_breakpoint varchar(10) NOT NULL,
173
+
174
  UNIQUE KEY id (id)
175
  ) $charset_collate;";
176
 
admin/controllers/WDIControllerFeeds_wdi.php CHANGED
@@ -108,6 +108,9 @@ class WDIControllerFeeds_wdi {
108
  '%d',/*show_username_on_thumb*/
109
  '%d',//'conditional_filter_enable'=>'0',
110
  '%s',//'liked_feed' => 'string'
 
 
 
111
  );
112
  }
113
  private function display() {
108
  '%d',/*show_username_on_thumb*/
109
  '%d',//'conditional_filter_enable'=>'0',
110
  '%s',//'liked_feed' => 'string'
111
+ '%d',//'mobile_breakpoint'=>'640',
112
+
113
+
114
  );
115
  }
116
  private function display() {
admin/models/WDIModelFeeds_wdi.php CHANGED
@@ -142,6 +142,7 @@ class WDIModelFeeds_wdi {
142
  'show_username_on_thumb'=>'0',
143
  'conditional_filter_enable'=>'0',
144
  'liked_feed' => 'userhash',
 
145
  );
146
  return $settings;
147
  }
@@ -211,6 +212,7 @@ class WDIModelFeeds_wdi {
211
  'conditional_filter_enable'=>'number',
212
  'conditional_filter_type' => 'string',
213
  'liked_feed' => 'string',
 
214
  );
215
  return $sanitize_types;
216
  }
142
  'show_username_on_thumb'=>'0',
143
  'conditional_filter_enable'=>'0',
144
  'liked_feed' => 'userhash',
145
+ 'mobile_breakpoint' => '640',
146
  );
147
  return $settings;
148
  }
212
  'conditional_filter_enable'=>'number',
213
  'conditional_filter_type' => 'string',
214
  'liked_feed' => 'string',
215
+ 'mobile_breakpoint' => 'number',
216
  );
217
  return $sanitize_types;
218
  }
admin/views/WDIViewFeeds_wdi.php CHANGED
@@ -233,6 +233,7 @@ public function getFormElements($current_id=''){
233
  'display_user_post_follow_number' => array('name'=>'display_user_post_follow_number','title'=>__('Display User Posts and Followers count',"wdi"),'type'=>'checkbox','tooltip'=>'','attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'thumbnails,masonry,blog_style,image_browser'))),
234
  'show_full_description' => array('name'=>'show_full_description','title'=>__('Show Full Description',"wdi"),'type'=>'checkbox','tooltip'=>__('Discription will be shown no matter how long it is',"wdi"),'attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'masonry'))),
235
  'disable_mobile_layout' => array('name'=>'disable_mobile_layout','title'=>__('Disable Mobile Layout',"wdi"),'type'=>'checkbox','tooltip'=>__('Column number stays the same in all screens',"wdi"),'attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'thumbnails,masonry'))),
 
236
  'feed_item_onclick' => array('name'=>'feed_item_onclick','title'=>__('Image Onclick',"wdi"),'type'=>'radio','valid_options'=>array('lightbox'=>__('Open Lightbox',"wdi"),'instagram'=>__('Redirect To Instagram',"wdi"),'none'=>__('Do Nothing',"wdi")),'break'=>'true','tooltip'=>'','attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'thumbnails,masonry,blog_style,image_browser'))),
237
  //lightbox settings
238
  'popup_fullscreen' => array('name'=>'popup_fullscreen','title'=>__('Full width lightbox',"wdi"),'type'=>'radio','valid_options'=>array('1'=>__('Yes',"wdi"),'0'=>__('No',"wdi")),'tooltip'=>'','attr'=>array(array('name'=>'tab','value'=>'lightbox_settings'))),
233
  'display_user_post_follow_number' => array('name'=>'display_user_post_follow_number','title'=>__('Display User Posts and Followers count',"wdi"),'type'=>'checkbox','tooltip'=>'','attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'thumbnails,masonry,blog_style,image_browser'))),
234
  'show_full_description' => array('name'=>'show_full_description','title'=>__('Show Full Description',"wdi"),'type'=>'checkbox','tooltip'=>__('Discription will be shown no matter how long it is',"wdi"),'attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'masonry'))),
235
  'disable_mobile_layout' => array('name'=>'disable_mobile_layout','title'=>__('Disable Mobile Layout',"wdi"),'type'=>'checkbox','tooltip'=>__('Column number stays the same in all screens',"wdi"),'attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'thumbnails,masonry'))),
236
+ 'mobile_breakpoint' => array('name'=>'mobile_breakpoint','title'=>__('Window width breakpoint for small size media',"wdi"),'type'=>'input','input_type'=>'number','tooltip'=>__('Load media of smaller size from Instagram if browser width is smaller than this value. Faster loading in mobile devices. Set the value about 320px to always load large-size media.',"wdi"),'attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'thumbnails,masonry,blog_style,image_browser'))),
237
  'feed_item_onclick' => array('name'=>'feed_item_onclick','title'=>__('Image Onclick',"wdi"),'type'=>'radio','valid_options'=>array('lightbox'=>__('Open Lightbox',"wdi"),'instagram'=>__('Redirect To Instagram',"wdi"),'none'=>__('Do Nothing',"wdi")),'break'=>'true','tooltip'=>'','attr'=>array(array('name'=>'tab','value'=>'feed_settings'),array('name'=>'section','value'=>'thumbnails,masonry,blog_style,image_browser'))),
238
  //lightbox settings
239
  'popup_fullscreen' => array('name'=>'popup_fullscreen','title'=>__('Full width lightbox',"wdi"),'type'=>'radio','valid_options'=>array('1'=>__('Yes',"wdi"),'0'=>__('No',"wdi")),'tooltip'=>'','attr'=>array(array('name'=>'tab','value'=>'lightbox_settings'))),
frontend/shortcode.php CHANGED
@@ -111,7 +111,7 @@ function wdi_feed($atts,$widget_params='') {
111
  if(isset($wdi_options['wdi_custom_js'])){
112
  ?>
113
  <script>
114
- <?php echo stripcslashes($wdi_options['wdi_custom_js']);?>
115
  </script>
116
  <?php
117
  }
111
  if(isset($wdi_options['wdi_custom_js'])){
112
  ?>
113
  <script>
114
+ <?php echo htmlspecialchars_decode(stripcslashes($wdi_options['wdi_custom_js']));?>
115
  </script>
116
  <?php
117
  }
js/wdi_frontend.js CHANGED
@@ -1244,29 +1244,39 @@ wdi_front.createObject = function (obj, currentFeed)
1244
  {
1245
 
1246
  var caption = (obj['caption'] != null) ? obj['caption']['text'] : '&nbsp';
1247
- var image_url;
1248
- if (window.innerWidth >= 640) {
 
 
 
1249
  image_url = obj['images']['standard_resolution']['url'];
1250
  if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
1251
  image_url = obj['link'] + 'media?size=l';
1252
  }
 
 
 
1253
  }
1254
- if (window.innerWidth >= 150 && window.innerWidth < 640) {
1255
  image_url = obj['images']['low_resolution']['url'];
1256
  if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
1257
  image_url = obj['link'] + 'media?size=l';
1258
  }
 
 
 
1259
  }
1260
- if (window.innerWidth < 150) {
1261
  image_url = obj['images']['thumbnail']['url'];
1262
  if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
1263
  image_url = obj['link'] + 'media?size=m';
1264
  }
 
 
 
1265
  }
1266
- var videoUrl = '';
1267
- if (obj['type'] == 'video') {
1268
- videoUrl = obj['videos']['standard_resolution']['url'];
1269
- }
1270
  var imageIndex = currentFeed.imageIndex;
1271
 
1272
  var photoObject = {
1244
  {
1245
 
1246
  var caption = (obj['caption'] != null) ? obj['caption']['text'] : '&nbsp';
1247
+
1248
+ var image_url = '';
1249
+ var videoUrl = '';
1250
+
1251
+ if (window.innerWidth >= currentFeed.feed_row.mobile_breakpoint) {
1252
  image_url = obj['images']['standard_resolution']['url'];
1253
  if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
1254
  image_url = obj['link'] + 'media?size=l';
1255
  }
1256
+ if (obj['type'] == 'video') {
1257
+ videoUrl = obj['videos']['standard_resolution']['url'];
1258
+ }
1259
  }
1260
+ if (window.innerWidth >= currentFeed.feed_row.mobile_breakpoint/4 && window.innerWidth < currentFeed.feed_row.mobile_breakpoint) {
1261
  image_url = obj['images']['low_resolution']['url'];
1262
  if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
1263
  image_url = obj['link'] + 'media?size=l';
1264
  }
1265
+ if (obj['type'] == 'video') {
1266
+ videoUrl = obj['videos']['low_bandwidth']['url'];
1267
+ }
1268
  }
1269
+ if (window.innerWidth < currentFeed.feed_row.mobile_breakpoint/4) {
1270
  image_url = obj['images']['thumbnail']['url'];
1271
  if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
1272
  image_url = obj['link'] + 'media?size=m';
1273
  }
1274
+ if (obj['type'] == 'video') {
1275
+ videoUrl = obj['videos']['low_resolution']['url'];
1276
+ }
1277
  }
1278
+
1279
+
 
 
1280
  var imageIndex = currentFeed.imageIndex;
1281
 
1282
  var photoObject = {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webdorado, progmastery
3
  Donate link: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
4
  Tags: : custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, Instagram wall, lightbox, photos
5
  Requires at least: 3.9
6
- Tested up to: 4.6
7
- Stable tag: 1.1.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -107,6 +107,11 @@ After downloading the ZIP file of the Instagram Feed WD plugin,
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
110
  = 1.1.16 =
111
  Fixed: Unicode "paragraph separator" symbol in media caption crashes lightbox
112
  Fixed: Javascript error in admin feed page and styling issue in lightbox because of some non-standard themes
3
  Donate link: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
4
  Tags: : custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, Instagram wall, lightbox, photos
5
  Requires at least: 3.9
6
+ Tested up to: 4.7
7
+ Stable tag: 1.1.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
107
 
108
  == Changelog ==
109
 
110
+ = 1.1.17 =
111
+ New: Option in feed settings to show small size images and low-bandwidth videos when viewed in mobile devices
112
+ Fixed: Escaping in custom JS
113
+ Change: WP 4.7 compatibility - language of frontend content in AJAX response
114
+
115
  = 1.1.16 =
116
  Fixed: Unicode "paragraph separator" symbol in media caption crashes lightbox
117
  Fixed: Javascript error in admin feed page and styling issue in lightbox because of some non-standard themes
update/wdi_update.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /**
3
- * @param version without first '1' or '2'
4
- *
5
- */
6
 
7
  function wdi_update_diff($new_v, $old_v = 0.0){
8
  global $wpdb;
9
  @ini_set('max_execution_time', 60);
10
 
11
  if(version_compare($old_v, "0.6", '<')){
12
-
13
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `conditional_filters` varchar(10000) NOT NULL DEFAULT ''");
14
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `conditional_filter_type` varchar(32) NOT NULL DEFAULT 'none'");
15
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `show_username_on_thumb` varchar(32) NOT NULL DEFAULT '0'");
@@ -19,7 +19,7 @@ function wdi_update_diff($new_v, $old_v = 0.0){
19
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `th_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
20
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'");
21
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
22
-
23
  require_once(WDI_DIR . '/framework/WDILibraryEmbed.php');
24
 
25
  /*set master user id*/
@@ -30,7 +30,7 @@ function wdi_update_diff($new_v, $old_v = 0.0){
30
  }
31
  $wdi_options["wdi_user_id"] = $master_user_id ? $master_user_id : '';
32
  update_option(WDI_OPT, $wdi_options);
33
-
34
  /*set ids in feeds*/
35
  $feeds = $wpdb->get_results( 'SELECT * FROM '.$wpdb->prefix . WDI_FEED_TABLE, ARRAY_A );
36
  foreach ($feeds as $feed) {
@@ -42,24 +42,24 @@ function wdi_update_diff($new_v, $old_v = 0.0){
42
  $current_user_id = $username;
43
  }
44
  else{
45
- $current_user_id = WDILibraryEmbed::get_instagram_id_by_username($username);
46
  }
47
-
48
  $current_user = new stdClass();
49
- $current_user->username = $username;
50
- $current_user->id = $current_user_id;
51
- array_push($users_new, $current_user);
52
  }
53
  $users_new_json = json_encode($users_new);
54
  /*save current feed data into WPDB*/
55
- $wpdb->update(
56
- $wpdb->prefix . WDI_FEED_TABLE,
57
- array(
58
  'feed_users' => $users_new_json,
59
- ),
60
- array( 'id' => $feed['id'] )
61
  );
62
- }
63
  }
64
 
65
  if(version_compare($old_v, "0.7", '<')){
@@ -70,19 +70,23 @@ function wdi_update_diff($new_v, $old_v = 0.0){
70
  /*add api update notice*/
71
  $admin_notices_option = get_option('wdi_admin_notice', array());
72
  $admin_notices_option['api_update_token_reset'] = array(
73
- 'start' => current_time("n/j/Y"),
74
- 'int' => 0,
75
- //'dismissed' => 1,
76
- );
77
  update_option('wdi_admin_notice', $admin_notices_option);
78
  }
79
  if(version_compare($old_v, "1.2", '<')){
80
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " convert to character set latin1 collate latin1_general_ci");
81
  }
82
-
83
  if(version_compare($old_v, "1.12", '<')){
84
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `liked_feed` varchar(30) NOT NULL DEFAULT 'userhash'");
85
  }
 
 
 
 
 
86
 
87
  }
88
 
1
  <?php
2
  /**
3
+ * @param version without first '1' or '2'
4
+ *
5
+ */
6
 
7
  function wdi_update_diff($new_v, $old_v = 0.0){
8
  global $wpdb;
9
  @ini_set('max_execution_time', 60);
10
 
11
  if(version_compare($old_v, "0.6", '<')){
12
+
13
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `conditional_filters` varchar(10000) NOT NULL DEFAULT ''");
14
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `conditional_filter_type` varchar(32) NOT NULL DEFAULT 'none'");
15
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `show_username_on_thumb` varchar(32) NOT NULL DEFAULT '0'");
19
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `th_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
20
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_bg_color` varchar(32) NOT NULL DEFAULT '#429FFF'");
21
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " ADD `mas_thumb_user_color` varchar(32) NOT NULL DEFAULT '#FFFFFF'");
22
+
23
  require_once(WDI_DIR . '/framework/WDILibraryEmbed.php');
24
 
25
  /*set master user id*/
30
  }
31
  $wdi_options["wdi_user_id"] = $master_user_id ? $master_user_id : '';
32
  update_option(WDI_OPT, $wdi_options);
33
+
34
  /*set ids in feeds*/
35
  $feeds = $wpdb->get_results( 'SELECT * FROM '.$wpdb->prefix . WDI_FEED_TABLE, ARRAY_A );
36
  foreach ($feeds as $feed) {
42
  $current_user_id = $username;
43
  }
44
  else{
45
+ $current_user_id = WDILibraryEmbed::get_instagram_id_by_username($username);
46
  }
47
+
48
  $current_user = new stdClass();
49
+ $current_user->username = $username;
50
+ $current_user->id = $current_user_id;
51
+ array_push($users_new, $current_user);
52
  }
53
  $users_new_json = json_encode($users_new);
54
  /*save current feed data into WPDB*/
55
+ $wpdb->update(
56
+ $wpdb->prefix . WDI_FEED_TABLE,
57
+ array(
58
  'feed_users' => $users_new_json,
59
+ ),
60
+ array( 'id' => $feed['id'] )
61
  );
62
+ }
63
  }
64
 
65
  if(version_compare($old_v, "0.7", '<')){
70
  /*add api update notice*/
71
  $admin_notices_option = get_option('wdi_admin_notice', array());
72
  $admin_notices_option['api_update_token_reset'] = array(
73
+ 'start' => current_time("n/j/Y"),
74
+ 'int' => 0,
75
+ //'dismissed' => 1,
76
+ );
77
  update_option('wdi_admin_notice', $admin_notices_option);
78
  }
79
  if(version_compare($old_v, "1.2", '<')){
80
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_THEME_TABLE . " convert to character set latin1 collate latin1_general_ci");
81
  }
 
82
  if(version_compare($old_v, "1.12", '<')){
83
  $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `liked_feed` varchar(30) NOT NULL DEFAULT 'userhash'");
84
  }
85
+ if(version_compare($old_v, "1.17", '<')){
86
+ $wpdb->query("ALTER TABLE " . $wpdb->prefix . WDI_FEED_TABLE . " ADD `mobile_breakpoint` varchar(10) NOT NULL DEFAULT '640'");
87
+ }
88
+
89
+
90
 
91
  }
92
 
wd-instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Instagram Feed WD
4
  Plugin URI: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
5
  Description: WD Instagram Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
- Version: 1.1.16
7
  Author: WebDorado
8
  Author URI: https://web-dorado.com
9
  License: GPLv2 or later
@@ -20,7 +20,7 @@ define("WDI_META", "_".WDI_VAR."_meta");
20
  //define("wdi",'wdi');
21
  define('WDI_FEED_TABLE','wdi_feeds');
22
  define('WDI_THEME_TABLE','wdi_themes');
23
- define('WDI_VERSION','1.1.16');
24
  define('WDI_IS_PRO','false');
25
 
26
 
@@ -55,6 +55,10 @@ add_action('wp_ajax_WDIGalleryBox', 'wdi_ajax_frontend');
55
  add_action('wp_ajax_nopriv_WDIGalleryBox', 'wdi_ajax_frontend');
56
  function wdi_ajax_frontend() {
57
 
 
 
 
 
58
 
59
  require_once(WDI_DIR . '/framework/WDILibrary.php');
60
  $page = WDILibrary::get('action');
3
  Plugin Name: Instagram Feed WD
4
  Plugin URI: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
5
  Description: WD Instagram Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
+ Version: 1.1.17
7
  Author: WebDorado
8
  Author URI: https://web-dorado.com
9
  License: GPLv2 or later
20
  //define("wdi",'wdi');
21
  define('WDI_FEED_TABLE','wdi_feeds');
22
  define('WDI_THEME_TABLE','wdi_themes');
23
+ define('WDI_VERSION','1.1.17');
24
  define('WDI_IS_PRO','false');
25
 
26
 
55
  add_action('wp_ajax_nopriv_WDIGalleryBox', 'wdi_ajax_frontend');
56
  function wdi_ajax_frontend() {
57
 
58
+ /* reset from user to site locale*/
59
+ if(function_exists('switch_to_locale')){
60
+ switch_to_locale( get_locale() );
61
+ }
62
 
63
  require_once(WDI_DIR . '/framework/WDILibrary.php');
64
  $page = WDILibrary::get('action');