WooCommerce Direct Checkout - Version 2.5.4

Version Description

  • Fix. QuadLayers widget cache
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Direct Checkout
Version 2.5.4
Comparing to
See all releases

Code changes from version 2.5.3 to 2.5.4

includes/quadlayers/widget.php CHANGED
@@ -24,19 +24,8 @@ if (!class_exists('QL_Widget')) {
24
 
25
  public function display_dashboard_widget()
26
  {
27
- $rss = fetch_feed('https://quadlayers.com/news/feed/');
28
 
29
- if (is_wp_error($rss)) {
30
- printf('<p><strong>%s: </strong>%s</p>', __('Error', 'woocommerce-direct-checkout'), $rss->get_error_message());
31
- return;
32
- }
33
-
34
- if (!$rss->get_item_quantity()) {
35
- printf('<ul><li>%s</li></ul>', __('An error has occurred, which probably means the feed is down. Try again later', 'woocommerce-direct-checkout'));
36
- $rss->__destruct();
37
- unset($rss);
38
- return;
39
- }
40
  ?>
41
  <div>
42
  <div>
@@ -50,35 +39,37 @@ if (!class_exists('QL_Widget')) {
50
  </div>
51
  <div style="margin: 16px -12px 0; padding: 12px 12px 0;border-top: 1px solid #eee;">
52
  <ul>
53
- <?php
54
- foreach ($rss->get_items(0, 3) as $item) {
55
- $link = $item->get_link();
56
- while (stristr($link, 'http') !== $link) {
57
- $link = substr($link, 1);
58
- }
59
-
60
- $link = esc_url(strip_tags($link . '?utm_source=ql_dashboard'));
61
- $title = esc_html(trim(strip_tags($item->get_title())));
62
-
63
- if (empty($title)) {
64
- $title = __('Untitled', 'woocommerce-direct-checkout');
65
- }
66
-
67
- $desc = html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'));
68
- $desc = esc_attr(wp_trim_words($desc, 15, '...'));
69
- $summary = $desc;
70
- $summary = '<div class="rssSummary">' . $summary . '</div>';
71
-
72
- $date = $item->get_date('U');
73
- if ($date) {
74
- $date = '<span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
75
- }
76
- $author = $item->get_author();
77
- $author = ucfirst($author->get_name());
78
- $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
79
-
80
- printf(__('<li><a href="%s" target="_blank">%s </a>%s%s%s</li>', 'woocommerce-direct-checkout'), $link, $title, $date, $summary, $author);
81
- } ?>
 
 
82
  </ul>
83
  </div>
84
  <div style="display: flex; justify-content: space-between;align-items: center;margin: 16px -12px 0;padding: 12px 12px 0; border-top: 1px solid #eee;">
@@ -88,6 +79,41 @@ if (!class_exists('QL_Widget')) {
88
  <?php
89
  }
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  public static function instance()
92
  {
93
  if (!isset(self::$instance)) {
24
 
25
  public function display_dashboard_widget()
26
  {
27
+ $feed_items = $this->get_feed();
28
 
 
 
 
 
 
 
 
 
 
 
 
29
  ?>
30
  <div>
31
  <div>
39
  </div>
40
  <div style="margin: 16px -12px 0; padding: 12px 12px 0;border-top: 1px solid #eee;">
41
  <ul>
42
+ <?php if (is_array($feed_items)) { ?>
43
+ <?php
44
+ foreach ($feed_items as $item) {
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', 'woocommerce-direct-checkout');
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>', 'woocommerce-direct-checkout'), $link, $title, $date, $summary, $author);
69
+ } ?>
70
+ <?php } else {
71
+ printf(__('<li>%s</li>', 'woocommerce-direct-checkout'), $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/woocommerce-direct-checkout/
4
  Tags: woocommerce, woocommerce ajax, woocommerce ajax cart, add to cart, woocommerce direct checkout, woocommerce quick buy, woocommerce remove checkout fields, woocommerce ajax single products, woocommerce one page checkout
5
  Requires at least: 4.6
6
  Tested up to: 5.8
7
- Stable tag: 2.5.3
8
  WC requires at least: 3.1.0
9
  WC tested up to: 5.5
10
  License: GPLv3
@@ -64,6 +64,9 @@ The premium version of WooCommerce Direct Checkot allows to include a quick purc
64
 
65
  == Changelog ==
66
 
 
 
 
67
  = 2.5.3 =
68
  * Fix: WordPress compatibility
69
 
4
  Tags: woocommerce, woocommerce ajax, woocommerce ajax cart, add to cart, woocommerce direct checkout, woocommerce quick buy, woocommerce remove checkout fields, woocommerce ajax single products, woocommerce one page checkout
5
  Requires at least: 4.6
6
  Tested up to: 5.8
7
+ Stable tag: 2.5.4
8
  WC requires at least: 3.1.0
9
  WC tested up to: 5.5
10
  License: GPLv3
64
 
65
  == Changelog ==
66
 
67
+ = 2.5.4 =
68
+ * Fix. QuadLayers widget cache
69
+
70
  = 2.5.3 =
71
  * Fix: WordPress compatibility
72
 
woocommerce-direct-checkout.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Direct Checkout for WooCommerce
5
  * Plugin URI: https://quadlayers.com/documentation/woocommerce-direct-checkout/
6
  * Description: Simplifies the checkout process to improve your sales rate.
7
- * Version: 2.5.3
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -19,7 +19,7 @@ if (!defined('QLWCDC_PLUGIN_NAME')) {
19
  define('QLWCDC_PLUGIN_NAME', 'Direct Checkout for WooCommerce');
20
  }
21
  if (!defined('QLWCDC_PLUGIN_VERSION')) {
22
- define('QLWCDC_PLUGIN_VERSION', '2.5.3');
23
  }
24
  if (!defined('QLWCDC_PLUGIN_FILE')) {
25
  define('QLWCDC_PLUGIN_FILE', __FILE__);
4
  * Plugin Name: Direct Checkout for WooCommerce
5
  * Plugin URI: https://quadlayers.com/documentation/woocommerce-direct-checkout/
6
  * Description: Simplifies the checkout process to improve your sales rate.
7
+ * Version: 2.5.4
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
19
  define('QLWCDC_PLUGIN_NAME', 'Direct Checkout for WooCommerce');
20
  }
21
  if (!defined('QLWCDC_PLUGIN_VERSION')) {
22
+ define('QLWCDC_PLUGIN_VERSION', '2.5.4');
23
  }
24
  if (!defined('QLWCDC_PLUGIN_FILE')) {
25
  define('QLWCDC_PLUGIN_FILE', __FILE__);