Instagram Gallery - Version 3.2.9

Version Description

  • Fix. QuadLayers widget cache
Download this release

Release Info

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

Code changes from version 3.2.8 to 3.2.9

Files changed (3) hide show
  1. includes/quadlayers/widget.php +68 -41
  2. insta-gallery.php +2 -2
  3. readme.txt +4 -1
includes/quadlayers/widget.php CHANGED
@@ -23,19 +23,8 @@ class QL_Widget
23
 
24
  public function display_dashboard_widget()
25
  {
26
- $rss = fetch_feed('https://quadlayers.com/news/feed/');
27
 
28
- if (is_wp_error($rss)) {
29
- printf('<p><strong>%s: </strong>%s</p>', __('Error', 'insta-gallery'), $rss->get_error_message());
30
- return;
31
- }
32
-
33
- if (!$rss->get_item_quantity()) {
34
- printf('<ul><li>%s</li></ul>', __('An error has occurred, which probably means the feed is down. Try again later', 'insta-gallery'));
35
- $rss->__destruct();
36
- unset($rss);
37
- return;
38
- }
39
  ?>
40
  <div>
41
  <div>
@@ -49,35 +38,38 @@ class QL_Widget
49
  </div>
50
  <div style="margin: 16px -12px 0; padding: 12px 12px 0;border-top: 1px solid #eee;">
51
  <ul>
52
- <?php
53
- foreach ($rss->get_items(0, 3) as $item) {
54
- $link = $item->get_link();
55
- while (stristr($link, 'http') !== $link) {
56
- $link = substr($link, 1);
57
- }
58
-
59
- $link = esc_url(strip_tags($link . '?utm_source=ql_dashboard'));
60
- $title = esc_html(trim(strip_tags($item->get_title())));
61
-
62
- if (empty($title)) {
63
- $title = __('Untitled', 'insta-gallery');
64
- }
65
-
66
- $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
67
- $desc = esc_attr(wp_trim_words($desc, 15, '...'));
68
- $summary = $desc;
69
- $summary = '<div class="rssSummary">' . $summary . '</div>';
70
-
71
- $date = $item->get_date('U');
72
- if ($date) {
73
- $date = '<span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
74
- }
75
- $author = $item->get_author();
76
- $author = ucfirst($author->get_name());
77
- $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
78
-
79
- printf(__('<li><a href="%s" target="_blank">%s </a>%s%s%s</li>', 'insta-gallery'), $link, $title, $date, $summary, $author);
80
- } ?>
 
 
 
81
  </ul>
82
  </div>
83
  <div style="display: flex; justify-content: space-between;align-items: center;margin: 16px -12px 0;padding: 12px 12px 0; border-top: 1px solid #eee;">
@@ -87,6 +79,41 @@ class QL_Widget
87
  <?php
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  public static function instance()
91
  {
92
  if (!isset(self::$instance)) {
23
 
24
  public function display_dashboard_widget()
25
  {
26
+ $feed_items = $this->get_feed();
27
 
 
 
 
 
 
 
 
 
 
 
 
28
  ?>
29
  <div>
30
  <div>
38
  </div>
39
  <div style="margin: 16px -12px 0; padding: 12px 12px 0;border-top: 1px solid #eee;">
40
  <ul>
41
+ <?php if (is_array($feed_items)) { ?>
42
+ <?php
43
+ foreach ($feed_items as $item) {
44
+
45
+ $link = $item['link'];
46
+ while (stristr($link, 'http') !== $link) {
47
+ $link = substr($link, 1);
48
+ }
49
+
50
+ $link = esc_url(strip_tags($link . '?utm_source=ql_dashboard'));
51
+ $title = esc_html(trim(strip_tags($item['title'])));
52
+
53
+ if (empty($title)) {
54
+ $title = __('Untitled', 'insta-gallery');
55
+ }
56
+
57
+ $desc = html_entity_decode($item['desc'], ENT_QUOTES, get_option('blog_charset'));
58
+ $desc = esc_attr(wp_trim_words($desc, 15, '...'));
59
+ $summary = $desc;
60
+ $summary = '<div class="rssSummary">' . $summary . '</div>';
61
+ $date = $item['date'];
62
+ if ($date) {
63
+ $date = '<span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
64
+ }
65
+ $author = $item['author'];
66
+ $author = ucfirst($author);
67
+ $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
68
+ printf(__('<li><a href="%s" target="_blank">%s </a>%s%s%s</li>', 'insta-gallery'), $link, $title, $date, $summary, $author);
69
+ } ?>
70
+ <?php } else {
71
+ printf(__('<li>%s</li>', 'insta-gallery'), $feed_items);
72
+ } ?>
73
  </ul>
74
  </div>
75
  <div style="display: flex; justify-content: space-between;align-items: center;margin: 16px -12px 0;padding: 12px 12px 0; border-top: 1px solid #eee;">
79
  <?php
80
  }
81
 
82
+ public function get_feed()
83
+ {
84
+ $rss_items = get_transient('quadlayers_news_feed');
85
+
86
+ if ($rss_items === false) {
87
+ $rss = fetch_feed('https://quadlayers.com/news/feed/');
88
+
89
+ if (is_wp_error($rss)) {
90
+ return "An error has occurred, which probably means the feed is down. Try again later";
91
+ }
92
+
93
+ if (!$rss->get_item_quantity()) {
94
+ $rss->__destruct();
95
+ unset($rss);
96
+ return "An error has occurred, which probably means the feed is down. Try again later";
97
+ }
98
+
99
+ $rss_items = [];
100
+
101
+ foreach ($rss->get_items(0, 3) as $item) {
102
+ $rss_items[] = [
103
+ 'link' => $item->get_link(),
104
+ 'author' => $item->get_author()->get_name(),
105
+ 'title' => $item->get_title(),
106
+ 'desc' => $item->get_description(),
107
+ 'date' => $item->get_date('U')
108
+ ];
109
+ }
110
+
111
+ set_transient('quadlayers_news_feed', $rss_items, DAY_IN_SECONDS);
112
+ }
113
+
114
+ return $rss_items;
115
+ }
116
+
117
  public static function instance()
118
  {
119
  if (!isset(self::$instance)) {
insta-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Social Feed Gallery
5
  * Plugin URI: https://quadlayers.com/portfolio/instagram-feed-gallery/
6
  * Description: Display beautiful and responsive galleries on your website from your Instagram feed account.
7
- * Version: 3.2.8
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -19,7 +19,7 @@ if (!defined('QLIGG_PLUGIN_NAME')) {
19
  define('QLIGG_PLUGIN_NAME', 'Social Feed Gallery');
20
  }
21
  if (!defined('QLIGG_PLUGIN_VERSION')) {
22
- define('QLIGG_PLUGIN_VERSION', '3.2.8');
23
  }
24
  if (!defined('QLIGG_PLUGIN_FILE')) {
25
  define('QLIGG_PLUGIN_FILE', __FILE__);
4
  * Plugin Name: Social Feed Gallery
5
  * Plugin URI: https://quadlayers.com/portfolio/instagram-feed-gallery/
6
  * Description: Display beautiful and responsive galleries on your website from your Instagram feed account.
7
+ * Version: 3.2.9
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
19
  define('QLIGG_PLUGIN_NAME', 'Social Feed Gallery');
20
  }
21
  if (!defined('QLIGG_PLUGIN_VERSION')) {
22
+ define('QLIGG_PLUGIN_VERSION', '3.2.9');
23
  }
24
  if (!defined('QLIGG_PLUGIN_FILE')) {
25
  define('QLIGG_PLUGIN_FILE', __FILE__);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/portfolio/instagram-gallery/
4
  Tags: Instagram, Instagram feed, Instagram gallery, Instagram photos, Instagram widget, Instagram pictures
5
  Requires at least: 3.4
6
  Tested up to: 5.8
7
- Stable tag: 3.2.8
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -105,6 +105,9 @@ There may be some other plugins(like: fancybox, elementor) which also uses image
105
 
106
  == Changelog ==
107
 
 
 
 
108
  = 3.2.8 =
109
  * Fix. Wordpress compatibility
110
 
4
  Tags: Instagram, Instagram feed, Instagram gallery, Instagram photos, Instagram widget, Instagram pictures
5
  Requires at least: 3.4
6
  Tested up to: 5.8
7
+ Stable tag: 3.2.9
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
105
 
106
  == Changelog ==
107
 
108
+ = 3.2.9 =
109
+ * Fix. QuadLayers widget cache
110
+
111
  = 3.2.8 =
112
  * Fix. Wordpress compatibility
113