WhatsApp Chat WP - Version 4.9.7

Version Description

  • Fix. QuadLayers widget cache
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WhatsApp Chat WP
Version 4.9.7
Comparing to
See all releases

Code changes from version 4.9.6 to 4.9.7

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', 'wp-whatsapp-chat'), $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', 'wp-whatsapp-chat'));
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', 'wp-whatsapp-chat');
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>', 'wp-whatsapp-chat'), $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', 'wp-whatsapp-chat');
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>', 'wp-whatsapp-chat'), $link, $title, $date, $summary, $author);
69
+ } ?>
70
+ <?php } else {
71
+ printf(__('<li>%s</li>', 'wp-whatsapp-chat'), $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)) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/portfolio/whatsapp-chat/
4
  Tags: whatsapp, whatsapp chat, whatsapp business, whatsapp support, click to chat, whatsapp group, directly message whatsapp, floating whatsapp, whatsapp message, help desk
5
  Requires at least: 3.0
6
  Tested up to: 5.8
7
- Stable tag: 4.9.6
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -97,9 +97,15 @@ Don't use: +001-(555)1234567
97
 
98
  == Changelog ==
99
 
 
 
 
100
  = 4.9.6 =
101
  * Fix. WordPress compatibility
102
 
 
 
 
103
  = 4.9.4 =
104
  * Fix. WordPress compatibility
105
 
4
  Tags: whatsapp, whatsapp chat, whatsapp business, whatsapp support, click to chat, whatsapp group, directly message whatsapp, floating whatsapp, whatsapp message, help desk
5
  Requires at least: 3.0
6
  Tested up to: 5.8
7
+ Stable tag: 4.9.7
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
97
 
98
  == Changelog ==
99
 
100
+ = 4.9.7 =
101
+ * Fix. QuadLayers widget cache
102
+
103
  = 4.9.6 =
104
  * Fix. WordPress compatibility
105
 
106
+ = 4.9.5 =
107
+ * Fix. WordPress compatibility
108
+
109
  = 4.9.4 =
110
  * Fix. WordPress compatibility
111
 
wp-whatsapp-chat.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Social Chat
5
  * Description: Social Chat allows your visitors to contact you or your team through WhatsApp chat with a single click.
6
  * Plugin URI: https://quadlayers.com/portfolio/whatsapp-chat/
7
- * Version: 4.9.6
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -17,7 +17,7 @@ if (!defined('ABSPATH')) {
17
  }
18
 
19
  define('QLWAPP_PLUGIN_NAME', 'Social Chat');
20
- define('QLWAPP_PLUGIN_VERSION', '4.9.6');
21
  define('QLWAPP_PLUGIN_FILE', __FILE__);
22
  define('QLWAPP_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR);
23
  define('QLWAPP_PREFIX', 'qlwapp');
4
  * Plugin Name: Social Chat
5
  * Description: Social Chat allows your visitors to contact you or your team through WhatsApp chat with a single click.
6
  * Plugin URI: https://quadlayers.com/portfolio/whatsapp-chat/
7
+ * Version: 4.9.7
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
17
  }
18
 
19
  define('QLWAPP_PLUGIN_NAME', 'Social Chat');
20
+ define('QLWAPP_PLUGIN_VERSION', '4.9.7');
21
  define('QLWAPP_PLUGIN_FILE', __FILE__);
22
  define('QLWAPP_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR);
23
  define('QLWAPP_PREFIX', 'qlwapp');