Instagram Feed - Version 2.8.1

Version Description

  • Fix: Fixed a PHP warning which would display in some situations: "array_diff(): Expected parameter 1 to be an array, string given".
  • Fix: Fixed PHP warning "Undefined index: accesstoken" which would display when no primary account was selected.
  • Fix: Fixed issue where account errors were not being removed after an account was deleted or reconnected.
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Instagram Feed
Version 2.8.1
Comparing to
See all releases

Code changes from version 2.8 to 2.8.1

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon, craig-at-smash-balloon
3
  Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
4
  Requires at least: 3.4
5
  Tested up to: 5.6
6
- Stable tag: 2.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -332,6 +332,11 @@ We understand that sometimes you need help, have issues or just have questions.
332
  * Plus more customization options added all the time!
333
 
334
  == Changelog ==
 
 
 
 
 
335
  = 2.8 =
336
  * New: The locations of the Instagram feeds on your site will now be logged and listed on a single page for easier management. After this feature has been active for awhile, a "Feed Finder" link will appear next to the Feed Type setting on the plugin Settings page which allows you to see a list of all feeds on your site along with their locations.
337
  * New: Local resized images will now include a 150x150 resolution version for each post.
3
  Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
4
  Requires at least: 3.4
5
  Tested up to: 5.6
6
+ Stable tag: 2.8.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
332
  * Plus more customization options added all the time!
333
 
334
  == Changelog ==
335
+ = 2.8.1 =
336
+ * Fix: Fixed a PHP warning which would display in some situations: "array_diff(): Expected parameter 1 to be an array, string given".
337
+ * Fix: Fixed PHP warning "Undefined index: accesstoken" which would display when no primary account was selected.
338
+ * Fix: Fixed issue where account errors were not being removed after an account was deleted or reconnected.
339
+
340
  = 2.8 =
341
  * New: The locations of the Instagram feeds on your site will now be logged and listed on a single page for easier management. After this feature has been active for awhile, a "Feed Finder" link will appear next to the Feed Type setting on the plugin Settings page which allows you to see a list of all feeds on your site along with their locations.
342
  * New: Local resized images will now include a 150x150 resolution version for each post.
