YITH WooCommerce Wishlist - Version 3.0.3

Version Description

  • Released on 12 December 2019 =

  • Tweak: prevent yith_setcookie to process if cookie name is not set

  • Tweak: refactored session class to set up session cookie name on demand, when needed (avoid empty cookie name)

  • Tweak: minor improvements to functions that require session (count_products, get_default_wishlist..) as a consequence of changes applied to session class

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Wishlist
Version 3.0.3
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.3

README.md CHANGED
@@ -72,30 +72,11 @@ We're also working hard to release a developer guide; please, follow our [social
72
 
73
  ## Changelog
74
 
75
- ### 3.0.0 - Released on 09 December 2019
76
-
77
- * New: option to show Add to Wishlist button on loops
78
- * New: Add to Wishlist button style when placed over product image
79
- * New: Add to Wishlist button can now turn into Remove from Wishlist after addition
80
- * New: plugin will add variation to wishlist, if user selected one before pressing the button
81
- * New: option to load wishlist templates via Ajax
82
- * New: select add to wishlist icon and/or upload custom image
83
- * New: guest wishlists are now stored on db, within session id
84
- * New: unified experience for guests and logged in users
85
- * Tweak: improved admin panel, and settings UX
86
- * Dev: code refactoring of the entire plugin
87
- * Dev: new YITH_WCWL_Wishlist and YITH_WCWL_Wishlist_Item objects
88
- * Dev: now using Data_store classes to handle db operations
89
- * Dev: added filter yith_wcwl_loop_positions
90
- * Dev: added filter yith_wcwl_custom_css_rules
91
- * Dev: added filter yith_wcwl_session_cookie
92
- * Dev: added filter yith_wcwl_item_formatted_price
93
- * Dev: added filter yith_wcwl_wishlist_formatted_title
94
- * Dev: added filter yith_wcwl_wishlist_get_items
95
- * Dev: added filter yith_wcwl_user_cannot_add_to_wishlist_message
96
- * Dev: added filter yith_wcwl_can_user_add_to_wishlist
97
- * Dev: added filters yith_wcwl_add_wishlist_{property}
98
- * Dev: added filters yith_wcwl_adding_to_wishlist_{property}
99
 
100
  ## Support
101
 
72
 
73
  ## Changelog
74
 
75
+ ### 3.0.3 - Released on 12 December 2019
76
+
77
+ * Tweak: prevent yith_setcookie to process if cookie name is not set
78
+ * Tweak: refactored session class to set up session cookie name on demand, when needed (avoid empty cookie name)
79
+ * Tweak: minor improvements to functions that require session (count_products, get_default_wishlist..) as a consequence of changes applied to session class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  ## Support
82
 
README.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
  Tags: wishlist, woocommerce, products, yit, e-commerce, shop, ecommerce wishlist, yith, woocommerce wishlist, shop wishlist
5
  Requires at least: 4.0
6
  Tested up to: 5.3
7
- Stable tag: 3.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -112,6 +112,12 @@ Yes, of course you can. To avoid Wishlist page to show product prices, you can h
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
 
115
  = 3.0.2 - Released on 10 December 2019 =
116
 
117
  * Update: plugin framework
4
  Tags: wishlist, woocommerce, products, yit, e-commerce, shop, ecommerce wishlist, yith, woocommerce wishlist, shop wishlist
5
  Requires at least: 4.0
6
  Tested up to: 5.3
7
+ Stable tag: 3.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
112
 
113
  == Changelog ==
114
 
115
+ = 3.0.3 - Released on 12 December 2019 =
116
+
117
+ * Tweak: prevent yith_setcookie to process if cookie name is not set
118
+ * Tweak: refactored session class to set up session cookie name on demand, when needed (avoid empty cookie name)
119
+ * Tweak: minor improvements to functions that require session (count_products, get_default_wishlist..) as a consequence of changes applied to session class
120
+
121
  = 3.0.2 - Released on 10 December 2019 =
122
 
123
  * Update: plugin framework
includes/class.yith-wcwl-frontend.php CHANGED
@@ -33,7 +33,7 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
33
  * @var string
34
  * @since 1.0.0
35
  */
36
- public $version = '3.0.2';
37
 
38
  /**
39
  * Plugin database version
33
  * @var string
34
  * @since 1.0.0
35
  */
36
+ public $version = '3.0.3';
37
 
38
  /**
39
  * Plugin database version
includes/class.yith-wcwl-session.php CHANGED
@@ -68,18 +68,7 @@ if ( ! class_exists( 'YITH_WCWL_Session' ) ) {
68
  * Construct session class
69
  */
70
  public function __construct() {
71
- add_action( 'init', array( $this, 'init' ), 0 );
72
- }
73
-
74
- /**
75
- * Init hooks and session data.
76
- *
77
- * @since 3.0.0
78
- */
79
- public function init() {
80
- $this->_cookie = apply_filters( 'yith_wcwl_session_cookie', 'yith_wcwl_session_' . COOKIEHASH );
81
-
82
- $this->init_session_cookie();
83
  }
84
 