inc/admin/actions.php CHANGED
@@ -278,7 +278,7 @@ function sbi_do_account_delete( $account_id ) {
278
  $options = get_option( 'sb_instagram_settings', array() );
279
  $connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
280
  global $sb_instagram_posts_manager;
281
- $sb_instagram_posts_manager->remove_connected_account_error( $connected_accounts[ $account_id ] );
282
  wp_cache_delete ( 'alloptions', 'options' );
283
  $username = $connected_accounts[ $account_id ]['username'];
284
  $sb_instagram_posts_manager->add_action_log( 'Deleting account ' . $username );
278
  $options = get_option( 'sb_instagram_settings', array() );
279
  $connected_accounts = isset( $options['connected_accounts'] ) ? $options['connected_accounts'] : array();
280
  global $sb_instagram_posts_manager;
281
+ $sb_instagram_posts_manager->reset_api_errors();
282
  wp_cache_delete ( 'alloptions', 'options' );
283
  $username = $connected_accounts[ $account_id ]['username'];
284
  $sb_instagram_posts_manager->add_action_log( 'Deleting account ' . $username );
inc/class-sb-instagram-feed-locator.php CHANGED
@@ -132,8 +132,12 @@ class SB_Instagram_Feed_Locator
132
  $unknown_match = false;
133
 
134
  foreach ( $this->matching_entries as $index => $matching_entry ) {
135
- $atts = is_array( $this->feed_details['atts'] ) ? $this->feed_details['atts'] : array();
136
- $atts_diff = array_diff( json_decode( $matching_entry['shortcode_atts'], true ), $atts ); // determines if the shortcode settings match the shortcode settings of an existing feed
 
 
 
 
137
  if ( empty( $atts_diff ) ) {
138
  $matching_indices[] = $matching_entry['id'];
139
  if ( $matching_entry['html_location'] === $this->feed_details['location']['html'] ) {
132
  $unknown_match = false;
133
 
134
  foreach ( $this->matching_entries as $index => $matching_entry ) {
135
+ $details_atts = is_array( $this->feed_details['atts'] ) ? $this->feed_details['atts'] : array();
136
+ $matching_atts = json_decode( $matching_entry['shortcode_atts'], true );
137
+ if ( ! is_array( $matching_atts ) ) {
138
+ $matching_atts = array();
139
+ }
140
+ $atts_diff = array_diff( $matching_atts, $details_atts ); // determines if the shortcode settings match the shortcode settings of an existing feed
141
  if ( empty( $atts_diff ) ) {
142
  $matching_indices[] = $matching_entry['id'];
143
  if ( $matching_entry['html_location'] === $this->feed_details['location']['html'] ) {
inc/class-sb-instagram-posts-manager.php CHANGED
@@ -663,34 +663,38 @@ class SB_Instagram_Posts_Manager
663
 
664
  foreach ( $this->errors['accounts'] as $account_id => $error_types ) {
665
 
666
- foreach ( $error_types as $error_type => $details ) {
667
- if ( (string)$account_id === (string)$clearing_account_id ) {
668
- if ( $error_type === $clearing_error_type || $clearing_error_type === 'all' ) {
669
- unset( $this->errors['accounts'][ $account_id ][ $error_type ] );
670
- $cleared = true;
671
- }
672
- } else {
673
- if ( isset( $details['username'] ) ) {
674
- if ( $details['username'] === $clearing_account['username'] ) {
675
- if ( $error_type === $clearing_error_type || $clearing_error_type === 'all' ) {
676
- unset( $this->errors['accounts'][ $account_id ][ $error_type ] );
677
- $cleared = true;
 
 
 
 
678
  }
679
  }
680
- }
681
- if ( isset( $this->errors['accounts'][ $account_id ] ) && isset( $details['access_token'] ) ) {
682
- if ( $details['access_token'] === $clearing_account['access_token'] ) {
683
- if ( $error_type === $clearing_error_type || $clearing_error_type === 'all' ) {
684
- unset( $this->errors['accounts'][ $account_id ][ $error_type ] );
685
- $cleared = true;
686
  }
687
  }
688
  }
689
  }
690
- }
691
 
692
- if ( empty( $this->errors['accounts'][ $account_id ] ) ) {
693
- unset( $this->errors['accounts'][ $account_id ] );
 
694
  }
695
 
696
  }
663
 
664
  foreach ( $this->errors['accounts'] as $account_id => $error_types ) {
665
 
666
+ if ( ! SB_Instagram_Connected_Account::lookup( $account_id ) ) {
667
+ unset( $this->errors['accounts'][ $account_id ] );
668
+ } else {
669
+ foreach ( $error_types as $error_type => $details ) {
670
+ if ( (string)$account_id === (string)$clearing_account_id ) {
671
+ if ( $error_type === $clearing_error_type || $clearing_error_type === 'all' ) {
672
+ unset( $this->errors['accounts'][ $account_id ][ $error_type ] );
673
+ $cleared = true;
674
+ }
675
+ } else {
676
+ if ( isset( $details['username'] ) ) {
677
+ if ( $details['username'] === $clearing_account['username'] ) {
678
+ if ( $error_type === $clearing_error_type || $clearing_error_type === 'all' ) {
679
+ unset( $this->errors['accounts'][ $account_id ][ $error_type ] );
680
+ $cleared = true;
681
+ }
682
  }
683
  }
684
+ if ( isset( $this->errors['accounts'][ $account_id ] ) && isset( $details['access_token'] ) ) {
685
+ if ( $details['access_token'] === $clearing_account['access_token'] ) {
686
+ if ( $error_type === $clearing_error_type || $clearing_error_type === 'all' ) {
687
+ unset( $this->errors['accounts'][ $account_id ][ $error_type ] );
688
+ $cleared = true;
689
+ }
690
  }
691
  }
692
  }
693
  }
 
694
 
695
+ if ( empty( $this->errors['accounts'][ $account_id ] ) ) {
696
+ unset( $this->errors['accounts'][ $account_id ] );
697
+ }
698
  }
699
 
700
  }
inc/class-sb-instagram-settings.php CHANGED
@@ -369,7 +369,7 @@ class SB_Instagram_Settings {
369
  if ( ! $users ) {
370
  $set = false;
371
  foreach ( $this->connected_accounts as $connected_account ) {
372
- if ( ! $set && strpos( $connected_account['accesstoken'], '.' ) === false ) {
373
  $set = true;
374
  $this->settings['user'] = $connected_account['username'];
375
  $this->connected_accounts_in_feed = array( $connected_account['user_id'] => $connected_account );
369
  if ( ! $users ) {
370
  $set = false;
371
  foreach ( $this->connected_accounts as $connected_account ) {
372
+ if ( ! $set && strpos( $connected_account['access_token'], '.' ) === false ) {
373
  $set = true;
374
  $this->settings['user'] = $connected_account['username'];
375
  $this->connected_accounts_in_feed = array( $connected_account['user_id'] => $connected_account );
instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Smash Balloon Instagram Feed
4
  Plugin URI: https://smashballoon.com/instagram-feed
5
  Description: Display beautifully clean, customizable, and responsive Instagram feeds.
6
- Version: 2.8
7
  Author: Smash Balloon
8
  Author URI: https://smashballoon.com/
9
  License: GPLv2 or later
@@ -23,7 +23,7 @@ along with this program; if not, write to the Free Software
23
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
  if ( ! defined( 'SBIVER' ) ) {
26
- define( 'SBIVER', '2.8' );
27
  }
28
  // Db version.
29
  if ( ! defined( 'SBI_DBVERSION' ) ) {
3
  Plugin Name: Smash Balloon Instagram Feed
4
  Plugin URI: https://smashballoon.com/instagram-feed
5
  Description: Display beautifully clean, customizable, and responsive Instagram feeds.
6
+ Version: 2.8.1
7
  Author: Smash Balloon
8
  Author URI: https://smashballoon.com/
9
  License: GPLv2 or later
23
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
  if ( ! defined( 'SBIVER' ) ) {
26
+ define( 'SBIVER', '2.8.1' );
27
  }
28
  // Db version.
29
  if ( ! defined( 'SBI_DBVERSION' ) ) {