85
  /**
@@ -136,7 +125,7 @@ if ( ! class_exists( 'YITH_WCWL_Session' ) ) {
136
  'session_expiring' => $this->_session_expiring,
137
  'cookie_hash' => $hash
138
  );
139
- yith_setcookie( $this->_cookie, $cookie_value, $this->_session_expiration );
140
 
141
  // cookie has been set
142
  $this->_has_cookie = true;
@@ -150,7 +139,7 @@ if ( ! class_exists( 'YITH_WCWL_Session' ) ) {
150
  * @return bool|array
151
  */
152
  public function get_session_cookie() {
153
- $cookie_value = yith_getcookie( $this->_cookie ); // @codingStandardsIgnoreLine.
154
 
155
  if ( empty( $cookie_value ) || ! is_array( $cookie_value ) ) {
156
  return false;
@@ -171,6 +160,20 @@ if ( ! class_exists( 'YITH_WCWL_Session' ) ) {
171
  return $cookie_value;
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  /**
175
  * Returns current session expiration; if session doesn't exist, creates it; if user is logged in, return false
176
  *
@@ -290,7 +293,7 @@ if ( ! class_exists( 'YITH_WCWL_Session' ) ) {
290
  * Forget all session data without destroying it.
291
  */
292
  public function forget_session() {
293
- yith_destroycookie( $this->_cookie );
294
 
295
  $this->_session_id = $this->generate_session_id();
296
  }
68
  * Construct session class
69
  */
70
  public function __construct() {
71
+ add_action( 'init', array( $this, 'init_session_cookie' ), 0 );
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
 
74
  /**
125
  'session_expiring' => $this->_session_expiring,
126
  'cookie_hash' => $hash
127
  );
128
+ yith_setcookie( $this->get_session_cookie_name(), $cookie_value, $this->_session_expiration );
129
 
130
  // cookie has been set
131
  $this->_has_cookie = true;
139
  * @return bool|array
140
  */
141
  public function get_session_cookie() {
142
+ $cookie_value = yith_getcookie( $this->get_session_cookie_name() ); // @codingStandardsIgnoreLine.
143
 
144
  if ( empty( $cookie_value ) || ! is_array( $cookie_value ) ) {
145
  return false;
160
  return $cookie_value;
161
  }
162
 
163
+ /**
164
+ * Returns name for the session cookie
165
+ *
166
+ * @return string
167
+ * @since 3.0.3
168
+ */
169
+ public function get_session_cookie_name() {
170
+ if( empty( $this->_cookie ) ){
171
+ $this->_cookie = apply_filters( 'yith_wcwl_session_cookie', 'yith_wcwl_session_' . COOKIEHASH );
172
+ }
173
+
174
+ return $this->_cookie;
175
+ }
176
+
177
  /**
178
  * Returns current session expiration; if session doesn't exist, creates it; if user is logged in, return false
179
  *
293
  * Forget all session data without destroying it.
294
  */
295
  public function forget_session() {
296
+ yith_destroycookie( $this->get_session_cookie_name() );
297
 
298
  $this->_session_id = $this->generate_session_id();
299
  }
includes/functions.yith-wcwl.php CHANGED
@@ -267,7 +267,7 @@ if( !function_exists( 'yith_setcookie' ) ) {
267
  * @since 1.0.0
268
  */
269
  function yith_setcookie( $name, $value = array(), $time = null ) {
270
- if( ! apply_filters( 'yith_wcwl_set_cookie', true ) ){
271
  return false;
272
  }
273
 
267
  * @since 1.0.0
268
  */
269
  function yith_setcookie( $name, $value = array(), $time = null ) {
270
+ if( ! apply_filters( 'yith_wcwl_set_cookie', true ) || empty( $name ) ){
271
  return false;
272
  }
273
 
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Wishlist
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-wishlist/
5
  * Description: <code><strong>YITH WooCommerce Wishlist</strong></code> gives your users the possibility to create, fill, manage and share their wishlists allowing you to analyze their interests and needs to improve your marketing strategies. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce on <strong>YITH</strong></a>
6
- * Version: 3.0.2
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-wishlist
3
  * Plugin Name: YITH WooCommerce Wishlist
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-wishlist/
5
  * Description: <code><strong>YITH WooCommerce Wishlist</strong></code> gives your users the possibility to create, fill, manage and share their wishlists allowing you to analyze their interests and needs to improve your marketing strategies. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce on <strong>YITH</strong></a>
6
+ * Version: 3.0.3
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-wishlist
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.4.6
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.4.6
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.4.7
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.4.7
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -537,6 +537,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
537
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
538
  */
539
  public function yit_panel() {
 
540
  $yit_options = $this->get_main_array_options();
541
  $wrap_class = isset( $this->settings[ 'class' ] ) ? $this->settings[ 'class' ] : '';
542
 
537
  * @author Emanuela Castorina <emanuela.castorina@yithemes.it>
538
  */
539
  public function yit_panel() {
540
+ $this->maybe_redirect_to_proper_wp_page();
541
  $yit_options = $this->get_main_array_options();
542
  $wrap_class = isset( $this->settings[ 'class' ] ) ? $this->settings[ 'class' ] : '';
543