WooCommerce Wishlist Plugin - Version 1.24.5

Version Description

Release Date - 30 March 2021

  • Fixed FOIT for the custom icon webfont
  • Security tweak
  • Forced uppercase removed from a wishlist unique share key
  • Updated integration with WooCommerce TM Extra Product Options plugin
  • Updated integration with Product Options and Price Calculation Formulas for WooCommerce Uni CPO plugin
Download this release

Release Info

Developer templateinvaders
Plugin Icon 128x128 WooCommerce Wishlist Plugin
Version 1.24.5
Comparing to
See all releases

Code changes from version 1.24.4 to 1.24.5

assets/css/admin-form-rtl.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
assets/css/admin-form.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
assets/css/admin-rtl.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  *{-webkit-box-sizing:border-box;box-sizing:border-box}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  *{-webkit-box-sizing:border-box;box-sizing:border-box}
assets/css/admin-setup-rtl.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  html{background:#f6f3ed}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  html{background:#f6f3ed}
assets/css/admin-setup.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  html{background:#f6f3ed}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  html{background:#f6f3ed}
assets/css/admin.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  *{-webkit-box-sizing:border-box;box-sizing:border-box}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  *{-webkit-box-sizing:border-box;box-sizing:border-box}
assets/css/public-rtl.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
assets/css/public.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
assets/css/theme-rtl.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type="button"],.tinv-wishlist input[type="reset"],.tinv-wishlist input[type="submit"]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type="button"],.tinv-wishlist input[type="reset"],.tinv-wishlist input[type="submit"]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
assets/css/theme.min.css CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type="button"],.tinv-wishlist input[type="reset"],.tinv-wishlist input[type="submit"]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  .tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type="button"],.tinv-wishlist input[type="reset"],.tinv-wishlist input[type="submit"]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
assets/css/webfont-rtl.css CHANGED
@@ -3,6 +3,7 @@ WooCommerce Wishlist Plugin custom webfont
3
  -------------------------------------------------------------------*/
4
  @font-face {
5
  font-family: 'tinvwl-webfont';
 
6
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");
7
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"), url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"), url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"), url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"), url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");
8
  font-weight: normal;
3
  -------------------------------------------------------------------*/
4
  @font-face {
5
  font-family: 'tinvwl-webfont';
6
+ font-display: block;
7
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");
8
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"), url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"), url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"), url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"), url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");
9
  font-weight: normal;
assets/css/webfont-rtl.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["webfont-rtl.css"],"file":"webfont-rtl.css","sourcesContent":["/*------------------------------------------------------------------\nWooCommerce Wishlist Plugin custom webfont\n-------------------------------------------------------------------*/\n@font-face {\n font-family: 'tinvwl-webfont';\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi\");\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix\") format(\"embedded-opentype\"), url(\"../fonts/tinvwl-webfont.woff2?ver=xu2uyi\") format(\"woff2\"), url(\"../fonts/tinvwl-webfont.woff?ver=xu2uyi\") format(\"woff\"), url(\"../fonts/tinvwl-webfont.ttf?ver=xu2uyi\") format(\"truetype\"), url(\"../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont\") format(\"svg\");\n font-weight: normal;\n font-style: normal; }\n\n.ftinvwl {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'tinvwl-webfont' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.ftinvwl-twitter:before {\n content: \"\\f099\" !important; }\n\n.ftinvwl-facebook:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-facebook-f:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-google:before {\n content: \"\\f0d5\" !important; }\n\n.ftinvwl-email:before {\n content: \"\\f0e0\" !important; }\n\n.ftinvwl-pinterest:before {\n content: \"\\f231\" !important; }\n\n.ftinvwl-whatsapp:before {\n content: \"\\f232\" !important; }\n\n.ftinvwl-clipboard:before {\n content: \"\\e911\" !important; }\n\n.ftinvwl-star:before {\n content: \"\\e912\" !important; }\n\n.ftinvwl-shopping-cart:before {\n content: \"\\e913\" !important; }\n\n.ftinvwl-magic:before {\n content: \"\\e914\" !important; }\n\n.ftinvwl-info:before {\n content: \"\\e915\" !important; }\n\n.ftinvwl-graduation-cap:before {\n content: \"\\e918\" !important; }\n\n.ftinvwl-floppy-o:before {\n content: \"\\e919\" !important; }\n\n.ftinvwl-eyedropper:before {\n content: \"\\e91a\" !important; }\n\n.ftinvwl-exclamation-triangle:before {\n content: \"\\e91b\" !important; }\n\n.ftinvwl-check:before {\n content: \"\\e91e\" !important; }\n\n.ftinvwl-arrow-left:before {\n content: \"\\e91f\" !important; }\n\n.ftinvwl-wrench:before {\n content: \"\\e920\" !important; }\n\n.ftinvwl-chevron-down:before {\n content: \"\\e900\" !important; }\n\n.ftinvwl-chevron-right:before {\n content: \"\\e901\" !important; }\n\n.ftinvwl-chevron-left:before {\n content: \"\\e902\" !important; }\n\n.ftinvwl-chevron-up:before {\n content: \"\\e903\" !important; }\n\n.ftinvwl-cancel:before {\n content: \"\\e904\" !important; }\n\n.ftinvwl-times:before {\n content: \"\\e905\" !important; }\n\n.ftinvwl-heart-plus:before {\n content: \"\\e906\" !important; }\n\n.ftinvwl-heart-mark-right:before {\n content: \"\\e907\" !important; }\n\n.ftinvwl-heart2:before {\n content: \"\\e908\" !important; }\n\n.ftinvwl-heart-o:before {\n content: \"\\e909\" !important; }\n\n.ftinvwl-heart-mark-left:before {\n content: \"\\e90a\" !important; }\n\n.ftinvwl-heart-mail:before {\n content: \"\\e90b\" !important; }\n\n.ftinvwl-heart-tinv:before {\n content: \"\\e90c\" !important; }\n\n.ftinvwl-key:before {\n content: \"\\e90d\" !important; }\n\n.ftinvwl-lock:before {\n content: \"\\e90e\" !important; }\n\n.ftinvwl-hearts:before {\n content: \"\\e90f\" !important; }\n\n.ftinvwl-user:before {\n content: \"\\e910\" !important; }\n\n/* PULSE */\n@-webkit-keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n@keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n.ftinvwl-pulse.ftinvwl-animated::before {\n -webkit-animation: ftinvwl-pulse 2s linear infinite;\n animation: ftinvwl-pulse 2s linear infinite; }\n"]}
1
+ {"version":3,"names":[],"mappings":"","sources":["webfont-rtl.css"],"file":"webfont-rtl.css","sourcesContent":["/*------------------------------------------------------------------\nWooCommerce Wishlist Plugin custom webfont\n-------------------------------------------------------------------*/\n@font-face {\n font-family: 'tinvwl-webfont';\n font-display: block;\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi\");\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix\") format(\"embedded-opentype\"), url(\"../fonts/tinvwl-webfont.woff2?ver=xu2uyi\") format(\"woff2\"), url(\"../fonts/tinvwl-webfont.woff?ver=xu2uyi\") format(\"woff\"), url(\"../fonts/tinvwl-webfont.ttf?ver=xu2uyi\") format(\"truetype\"), url(\"../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont\") format(\"svg\");\n font-weight: normal;\n font-style: normal; }\n\n.ftinvwl {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'tinvwl-webfont' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.ftinvwl-twitter:before {\n content: \"\\f099\" !important; }\n\n.ftinvwl-facebook:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-facebook-f:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-google:before {\n content: \"\\f0d5\" !important; }\n\n.ftinvwl-email:before {\n content: \"\\f0e0\" !important; }\n\n.ftinvwl-pinterest:before {\n content: \"\\f231\" !important; }\n\n.ftinvwl-whatsapp:before {\n content: \"\\f232\" !important; }\n\n.ftinvwl-clipboard:before {\n content: \"\\e911\" !important; }\n\n.ftinvwl-star:before {\n content: \"\\e912\" !important; }\n\n.ftinvwl-shopping-cart:before {\n content: \"\\e913\" !important; }\n\n.ftinvwl-magic:before {\n content: \"\\e914\" !important; }\n\n.ftinvwl-info:before {\n content: \"\\e915\" !important; }\n\n.ftinvwl-graduation-cap:before {\n content: \"\\e918\" !important; }\n\n.ftinvwl-floppy-o:before {\n content: \"\\e919\" !important; }\n\n.ftinvwl-eyedropper:before {\n content: \"\\e91a\" !important; }\n\n.ftinvwl-exclamation-triangle:before {\n content: \"\\e91b\" !important; }\n\n.ftinvwl-check:before {\n content: \"\\e91e\" !important; }\n\n.ftinvwl-arrow-left:before {\n content: \"\\e91f\" !important; }\n\n.ftinvwl-wrench:before {\n content: \"\\e920\" !important; }\n\n.ftinvwl-chevron-down:before {\n content: \"\\e900\" !important; }\n\n.ftinvwl-chevron-right:before {\n content: \"\\e901\" !important; }\n\n.ftinvwl-chevron-left:before {\n content: \"\\e902\" !important; }\n\n.ftinvwl-chevron-up:before {\n content: \"\\e903\" !important; }\n\n.ftinvwl-cancel:before {\n content: \"\\e904\" !important; }\n\n.ftinvwl-times:before {\n content: \"\\e905\" !important; }\n\n.ftinvwl-heart-plus:before {\n content: \"\\e906\" !important; }\n\n.ftinvwl-heart-mark-right:before {\n content: \"\\e907\" !important; }\n\n.ftinvwl-heart2:before {\n content: \"\\e908\" !important; }\n\n.ftinvwl-heart-o:before {\n content: \"\\e909\" !important; }\n\n.ftinvwl-heart-mark-left:before {\n content: \"\\e90a\" !important; }\n\n.ftinvwl-heart-mail:before {\n content: \"\\e90b\" !important; }\n\n.ftinvwl-heart-tinv:before {\n content: \"\\e90c\" !important; }\n\n.ftinvwl-key:before {\n content: \"\\e90d\" !important; }\n\n.ftinvwl-lock:before {\n content: \"\\e90e\" !important; }\n\n.ftinvwl-hearts:before {\n content: \"\\e90f\" !important; }\n\n.ftinvwl-user:before {\n content: \"\\e910\" !important; }\n\n/* PULSE */\n@-webkit-keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n@keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n.ftinvwl-pulse.ftinvwl-animated::before {\n -webkit-animation: ftinvwl-pulse 2s linear infinite;\n animation: ftinvwl-pulse 2s linear infinite; }\n"]}
assets/css/webfont-rtl.min.css CHANGED
@@ -1,9 +1,9 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
- @font-face{font-family:'tinvwl-webfont';src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
7
  .ftinvwl{font-family:'tinvwl-webfont' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
8
  .ftinvwl-twitter:before{content:"\f099" !important}
9
  .ftinvwl-facebook:before{content:"\f09a" !important}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
+ @font-face{font-family:'tinvwl-webfont';font-display:block;src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
7
  .ftinvwl{font-family:'tinvwl-webfont' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
8
  .ftinvwl-twitter:before{content:"\f099" !important}
9
  .ftinvwl-facebook:before{content:"\f09a" !important}
assets/css/webfont.css CHANGED
@@ -3,6 +3,7 @@ WooCommerce Wishlist Plugin custom webfont
3
  -------------------------------------------------------------------*/
4
  @font-face {
5
  font-family: 'tinvwl-webfont';
 
6
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");
7
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"), url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"), url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"), url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"), url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");
8
  font-weight: normal;
3
  -------------------------------------------------------------------*/
4
  @font-face {
5
  font-family: 'tinvwl-webfont';
6
+ font-display: block;
7
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");
8
  src: url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"), url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"), url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"), url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"), url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");
9
  font-weight: normal;
assets/css/webfont.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["webfont.css"],"file":"webfont.css","sourcesContent":["/*------------------------------------------------------------------\nWooCommerce Wishlist Plugin custom webfont\n-------------------------------------------------------------------*/\n@font-face {\n font-family: 'tinvwl-webfont';\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi\");\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix\") format(\"embedded-opentype\"), url(\"../fonts/tinvwl-webfont.woff2?ver=xu2uyi\") format(\"woff2\"), url(\"../fonts/tinvwl-webfont.woff?ver=xu2uyi\") format(\"woff\"), url(\"../fonts/tinvwl-webfont.ttf?ver=xu2uyi\") format(\"truetype\"), url(\"../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont\") format(\"svg\");\n font-weight: normal;\n font-style: normal; }\n\n.ftinvwl {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'tinvwl-webfont' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.ftinvwl-twitter:before {\n content: \"\\f099\" !important; }\n\n.ftinvwl-facebook:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-facebook-f:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-google:before {\n content: \"\\f0d5\" !important; }\n\n.ftinvwl-email:before {\n content: \"\\f0e0\" !important; }\n\n.ftinvwl-pinterest:before {\n content: \"\\f231\" !important; }\n\n.ftinvwl-whatsapp:before {\n content: \"\\f232\" !important; }\n\n.ftinvwl-clipboard:before {\n content: \"\\e911\" !important; }\n\n.ftinvwl-star:before {\n content: \"\\e912\" !important; }\n\n.ftinvwl-shopping-cart:before {\n content: \"\\e913\" !important; }\n\n.ftinvwl-magic:before {\n content: \"\\e914\" !important; }\n\n.ftinvwl-info:before {\n content: \"\\e915\" !important; }\n\n.ftinvwl-graduation-cap:before {\n content: \"\\e918\" !important; }\n\n.ftinvwl-floppy-o:before {\n content: \"\\e919\" !important; }\n\n.ftinvwl-eyedropper:before {\n content: \"\\e91a\" !important; }\n\n.ftinvwl-exclamation-triangle:before {\n content: \"\\e91b\" !important; }\n\n.ftinvwl-check:before {\n content: \"\\e91e\" !important; }\n\n.ftinvwl-arrow-left:before {\n content: \"\\e91f\" !important; }\n\n.ftinvwl-wrench:before {\n content: \"\\e920\" !important; }\n\n.ftinvwl-chevron-down:before {\n content: \"\\e900\" !important; }\n\n.ftinvwl-chevron-right:before {\n content: \"\\e901\" !important; }\n\n.ftinvwl-chevron-left:before {\n content: \"\\e902\" !important; }\n\n.ftinvwl-chevron-up:before {\n content: \"\\e903\" !important; }\n\n.ftinvwl-cancel:before {\n content: \"\\e904\" !important; }\n\n.ftinvwl-times:before {\n content: \"\\e905\" !important; }\n\n.ftinvwl-heart-plus:before {\n content: \"\\e906\" !important; }\n\n.ftinvwl-heart-mark-right:before {\n content: \"\\e907\" !important; }\n\n.ftinvwl-heart2:before {\n content: \"\\e908\" !important; }\n\n.ftinvwl-heart-o:before {\n content: \"\\e909\" !important; }\n\n.ftinvwl-heart-mark-left:before {\n content: \"\\e90a\" !important; }\n\n.ftinvwl-heart-mail:before {\n content: \"\\e90b\" !important; }\n\n.ftinvwl-heart-tinv:before {\n content: \"\\e90c\" !important; }\n\n.ftinvwl-key:before {\n content: \"\\e90d\" !important; }\n\n.ftinvwl-lock:before {\n content: \"\\e90e\" !important; }\n\n.ftinvwl-hearts:before {\n content: \"\\e90f\" !important; }\n\n.ftinvwl-user:before {\n content: \"\\e910\" !important; }\n\n/* PULSE */\n@-webkit-keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n@keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n.ftinvwl-pulse.ftinvwl-animated::before {\n -webkit-animation: ftinvwl-pulse 2s linear infinite;\n animation: ftinvwl-pulse 2s linear infinite; }\n"]}
1
+ {"version":3,"names":[],"mappings":"","sources":["webfont.css"],"file":"webfont.css","sourcesContent":["/*------------------------------------------------------------------\nWooCommerce Wishlist Plugin custom webfont\n-------------------------------------------------------------------*/\n@font-face {\n font-family: 'tinvwl-webfont';\n font-display: block;\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi\");\n src: url(\"../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix\") format(\"embedded-opentype\"), url(\"../fonts/tinvwl-webfont.woff2?ver=xu2uyi\") format(\"woff2\"), url(\"../fonts/tinvwl-webfont.woff?ver=xu2uyi\") format(\"woff\"), url(\"../fonts/tinvwl-webfont.ttf?ver=xu2uyi\") format(\"truetype\"), url(\"../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont\") format(\"svg\");\n font-weight: normal;\n font-style: normal; }\n\n.ftinvwl {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'tinvwl-webfont' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale; }\n\n.ftinvwl-twitter:before {\n content: \"\\f099\" !important; }\n\n.ftinvwl-facebook:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-facebook-f:before {\n content: \"\\f09a\" !important; }\n\n.ftinvwl-google:before {\n content: \"\\f0d5\" !important; }\n\n.ftinvwl-email:before {\n content: \"\\f0e0\" !important; }\n\n.ftinvwl-pinterest:before {\n content: \"\\f231\" !important; }\n\n.ftinvwl-whatsapp:before {\n content: \"\\f232\" !important; }\n\n.ftinvwl-clipboard:before {\n content: \"\\e911\" !important; }\n\n.ftinvwl-star:before {\n content: \"\\e912\" !important; }\n\n.ftinvwl-shopping-cart:before {\n content: \"\\e913\" !important; }\n\n.ftinvwl-magic:before {\n content: \"\\e914\" !important; }\n\n.ftinvwl-info:before {\n content: \"\\e915\" !important; }\n\n.ftinvwl-graduation-cap:before {\n content: \"\\e918\" !important; }\n\n.ftinvwl-floppy-o:before {\n content: \"\\e919\" !important; }\n\n.ftinvwl-eyedropper:before {\n content: \"\\e91a\" !important; }\n\n.ftinvwl-exclamation-triangle:before {\n content: \"\\e91b\" !important; }\n\n.ftinvwl-check:before {\n content: \"\\e91e\" !important; }\n\n.ftinvwl-arrow-left:before {\n content: \"\\e91f\" !important; }\n\n.ftinvwl-wrench:before {\n content: \"\\e920\" !important; }\n\n.ftinvwl-chevron-down:before {\n content: \"\\e900\" !important; }\n\n.ftinvwl-chevron-right:before {\n content: \"\\e901\" !important; }\n\n.ftinvwl-chevron-left:before {\n content: \"\\e902\" !important; }\n\n.ftinvwl-chevron-up:before {\n content: \"\\e903\" !important; }\n\n.ftinvwl-cancel:before {\n content: \"\\e904\" !important; }\n\n.ftinvwl-times:before {\n content: \"\\e905\" !important; }\n\n.ftinvwl-heart-plus:before {\n content: \"\\e906\" !important; }\n\n.ftinvwl-heart-mark-right:before {\n content: \"\\e907\" !important; }\n\n.ftinvwl-heart2:before {\n content: \"\\e908\" !important; }\n\n.ftinvwl-heart-o:before {\n content: \"\\e909\" !important; }\n\n.ftinvwl-heart-mark-left:before {\n content: \"\\e90a\" !important; }\n\n.ftinvwl-heart-mail:before {\n content: \"\\e90b\" !important; }\n\n.ftinvwl-heart-tinv:before {\n content: \"\\e90c\" !important; }\n\n.ftinvwl-key:before {\n content: \"\\e90d\" !important; }\n\n.ftinvwl-lock:before {\n content: \"\\e90e\" !important; }\n\n.ftinvwl-hearts:before {\n content: \"\\e90f\" !important; }\n\n.ftinvwl-user:before {\n content: \"\\e910\" !important; }\n\n/* PULSE */\n@-webkit-keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n@keyframes ftinvwl-pulse {\n 0% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); }\n 50% {\n -webkit-transform: scale(0.8);\n transform: scale(0.8); }\n 100% {\n -webkit-transform: scale(1.1);\n transform: scale(1.1); } }\n\n.ftinvwl-pulse.ftinvwl-animated::before {\n -webkit-animation: ftinvwl-pulse 2s linear infinite;\n animation: ftinvwl-pulse 2s linear infinite; }\n"]}
assets/css/webfont.min.css CHANGED
@@ -1,9 +1,9 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
- @font-face{font-family:'tinvwl-webfont';src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
7
  .ftinvwl{font-family:'tinvwl-webfont' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
8
  .ftinvwl-twitter:before{content:"\f099" !important}
9
  .ftinvwl-facebook:before{content:"\f09a" !important}
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
+ @font-face{font-family:'tinvwl-webfont';font-display:block;src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
7
  .ftinvwl{font-family:'tinvwl-webfont' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
8
  .ftinvwl-twitter:before{content:"\f099" !important}
9
  .ftinvwl-facebook:before{content:"\f09a" !important}
assets/js/admin.min.js CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  "use strict";function TInvWL($,h){this.pf="tinvwl",this.g="_",this.ho=h||!1,this.n="TInvWL",this.aj_act=function(t){return[this.pf,t].join(this.g)},this._csel=function(t,n){return"{0}{1}{2}".format(n=n||".",this.pf,t)},this._tm=function(t){var n=$("script#{0}[type='text/template']".format(t));return n.length?n.html():""},this.formElm=function(){if($(this._csel("-form-onoff")).tiwl_onoff(),$("input[type=checkbox][tiwl-show], input[type=checkbox][tiwl-hide]").tiwl_onoffblock(),$("[tiwl-value][tiwl-show], [tiwl-value][tiwl-hide]").tiwl_byvalueblock(),void 0!==$.fn.wpColorPicker){var e=function(t){var n=t.substring(1),i=parseInt(n,16);return.2126*(i>>16&255)+.7152*(i>>8&255)+.0722*(i>>0&255)},n=this._csel("-form-color");$(n).each(function(){var n=$(this),t=$(this).closest(".tinvwl-color-picker"),i=t.find(".tinvwl-eyedropper");n.css("background-color",n.val()),175<e(n.val())&&n.css("color","#000000"),n.iris({mode:"hsv",target:$(this).parent().parent(),change:function(t,n){175<e(n.color.toCSS())?$(this).css("color","#000000"):$(this).css("color",""),$(this).css("background-color",n.color.toCSS())}}),t.on("click",".iris-square-value",function(t){t.preventDefault(),n.iris("toggle")}),i.on("click",function(t){t.preventDefault(),n.iris("show")}),n.on("focusin",function(){n.iris("show")})}),$(document).on("click",function(t){$(t.target).is(n+", .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .ftinvwl-eyedropper")?$(n).not($(t.target).closest(".tinvwl-color-picker").find(n)).iris("hide"):$(n).iris("hide")})}},this.wizard_page=function(t){$(t).find("select").change(this._wizard_page_ch),this.wizard_page_ch($(t).find("select"))},this.wizard_page_ch=function(t){var n=(t=$(t)).parent(this._csel("-page-select")),i=n.find("input[type=hidden]").val(),e=n.find(this._csel("-error-icon")),o=n.find(this._csel("-error-desc"));""!==t.val()?(n.removeClass("tinvwl-error"),e.hide(),o.hide()):0==i&&(n.addClass("tinvwl-error"),e.show(),o.show())},this.pageElm=function(){$(this._csel("-header","div.")).prependTo("#wpbody-content"),$(this._csel("-page-select")).each(this._wizard_page),$(".bulkactions [type=submit]").each(this._control_bulkactions),$(".action-search [type=submit]").each(this._control_search)},this.control_bulkactions=function(t){$(t).on("click",this._control_bulkactions_ck)},this.control_bulkactions_ck=function(t,n){var i=(t=$(t)).parents(".bulkactions").eq(0).find("[name=action]"),e=t.parents("form").eq(0);i&&("-1"!==i.val()&&e.find("input[type=checkbox]:checked").length||n.preventDefault())},this.control_search=function(t){$(t).on("click",this._control_search_ck)},this.control_search_ck=function(t,n){var i=(t=$(t)).parents(".action-search").eq(0).find("[name=s]");i&&""===i.val()&&n.preventDefault()},this.Run=function(){this.formElm(),this.pageElm()},this.cg=function(){var t=this.n;if(this.ho){var n=new Date;t=t+n.getFullYear()+n.getMonth()+n.getDate()}window[t]=this},this.cg(),String.prototype.format||(String.prototype.format=function(){var i=arguments;return this.replace(/{(\d+)}/g,function(t,n){return void 0!==i[n]?i[n]:t})}),function(o){var n=o.n,ho=o.ho,c="";for(var i in ho&&(c="t=new Date(),n=n+t.getFullYear()+t.getMonth()+t.getDate(),"),o)"function"!=typeof o[i]||"_"===i[0]||o.hasOwnProperty("_"+i)||eval("o._"+i+"=function(a,b,c,d){var n='"+n+"',"+c+"o=window[n]||null;if (o) {return o."+i+"(this,a,b,c,d);};};")}(this)}!function(s){s.fn.tiwl_onoff=function(t){var o=s.extend(!0,{},{value:{on:"",off:""},class:"tiwlform-onoff",wrap:"container",button:"button"},t);return s(this).each(function(){var n=s(this),t=s("<div>").attr({class:o.class+"-"+o.button}),i=o.class+"-"+o.wrap,e=s("<div>").attr({id:n.attr("id")+"_"+o.wrap,class:i});return n.is("input")&&(e.attr("class",e.attr("class")+" "+n.attr("class")),n.is(":disabled")&&(e.toggleClass("disabled",n.is(":disabled")),n.prop("disabled",!1)),e.toggleClass("checked",n.is(":checked")),n.hide().removeAttr("class").wrap(e).before(t),e=n.parent(),n.on("change",function(t){if(e.hasClass("disabled"))return t.preventDefault();e.toggleClass("checked",s(this).is(":checked"))}),e.on("click",function(t){if(e.hasClass("disabled"))return t.preventDefault();n.is(":enabled")&&e.hasClass("checked")===n.is(":checked")&&n.click()})),n})},s.fn.tiwl_onoffblock=function(t){var n={onEachElm:function(){},isChecked:function(){return s(this).is(":checked")}},c=s.extend(!0,{},n,t);return s(this).each(function(){function t(){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){c.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),e=n.attr("tiwl-hide"),o=c.isChecked.call(n);return"string"==typeof i&&t(i,o),"string"==typeof e&&t(e,!o),n}var n=s(this);return n.is("input")&&"checkbox"==n.attr("type")?(s(this).on("change",t),t.call(n)):n})},s.fn.tiwl_byvalueblock=function(t){var n={onEachElm:function(){},onClick:function(){return s(this).val()==s(this).attr("tiwl-value")}},i=s.extend(!0,{},n,t);return s(this).each(function(){function t(e){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){e.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),o=n.attr("tiwl-hide"),c=e.onClick.call(n);return"string"==typeof i&&t(i,c),"string"==typeof o&&t(o,!c),n}var n=s(this);return n.is("input")||n.is("select")?(s(this).on("change",function(){t.call(this,i)}),t.call(n,i)):n})};var n=new TInvWL(s);s(document).ready(function(){if(n.Run(),jQuery('input[name="general-show_notice"]').change(function(){var t=!jQuery(this).is(":checked"),n=jQuery('input[name="general-redirect_require_login"]');t&&!n.is(":checked")&&n.click().trigger("change"),n.closest(".tiwlform-onoff-container").toggleClass("disabled",t)}).change(),s(".tablenav").each(function(){var t=s(this);s.trim(t.find(".alignleft").html()).length||t.find(".alignleft").remove(),s.trim(t.find(".alignright").html()).length&&!t.find(".tablenav-pages").hasClass("one-page")||(t.find(".alignright").remove(),t.find(".tinv-wishlist-clear").remove()),s.trim(t.html()).length||t.remove()}),s(".tablenav .bulkactions select").addClass("tinvwl-select grey").wrap('<span class="tinvwl-select-wrap">').parent().append('<span class="tinvwl-caret"><span></span></span>'),s(".tablenav .bulkactions .button.action, .tablenav #search-submit").removeClass("button").addClass("tinvwl-btn grey"),s(".tinvwl-modal-btn").on("click",function(){s(this).next(".tinvwl-modal").addClass("tinvwl-modal-open")}),s(".tinvwl-overlay, .tinvwl-close-modal, .tinvwl_button_close").on("click",function(t){t.preventDefault(),s(this).parents(".tinvwl-modal:first").removeClass("tinvwl-modal-open")}),void 0!==s.fn.popover){var t=s(".tinvwl-help");t.popover({content:function(){return s(this).closest(".tinvwl-info-wrap").find(".tinvwl-info-desc").html()}}),t.on("click",function(){s(this).popover("toggle")}),t.on("focusout",function(){s(this).popover("hide")}),s(window).on("resize",function(){t.popover("hide")})}s("body").on("click",".tinvwl-confirm-reset",function(t){t.preventDefault(),confirm(tinvwl_comfirm.text_comfirm_reset)&&s(this).removeClass("tinvwl-confirm-reset").trigger("click")})})}(jQuery);
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  "use strict";function TInvWL($,h){this.pf="tinvwl",this.g="_",this.ho=h||!1,this.n="TInvWL",this.aj_act=function(t){return[this.pf,t].join(this.g)},this._csel=function(t,n){return"{0}{1}{2}".format(n=n||".",this.pf,t)},this._tm=function(t){var n=$("script#{0}[type='text/template']".format(t));return n.length?n.html():""},this.formElm=function(){if($(this._csel("-form-onoff")).tiwl_onoff(),$("input[type=checkbox][tiwl-show], input[type=checkbox][tiwl-hide]").tiwl_onoffblock(),$("[tiwl-value][tiwl-show], [tiwl-value][tiwl-hide]").tiwl_byvalueblock(),void 0!==$.fn.wpColorPicker){var e=function(t){var n=t.substring(1),i=parseInt(n,16);return.2126*(i>>16&255)+.7152*(i>>8&255)+.0722*(i>>0&255)},n=this._csel("-form-color");$(n).each(function(){var n=$(this),t=$(this).closest(".tinvwl-color-picker"),i=t.find(".tinvwl-eyedropper");n.css("background-color",n.val()),175<e(n.val())&&n.css("color","#000000"),n.iris({mode:"hsv",target:$(this).parent().parent(),change:function(t,n){175<e(n.color.toCSS())?$(this).css("color","#000000"):$(this).css("color",""),$(this).css("background-color",n.color.toCSS())}}),t.on("click",".iris-square-value",function(t){t.preventDefault(),n.iris("toggle")}),i.on("click",function(t){t.preventDefault(),n.iris("show")}),n.on("focusin",function(){n.iris("show")})}),$(document).on("click",function(t){$(t.target).is(n+", .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .ftinvwl-eyedropper")?$(n).not($(t.target).closest(".tinvwl-color-picker").find(n)).iris("hide"):$(n).iris("hide")})}},this.wizard_page=function(t){$(t).find("select").change(this._wizard_page_ch),this.wizard_page_ch($(t).find("select"))},this.wizard_page_ch=function(t){var n=(t=$(t)).parent(this._csel("-page-select")),i=n.find("input[type=hidden]").val(),e=n.find(this._csel("-error-icon")),o=n.find(this._csel("-error-desc"));""!==t.val()?(n.removeClass("tinvwl-error"),e.hide(),o.hide()):0==i&&(n.addClass("tinvwl-error"),e.show(),o.show())},this.pageElm=function(){$(this._csel("-header","div.")).prependTo("#wpbody-content"),$(this._csel("-page-select")).each(this._wizard_page),$(".bulkactions [type=submit]").each(this._control_bulkactions),$(".action-search [type=submit]").each(this._control_search)},this.control_bulkactions=function(t){$(t).on("click",this._control_bulkactions_ck)},this.control_bulkactions_ck=function(t,n){var i=(t=$(t)).parents(".bulkactions").eq(0).find("[name=action]"),e=t.parents("form").eq(0);i&&("-1"!==i.val()&&e.find("input[type=checkbox]:checked").length||n.preventDefault())},this.control_search=function(t){$(t).on("click",this._control_search_ck)},this.control_search_ck=function(t,n){var i=(t=$(t)).parents(".action-search").eq(0).find("[name=s]");i&&""===i.val()&&n.preventDefault()},this.Run=function(){this.formElm(),this.pageElm()},this.cg=function(){var t=this.n;if(this.ho){var n=new Date;t=t+n.getFullYear()+n.getMonth()+n.getDate()}window[t]=this},this.cg(),String.prototype.format||(String.prototype.format=function(){var i=arguments;return this.replace(/{(\d+)}/g,function(t,n){return void 0!==i[n]?i[n]:t})}),function(o){var n=o.n,ho=o.ho,c="";for(var i in ho&&(c="t=new Date(),n=n+t.getFullYear()+t.getMonth()+t.getDate(),"),o)"function"!=typeof o[i]||"_"===i[0]||o.hasOwnProperty("_"+i)||eval("o._"+i+"=function(a,b,c,d){var n='"+n+"',"+c+"o=window[n]||null;if (o) {return o."+i+"(this,a,b,c,d);};};")}(this)}!function(s){s.fn.tiwl_onoff=function(t){var o=s.extend(!0,{},{value:{on:"",off:""},class:"tiwlform-onoff",wrap:"container",button:"button"},t);return s(this).each(function(){var n=s(this),t=s("<div>").attr({class:o.class+"-"+o.button}),i=o.class+"-"+o.wrap,e=s("<div>").attr({id:n.attr("id")+"_"+o.wrap,class:i});return n.is("input")&&(e.attr("class",e.attr("class")+" "+n.attr("class")),n.is(":disabled")&&(e.toggleClass("disabled",n.is(":disabled")),n.prop("disabled",!1)),e.toggleClass("checked",n.is(":checked")),n.hide().removeAttr("class").wrap(e).before(t),e=n.parent(),n.on("change",function(t){if(e.hasClass("disabled"))return t.preventDefault();e.toggleClass("checked",s(this).is(":checked"))}),e.on("click",function(t){if(e.hasClass("disabled"))return t.preventDefault();n.is(":enabled")&&e.hasClass("checked")===n.is(":checked")&&n.click()})),n})},s.fn.tiwl_onoffblock=function(t){var n={onEachElm:function(){},isChecked:function(){return s(this).is(":checked")}},c=s.extend(!0,{},n,t);return s(this).each(function(){function t(){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){c.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),e=n.attr("tiwl-hide"),o=c.isChecked.call(n);return"string"==typeof i&&t(i,o),"string"==typeof e&&t(e,!o),n}var n=s(this);return n.is("input")&&"checkbox"==n.attr("type")?(s(this).on("change",t),t.call(n)):n})},s.fn.tiwl_byvalueblock=function(t){var n={onEachElm:function(){},onClick:function(){return s(this).val()==s(this).attr("tiwl-value")}},i=s.extend(!0,{},n,t);return s(this).each(function(){function t(e){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){e.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),o=n.attr("tiwl-hide"),c=e.onClick.call(n);return"string"==typeof i&&t(i,c),"string"==typeof o&&t(o,!c),n}var n=s(this);return n.is("input")||n.is("select")?(s(this).on("change",function(){t.call(this,i)}),t.call(n,i)):n})};var n=new TInvWL(s);s(document).ready(function(){if(n.Run(),jQuery('input[name="general-show_notice"]').change(function(){var t=!jQuery(this).is(":checked"),n=jQuery('input[name="general-redirect_require_login"]');t&&!n.is(":checked")&&n.click().trigger("change"),n.closest(".tiwlform-onoff-container").toggleClass("disabled",t)}).change(),s(".tablenav").each(function(){var t=s(this);s.trim(t.find(".alignleft").html()).length||t.find(".alignleft").remove(),s.trim(t.find(".alignright").html()).length&&!t.find(".tablenav-pages").hasClass("one-page")||(t.find(".alignright").remove(),t.find(".tinv-wishlist-clear").remove()),s.trim(t.html()).length||t.remove()}),s(".tablenav .bulkactions select").addClass("tinvwl-select grey").wrap('<span class="tinvwl-select-wrap">').parent().append('<span class="tinvwl-caret"><span></span></span>'),s(".tablenav .bulkactions .button.action, .tablenav #search-submit").removeClass("button").addClass("tinvwl-btn grey"),s(".tinvwl-modal-btn").on("click",function(){s(this).next(".tinvwl-modal").addClass("tinvwl-modal-open")}),s(".tinvwl-overlay, .tinvwl-close-modal, .tinvwl_button_close").on("click",function(t){t.preventDefault(),s(this).parents(".tinvwl-modal:first").removeClass("tinvwl-modal-open")}),void 0!==s.fn.popover){var t=s(".tinvwl-help");t.popover({content:function(){return s(this).closest(".tinvwl-info-wrap").find(".tinvwl-info-desc").html()}}),t.on("click",function(){s(this).popover("toggle")}),t.on("focusout",function(){s(this).popover("hide")}),s(window).on("resize",function(){t.popover("hide")})}s("body").on("click",".tinvwl-confirm-reset",function(t){t.preventDefault(),confirm(tinvwl_comfirm.text_comfirm_reset)&&s(this).removeClass("tinvwl-confirm-reset").trigger("click")})})}(jQuery);
assets/js/public.min.js CHANGED
@@ -1,6 +1,6 @@
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
- * @version 1.24.4
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function showTooltip(t,i){t.setAttribute("class","social social-clipboard tooltipped tooltipped-s"),t.setAttribute("aria-label",i)}function clearTooltip(t){t.currentTarget.setAttribute("class","social social-clipboard "),t.currentTarget.removeAttribute("aria-label")}!function(c){c.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href.split("?")[0],text_create:window.tinvwl_add_to_wishlist.text_create,text_already_in:window.tinvwl_add_to_wishlist.text_already_in,class:{dialogbox:".tinvwl_add_to_select_wishlist",select:".tinvwl_wishlist",newtitle:".tinvwl_new_input",dialogbutton:".tinvwl_button_add"},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){c(this).append(c("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(t){c(t).addClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){c(t).removeClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(c(this).is(".disabled-add-wishlist"))return!1;c(this).is(".ftinvwl-animated")&&c(this).addClass("ftinvwl-pulse"),this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):e.onActionProduct.call(this)},onPrepareDataAction:function(t,i){c("body").trigger("tinvwl_wishlist_button_clicked",[t,i])},filterProductAlreadyIn:function(t){t=t||[];var o={};return c("form.cart[method=post], .woocommerce-variation-add-to-cart, form.vtajaxform[method=post]").find("input, select").each(function(){var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val();("checkbox"!==i&&"radio"!==i||c(this).is(":checked"))&&(o["form"+t]=n)}),o=o.formvariation_id,t.filter(function(t){if("object"!==_typeof(t.in)||"string"!=typeof o)return t.in;var i=parseInt(o);return 0<=t.in.indexOf(i)})},onMultiProductAlreadyIn:function(t){t=t||[];t=e.onPrepareList.call(t)||t,t=e.filterProductAlreadyIn.call(this,t)||t,c(this).parent().parent().find(".already-in").remove();var n="";switch(t.length){case 0:break;default:n=c("<ul>");c.each(t,function(t,i){n.append(c("<li>").html(c("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}n.length&&c(this).closest(".tinv-modal-inner").find("img").after(c("<div>").addClass("already-in").html(e.text_already_in+" ").append(n))},onAction:{redirect:function(t){e.redirectTimer&&clearTimeout(e.redirectTimer),e.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(){},msg:function(t){if(!t)return!1;var i=c(t).eq(0);c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c("body > .tinv-wishlist").append(i),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),e.redirectTimer&&clearTimeout(e.redirectTimer)})},status:function(t){c("body").trigger("tinvwl_wishlist_added_status",[this,t])},removed:function(){},make_remove:function(){},wishlists_data:function(t){d(JSON.stringify(t))}}};i.onActionProduct=function(t,i){var r={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:c(this).attr("data-tinv-wl-producttype"),product_id:c(this).attr("data-tinv-wl-product")||0,product_variation:c(this).attr("data-tinv-wl-productvariation")||0,product_action:c(this).attr("data-tinv-wl-action")||"addto",redirect:window.location.href},n=this,o=[],d=new FormData;tinvwl_add_to_wishlist.wpml&&(r.lang=tinvwl_add_to_wishlist.wpml),c('form.cart[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"], form.vtajaxform[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),o.length||(c(n).closest("form.cart[method=post], form.vtajaxform[method=post]").each(function(){o.push(c(this))}),o.length||o.push(c("form.cart[method=post]"))),c('.tinv-wraper[data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),c.each(o,function(t,i){c(i).find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").each(function(){function e(t,i){if("object"!==_typeof(i))return i;for(var n in void 0===t&&(t={}),i)if(""===n){var o=-1;for(o in t)o=o;t[o=parseInt(o)+1]=e(t[n],i[n])}else t[n]=e(t[n],i[n]);return t}var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val(),o=10;if("button"!==i&&void 0!==t){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<o;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=n,n=l}t=a[1],o--}if("file"===i){var s=c(this)[0].files;s&&d.append(t,s[0])}"checkbox"===i||"radio"===i?c(this).is(":checked")&&(n.length||"object"===_typeof(n)||(n=!0),r.form[t]=e(r.form[t],n)):r.form[t]=e(r.form[t],n)}})}),r=e.onPrepareDataAction.call(n,n,r)||r,c.each(r,function(n,t){"form"===n?c.each(t,function(t,i){"object"===_typeof(i)&&(i=JSON.stringify(i)),d.append(n+"["+t+"]",i)}):d.append(n,t)}),c.ajax({url:e.api_url,method:"POST",contentType:!1,processData:!1,data:d}).done(function(t){if(e.onDialogHide.call(n.tinvwl_dialog,n),"object"===_typeof(t))for(var i in t)"function"==typeof e.onAction[i]&&e.onAction[i].call(n,t[i]);else"function"==typeof e.onAction.msg&&e.onAction.msg.call(n,t)})};var e=c.extend(!0,{},i,t);return c(this).each(function(){if(!c(this).attr("data-tinv-wl-list"))return!1;if(e.dialogbox&&e.dialogbox.length&&(this.tinvwl_dialog=e.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=e.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=c(this).nextAll(e.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){e.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=c(this).find(e.class.select).eq(0);c(this).find(e.class.newtitle).hide().val(""),n.html(""),c.each(t,function(t,i){e.onCreateWishList.call(n,i)}),e.text_create&&e.onCreateWishList.call(n,{ID:"",title:e.text_create,in:!1}),e.onMultiProductAlreadyIn.call(n,t),e.onSelectWishList.call(n,t),c(this).find(e.class.newtitle).toggle(""===n.val())}),"function"!=typeof this.tinvwl_dialog.show_list&&(this.tinvwl_dialog.show_list=function(){var t=JSON.parse(c(this).attr("data-tinv-wl-list"))||[];t.length?(t=e.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),e.onDialogShow.call(this.tinvwl_dialog,this)):e.onActionProduct.call(this)});var o=this;c(this.tinvwl_dialog).find(e.class.dialogbutton).off("click").on("click",function(){var t,i=c(o.tinvwl_dialog).find(e.class.select),n=c(o.tinvwl_dialog).find(e.class.newtitle);i.val()||n.val()?e.onActionProduct.call(o,i.val(),n.val()):((t=n.is(":visible")?n:i).addClass("empty-name-wishlist"),window.setTimeout(function(){t.removeClass("empty-name-wishlist")},1e3))})}c(this).off("click").on("click",e.onClick),e.onInited.call(this,e)})},c(document).ready(function(){c("body").on("click",".tinvwl_add_to_wishlist_button",function(t){if(c("body").trigger("tinvwl_add_to_wishlist_button_click",[this]),c(this).is(".disabled-add-wishlist"))return t.preventDefault(),void window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);c(this).is(".inited-add-wishlist")||c(this).tinvwl_to_wishlist({onInited:function(t){c(this).addClass("inited-add-wishlist"),t.onClick.call(this)}})}),c(document).on("hide_variation",".variations_form",function(t){var i=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(i.attr("data-tinv-wl-productvariation",0),i.length&&i.attr("data-tinv-wl-list")){var n=JSON.parse(i.attr("data-tinv-wl-list")),o=!1,e="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var a in n)n[a].hasOwnProperty("in")&&Array.isArray(n[a].in)&&-1<(n[a].in||[]).indexOf(0)&&(o=!0);i.toggleClass("tinvwl-product-in-list",o).toggleClass("tinvwl-product-make-remove",o&&e).attr("data-tinv-wl-action",o&&e?"remove":"addto")}i.length&&!tinvwl_add_to_wishlist.allow_parent_variable&&(t.preventDefault(),i.addClass("disabled-add-wishlist"))}),c(document).on("show_variation",".variations_form",function(t,i,n){var o=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(o.attr("data-tinv-wl-productvariation",i.variation_id),o.length&&o.attr("data-tinv-wl-list")){var e=JSON.parse(o.attr("data-tinv-wl-list")),a=!1,l="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var s in e)e[s].hasOwnProperty("in")&&Array.isArray(e[s].in)&&-1<(e[s].in||[]).indexOf(i.variation_id)&&(a=!0);o.toggleClass("tinvwl-product-in-list",a).toggleClass("tinvwl-product-make-remove",a&&l).attr("data-tinv-wl-action",a&&l?"remove":"addto")}t.preventDefault(),o.removeClass("disabled-add-wishlist")}),c(window).on("storage onstorage",function(t){if(s===t.originalEvent.key&&localStorage.getItem(s)!==sessionStorage.getItem(s)&&localStorage.getItem(s)){var i=JSON.parse(localStorage.getItem(s));"object"===_typeof(i)&&null!==i&&(i.hasOwnProperty("products")||i.hasOwnProperty("counter"))&&d(localStorage.getItem(s))}});var n=[],i=!1;c("a.tinvwl_add_to_wishlist_button").each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))}),c(".wishlist_products_counter_number").each(function(){i=!0});function o(){if(n.length||i){var t={};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.plugin_url+"includes/api/ajax.php",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)}).fail(function(){!function(){if(n.length||i){var t={ids:n,counter:i,tinvwl_request:!0};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.rest_root+"wishlist/v1/products",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)})}}()})}}function e(){if(l&&(tinvwl_add_to_wishlist.update_wishlists_data&&localStorage.setItem(s,""),localStorage.getItem(s))){var t=JSON.parse(localStorage.getItem(s));if("object"===_typeof(t)&&null!==t&&(t.hasOwnProperty("products")||t.hasOwnProperty("counter"))&&(!t.hasOwnProperty("lang")&&!tinvwl_add_to_wishlist.wpml||tinvwl_add_to_wishlist.wpml&&t.lang===tinvwl_add_to_wishlist.wpml))return void r(t)}tinvwl_add_to_wishlist.block_ajax_wishlists_data||o()}e();var t=new MutationObserver(function(t){n=[],t.forEach(function(t){var i=t.addedNodes;null!==i&&c(i).each(function(){var t=c(this).find(".tinvwl_add_to_wishlist_button");t.length&&t.each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))})})}),n.length&&e()}),a=document.body;t.observe(a,{childList:!0,subtree:!0})});var l=!0,s=tinvwl_add_to_wishlist.hash_key;try{l="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("ti","test"),window.sessionStorage.removeItem("ti"),window.localStorage.setItem("ti","test"),window.localStorage.removeItem("ti")}catch(t){l=!1}function r(t){var l="1"==window.tinvwl_add_to_wishlist.simple_flow;l&&c("a.tinvwl_add_to_wishlist_button").each(function(){c(this).removeClass("tinvwl-product-make-remove").removeClass("tinvwl-product-already-on-wishlist").removeClass("tinvwl-product-in-list").attr("data-tinv-wl-action","addto").attr("data-tinv-wl-list","[]")}),c("body").trigger("tinvwl_wishlist_mark_products",[t]),c.each(t.products,function(t,e){var a=t;c('a.tinvwl_add_to_wishlist_button[data-tinv-wl-product="'+a+'"]').each(function(){var t=parseInt(c(this).attr("data-tinv-wl-productvariation")),i=c(this).data("tinv-wl-productvariations")||[],n=!1;for(var o in e)e[o].hasOwnProperty("in")&&Array.isArray(e[o].in)&&(-1<(e[o].in||[]).indexOf(a)||-1<(e[o].in||[]).indexOf(t)||i.some(function(t){return 0<=(e[o].in||[]).indexOf(t)}))&&(n=!0);c("body").trigger("tinvwl_wishlist_product_marked",[this,n]),c(this).attr("data-tinv-wl-list",JSON.stringify(e)).toggleClass("tinvwl-product-in-list",n).toggleClass("tinvwl-product-make-remove",n&&l).attr("data-tinv-wl-action",n&&l?"remove":"addto")})}),function(t){"1"==window.tinvwl_add_to_wishlist.hide_zero_counter&&0===t&&(t="false");jQuery("i.wishlist-icon").addClass("added"),"false"!==t?(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html(t),jQuery("i.wishlist-icon").attr("data-icon-label",t)):(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html("").closest("span.wishlist-counter-with-products").removeClass("wishlist-counter-with-products"),jQuery("i.wishlist-icon").removeAttr("data-icon-label"));var i=!("0"==t||"false"==t);jQuery(".wishlist_products_counter").toggleClass("wishlist-counter-with-products",i),setTimeout(function(){jQuery("i.wishlist-icon").removeClass("added")},500)}(t.counter)}function d(t){l&&(localStorage.setItem(s,t),sessionStorage.setItem(s,t),r(JSON.parse(t)))}}(jQuery),function(o){o(document).ready(function(){if(o("#tinvwl_manage_actions, #tinvwl_product_actions").addClass("form-control").parent().wrapInner('<div class="tinvwl-input-group tinvwl-no-full">').find("button").wrap('<span class="tinvwl-input-group-btn">'),o(".tinv-lists-nav").each(function(){o(this).html().trim().length||o(this).remove()}),o("body").on("click",".social-buttons .social:not(.social-email,.social-whatsapp,.social-clipboard)",function(t){var i=window.open(o(this).attr("href"),o(this).attr("title"),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");i&&(i.focus(),t.preventDefault())}),"undefined"!=typeof ClipboardJS){new ClipboardJS(".social-buttons .social.social-clipboard",{text:function(t){return t.getAttribute("href")}}).on("success",function(t){showTooltip(t.trigger,tinvwl_add_to_wishlist.tinvwl_clipboard)});for(var t=document.querySelectorAll(".social-buttons .social.social-clipboard"),i=0;i<t.length;i++)t[i].addEventListener("mouseleave",clearTooltip),t[i].addEventListener("blur",clearTooltip)}o("body").on("click",".social-buttons .social.social-clipboard",function(t){t.preventDefault()}),o("body").on("click",".tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close",function(t){t.preventDefault(),o(this).parents(".tinv-modal:first").removeClass("tinv-modal-open"),o("body").trigger("tinvwl_modal_closed",[this])}),o("body").on("click",".tinv-wishlist .tinvwl-btn-onclick",function(t){o(this).data("url")&&(t.preventDefault(),window.location=o(this).data("url"))});var n=o(".tinv-wishlist .navigation-button");n.length&&n.each(function(){var t=o(this).find("> li");t.length<5&&t.parent().addClass("tinvwl-btns-count-"+t.length)}),o(".tinv-login .showlogin").off("click").on("click",function(t){t.preventDefault(),o(this).closest(".tinv-login").find(".login").toggle()}),o(".tinv-wishlist table.tinvwl-table-manage-list tfoot td").each(function(){o(this).toggle(!!o(this).children().not(".look_in").length||!!o(this).children(".look_in").children().length)})})}(jQuery),function(o){o.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return o(this).val()},rule:function(){var t=o(this).parents("form").eq(0).find(n.selector),i=n.invert;return 0===t.length?n.ifempty:(t.each(function(){i&&!n.invert||!i&&n.invert||(i=Boolean(n.validate.call(o(this))))}),i)}},n=o.extend(!0,{},i,t);return o(this).each(function(){o(this).on("click",function(t){n.rule.call(o(this))||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault())})})},o(document).ready(function(){o(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),o(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return o(this).is(":checked")}}),o(".global-cb").on("click",function(){o(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",o(this).is(":checked"))})})}(jQuery);
1
  /**
2
  * TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
3
+ * @version 1.24.5
4
  * @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
5
  */
6
  "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function showTooltip(t,i){t.setAttribute("class","social social-clipboard tooltipped tooltipped-s"),t.setAttribute("aria-label",i)}function clearTooltip(t){t.currentTarget.setAttribute("class","social social-clipboard "),t.currentTarget.removeAttribute("aria-label")}!function(c){c.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href.split("?")[0],text_create:window.tinvwl_add_to_wishlist.text_create,text_already_in:window.tinvwl_add_to_wishlist.text_already_in,class:{dialogbox:".tinvwl_add_to_select_wishlist",select:".tinvwl_wishlist",newtitle:".tinvwl_new_input",dialogbutton:".tinvwl_button_add"},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){c(this).append(c("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(t){c(t).addClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){c(t).removeClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(c(this).is(".disabled-add-wishlist"))return!1;c(this).is(".ftinvwl-animated")&&c(this).addClass("ftinvwl-pulse"),this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):e.onActionProduct.call(this)},onPrepareDataAction:function(t,i){c("body").trigger("tinvwl_wishlist_button_clicked",[t,i])},filterProductAlreadyIn:function(t){t=t||[];var o={};return c("form.cart[method=post], .woocommerce-variation-add-to-cart, form.vtajaxform[method=post]").find("input, select").each(function(){var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val();("checkbox"!==i&&"radio"!==i||c(this).is(":checked"))&&(o["form"+t]=n)}),o=o.formvariation_id,t.filter(function(t){if("object"!==_typeof(t.in)||"string"!=typeof o)return t.in;var i=parseInt(o);return 0<=t.in.indexOf(i)})},onMultiProductAlreadyIn:function(t){t=t||[];t=e.onPrepareList.call(t)||t,t=e.filterProductAlreadyIn.call(this,t)||t,c(this).parent().parent().find(".already-in").remove();var n="";switch(t.length){case 0:break;default:n=c("<ul>");c.each(t,function(t,i){n.append(c("<li>").html(c("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}n.length&&c(this).closest(".tinv-modal-inner").find("img").after(c("<div>").addClass("already-in").html(e.text_already_in+" ").append(n))},onAction:{redirect:function(t){e.redirectTimer&&clearTimeout(e.redirectTimer),e.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(){},msg:function(t){if(!t)return!1;var i=c(t).eq(0);c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c("body > .tinv-wishlist").append(i),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),e.redirectTimer&&clearTimeout(e.redirectTimer)})},status:function(t){c("body").trigger("tinvwl_wishlist_added_status",[this,t])},removed:function(){},make_remove:function(){},wishlists_data:function(t){d(JSON.stringify(t))}}};i.onActionProduct=function(t,i){var r={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:c(this).attr("data-tinv-wl-producttype"),product_id:c(this).attr("data-tinv-wl-product")||0,product_variation:c(this).attr("data-tinv-wl-productvariation")||0,product_action:c(this).attr("data-tinv-wl-action")||"addto",redirect:window.location.href},n=this,o=[],d=new FormData;tinvwl_add_to_wishlist.wpml&&(r.lang=tinvwl_add_to_wishlist.wpml),c('form.cart[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"], form.vtajaxform[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),o.length||(c(n).closest("form.cart[method=post], form.vtajaxform[method=post]").each(function(){o.push(c(this))}),o.length||o.push(c("form.cart[method=post]"))),c('.tinv-wraper[data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),c.each(o,function(t,i){c(i).find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").each(function(){function e(t,i){if("object"!==_typeof(i))return i;for(var n in void 0===t&&(t={}),i)if(""===n){var o=-1;for(o in t)o=o;t[o=parseInt(o)+1]=e(t[n],i[n])}else t[n]=e(t[n],i[n]);return t}var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val(),o=10;if("button"!==i&&void 0!==t){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<o;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=n,n=l}t=a[1],o--}if("file"===i){var s=c(this)[0].files;s&&d.append(t,s[0])}"checkbox"===i||"radio"===i?c(this).is(":checked")&&(n.length||"object"===_typeof(n)||(n=!0),r.form[t]=e(r.form[t],n)):r.form[t]=e(r.form[t],n)}})}),r=e.onPrepareDataAction.call(n,n,r)||r,c.each(r,function(n,t){"form"===n?c.each(t,function(t,i){"object"===_typeof(i)&&(i=JSON.stringify(i)),d.append(n+"["+t+"]",i)}):d.append(n,t)}),c.ajax({url:e.api_url,method:"POST",contentType:!1,processData:!1,data:d}).done(function(t){if(e.onDialogHide.call(n.tinvwl_dialog,n),"object"===_typeof(t))for(var i in t)"function"==typeof e.onAction[i]&&e.onAction[i].call(n,t[i]);else"function"==typeof e.onAction.msg&&e.onAction.msg.call(n,t)})};var e=c.extend(!0,{},i,t);return c(this).each(function(){if(!c(this).attr("data-tinv-wl-list"))return!1;if(e.dialogbox&&e.dialogbox.length&&(this.tinvwl_dialog=e.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=e.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=c(this).nextAll(e.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){e.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=c(this).find(e.class.select).eq(0);c(this).find(e.class.newtitle).hide().val(""),n.html(""),c.each(t,function(t,i){e.onCreateWishList.call(n,i)}),e.text_create&&e.onCreateWishList.call(n,{ID:"",title:e.text_create,in:!1}),e.onMultiProductAlreadyIn.call(n,t),e.onSelectWishList.call(n,t),c(this).find(e.class.newtitle).toggle(""===n.val())}),"function"!=typeof this.tinvwl_dialog.show_list&&(this.tinvwl_dialog.show_list=function(){var t=JSON.parse(c(this).attr("data-tinv-wl-list"))||[];t.length?(t=e.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),e.onDialogShow.call(this.tinvwl_dialog,this)):e.onActionProduct.call(this)});var o=this;c(this.tinvwl_dialog).find(e.class.dialogbutton).off("click").on("click",function(){var t,i=c(o.tinvwl_dialog).find(e.class.select),n=c(o.tinvwl_dialog).find(e.class.newtitle);i.val()||n.val()?e.onActionProduct.call(o,i.val(),n.val()):((t=n.is(":visible")?n:i).addClass("empty-name-wishlist"),window.setTimeout(function(){t.removeClass("empty-name-wishlist")},1e3))})}c(this).off("click").on("click",e.onClick),e.onInited.call(this,e)})},c(document).ready(function(){c("body").on("click",".tinvwl_add_to_wishlist_button",function(t){if(c("body").trigger("tinvwl_add_to_wishlist_button_click",[this]),c(this).is(".disabled-add-wishlist"))return t.preventDefault(),void window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);c(this).is(".inited-add-wishlist")||c(this).tinvwl_to_wishlist({onInited:function(t){c(this).addClass("inited-add-wishlist"),t.onClick.call(this)}})}),c(document).on("hide_variation",".variations_form",function(t){var i=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(i.attr("data-tinv-wl-productvariation",0),i.length&&i.attr("data-tinv-wl-list")){var n=JSON.parse(i.attr("data-tinv-wl-list")),o=!1,e="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var a in n)n[a].hasOwnProperty("in")&&Array.isArray(n[a].in)&&-1<(n[a].in||[]).indexOf(0)&&(o=!0);i.toggleClass("tinvwl-product-in-list",o).toggleClass("tinvwl-product-make-remove",o&&e).attr("data-tinv-wl-action",o&&e?"remove":"addto")}i.length&&!tinvwl_add_to_wishlist.allow_parent_variable&&(t.preventDefault(),i.addClass("disabled-add-wishlist"))}),c(document).on("show_variation",".variations_form",function(t,i,n){var o=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(o.attr("data-tinv-wl-productvariation",i.variation_id),o.length&&o.attr("data-tinv-wl-list")){var e=JSON.parse(o.attr("data-tinv-wl-list")),a=!1,l="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var s in e)e[s].hasOwnProperty("in")&&Array.isArray(e[s].in)&&-1<(e[s].in||[]).indexOf(i.variation_id)&&(a=!0);o.toggleClass("tinvwl-product-in-list",a).toggleClass("tinvwl-product-make-remove",a&&l).attr("data-tinv-wl-action",a&&l?"remove":"addto")}t.preventDefault(),o.removeClass("disabled-add-wishlist")}),c(window).on("storage onstorage",function(t){if(s===t.originalEvent.key&&localStorage.getItem(s)!==sessionStorage.getItem(s)&&localStorage.getItem(s)){var i=JSON.parse(localStorage.getItem(s));"object"===_typeof(i)&&null!==i&&(i.hasOwnProperty("products")||i.hasOwnProperty("counter"))&&d(localStorage.getItem(s))}});var n=[],i=!1;c("a.tinvwl_add_to_wishlist_button").each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))}),c(".wishlist_products_counter_number").each(function(){i=!0});function o(){if(n.length||i){var t={};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.plugin_url+"includes/api/ajax.php",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)}).fail(function(){!function(){if(n.length||i){var t={ids:n,counter:i,tinvwl_request:!0};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.rest_root+"wishlist/v1/products",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)})}}()})}}function e(){if(l&&(tinvwl_add_to_wishlist.update_wishlists_data&&localStorage.setItem(s,""),localStorage.getItem(s))){var t=JSON.parse(localStorage.getItem(s));if("object"===_typeof(t)&&null!==t&&(t.hasOwnProperty("products")||t.hasOwnProperty("counter"))&&(!t.hasOwnProperty("lang")&&!tinvwl_add_to_wishlist.wpml||tinvwl_add_to_wishlist.wpml&&t.lang===tinvwl_add_to_wishlist.wpml))return void r(t)}tinvwl_add_to_wishlist.block_ajax_wishlists_data||o()}e();var t=new MutationObserver(function(t){n=[],t.forEach(function(t){var i=t.addedNodes;null!==i&&c(i).each(function(){var t=c(this).find(".tinvwl_add_to_wishlist_button");t.length&&t.each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))})})}),n.length&&e()}),a=document.body;t.observe(a,{childList:!0,subtree:!0})});var l=!0,s=tinvwl_add_to_wishlist.hash_key;try{l="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("ti","test"),window.sessionStorage.removeItem("ti"),window.localStorage.setItem("ti","test"),window.localStorage.removeItem("ti")}catch(t){l=!1}function r(t){var l="1"==window.tinvwl_add_to_wishlist.simple_flow;l&&c("a.tinvwl_add_to_wishlist_button").each(function(){c(this).removeClass("tinvwl-product-make-remove").removeClass("tinvwl-product-already-on-wishlist").removeClass("tinvwl-product-in-list").attr("data-tinv-wl-action","addto").attr("data-tinv-wl-list","[]")}),c("body").trigger("tinvwl_wishlist_mark_products",[t]),c.each(t.products,function(t,e){var a=t;c('a.tinvwl_add_to_wishlist_button[data-tinv-wl-product="'+a+'"]').each(function(){var t=parseInt(c(this).attr("data-tinv-wl-productvariation")),i=c(this).data("tinv-wl-productvariations")||[],n=!1;for(var o in e)e[o].hasOwnProperty("in")&&Array.isArray(e[o].in)&&(-1<(e[o].in||[]).indexOf(a)||-1<(e[o].in||[]).indexOf(t)||i.some(function(t){return 0<=(e[o].in||[]).indexOf(t)}))&&(n=!0);c("body").trigger("tinvwl_wishlist_product_marked",[this,n]),c(this).attr("data-tinv-wl-list",JSON.stringify(e)).toggleClass("tinvwl-product-in-list",n).toggleClass("tinvwl-product-make-remove",n&&l).attr("data-tinv-wl-action",n&&l?"remove":"addto")})}),function(t){"1"==window.tinvwl_add_to_wishlist.hide_zero_counter&&0===t&&(t="false");jQuery("i.wishlist-icon").addClass("added"),"false"!==t?(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html(t),jQuery("i.wishlist-icon").attr("data-icon-label",t)):(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html("").closest("span.wishlist-counter-with-products").removeClass("wishlist-counter-with-products"),jQuery("i.wishlist-icon").removeAttr("data-icon-label"));var i=!("0"==t||"false"==t);jQuery(".wishlist_products_counter").toggleClass("wishlist-counter-with-products",i),setTimeout(function(){jQuery("i.wishlist-icon").removeClass("added")},500)}(t.counter)}function d(t){l&&(localStorage.setItem(s,t),sessionStorage.setItem(s,t),r(JSON.parse(t)))}}(jQuery),function(o){o(document).ready(function(){if(o("#tinvwl_manage_actions, #tinvwl_product_actions").addClass("form-control").parent().wrapInner('<div class="tinvwl-input-group tinvwl-no-full">').find("button").wrap('<span class="tinvwl-input-group-btn">'),o(".tinv-lists-nav").each(function(){o(this).html().trim().length||o(this).remove()}),o("body").on("click",".social-buttons .social:not(.social-email,.social-whatsapp,.social-clipboard)",function(t){var i=window.open(o(this).attr("href"),o(this).attr("title"),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");i&&(i.focus(),t.preventDefault())}),"undefined"!=typeof ClipboardJS){new ClipboardJS(".social-buttons .social.social-clipboard",{text:function(t){return t.getAttribute("href")}}).on("success",function(t){showTooltip(t.trigger,tinvwl_add_to_wishlist.tinvwl_clipboard)});for(var t=document.querySelectorAll(".social-buttons .social.social-clipboard"),i=0;i<t.length;i++)t[i].addEventListener("mouseleave",clearTooltip),t[i].addEventListener("blur",clearTooltip)}o("body").on("click",".social-buttons .social.social-clipboard",function(t){t.preventDefault()}),o("body").on("click",".tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close",function(t){t.preventDefault(),o(this).parents(".tinv-modal:first").removeClass("tinv-modal-open"),o("body").trigger("tinvwl_modal_closed",[this])}),o("body").on("click",".tinv-wishlist .tinvwl-btn-onclick",function(t){o(this).data("url")&&(t.preventDefault(),window.location=o(this).data("url"))});var n=o(".tinv-wishlist .navigation-button");n.length&&n.each(function(){var t=o(this).find("> li");t.length<5&&t.parent().addClass("tinvwl-btns-count-"+t.length)}),o(".tinv-login .showlogin").off("click").on("click",function(t){t.preventDefault(),o(this).closest(".tinv-login").find(".login").toggle()}),o(".tinv-wishlist table.tinvwl-table-manage-list tfoot td").each(function(){o(this).toggle(!!o(this).children().not(".look_in").length||!!o(this).children(".look_in").children().length)})})}(jQuery),function(o){o.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return o(this).val()},rule:function(){var t=o(this).parents("form").eq(0).find(n.selector),i=n.invert;return 0===t.length?n.ifempty:(t.each(function(){i&&!n.invert||!i&&n.invert||(i=Boolean(n.validate.call(o(this))))}),i)}},n=o.extend(!0,{},i,t);return o(this).each(function(){o(this).on("click",function(t){n.rule.call(o(this))||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault())})})},o(document).ready(function(){o(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),o(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return o(this).is(":checked")}}),o(".global-cb").on("click",function(){o(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",o(this).is(":checked"))})})}(jQuery);
includes/wishlist.class.php CHANGED
@@ -7,14 +7,15 @@
7
  */
8
 
9
  // If this file is called directly, abort.
10
- if ( ! defined( 'ABSPATH' ) ) {
11
  die;
12
  }
13
 
14
  /**
15
  * Wishlists function class
16
  */
17
- class TInvWL_Wishlist {
 
18
 
19
  /**
20
  * Table name
@@ -67,15 +68,16 @@ class TInvWL_Wishlist {
67
  * @global wpdb $wpdb
68
  *
69
  */
70
- function __construct( $plugin_name = TINVWL_PREFIX ) {
 
71
  global $wpdb;
72
 
73
- $this->_name = $plugin_name;
74
- $this->table = sprintf( '%s%s_%s', $wpdb->prefix, $this->_name, 'lists' );
75
- $this->default_name = apply_filters( 'tinvwl_default_wishlist_title', tinv_get_option( 'general', 'default_title' ) );
76
  $this->default_privacy = 'share';
77
- $this->privacy = array( 'public', 'share', 'private' );
78
- if ( ! in_array( $this->default_privacy, $this->privacy ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
79
  $this->default_privacy = 'share';
80
  }
81
  $this->user = get_current_user_id();
@@ -87,18 +89,19 @@ class TInvWL_Wishlist {
87
  * @return string
88
  * @global wpdb $wpdb
89
  */
90
- function unique_share_key() {
 
91
  global $wpdb;
92
 
93
- $sharekeys = $wpdb->get_results( "SELECT `share_key` FROM `{$this->table}`", ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
94
  $share_keys = array();
95
- foreach ( $sharekeys as $sharekey ) {
96
  $share_keys[] = $sharekey['share_key'];
97
  }
98
  $new_key = '';
99
  do {
100
- $new_key = strtoupper( substr( md5( date( 'r' ) . mt_rand( 0, 3000 ) ), 0, 6 ) );
101
- } while ( array_search( $new_key, $share_keys ) ); // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
102
 
103
  return $new_key;
104
  }
@@ -110,20 +113,21 @@ class TInvWL_Wishlist {
110
  *
111
  * @return boolean|array
112
  */
113
- function add_user_default( $user_id = 0 ) {
114
- if ( empty( $user_id ) ) {
 
115
  $user_id = $this->user;
116
  }
117
- if ( empty( $user_id ) ) {
118
  return $this->add_sharekey_default();
119
  }
120
- if ( $wl = $this->get_by_user_default( $user_id ) ) {
121
- return array_shift( $wl );
122
  }
123
 
124
- $wl = $this->add( '', 'default', $this->default_privacy, $user_id );
125
- if ( is_array( $wl ) && array_key_exists( 'share_key', $wl ) ) {
126
- $this->set_sharekey( $wl['share_key'] );
127
 
128
  return $wl;
129
  }
@@ -138,14 +142,15 @@ class TInvWL_Wishlist {
138
  *
139
  * @return boolean|array
140
  */
141
- function add_sharekey_default( $sharekey = '' ) {
142
- if ( $wl = $this->get_by_sharekey_default( $sharekey ) ) {
143
- return array_shift( $wl );
 
144
  }
145
 
146
- $wl = $this->add( '', 'default', $this->default_privacy, 0 );
147
- if ( is_array( $wl ) && array_key_exists( 'share_key', $wl ) ) {
148
- $this->set_sharekey( $wl['share_key'] );
149
 
150
  return $wl;
151
  }
@@ -165,42 +170,43 @@ class TInvWL_Wishlist {
165
  * @global wpdb $wpdb
166
  *
167
  */
168
- function add( $data, $type = 'list', $status = 'public', $user_id = 0 ) {
169
- $user_id = absint( $user_id );
170
- if ( empty( $user_id ) ) {
 
171
  $user_id = $this->user;
172
  }
173
 
174
  $default = array(
175
- 'author' => $user_id,
176
- 'date' => current_time( 'Y-m-d H:i:s' ),
177
- 'status' => $this->default_privacy,
178
  'share_key' => $this->unique_share_key(),
179
- 'title' => $this->default_name,
180
- 'type' => 'list',
181
  );
182
 
183
- if ( ! is_array( $data ) ) {
184
  $data = array(
185
- 'title' => $data,
186
  'status' => $status,
187
- 'type' => $type,
188
  );
189
  }
190
- $data = wp_parse_args( $data, $default );
191
- $data = apply_filters( 'tinvwl_wishlist_add', $data );
192
- if ( ! in_array( $data['status'], $this->privacy ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
193
  $data['status'] = 'public';
194
  }
195
  global $wpdb;
196
- if ( $wpdb->insert( $this->table, $data ) ) { // @codingStandardsIgnoreLine WordPress.VIP.DirectDatabaseQuery.DirectQuery
197
  $data['ID'] = $wpdb->insert_id;
198
 
199
  /* Run a 3rd party code when a new wishlist created.
200
  *
201
  * @param array $data A wishlist data.
202
  * */
203
- do_action( 'tinvwl_wishlist_created', $data );
204
 
205
  return $data;
206
  }
@@ -215,21 +221,22 @@ class TInvWL_Wishlist {
215
  *
216
  * @return array
217
  */
218
- function get_by_user_default( $user_id = 0 ) {
219
- $user_id = absint( $user_id );
220
- if ( empty( $user_id ) ) {
 
221
  $user_id = $this->user;
222
  }
223
 
224
  $data = array(
225
  'author' => $user_id,
226
- 'type' => 'default',
227
  );
228
- if ( ! current_user_can( 'tinvwl_general_settings' ) && ( empty( $this->user ) || ( $data['author'] != $this->user ) ) ) { // WPCS: loose comparison ok.
229
  $data['status'] = 'public';
230
  }
231
 
232
- return $this->get( $data );
233
  }
234
 
235
  /**
@@ -239,20 +246,21 @@ class TInvWL_Wishlist {
239
  *
240
  * @return array
241
  */
242
- function get_by_sharekey_default( $sharekey = '' ) {
243
- if ( empty( $sharekey ) ) {
 
244
  $sharekey = $this->get_sharekey();
245
  }
246
- if ( empty( $sharekey ) ) {
247
  return array();
248
  }
249
 
250
  $data = array(
251
  'share_key' => $sharekey,
252
- 'type' => 'default',
253
  );
254
 
255
- return $this->get( $data );
256
  }
257
 
258
  /**
@@ -263,22 +271,23 @@ class TInvWL_Wishlist {
263
  *
264
  * @return array
265
  */
266
- function get_by_user( $user_id = 0, $data = array() ) {
267
- $user_id = absint( $user_id );
268
- if ( empty( $user_id ) ) {
 
269
  $user_id = $this->user;
270
  }
271
- $this->add_user_default( $user_id );
272
  $_data = array(
273
  'author' => $user_id,
274
  );
275
 
276
- if ( ! current_user_can( 'tinvwl_general_settings' ) && ( empty( $this->user ) || ( $_data['author'] != $this->user ) ) ) { // WPCS: loose comparison ok.
277
  $_data['status'] = 'public';
278
  }
279
- $data = tinv_array_merge( $data, $_data );
280
 
281
- return $this->get( $data );
282
  }
283
 
284
  /**
@@ -288,14 +297,15 @@ class TInvWL_Wishlist {
288
  *
289
  * @return array
290
  */
291
- function get_by_id( $id ) {
292
- $id = absint( $id );
293
- if ( empty( $id ) ) {
 
294
  return null;
295
  }
296
 
297
- $wishlists = $this->get( array( 'ID' => $id ) );
298
- $wishlist = array_shift( $wishlists );
299
 
300
  return $wishlist;
301
  }
@@ -307,12 +317,13 @@ class TInvWL_Wishlist {
307
  *
308
  * @return array
309
  */
310
- function get_by_share_key( $share_key ) {
311
- if ( ! preg_match( '/[a-f0-9]{6}/i', $share_key ) ) {
 
312
  return null;
313
  }
314
- $wishlists = $this->get( array( 'share_key' => $share_key ) );
315
- $wishlist = array_shift( $wishlists );
316
 
317
  return $wishlist;
318
  }
@@ -326,88 +337,89 @@ class TInvWL_Wishlist {
326
  * @global wpdb $wpdb
327
  *
328
  */
329
- function get( $data = array() ) {
 
330
  global $wpdb;
331
 
332
  $default = array(
333
- 'count' => 10,
334
- 'field' => null,
335
- 'offset' => 0,
336
- 'order' => 'ASC',
337
  'order_by' => 'title',
338
- 'sql' => '',
339
  );
340
 
341
- foreach ( $default as $_k => $_v ) {
342
- if ( array_key_exists( $_k, $data ) ) {
343
- $default[ $_k ] = $data[ $_k ];
344
- unset( $data[ $_k ] );
345
  }
346
  }
347
 
348
- if ( is_array( $default['field'] ) ) {
349
- $default['field'] = '`' . implode( '`,`', $default['field'] ) . '`';
350
- } elseif ( is_string( $default['field'] ) ) {
351
- $default['field'] = array( 'ID', 'type', $default['field'] );
352
- $default['field'] = '`' . implode( '`,`', $default['field'] ) . '`';
353
  } else {
354
  $default['field'] = '*';
355
  }
356
  $sql = "SELECT {$default[ 'field' ]} FROM `{$this->table}`";
357
 
358
  $where = '1';
359
- if ( ! empty( $data ) && is_array( $data ) ) {
360
- foreach ( $data as $f => $v ) {
361
- $s = is_array( $v ) ? ' IN ' : '=';
362
- if ( is_array( $v ) ) {
363
- foreach ( $v as $_f => $_v ) {
364
- $v[ $_f ] = $wpdb->prepare( '%s', $_v );
365
  }
366
- $v = implode( ',', $v );
367
  $v = "($v)";
368
  } else {
369
- $v = $wpdb->prepare( '%s', $v );
370
  }
371
- $data[ $f ] = sprintf( '`%s`%s%s', $f, $s, $v );
372
  }
373
- $where = ' WHERE ' . implode( ' AND ', $data );
374
- $sql .= $where;
375
  }
376
- $sql .= sprintf( ' ORDER BY `%s` %s LIMIT %d,%d;', $default['order_by'], $default['order'], $default['offset'], $default['count'] );
377
 
378
- if ( ! empty( $default['sql'] ) ) {
379
- $replacer = $replace = array();
380
- $replace[0] = '{table}';
381
  $replacer[0] = $this->table;
382
- $replace[1] = '{where}';
383
  $replacer[1] = $where;
384
 
385
- foreach ( $default as $key => $value ) {
386
- $i = count( $replace );
387
 
388
- $replace[ $i ] = '{' . $key . '}';
389
- $replacer[ $i ] = $value;
390
  }
391
 
392
- $sql = str_replace( $replace, $replacer, $default['sql'] );
393
  }
394
 
395
- $wls = $wpdb->get_results( $sql, ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
396
 
397
- if ( empty( $wls ) ) {
398
  return array();
399
  }
400
 
401
- foreach ( $wls as $k => $wl ) {
402
- $wl['ID'] = absint( $wl['ID'] );
403
- if ( array_key_exists( 'author', $wl ) ) {
404
- $wl['author'] = absint( $wl['author'] );
405
  }
406
- if ( 'default' === $wl['type'] && empty( $wl['title'] ) ) {
407
  $wl['title'] = $this->default_name;
408
  }
409
 
410
- $wls[ $k ] = apply_filters( 'tinvwl_wishlist_get', $wl );
411
  }
412
 
413
  return $wls;
@@ -425,31 +437,32 @@ class TInvWL_Wishlist {
425
  * @global wpdb $wpdb
426
  *
427
  */
428
- function update( $id, $data, $type = 'list', $status = 'public' ) {
429
- if ( ! is_array( $data ) ) {
 
430
  $data = array(
431
- 'title' => $data,
432
  'status' => $status,
433
- 'type' => $type,
434
  );
435
  }
436
- $data = filter_var_array( $data, apply_filters( 'tinvwl_wishlist_fields_update', array(
437
- 'title' => FILTER_SANITIZE_STRING,
438
  'status' => FILTER_SANITIZE_STRING,
439
- 'type' => FILTER_SANITIZE_STRING,
440
  'author' => FILTER_VALIDATE_INT,
441
- ) ) );
442
- $data = array_filter( $data );
443
- $data = apply_filters( 'tinvwl_wishlist_update', $data, $id );
444
- if ( ! array_key_exists( 'title', $data ) ) {
445
- $wishlist = $this->get_by_id( $id );
446
- if ( 'default' === $wishlist['type'] ) {
447
  $data['title'] = '';
448
  }
449
  }
450
  global $wpdb;
451
 
452
- return false !== $wpdb->update( $this->table, $data, array( 'ID' => $id ) ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
453
  }
454
 
455
  /**
@@ -461,17 +474,18 @@ class TInvWL_Wishlist {
461
  * @global wpdb $wpdb
462
  *
463
  */
464
- public function remove( $id ) {
465
- $id = absint( $id );
466
- if ( empty( $id ) ) {
 
467
  return false;
468
  }
469
  global $wpdb;
470
- $result = $wpdb->delete( $this->table, array( 'ID' => $id ) ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
471
- if ( false !== $result ) {
472
- do_action( 'tinvwl_wishlist_removed', $id );
473
  $wlp = new TInvWL_Product();
474
- $wlp->remove_product_from_wl( $id );
475
 
476
  return true;
477
  }
@@ -486,13 +500,14 @@ class TInvWL_Wishlist {
486
  *
487
  * @return string
488
  */
489
- function set_sharekey( $sharekey = '' ) {
 
490
  global $tinvwl_wishlist_sharekey;
491
 
492
- if ( ! empty( $sharekey ) ) {
493
  self::$default_sharekey = $tinvwl_wishlist_sharekey = $sharekey;
494
- @setcookie( 'tinv_wishlistkey', self::$default_sharekey, time() + 31 * DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
495
- set_transient( '_tinvwl_update_wishlists_data', '1' );
496
  }
497
 
498
  return self::$default_sharekey;
@@ -503,16 +518,17 @@ class TInvWL_Wishlist {
503
  *
504
  * @return string
505
  */
506
- function get_sharekey() {
 
507
  global $tinvwl_wishlist_sharekey;
508
 
509
- if ( empty( self::$default_sharekey ) ) {
510
- self::$default_sharekey = $tinvwl_wishlist_sharekey = filter_input( INPUT_COOKIE, 'tinv_wishlistkey', FILTER_VALIDATE_REGEXP, array(
511
  'options' => array(
512
- 'regexp' => '/^[A-Fa-f0-9]{6}$/',
513
  'default' => $tinvwl_wishlist_sharekey,
514
  ),
515
- ) );
516
  }
517
 
518
  return self::$default_sharekey;
7
  */
8
 
9
  // If this file is called directly, abort.
10
+ if (!defined('ABSPATH')) {
11
  die;
12
  }
13
 
14
  /**
15
  * Wishlists function class
16
  */
17
+ class TInvWL_Wishlist
18
+ {
19
 
20
  /**
21
  * Table name
68
  * @global wpdb $wpdb
69
  *
70
  */
71
+ function __construct($plugin_name = TINVWL_PREFIX)
72
+ {
73
  global $wpdb;
74
 
75
+ $this->_name = $plugin_name;
76
+ $this->table = sprintf('%s%s_%s', $wpdb->prefix, $this->_name, 'lists');
77
+ $this->default_name = apply_filters('tinvwl_default_wishlist_title', tinv_get_option('general', 'default_title'));
78
  $this->default_privacy = 'share';
79
+ $this->privacy = array('public', 'share', 'private');
80
+ if (!in_array($this->default_privacy, $this->privacy)) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
81
  $this->default_privacy = 'share';
82
  }
83
  $this->user = get_current_user_id();
89
  * @return string
90
  * @global wpdb $wpdb
91
  */
92
+ function unique_share_key()
93
+ {
94
  global $wpdb;
95
 
96
+ $sharekeys = $wpdb->get_results("SELECT `share_key` FROM `{$this->table}`", ARRAY_A); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
97
  $share_keys = array();
98
+ foreach ($sharekeys as $sharekey) {
99
  $share_keys[] = $sharekey['share_key'];
100
  }
101
  $new_key = '';
102
  do {
103
+ $new_key = substr(md5(date('r') . mt_rand(0, 3000)), 0, 6);
104
+ } while (array_search($new_key, $share_keys)); // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
105
 
106
  return $new_key;
107
  }
113
  *
114
  * @return boolean|array
115
  */
116
+ function add_user_default($user_id = 0)
117
+ {
118
+ if (empty($user_id)) {
119
  $user_id = $this->user;
120
  }
121
+ if (empty($user_id)) {
122
  return $this->add_sharekey_default();
123
  }
124
+ if ($wl = $this->get_by_user_default($user_id)) {
125
+ return array_shift($wl);
126
  }
127
 
128
+ $wl = $this->add('', 'default', $this->default_privacy, $user_id);
129
+ if (is_array($wl) && array_key_exists('share_key', $wl)) {
130
+ $this->set_sharekey($wl['share_key']);
131
 
132
  return $wl;
133
  }
142
  *
143
  * @return boolean|array
144
  */
145
+ function add_sharekey_default($sharekey = '')
146
+ {
147
+ if ($wl = $this->get_by_sharekey_default($sharekey)) {
148
+ return array_shift($wl);
149
  }
150
 
151
+ $wl = $this->add('', 'default', $this->default_privacy, 0);
152
+ if (is_array($wl) && array_key_exists('share_key', $wl)) {
153
+ $this->set_sharekey($wl['share_key']);
154
 
155
  return $wl;
156
  }
170
  * @global wpdb $wpdb
171
  *
172
  */
173
+ function add($data, $type = 'list', $status = 'public', $user_id = 0)
174
+ {
175
+ $user_id = absint($user_id);
176
+ if (empty($user_id)) {
177
  $user_id = $this->user;
178
  }
179
 
180
  $default = array(
181
+ 'author' => $user_id,
182
+ 'date' => current_time('Y-m-d H:i:s'),
183
+ 'status' => $this->default_privacy,
184
  'share_key' => $this->unique_share_key(),
185
+ 'title' => $this->default_name,
186
+ 'type' => 'list',
187
  );
188
 
189
+ if (!is_array($data)) {
190
  $data = array(
191
+ 'title' => $data,
192
  'status' => $status,
193
+ 'type' => $type,
194
  );
195
  }
196
+ $data = wp_parse_args($data, $default);
197
+ $data = apply_filters('tinvwl_wishlist_add', $data);
198
+ if (!in_array($data['status'], $this->privacy)) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
199
  $data['status'] = 'public';
200
  }
201
  global $wpdb;
202
+ if ($wpdb->insert($this->table, $data)) { // @codingStandardsIgnoreLine WordPress.VIP.DirectDatabaseQuery.DirectQuery
203
  $data['ID'] = $wpdb->insert_id;
204
 
205
  /* Run a 3rd party code when a new wishlist created.
206
  *
207
  * @param array $data A wishlist data.
208
  * */
209
+ do_action('tinvwl_wishlist_created', $data);
210
 
211
  return $data;
212
  }
221
  *
222
  * @return array
223
  */
224
+ function get_by_user_default($user_id = 0)
225
+ {
226
+ $user_id = absint($user_id);
227
+ if (empty($user_id)) {
228
  $user_id = $this->user;
229
  }
230
 
231
  $data = array(
232
  'author' => $user_id,
233
+ 'type' => 'default',
234
  );
235
+ if (!current_user_can('tinvwl_general_settings') && (empty($this->user) || ($data['author'] != $this->user))) { // WPCS: loose comparison ok.
236
  $data['status'] = 'public';
237
  }
238
 
239
+ return $this->get($data);
240
  }
241
 
242
  /**
246
  *
247
  * @return array
248
  */
249
+ function get_by_sharekey_default($sharekey = '')
250
+ {
251
+ if (empty($sharekey)) {
252
  $sharekey = $this->get_sharekey();
253
  }
254
+ if (empty($sharekey)) {
255
  return array();
256
  }
257
 
258
  $data = array(
259
  'share_key' => $sharekey,
260
+ 'type' => 'default',
261
  );
262
 
263
+ return $this->get($data);
264
  }
265
 
266
  /**
271
  *
272
  * @return array
273
  */
274
+ function get_by_user($user_id = 0, $data = array())
275
+ {
276
+ $user_id = absint($user_id);
277
+ if (empty($user_id)) {
278
  $user_id = $this->user;
279
  }
280
+ $this->add_user_default($user_id);
281
  $_data = array(
282
  'author' => $user_id,
283
  );
284
 
285
+ if (!current_user_can('tinvwl_general_settings') && (empty($this->user) || ($_data['author'] != $this->user))) { // WPCS: loose comparison ok.
286
  $_data['status'] = 'public';
287
  }
288
+ $data = tinv_array_merge($data, $_data);
289
 
290
+ return $this->get($data);
291
  }
292
 
293
  /**
297
  *
298
  * @return array
299
  */
300
+ function get_by_id($id)
301
+ {
302
+ $id = absint($id);
303
+ if (empty($id)) {
304
  return null;
305
  }
306
 
307
+ $wishlists = $this->get(array('ID' => $id));
308
+ $wishlist = array_shift($wishlists);
309
 
310
  return $wishlist;
311
  }
317
  *
318
  * @return array
319
  */
320
+ function get_by_share_key($share_key)
321
+ {
322
+ if (!preg_match('/[a-f0-9]{6}/i', $share_key)) {
323
  return null;
324
  }
325
+ $wishlists = $this->get(array('share_key' => $share_key));
326
+ $wishlist = array_shift($wishlists);
327
 
328
  return $wishlist;
329
  }
337
  * @global wpdb $wpdb
338
  *
339
  */
340
+ function get($data = array())
341
+ {
342
  global $wpdb;
343
 
344
  $default = array(
345
+ 'count' => 10,
346
+ 'field' => null,
347
+ 'offset' => 0,
348
+ 'order' => 'ASC',
349
  'order_by' => 'title',
350
+ 'sql' => '',
351
  );
352
 
353
+ foreach ($default as $_k => $_v) {
354
+ if (array_key_exists($_k, $data)) {
355
+ $default[$_k] = $data[$_k];
356
+ unset($data[$_k]);
357
  }
358
  }
359
 
360
+ if (is_array($default['field'])) {
361
+ $default['field'] = '`' . implode('`,`', $default['field']) . '`';
362
+ } elseif (is_string($default['field'])) {
363
+ $default['field'] = array('ID', 'type', $default['field']);
364
+ $default['field'] = '`' . implode('`,`', $default['field']) . '`';
365
  } else {
366
  $default['field'] = '*';
367
  }
368
  $sql = "SELECT {$default[ 'field' ]} FROM `{$this->table}`";
369
 
370
  $where = '1';
371
+ if (!empty($data) && is_array($data)) {
372
+ foreach ($data as $f => $v) {
373
+ $s = is_array($v) ? ' IN ' : '=';
374
+ if (is_array($v)) {
375
+ foreach ($v as $_f => $_v) {
376
+ $v[$_f] = $wpdb->prepare('%s', $_v);
377
  }
378
+ $v = implode(',', $v);
379
  $v = "($v)";
380
  } else {
381
+ $v = $wpdb->prepare('%s', $v);
382
  }
383
+ $data[$f] = sprintf('`%s`%s%s', $f, $s, $v);
384
  }
385
+ $where = ' WHERE ' . implode(' AND ', $data);
386
+ $sql .= $where;
387
  }
388
+ $sql .= sprintf(' ORDER BY `%s` %s LIMIT %d,%d;', $default['order_by'], $default['order'], $default['offset'], $default['count']);
389
 
390
+ if (!empty($default['sql'])) {
391
+ $replacer = $replace = array();
392
+ $replace[0] = '{table}';
393
  $replacer[0] = $this->table;
394
+ $replace[1] = '{where}';
395
  $replacer[1] = $where;
396
 
397
+ foreach ($default as $key => $value) {
398
+ $i = count($replace);
399
 
400
+ $replace[$i] = '{' . $key . '}';
401
+ $replacer[$i] = $value;
402
  }
403
 
404
+ $sql = str_replace($replace, $replacer, $default['sql']);
405
  }
406
 
407
+ $wls = $wpdb->get_results($sql, ARRAY_A); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
408
 
409
+ if (empty($wls)) {
410
  return array();
411
  }
412
 
413
+ foreach ($wls as $k => $wl) {
414
+ $wl['ID'] = absint($wl['ID']);
415
+ if (array_key_exists('author', $wl)) {
416
+ $wl['author'] = absint($wl['author']);
417
  }
418
+ if ('default' === $wl['type'] && empty($wl['title'])) {
419
  $wl['title'] = $this->default_name;
420
  }
421
 
422
+ $wls[$k] = apply_filters('tinvwl_wishlist_get', $wl);
423
  }
424
 
425
  return $wls;
437
  * @global wpdb $wpdb
438
  *
439
  */
440
+ function update($id, $data, $type = 'list', $status = 'public')
441
+ {
442
+ if (!is_array($data)) {
443
  $data = array(
444
+ 'title' => $data,
445
  'status' => $status,
446
+ 'type' => $type,
447
  );
448
  }
449
+ $data = filter_var_array($data, apply_filters('tinvwl_wishlist_fields_update', array(
450
+ 'title' => FILTER_SANITIZE_STRING,
451
  'status' => FILTER_SANITIZE_STRING,
452
+ 'type' => FILTER_SANITIZE_STRING,
453
  'author' => FILTER_VALIDATE_INT,
454
+ )));
455
+ $data = array_filter($data);
456
+ $data = apply_filters('tinvwl_wishlist_update', $data, $id);
457
+ if (!array_key_exists('title', $data)) {
458
+ $wishlist = $this->get_by_id($id);
459
+ if ('default' === $wishlist['type']) {
460
  $data['title'] = '';
461
  }
462
  }
463
  global $wpdb;
464
 
465
+ return false !== $wpdb->update($this->table, $data, array('ID' => $id)); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
466
  }
467
 
468
  /**
474
  * @global wpdb $wpdb
475
  *
476
  */
477
+ public function remove($id)
478
+ {
479
+ $id = absint($id);
480
+ if (empty($id)) {
481
  return false;
482
  }
483
  global $wpdb;
484
+ $result = $wpdb->delete($this->table, array('ID' => $id)); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
485
+ if (false !== $result) {
486
+ do_action('tinvwl_wishlist_removed', $id);
487
  $wlp = new TInvWL_Product();
488
+ $wlp->remove_product_from_wl($id);
489
 
490
  return true;
491
  }
500
  *
501
  * @return string
502
  */
503
+ function set_sharekey($sharekey = '')
504
+ {
505
  global $tinvwl_wishlist_sharekey;
506
 
507
+ if (!empty($sharekey)) {
508
  self::$default_sharekey = $tinvwl_wishlist_sharekey = $sharekey;
509
+ @setcookie('tinv_wishlistkey', self::$default_sharekey, time() + 31 * DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
510
+ set_transient('_tinvwl_update_wishlists_data', '1');
511
  }
512
 
513
  return self::$default_sharekey;
518
  *
519
  * @return string
520
  */
521
+ function get_sharekey()
522
+ {
523
  global $tinvwl_wishlist_sharekey;
524
 
525
+ if (empty(self::$default_sharekey)) {
526
+ self::$default_sharekey = $tinvwl_wishlist_sharekey = filter_input(INPUT_COOKIE, 'tinv_wishlistkey', FILTER_VALIDATE_REGEXP, array(
527
  'options' => array(
528
+ 'regexp' => '/^[A-Fa-f0-9]{6}$/',
529
  'default' => $tinvwl_wishlist_sharekey,
530
  ),
531
+ ));
532
  }
533
 
534
  return self::$default_sharekey;
integrations/uni-woo-custom-product-options.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @name Product Options and Price Calculation Formulas for WooCommerce – Uni CPO
6
  *
7
- * @version 4.7.5
8
  *
9
  * @slug uni-woo-custom-product-options
10
  *
@@ -26,7 +26,7 @@ $name = "Product Options and Price Calculation Formulas for WooCommerce – Uni
26
 
27
  $available = class_exists('Uni_Cpo');
28
 
29
- $tinvwl_integrations = is_array( $tinvwl_integrations ) ? $tinvwl_integrations : [];
30
 
31
  $tinvwl_integrations[$slug] = array(
32
  'name' => $name,
@@ -64,13 +64,34 @@ if (!function_exists('tinv_wishlist_item_meta_uni_woo_custom_product_options'))
64
  }
65
 
66
  if (!empty($item_data)) {
67
-
68
  $form_data = array();
69
-
 
 
70
  foreach ($item_data as $key => $value) {
71
  $form_data[$key] = $value['display'];
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  $filtered_form_data = array_filter($form_data, function ($k) use ($form_data) {
75
  return false !== strpos($k, UniCpo()->get_var_slug()) && !empty($form_data[$k]);
76
  }, ARRAY_FILTER_USE_KEY);
@@ -84,6 +105,7 @@ if (!function_exists('tinv_wishlist_item_meta_uni_woo_custom_product_options'))
84
  $option = uni_cpo_get_option($post_id);
85
  if (is_object($option)) {
86
  $calculate_result = $option->calculate($filtered_form_data);
 
87
  if (is_array($calculate_result) && isset($calculate_result[$option->get_slug()])) {
88
  if (is_array($calculate_result[$option->get_slug()]['order_meta'])) {
89
  $calculate_result[$option->get_slug()]['order_meta'] = array_map(function ($item) {
@@ -101,9 +123,26 @@ if (!function_exists('tinv_wishlist_item_meta_uni_woo_custom_product_options'))
101
  $display_value = $calculate_result[$option->get_slug()]['order_meta'];
102
  }
103
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  $item_data[$option->get_slug()]['display'] = $display_value;
105
  }
106
- $item_data[$option->get_slug()]['key'] = uni_cpo_sanitize_label($option->cpo_order_label());
107
  }
108
  }
109
  }
@@ -136,96 +175,99 @@ if (!function_exists('tinvwl_item_price_uni_woo_custom_product_options')) {
136
 
137
  if (class_exists('Uni_Cpo')) {
138
  $product_data = Uni_Cpo_Product::get_product_data_by_id($product->get_id());
139
- $form_data = $wl_product['meta'];
140
- $options_eval_result = array();
141
- $variables = array();
142
- $is_calc_disabled = false;
143
- $formatted_vars = array();
144
-
145
- $main_formula = $product_data['formula_data']['main_formula'];
146
- $filtered_form_data = array_filter($form_data, function ($k) use ($form_data) {
147
- return false !== strpos($k, UniCpo()->get_var_slug()) && !empty($form_data[$k]);
148
- }, ARRAY_FILTER_USE_KEY);
149
-
150
-
151
- if (!empty($filtered_form_data)) {
152
- $posts = uni_cpo_get_posts_by_slugs(array_keys($filtered_form_data));
153
-
154
- if (!empty($posts)) {
155
- $posts_ids = wp_list_pluck($posts, 'ID');
156
- foreach ($posts_ids as $post_id) {
157
- $option = uni_cpo_get_option($post_id);
158
-
159
- if (is_object($option)) {
160
- $calculate_result = $option->calculate($filtered_form_data);
161
- if (!empty($calculate_result)) {
162
- $options_eval_result[$option->get_slug()] = $calculate_result;
 
 
 
163
  }
164
- }
165
 
 
166
  }
167
- }
168
-
169
- }
170
 
171
- array_walk($options_eval_result, function ($v) use (&$variables, &$formatted_vars) {
172
- foreach ($v as $slug => $value) {
173
- // prepare $variables for calculation purpose
174
- $variables['{' . $slug . '}'] = $value['calc'];
175
- // prepare $formatted_vars for conditional logic purpose
176
- $formatted_vars[$slug] = $value['cart_meta'];
177
  }
178
- });
179
- $variables['{uni_cpo_price}'] = $product->get_price('edit');
180
- // non option variables
181
- if ('on' === $product_data['nov_data']['nov_enable'] && !empty($product_data['nov_data']['nov'])) {
182
- $variables = uni_cpo_process_formula_with_non_option_vars($variables, $product_data, $formatted_vars);
183
- }
184
- // formula conditional logic
185
 
186
- if ('on' === $product_data['formula_data']['rules_enable'] && !empty($product_data['formula_data']['formula_scheme']) && is_array($product_data['formula_data']['formula_scheme'])) {
187
- $conditional_formula = uni_cpo_process_formula_scheme($formatted_vars, $product_data);
188
- if ($conditional_formula) {
189
- $main_formula = $conditional_formula;
 
 
 
 
 
 
 
 
190
  }
191
- }
192
 
193
- if ('disable' === $main_formula) {
194
- $is_calc_disabled = true;
195
- }
196
- //
197
-
198
- if (!$is_calc_disabled) {
199
- $main_formula = uni_cpo_process_formula_with_vars($main_formula, $variables);
200
- // calculates formula
201
- $price_calculated = uni_cpo_calculate_formula($main_formula);
202
- $price_min = $product_data['settings_data']['min_price'];
203
- $price_max = $product_data['settings_data']['max_price'];
204
- // check for min price
205
- if ($price_calculated < $price_min) {
206
- $price_calculated = $price_min;
207
  }
208
- // check for max price
209
- if (!empty($price_max) && $price_calculated >= $price_max) {
210
  $is_calc_disabled = true;
211
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
- if (true !== $is_calc_disabled) {
214
- // filter, so 3rd party scripts can hook up
215
- $price_calculated = apply_filters(
216
- 'uni_cpo_in_cart_calculated_price',
217
- $price_calculated,
218
- $product,
219
- $filtered_form_data
220
- );
 
 
 
 
 
221
 
222
- return wc_price($price_calculated);
223
  } else {
224
- return wc_price($price_max);
225
  }
226
-
227
- } else {
228
- return wc_price(0);
229
  }
230
 
231
  }
4
  *
5
  * @name Product Options and Price Calculation Formulas for WooCommerce – Uni CPO
6
  *
7
+ * @version 4.9.9.1
8
  *
9
  * @slug uni-woo-custom-product-options
10
  *
26
 
27
  $available = class_exists('Uni_Cpo');
28
 
29
+ $tinvwl_integrations = is_array($tinvwl_integrations) ? $tinvwl_integrations : [];
30
 
31
  $tinvwl_integrations[$slug] = array(
32
  'name' => $name,
64
  }
65
 
66
  if (!empty($item_data)) {
67
+ $options_eval_result = [];
68
  $form_data = array();
69
+ $formatted_vars = array();
70
+ $variables = array();
71
+ $product_data = Uni_Cpo_Product::get_product_data_by_id($product_id);
72
  foreach ($item_data as $key => $value) {
73
  $form_data[$key] = $value['display'];
74
  }
75
 
76
+ array_walk(
77
+ $options_eval_result,
78
+ function ($v) use (&$variables, &$formatted_vars, &$nice_names_vars) {
79
+ foreach ($v as $slug => $value) {
80
+ // prepare $variables for calculation purpose
81
+ $variables['{' . $slug . '}'] = $value['calc'];
82
+ // prepare $formatted_vars for conditional logic purpose
83
+ $formatted_vars[$slug] = $value['cart_meta'];
84
+ }
85
+ }
86
+ );
87
+
88
+ // non option variables
89
+ if ('on' === $product_data['nov_data']['nov_enable']
90
+ && !empty($product_data['nov_data']['nov'])
91
+ ) {
92
+ $variables = uni_cpo_process_formula_with_non_option_vars($variables, $product_data, $formatted_vars);
93
+ }
94
+
95
  $filtered_form_data = array_filter($form_data, function ($k) use ($form_data) {
96
  return false !== strpos($k, UniCpo()->get_var_slug()) && !empty($form_data[$k]);
97
  }, ARRAY_FILTER_USE_KEY);
105
  $option = uni_cpo_get_option($post_id);
106
  if (is_object($option)) {
107
  $calculate_result = $option->calculate($filtered_form_data);
108
+
109
  if (is_array($calculate_result) && isset($calculate_result[$option->get_slug()])) {
110
  if (is_array($calculate_result[$option->get_slug()]['order_meta'])) {
111
  $calculate_result[$option->get_slug()]['order_meta'] = array_map(function ($item) {
123
  $display_value = $calculate_result[$option->get_slug()]['order_meta'];
124
  }
125
  }
126
+ $display_key = uni_cpo_sanitize_label($option->cpo_order_label());
127
+ $display_value = uni_cpo_replace_curly(
128
+ $display_value,
129
+ $formatted_vars,
130
+ $product_data,
131
+ $variables
132
+ );
133
+ $display_value = uni_cpo_get_proper_option_label_cart($display_value);
134
+ $display_key = uni_cpo_replace_curly(
135
+ $display_key,
136
+ $formatted_vars,
137
+ $product_data,
138
+ $variables
139
+ );
140
+ $display_key = trim($display_key, ' ');
141
+ $display_key = uni_cpo_get_proper_option_label_cart($display_key);
142
+
143
  $item_data[$option->get_slug()]['display'] = $display_value;
144
  }
145
+ $item_data[$option->get_slug()]['key'] = $display_key;
146
  }
147
  }
148
  }
175
 
176
  if (class_exists('Uni_Cpo')) {
177
  $product_data = Uni_Cpo_Product::get_product_data_by_id($product->get_id());
178
+
179
+ if ('on' === $product_data['settings_data']['calc_enable']) {
180
+ $form_data = $wl_product['meta'];
181
+ $options_eval_result = array();
182
+ $variables = array();
183
+ $is_calc_disabled = false;
184
+ $formatted_vars = array();
185
+
186
+ $main_formula = $product_data['formula_data']['main_formula'];
187
+ $filtered_form_data = array_filter($form_data, function ($k) use ($form_data) {
188
+ return false !== strpos($k, UniCpo()->get_var_slug()) && !empty($form_data[$k]);
189
+ }, ARRAY_FILTER_USE_KEY);
190
+
191
+
192
+ if (!empty($filtered_form_data)) {
193
+ $posts = uni_cpo_get_posts_by_slugs(array_keys($filtered_form_data));
194
+
195
+ if (!empty($posts)) {
196
+ $posts_ids = wp_list_pluck($posts, 'ID');
197
+ foreach ($posts_ids as $post_id) {
198
+ $option = uni_cpo_get_option($post_id);
199
+
200
+ if (is_object($option)) {
201
+ $calculate_result = $option->calculate($filtered_form_data);
202
+ if (!empty($calculate_result)) {
203
+ $options_eval_result[$option->get_slug()] = $calculate_result;
204
+ }
205
  }
 
206
 
207
+ }
208
  }
 
 
 
209
 
 
 
 
 
 
 
210
  }
 
 
 
 
 
 
 
211
 
212
+ array_walk($options_eval_result, function ($v) use (&$variables, &$formatted_vars) {
213
+ foreach ($v as $slug => $value) {
214
+ // prepare $variables for calculation purpose
215
+ $variables['{' . $slug . '}'] = $value['calc'];
216
+ // prepare $formatted_vars for conditional logic purpose
217
+ $formatted_vars[$slug] = $value['cart_meta'];
218
+ }
219
+ });
220
+ $variables['{uni_cpo_price}'] = $product->get_price('edit');
221
+ // non option variables
222
+ if ('on' === $product_data['nov_data']['nov_enable'] && !empty($product_data['nov_data']['nov'])) {
223
+ $variables = uni_cpo_process_formula_with_non_option_vars($variables, $product_data, $formatted_vars);
224
  }
225
+ // formula conditional logic
226
 
227
+ if ('on' === $product_data['formula_data']['rules_enable'] && !empty($product_data['formula_data']['formula_scheme']) && is_array($product_data['formula_data']['formula_scheme'])) {
228
+ $conditional_formula = uni_cpo_process_formula_scheme($formatted_vars, $product_data);
229
+ if ($conditional_formula) {
230
+ $main_formula = $conditional_formula;
231
+ }
 
 
 
 
 
 
 
 
 
232
  }
233
+
234
+ if ('disable' === $main_formula) {
235
  $is_calc_disabled = true;
236
  }
237
+ //
238
+
239
+ if (!$is_calc_disabled) {
240
+ $main_formula = uni_cpo_process_formula_with_vars($main_formula, $variables);
241
+ // calculates formula
242
+ $price_calculated = uni_cpo_calculate_formula($main_formula);
243
+ $price_min = $product_data['settings_data']['min_price'];
244
+ $price_max = $product_data['settings_data']['max_price'];
245
+ // check for min price
246
+ if ($price_calculated < $price_min) {
247
+ $price_calculated = $price_min;
248
+ }
249
+ // check for max price
250
+ if (!empty($price_max) && $price_calculated >= $price_max) {
251
+ $is_calc_disabled = true;
252
+ }
253
 
254
+ if (true !== $is_calc_disabled) {
255
+ // filter, so 3rd party scripts can hook up
256
+ $price_calculated = apply_filters(
257
+ 'uni_cpo_in_cart_calculated_price',
258
+ $price_calculated,
259
+ $product,
260
+ $filtered_form_data
261
+ );
262
+
263
+ return wc_price($price_calculated);
264
+ } else {
265
+ return wc_price($price_max);
266
+ }
267
 
 
268
  } else {
269
+ return wc_price(0);
270
  }
 
 
 
271
  }
272
 
273
  }
integrations/woocommerce-tm-extra-product-options.php CHANGED
@@ -26,7 +26,7 @@ $name = "WooCommerce TM Extra Product Options";
26
 
27
  $available = (defined('THEMECOMPLETE_EPO_VERSION') || defined('TM_EPO_VERSION'));
28
 
29
- $tinvwl_integrations = is_array( $tinvwl_integrations ) ? $tinvwl_integrations : [];
30
 
31
  $tinvwl_integrations[$slug] = array(
32
  'name' => $name,
@@ -320,3 +320,20 @@ function tinvwl_cart_meta_woocommerce_tm_extra_product_options($meta)
320
 
321
  return $meta;
322
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  $available = (defined('THEMECOMPLETE_EPO_VERSION') || defined('TM_EPO_VERSION'));
28
 
29
+ $tinvwl_integrations = is_array($tinvwl_integrations) ? $tinvwl_integrations : [];
30
 
31
  $tinvwl_integrations[$slug] = array(
32
  'name' => $name,
320
 
321
  return $meta;
322
  }
323
+
324
+ function tinvwl_add_to_wishlist_tm_extra_product_options()
325
+ {
326
+ wp_add_inline_script('tinvwl', "
327
+ jQuery('body').on('tinvwl_add_to_wishlist_button_click', function(e, el){
328
+ jQuery(el).closest('form.cart').each(function(){
329
+ if (!jQuery(this)[0].checkValidity()){
330
+ jQuery(el).addClass('disabled-add-wishlist');
331
+ jQuery(this)[0].reportValidity();
332
+ } else {
333
+ jQuery(el).removeClass('disabled-add-wishlist');}
334
+ });
335
+ });
336
+ ");
337
+ }
338
+
339
+ add_action('wp_enqueue_scripts', 'tinvwl_add_to_wishlist_tm_extra_product_options', 100, 1);
languages/ti-woocommerce-wishlist.pot CHANGED
@@ -1,8 +1,8 @@
1
- # Copyright (C) 2021 TI WooCommerce Wishlist Plugin - 1.24.4
2
- # This file is distributed under the same license as the TI WooCommerce Wishlist Plugin - 1.24.4 package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: TI WooCommerce Wishlist Plugin - 1.24.4\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
@@ -1175,7 +1175,7 @@ msgstr ""
1175
  msgid "Remove"
1176
  msgstr ""
1177
 
1178
- #: public/wishlist/buttons.class.php:523, public/wishlist/view.class.php:502
1179
  msgid "&ldquo;%s&rdquo;"
1180
  msgstr ""
1181
 
@@ -1209,27 +1209,27 @@ msgstr ""
1209
  msgid "WhatsApp"
1210
  msgstr ""
1211
 
1212
- #: public/wishlist/view.class.php:440
1213
  msgid "%1$s by %2$s"
1214
  msgstr ""
1215
 
1216
- #: public/wishlist/view.class.php:517
1217
  msgid "%s has not been removed from wishlist."
1218
  msgstr ""
1219
 
1220
- #: public/wishlist/view.class.php:515
1221
  msgid "%s has been removed from wishlist."
1222
  msgstr ""
1223
 
1224
- #: public/wishlist/view.class.php:660
1225
  msgid "Return to Wishlist"
1226
  msgstr ""
1227
 
1228
- #: public/wishlist/view.class.php:780
1229
  msgid "Previous Page"
1230
  msgstr ""
1231
 
1232
- #: public/wishlist/view.class.php:808
1233
  msgid "Next Page"
1234
  msgstr ""
1235
 
1
+ # Copyright (C) 2021 TI WooCommerce Wishlist Plugin - 1.24.5
2
+ # This file is distributed under the same license as the TI WooCommerce Wishlist Plugin - 1.24.5 package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: TI WooCommerce Wishlist Plugin - 1.24.5\n"
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
1175
  msgid "Remove"
1176
  msgstr ""
1177
 
1178
+ #: public/wishlist/buttons.class.php:523, public/wishlist/view.class.php:518
1179
  msgid "&ldquo;%s&rdquo;"
1180
  msgstr ""
1181
 
1209
  msgid "WhatsApp"
1210
  msgstr ""
1211
 
1212
+ #: public/wishlist/view.class.php:455
1213
  msgid "%1$s by %2$s"
1214
  msgstr ""
1215
 
1216
+ #: public/wishlist/view.class.php:533
1217
  msgid "%s has not been removed from wishlist."
1218
  msgstr ""
1219
 
1220
+ #: public/wishlist/view.class.php:531
1221
  msgid "%s has been removed from wishlist."
1222
  msgstr ""
1223
 
1224
+ #: public/wishlist/view.class.php:680
1225
  msgid "Return to Wishlist"
1226
  msgstr ""
1227
 
1228
+ #: public/wishlist/view.class.php:804
1229
  msgid "Previous Page"
1230
  msgstr ""
1231
 
1232
+ #: public/wishlist/view.class.php:834
1233
  msgid "Next Page"
1234
  msgstr ""
1235
 
public/wishlist/buttons.class.php CHANGED
@@ -7,7 +7,7 @@
7
  */
8
 
9
  // If this file is called directly, abort.
10
- if ( ! defined('ABSPATH')) {
11
  die;
12
  }
13
 
@@ -59,11 +59,11 @@ class TInvWL_Public_Wishlist_Buttons
59
  $buttons = array();
60
  if (tinv_get_option('table', 'colm_checkbox') && tinv_get_option('table', 'colm_actions')) {
61
  $buttons[] = array(
62
- 'name' => 'product_apply',
63
- 'title' => sprintf(__('Apply %s', 'ti-woocommerce-wishlist'), "<span class='tinvwl-mobile'>" . __('Action', 'ti-woocommerce-wishlist') . '</span>'),
64
- 'method' => array(__CLASS__, 'apply_action'),
65
- 'before' => array(__CLASS__, 'apply_action_before'),
66
- 'priority' => 10,
67
  'condition' => '$a["is_owner"]',
68
  );
69
  add_filter('tinvwl_prepare_attr__button_product_apply', array(
@@ -77,9 +77,9 @@ class TInvWL_Public_Wishlist_Buttons
77
  }
78
  if (tinv_get_option('table', 'colm_checkbox') && tinv_get_option('table', 'add_select_to_cart')) {
79
  $buttons[] = array(
80
- 'name' => 'product_selected',
81
- 'title' => apply_filters('tinvwl_add_selected_to_cart_text', tinv_get_option('table', 'text_add_select_to_cart')),
82
- 'method' => array(__CLASS__, 'apply_action_add_selected'),
83
  'priority' => 25,
84
  );
85
  add_filter('tinvwl_prepare_attr_button_product_selected', array(
@@ -89,9 +89,9 @@ class TInvWL_Public_Wishlist_Buttons
89
  }
90
  if (tinv_get_option('table', 'add_all_to_cart')) {
91
  $buttons[] = array(
92
- 'name' => 'product_all',
93
- 'title' => apply_filters('tinvwl_add_all_to_cart_text', tinv_get_option('table', 'text_add_all_to_cart')),
94
- 'method' => array(__CLASS__, 'add_all'),
95
  'priority' => 30,
96
  );
97
  add_filter('tinvwl_prepare_attr_button_product_selected', array(__CLASS__, 'class_action'));
@@ -158,19 +158,19 @@ class TInvWL_Public_Wishlist_Buttons
158
  */
159
  public static function addbutton($button)
160
  {
161
- if ( ! array_key_exists('name', $button)) {
162
  return false;
163
  }
164
- if ( ! array_key_exists('priority', $button)) {
165
  $button['priority'] = 10;
166
  }
167
- if ( ! array_key_exists('method', $button)) {
168
  $button['method'] = array(__CLASS__, 'null_action');
169
  }
170
- if ( ! array_key_exists('event', $button)) {
171
  $button['event'] = self::$event;
172
  }
173
- if ( ! array_key_exists('condition', $button)) {
174
  $button['condition'] = 'true';
175
  }
176
  if (array_key_exists('submit', $button)) {
@@ -208,9 +208,9 @@ class TInvWL_Public_Wishlist_Buttons
208
  {
209
  $html = apply_filters('tinvwl_before__button_' . $value, '');
210
  $attr = array(
211
- 'type' => $submit,
212
  'class' => 'button',
213
- 'name' => 'tinvwl-action',
214
  'value' => $value,
215
  'title' => esc_attr(wp_strip_all_tags($title)),
216
  );
@@ -286,11 +286,11 @@ class TInvWL_Public_Wishlist_Buttons
286
  {
287
  add_filter('tinvwl_before_get_current_product', array(__CLASS__, 'get_all_products_fix_offset'));
288
  $products = self::get_current_products($wishlist, 9999999);
289
- $result = $errors = array();
290
  foreach ($products as $_product) {
291
  $product_data = wc_get_product($_product['variation_id'] ? $_product['variation_id'] : $_product['product_id']);
292
 
293
- if ( ! $product_data || 'trash' === $product_data->get_status()) {
294
  continue;
295
  }
296
 
@@ -307,7 +307,7 @@ class TInvWL_Public_Wishlist_Buttons
307
  // restore global product data.
308
  $product = $_product_tmp;
309
 
310
- $quantity = apply_filters('tinvwl_product_add_to_cart_quantity', array_key_exists($_product['ID'], (array)$_quantity) ? $_quantity[ $_product['ID'] ] : 1, $product_data);
311
  $_product['quantity'] = $quantity;
312
  if (apply_filters('tinvwl_product_add_to_cart_need_redirect', false, $product_data, $redirect_url, $_product)) {
313
  $errors[] = $_product['product_id'];
@@ -325,7 +325,7 @@ class TInvWL_Public_Wishlist_Buttons
325
  }
326
  }
327
 
328
- if ( ! empty($errors)) {
329
  $titles = array();
330
  foreach ($errors as $product_id) {
331
  $titles[] = sprintf(_x('&ldquo;%s&rdquo;', 'Item name in quotes', 'ti-woocommerce-wishlist'), strip_tags(get_the_title($product_id)));
@@ -333,7 +333,7 @@ class TInvWL_Public_Wishlist_Buttons
333
  $titles = array_filter($titles);
334
  wc_add_notice(sprintf(_n('Product %s could not be added to cart because some requirements are not met.', 'Products: %s could not be added to cart because some requirements are not met.', count($titles), 'ti-woocommerce-wishlist'), wc_format_list_of_items($titles)), 'error');
335
  }
336
- if ( ! empty($result)) {
337
  wc_add_to_cart_message($result, true);
338
 
339
  if (tinv_get_option('processing', 'redirect_checkout')) {
@@ -387,7 +387,7 @@ class TInvWL_Public_Wishlist_Buttons
387
  */
388
  public static function apply_action($wishlist, $selected = array(), $_quantity = array(), $owner = false)
389
  {
390
- if (empty($selected) || ! is_array($selected)) {
391
  return false;
392
  }
393
  $action = filter_input(INPUT_POST, 'product_actions', FILTER_SANITIZE_STRING);
@@ -413,7 +413,7 @@ class TInvWL_Public_Wishlist_Buttons
413
  */
414
  public static function apply_action_add_selected($wishlist, $selected = array(), $_quantity = array(), $owner = false)
415
  {
416
- if ( ! empty($selected)) {
417
  $result = $errors = array();
418
  foreach ($selected as $id) {
419
  $wlp = null;
@@ -427,7 +427,7 @@ class TInvWL_Public_Wishlist_Buttons
427
 
428
  $product_data = wc_get_product($_product['variation_id'] ? $_product['variation_id'] : $_product['product_id']);
429
 
430
- if ( ! $product_data || 'trash' === $product_data->get_status()) {
431
  continue;
432
  }
433
 
@@ -444,7 +444,7 @@ class TInvWL_Public_Wishlist_Buttons
444
  // restore global product data.
445
  $product = $_product_tmp;
446
 
447
- $quantity = apply_filters('tinvwl_product_add_to_cart_quantity', array_key_exists($id, (array)$_quantity) ? $_quantity[ $id ] : 1, $product_data);
448
  $_product['quantity'] = $quantity;
449
 
450
  if (apply_filters('tinvwl_product_add_to_cart_need_redirect', false, $product_data, $redirect_url, $_product)) {
@@ -459,7 +459,7 @@ class TInvWL_Public_Wishlist_Buttons
459
  $errors[] = $_product['variation_id'] ? $_product['variation_id'] : $_product['product_id'];
460
  }
461
  }
462
- if ( ! empty($errors)) {
463
  $titles = array();
464
  foreach ($errors as $product_id) {
465
  $titles[] = sprintf(_x('&ldquo;%s&rdquo;', 'Item name in quotes', 'ti-woocommerce-wishlist'), strip_tags(get_the_title($product_id)));
@@ -467,7 +467,7 @@ class TInvWL_Public_Wishlist_Buttons
467
  $titles = array_filter($titles);
468
  wc_add_notice(sprintf(_n('Product %s could not be added to cart because some requirements are not met.', 'Products: %s could not be added to cart because some requirements are not met.', count($titles), 'ti-woocommerce-wishlist'), wc_format_list_of_items($titles)), 'error');
469
  }
470
- if ( ! empty($result)) {
471
  wc_add_to_cart_message($result, true);
472
 
473
  if (tinv_get_option('processing', 'redirect_checkout')) {
@@ -499,7 +499,7 @@ class TInvWL_Public_Wishlist_Buttons
499
  */
500
  public static function apply_action_remove($wishlist, $selected = array(), $_quantity = array(), $owner = false)
501
  {
502
- if ( ! $owner) {
503
  return false;
504
  }
505
  $wlp = null;
@@ -513,7 +513,7 @@ class TInvWL_Public_Wishlist_Buttons
513
  }
514
 
515
  $products = $wlp->get_wishlist(array(
516
- 'ID' => $selected,
517
  'count' => 100,
518
  ));
519
 
@@ -527,7 +527,7 @@ class TInvWL_Public_Wishlist_Buttons
527
  }
528
  }
529
 
530
- if ( ! empty($titles)) {
531
  add_action('tinvwl_before_wishlist', array(
532
  'TInvWL_Public_Wishlist_View',
533
  'check_cart_hash',
@@ -564,13 +564,13 @@ class TInvWL_Public_Wishlist_Buttons
564
  return array();
565
  }
566
 
567
- $paged = get_query_var('wl_paged', 1);
568
  $paged = 1 < $paged ? $paged : 1;
569
 
570
- if ( ! $per_page) {
571
  $per_page = apply_filters('tinvwl_wishlist_products_per_page', filter_input(INPUT_POST, 'lists_per_page', FILTER_VALIDATE_INT, array(
572
  'options' => array(
573
- 'default' => 10,
574
  'min_range' => 1,
575
  ),
576
  )));
@@ -578,14 +578,14 @@ class TInvWL_Public_Wishlist_Buttons
578
  }
579
 
580
  $product_data = array(
581
- 'count' => $per_page,
582
- 'offset' => $per_page * ($paged - 1),
583
  'external' => false,
584
  );
585
 
586
  $product_data = apply_filters('tinvwl_before_get_current_product', $product_data);
587
- $products = $wlp->get_wishlist($product_data);
588
- $products = apply_filters('tinvwl_after_get_current_product', $products);
589
 
590
  return $products;
591
  }
7
  */
8
 
9
  // If this file is called directly, abort.
10
+ if (!defined('ABSPATH')) {
11
  die;
12
  }
13
 
59
  $buttons = array();
60
  if (tinv_get_option('table', 'colm_checkbox') && tinv_get_option('table', 'colm_actions')) {
61
  $buttons[] = array(
62
+ 'name' => 'product_apply',
63
+ 'title' => sprintf(__('Apply %s', 'ti-woocommerce-wishlist'), "<span class='tinvwl-mobile'>" . __('Action', 'ti-woocommerce-wishlist') . '</span>'),
64
+ 'method' => array(__CLASS__, 'apply_action'),
65
+ 'before' => array(__CLASS__, 'apply_action_before'),
66
+ 'priority' => 10,
67
  'condition' => '$a["is_owner"]',
68
  );
69
  add_filter('tinvwl_prepare_attr__button_product_apply', array(
77
  }
78
  if (tinv_get_option('table', 'colm_checkbox') && tinv_get_option('table', 'add_select_to_cart')) {
79
  $buttons[] = array(
80
+ 'name' => 'product_selected',
81
+ 'title' => apply_filters('tinvwl_add_selected_to_cart_text', tinv_get_option('table', 'text_add_select_to_cart')),
82
+ 'method' => array(__CLASS__, 'apply_action_add_selected'),
83
  'priority' => 25,
84
  );
85
  add_filter('tinvwl_prepare_attr_button_product_selected', array(
89
  }
90
  if (tinv_get_option('table', 'add_all_to_cart')) {
91
  $buttons[] = array(
92
+ 'name' => 'product_all',
93
+ 'title' => apply_filters('tinvwl_add_all_to_cart_text', tinv_get_option('table', 'text_add_all_to_cart')),
94
+ 'method' => array(__CLASS__, 'add_all'),
95
  'priority' => 30,
96
  );
97
  add_filter('tinvwl_prepare_attr_button_product_selected', array(__CLASS__, 'class_action'));
158
  */
159
  public static function addbutton($button)
160
  {
161
+ if (!array_key_exists('name', $button)) {
162
  return false;
163
  }
164
+ if (!array_key_exists('priority', $button)) {
165
  $button['priority'] = 10;
166
  }
167
+ if (!array_key_exists('method', $button)) {
168
  $button['method'] = array(__CLASS__, 'null_action');
169
  }
170
+ if (!array_key_exists('event', $button)) {
171
  $button['event'] = self::$event;
172
  }
173
+ if (!array_key_exists('condition', $button)) {
174
  $button['condition'] = 'true';
175
  }
176
  if (array_key_exists('submit', $button)) {
208
  {
209
  $html = apply_filters('tinvwl_before__button_' . $value, '');
210
  $attr = array(
211
+ 'type' => $submit,
212
  'class' => 'button',
213
+ 'name' => 'tinvwl-action',
214
  'value' => $value,
215
  'title' => esc_attr(wp_strip_all_tags($title)),
216
  );
286
  {
287
  add_filter('tinvwl_before_get_current_product', array(__CLASS__, 'get_all_products_fix_offset'));
288
  $products = self::get_current_products($wishlist, 9999999);
289
+ $result = $errors = array();
290
  foreach ($products as $_product) {
291
  $product_data = wc_get_product($_product['variation_id'] ? $_product['variation_id'] : $_product['product_id']);
292
 
293
+ if (!$product_data || 'trash' === $product_data->get_status()) {
294
  continue;
295
  }
296
 
307
  // restore global product data.
308
  $product = $_product_tmp;
309
 
310
+ $quantity = apply_filters('tinvwl_product_add_to_cart_quantity', array_key_exists($_product['ID'], (array)$_quantity) ? $_quantity[$_product['ID']] : 1, $product_data);
311
  $_product['quantity'] = $quantity;
312
  if (apply_filters('tinvwl_product_add_to_cart_need_redirect', false, $product_data, $redirect_url, $_product)) {
313
  $errors[] = $_product['product_id'];
325
  }
326
  }
327
 
328
+ if (!empty($errors)) {
329
  $titles = array();
330
  foreach ($errors as $product_id) {
331
  $titles[] = sprintf(_x('&ldquo;%s&rdquo;', 'Item name in quotes', 'ti-woocommerce-wishlist'), strip_tags(get_the_title($product_id)));
333
  $titles = array_filter($titles);
334
  wc_add_notice(sprintf(_n('Product %s could not be added to cart because some requirements are not met.', 'Products: %s could not be added to cart because some requirements are not met.', count($titles), 'ti-woocommerce-wishlist'), wc_format_list_of_items($titles)), 'error');
335
  }
336
+ if (!empty($result)) {
337
  wc_add_to_cart_message($result, true);
338
 
339
  if (tinv_get_option('processing', 'redirect_checkout')) {
387
  */
388
  public static function apply_action($wishlist, $selected = array(), $_quantity = array(), $owner = false)
389
  {
390
+ if (empty($selected) || !is_array($selected)) {
391
  return false;
392
  }
393
  $action = filter_input(INPUT_POST, 'product_actions', FILTER_SANITIZE_STRING);
413
  */
414
  public static function apply_action_add_selected($wishlist, $selected = array(), $_quantity = array(), $owner = false)
415
  {
416
+ if (!empty($selected)) {
417
  $result = $errors = array();
418
  foreach ($selected as $id) {
419
  $wlp = null;
427
 
428
  $product_data = wc_get_product($_product['variation_id'] ? $_product['variation_id'] : $_product['product_id']);
429
 
430
+ if (!$product_data || 'trash' === $product_data->get_status()) {
431
  continue;
432
  }
433
 
444
  // restore global product data.
445
  $product = $_product_tmp;
446
 
447
+ $quantity = apply_filters('tinvwl_product_add_to_cart_quantity', array_key_exists($id, (array)$_quantity) ? $_quantity[$id] : 1, $product_data);
448
  $_product['quantity'] = $quantity;
449
 
450
  if (apply_filters('tinvwl_product_add_to_cart_need_redirect', false, $product_data, $redirect_url, $_product)) {
459
  $errors[] = $_product['variation_id'] ? $_product['variation_id'] : $_product['product_id'];
460
  }
461
  }
462
+ if (!empty($errors)) {
463
  $titles = array();
464
  foreach ($errors as $product_id) {
465
  $titles[] = sprintf(_x('&ldquo;%s&rdquo;', 'Item name in quotes', 'ti-woocommerce-wishlist'), strip_tags(get_the_title($product_id)));
467
  $titles = array_filter($titles);
468
  wc_add_notice(sprintf(_n('Product %s could not be added to cart because some requirements are not met.', 'Products: %s could not be added to cart because some requirements are not met.', count($titles), 'ti-woocommerce-wishlist'), wc_format_list_of_items($titles)), 'error');
469
  }
470
+ if (!empty($result)) {
471
  wc_add_to_cart_message($result, true);
472
 
473
  if (tinv_get_option('processing', 'redirect_checkout')) {
499
  */
500
  public static function apply_action_remove($wishlist, $selected = array(), $_quantity = array(), $owner = false)
501
  {
502
+ if (!$owner) {
503
  return false;
504
  }
505
  $wlp = null;
513
  }
514
 
515
  $products = $wlp->get_wishlist(array(
516
+ 'ID' => $selected,
517
  'count' => 100,
518
  ));
519
 
527
  }
528
  }
529
 
530
+ if (!empty($titles)) {
531
  add_action('tinvwl_before_wishlist', array(
532
  'TInvWL_Public_Wishlist_View',
533
  'check_cart_hash',
564
  return array();
565
  }
566
 
567
+ $paged = absint(get_query_var('wl_paged', 1));
568
  $paged = 1 < $paged ? $paged : 1;
569
 
570
+ if (!$per_page) {
571
  $per_page = apply_filters('tinvwl_wishlist_products_per_page', filter_input(INPUT_POST, 'lists_per_page', FILTER_VALIDATE_INT, array(
572
  'options' => array(
573
+ 'default' => 10,
574
  'min_range' => 1,
575
  ),
576
  )));
578
  }
579
 
580
  $product_data = array(
581
+ 'count' => $per_page,
582
+ 'offset' => $per_page * ($paged - 1),
583
  'external' => false,
584
  );
585
 
586
  $product_data = apply_filters('tinvwl_before_get_current_product', $product_data);
587
+ $products = $wlp->get_wishlist($product_data);
588
+ $products = apply_filters('tinvwl_after_get_current_product', $products);
589
 
590
  return $products;
591
  }
public/wishlist/view.class.php CHANGED
@@ -7,14 +7,15 @@
7
  */
8
 
9
  // If this file is called directly, abort.
10
- if ( ! defined( 'ABSPATH' ) ) {
11
  die;
12
  }
13
 
14
  /**
15
  * Wishlist shortcode
16
  */
17
- class TInvWL_Public_Wishlist_View {
 
18
 
19
  /**
20
  * Plugin name
@@ -86,9 +87,10 @@ class TInvWL_Public_Wishlist_View {
86
  *
87
  * @return \TInvWL_Public_Wishlist_View
88
  */
89
- public static function instance( $plugin_name = TINVWL_PREFIX ) {
90
- if ( is_null( self::$_instance ) ) {
91
- self::$_instance = new self( $plugin_name );
 
92
  }
93
 
94
  return self::$_instance;
@@ -99,7 +101,8 @@ class TInvWL_Public_Wishlist_View {
99
  *
100
  * @param string $plugin_name Plugin name.
101
  */
102
- function __construct( $plugin_name ) {
 
103
  $this->_name = $plugin_name;
104
  $this->define_hooks();
105
  }
@@ -107,32 +110,34 @@ class TInvWL_Public_Wishlist_View {
107
  /**
108
  * Defined shortcode and hooks
109
  */
110
- function define_hooks() {
111
- add_action( 'template_redirect', array( $this, 'login_redirect' ) );
 
112
 
113
- add_action( 'wp_loaded', array( $this, 'login_post_redirect' ), 19 );
114
 
115
- add_action( 'wp', array( $this, 'wishlist_action' ), 0 );
116
- add_action( 'wp_head', array( $this, 'add_meta_tags' ), 1 );
117
 
118
- add_action( 'tinvwl_before_wishlist', array( $this, 'wishlist_header' ) );
119
 
120
- add_action( 'tinvwl_after_wishlist', array( 'TInvWL_Public_Wishlist_Social', 'init' ) );
121
- add_filter( 'tinvwl_wishlist_item_url', array( $this, 'add_argument' ), 10, 3 );
122
- add_filter( 'tinvwl_wishlist_item_action_add_to_cart', array( $this, 'product_allow_add_to_cart' ), 10, 3 );
123
- add_filter( 'tinvwl_wishlist_item_add_to_cart', array( $this, 'external_text' ), 10, 3 );
124
- add_filter( 'tinvwl_wishlist_item_add_to_cart', array( $this, 'variable_text' ), 10, 3 );
125
- add_action( 'tinvwl_after_wishlist_table', array( $this, 'get_per_page' ) );
126
 
127
- TInvWL_Public_Wishlist_Buttons::init( $this->_name );
128
  }
129
 
130
  /**
131
  * Redirect back after successful login.
132
  */
133
- public function login_post_redirect() {
134
- $nonce_value = isset( $_REQUEST['woocommerce-login-nonce'] ) ? $_REQUEST['woocommerce-login-nonce'] : ( isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : '' );
135
- if ( ! empty( $_POST['login'] ) && wp_verify_nonce( $nonce_value, 'woocommerce-login' ) && ! empty( $_GET['tinvwl_redirect'] ) ) {
 
136
  $_POST['redirect'] = $_GET['tinvwl_redirect']; // Force WC Login form handler to do redirect.
137
  }
138
  }
@@ -140,21 +145,22 @@ class TInvWL_Public_Wishlist_View {
140
  /**
141
  * Redirect guests to login page.
142
  */
143
- public function login_redirect() {
144
- if ( ! wc_get_page_id( 'myaccount' ) && is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) && ! is_user_logged_in() && tinv_get_option( 'general', 'require_login' ) ) {
 
145
  $full_link = get_permalink();
146
- $share_key = get_query_var( 'tinvwlID', null );
147
- if ( ! empty( $share_key ) ) {
148
- if ( get_option( 'permalink_structure' ) ) {
149
- if ( ! preg_match( '/\/$/', $full_link ) ) {
150
  $full_link .= '/';
151
  }
152
  $full_link .= $share_key . '/';
153
  } else {
154
- $full_link = add_query_arg( 'tinvwlID', $share_key, $full_link );
155
  }
156
  }
157
- wp_safe_redirect( add_query_arg( 'tinvwl_redirect', rawurlencode( $full_link ), wc_get_page_permalink( 'myaccount' ) ) );
158
  exit;
159
  }
160
  }
@@ -168,14 +174,15 @@ class TInvWL_Public_Wishlist_View {
168
  *
169
  * @return string
170
  */
171
- function external_text( $text, $wl_product, $_product ) {
 
172
  global $product;
173
  // store global product data.
174
  $_product_tmp = $product;
175
  // override global product data.
176
  $product = $_product;
177
 
178
- if ( 'external' === ( $product->get_type() ) ) {
179
 
180
  $text = $product->single_add_to_cart_text();
181
 
@@ -195,17 +202,18 @@ class TInvWL_Public_Wishlist_View {
195
  *
196
  * @return string
197
  */
198
- function variable_text( $text, $wl_product, $_product ) {
 
199
  global $product;
200
  // store global product data.
201
  $_product_tmp = $product;
202
  // override global product data.
203
  $product = $_product;
204
- if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $product, $product->get_permalink(), $wl_product )
205
- && in_array( $product->get_type(), array(
206
  'variable',
207
  'variable-subscription',
208
- ) ) ) {
209
 
210
  $text = $product->add_to_cart_text();
211
 
@@ -225,8 +233,9 @@ class TInvWL_Public_Wishlist_View {
225
  *
226
  * @return type
227
  */
228
- function add_argument( $url, $wl_product, $product ) {
229
- return add_query_arg( 'tiwp', $wl_product['ID'], $url );
 
230
  }
231
 
232
  /**
@@ -234,9 +243,10 @@ class TInvWL_Public_Wishlist_View {
234
  *
235
  * @return array
236
  */
237
- function get_current_wishlist() {
238
- if ( empty( $this->current_wishlist ) ) {
239
- $this->current_wishlist = apply_filters( 'tinvwl_get_current_wishlist', tinv_wishlist_get() );
 
240
  }
241
 
242
  return $this->current_wishlist;
@@ -247,8 +257,9 @@ class TInvWL_Public_Wishlist_View {
247
  *
248
  * @return array
249
  */
250
- function get_current_products_query() {
251
- if ( ! is_array( $this->current_products_query ) ) {
 
252
  return false;
253
  }
254
 
@@ -264,16 +275,17 @@ class TInvWL_Public_Wishlist_View {
264
  *
265
  * @return array
266
  */
267
- function get_current_products( $wishlist = null, $external = true, $lists_per_page = 10 ) {
268
- if ( empty( $wishlist ) || $wishlist === $this->get_current_wishlist() ) {
 
269
  $wishlist = $this->get_current_wishlist();
270
 
271
- if ( ! $this->wishlist_products_helper ) {
272
  $wlp = null;
273
- if ( isset( $wishlist['ID'] ) && 0 === $wishlist['ID'] ) {
274
  $wlp = TInvWL_Product_Local::instance();
275
  } else {
276
- $wlp = new TInvWL_Product( $wishlist );
277
  }
278
  $this->wishlist_products_helper = $wlp;
279
  } else {
@@ -282,38 +294,38 @@ class TInvWL_Public_Wishlist_View {
282
 
283
  } else {
284
  $wlp = null;
285
- if ( isset( $wishlist['ID'] ) && 0 === $wishlist['ID'] ) {
286
  $wlp = TInvWL_Product_Local::instance();
287
  } else {
288
- $wlp = new TInvWL_Product( $wishlist );
289
  }
290
  }
291
 
292
- if ( empty( $wlp ) ) {
293
  return array();
294
  }
295
 
296
- $paged = get_query_var( 'wl_paged', 1 );
297
- $this->pages = ceil( absint( $wlp->get_wishlist( array(
298
- 'count' => 9999999,
299
  'external' => false,
300
- ), true ) ) / absint( $lists_per_page ) );
301
 
302
  $paged = $this->pages < $paged ? $this->pages : $paged;
303
 
304
  $product_data = array(
305
- 'count' => $lists_per_page,
306
- 'offset' => absint( $lists_per_page ) * ( absint( $paged ) - 1 ),
307
  'external' => $external,
308
  'order_by' => 'date',
309
- 'order' => 'DESC',
310
  );
311
 
312
- $product_data = apply_filters( 'tinvwl_before_get_current_product', $product_data );
313
- $products = $wlp->get_wishlist( $product_data );
314
- $products = apply_filters( 'tinvwl_after_get_current_product', $products );
315
 
316
- if ( 10 === absint( $lists_per_page ) ) {
317
  $this->current_products_query = $products;
318
  }
319
 
@@ -329,12 +341,13 @@ class TInvWL_Public_Wishlist_View {
329
  *
330
  * @return boolean
331
  */
332
- function product_allow_add_to_cart( $allow, $wlproduct, $product ) {
333
- if ( ! $allow ) {
 
334
  return false;
335
  }
336
 
337
- return ( $product->is_purchasable() || 'external' === $product->get_type() ) && ( $product->is_in_stock() || $product->backorders_allowed() );
338
  }
339
 
340
  /**
@@ -342,44 +355,45 @@ class TInvWL_Public_Wishlist_View {
342
  *
343
  * @return boolean
344
  */
345
- function wishlist_action() {
 
346
 
347
- $wishlist_page_id = apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true );
348
 
349
- if ( is_page( $wishlist_page_id )
350
- || ( is_home() && 'page' === get_option( 'show_on_front' ) && absint( get_option( 'page_on_front' ) ) === $wishlist_page_id )
351
- || ( is_shop() && wc_get_page_id( 'shop' ) === $wishlist_page_id ) ) {
352
  $wishlist = $this->get_current_wishlist();
353
- if ( empty( $wishlist ) ) {
354
  return false;
355
  }
356
 
357
- if ( version_compare( WC_VERSION, '3.2.0', '<' ) ) {
358
- if ( ! defined( 'DONOTCACHEPAGE' ) ) {
359
- define( 'DONOTCACHEPAGE', true );
360
  }
361
- if ( ! defined( 'DONOTCACHEOBJECT' ) ) {
362
- define( 'DONOTCACHEOBJECT', true );
363
  }
364
- if ( ! defined( 'DONOTCACHEDB' ) ) {
365
- define( 'DONOTCACHEDB', true );
366
  }
367
  } else {
368
- WC_Cache_Helper::set_nocache_constants( true );
369
  nocache_headers();
370
  }
371
 
372
- $is_owner = is_user_logged_in() ? ( get_current_user_id() === $wishlist['author'] ) : $wishlist['is_owner'];
373
- $nonce = filter_input( INPUT_POST, 'wishlist_nonce' );
374
- if ( $nonce && wp_verify_nonce( $nonce, 'tinvwl_wishlist_owner' ) && $is_owner ) {
375
- do_action( 'tinvwl_before_action_owner', $wishlist );
376
- $this->wishlist_actions( $wishlist, true );
377
- do_action( 'tinvwl_after_action_owner', $wishlist );
378
  }
379
- if ( $nonce && wp_verify_nonce( $nonce, 'tinvwl_wishlist_user' ) && ! $is_owner ) {
380
- do_action( 'tinvwl_before_action_user', $wishlist );
381
- $this->wishlist_actions( $wishlist, false );
382
- do_action( 'tinvwl_after_action_user', $wishlist );
383
  }
384
  }
385
  }
@@ -387,63 +401,64 @@ class TInvWL_Public_Wishlist_View {
387
  /**
388
  * Create social meta tags
389
  */
390
- function add_meta_tags() {
391
- if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) ) {
 
392
  $wishlist = $this->get_current_wishlist();
393
- if ( $wishlist && 0 < $wishlist['ID'] ) {
394
- $this->wishlist_url = tinv_url_wishlist( $wishlist['share_key'] );
395
- if ( 'private' !== $wishlist['status'] && tinv_get_option( 'social', 'facebook' ) ) {
396
- if ( is_user_logged_in() ) {
397
- $user = get_user_by( 'id', $wishlist['author'] );
398
- if ( $user && $user->exists() ) {
399
- $user_name = trim( sprintf( '%s %s', $user->user_firstname, $user->user_lastname ) );
400
- $user = @$user->display_name; // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
401
  } else {
402
  $user_name = '';
403
- $user = '';
404
  }
405
  } else {
406
  $user_name = '';
407
- $user = '';
408
  }
409
 
410
- if ( is_array( $this->get_current_products_query() ) ) {
411
  $products = $this->current_products_query;
412
  } else {
413
- $products = $this->get_current_products( $wishlist, true );
414
  }
415
 
416
  $products_title = array();
417
- foreach ( $products as $product ) {
418
- if ( ! empty( $product ) && ! empty( $product['data'] ) ) {
419
- $title = is_callable( array(
420
  $product['data'],
421
  'get_name'
422
- ) ) ? $product['data']->get_name() : $product['data']->get_title();
423
- if ( ! in_array( $title, $products_title ) ) {
424
  $products_title[] = $title;
425
  }
426
  }
427
  }
428
- $product = array_shift( $products );
429
- $image = '';
430
- if ( ! empty( $product ) && ! empty( $product['data'] ) ) {
431
- list( $image ) = wp_get_attachment_image_src( $product['data']->get_image_id(), 'full' );
432
  }
433
 
434
  $this->social_image = $image;
435
 
436
 
437
- $meta = apply_filters( 'tinvwl_social_header_meta', array(
438
- 'url' => $this->wishlist_url,
439
- 'type' => 'product.group',
440
- 'title' => sprintf( __( '%1$s by %2$s', 'ti-woocommerce-wishlist' ), $wishlist['title'], ( empty( $user_name ) ? $user : $user_name ) ),
441
- 'description' => implode( ', ', $products_title ),
442
- 'image' => $image,
443
- ) );
444
 
445
- foreach ( $meta as $name => $content ) {
446
- echo sprintf( '<meta property="og:%s" content="%s" />', esc_attr( $name ), esc_attr( $content ) );
447
  }
448
  echo "\n";
449
  }
@@ -459,67 +474,68 @@ class TInvWL_Public_Wishlist_View {
459
  *
460
  * @return boolean
461
  */
462
- function wishlist_actions( $wishlist, $owner = false ) {
463
- $post = filter_input_array( INPUT_POST, array(
464
- 'wishlist_pr' => array(
 
465
  'filter' => FILTER_VALIDATE_INT,
466
- 'flags' => FILTER_FORCE_ARRAY,
467
  ),
468
- 'wishlist_qty' => array(
469
- 'filter' => FILTER_VALIDATE_INT,
470
- 'flags' => FILTER_FORCE_ARRAY,
471
- 'options' => array( 'min_range' => 0, 'default' => 1 ),
472
  ),
473
  'tinvwl-add-to-cart' => FILTER_VALIDATE_INT,
474
- 'tinvwl-remove' => FILTER_VALIDATE_INT,
475
- 'tinvwl-action' => FILTER_SANITIZE_STRING,
476
- ) );
477
 
478
- if ( ! empty( $post['tinvwl-add-to-cart'] ) ) {
479
- $product = $post['tinvwl-add-to-cart'];
480
- $quantity = array_key_exists( $product, (array) $post['wishlist_qty'] ) ? $post['wishlist_qty'][ $product ] : 1;
481
 
482
- return $this->button_addtocart( $wishlist, $product, $quantity, $owner );
483
  }
484
- if ( ! empty( $post['tinvwl-remove'] ) ) {
485
- if ( ! $wishlist['is_owner'] ) {
486
  return false;
487
  }
488
  $product = $post['tinvwl-remove'];
489
- if ( 0 === $wishlist['ID'] ) {
490
  $wlp = TInvWL_Product_Local::instance();
491
  } else {
492
- $wlp = new TInvWL_Product( $wishlist );
493
  }
494
- if ( empty( $wlp ) ) {
495
  return false;
496
  }
497
- $product_data = $wlp->get_wishlist( array( 'ID' => $product ) );
498
- $product_data = array_shift( $product_data );
499
- if ( empty( $product_data ) ) {
500
  return false;
501
  }
502
- $title = sprintf( __( '&ldquo;%s&rdquo;', 'ti-woocommerce-wishlist' ), is_callable( array(
503
  $product_data['data'],
504
  'get_name'
505
- ) ) ? $product_data['data']->get_name() : $product_data['data']->get_title() );
506
- if ( $wlp->remove( $product_data ) ) {
507
- add_action( 'tinvwl_before_wishlist', array(
508
  'TInvWL_Public_Wishlist_View',
509
  'check_cart_hash',
510
- ), 99, 1 );
511
- add_action( 'woocommerce_set_cart_cookies', array(
512
  'TInvWL_Public_Wishlist_View',
513
  'reset_cart_hash',
514
- ), 99, 1 );
515
- wc_add_notice( sprintf( __( '%s has been removed from wishlist.', 'ti-woocommerce-wishlist' ), $title ) );
516
  } else {
517
- wc_add_notice( sprintf( __( '%s has not been removed from wishlist.', 'ti-woocommerce-wishlist' ), $title ), 'error' );
518
  }
519
 
520
  return true;
521
  }
522
- do_action( 'tinvwl_action_' . $post['tinvwl-action'], $wishlist, $post['wishlist_pr'], $post['wishlist_qty'], $owner ); // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidHookName.UseUnderscores
523
  }
524
 
525
  /**
@@ -527,8 +543,9 @@ class TInvWL_Public_Wishlist_View {
527
  *
528
  * @param $wishlist
529
  */
530
- public static function check_cart_hash( $wishlist ) {
531
- wp_add_inline_script( 'woocommerce', "
 
532
  jQuery(document).ready(function($){
533
  if ( typeof wc_cart_fragments_params === 'undefined' ) {
534
  return false;
@@ -541,7 +558,7 @@ class TInvWL_Public_Wishlist_View {
541
  sessionStorage.setItem( cart_hash_key, 'empty' );
542
  }
543
  });
544
- " );
545
  }
546
 
547
  /**
@@ -549,8 +566,9 @@ class TInvWL_Public_Wishlist_View {
549
  *
550
  * @param bool $set
551
  */
552
- public static function reset_cart_hash( $set ) {
553
- wc_setcookie( 'woocommerce_cart_hash', 'reset', time() - HOUR_IN_SECONDS );
 
554
  }
555
 
556
  /**
@@ -563,26 +581,27 @@ class TInvWL_Public_Wishlist_View {
563
  *
564
  * @return boolean
565
  */
566
- function button_addtocart( $wishlist, $id, $quantity = 1, $owner = false ) {
567
- $id = absint( $id );
568
- $quantity = absint( $quantity );
569
- if ( empty( $id ) || empty( $quantity ) ) {
 
570
  return false;
571
  }
572
 
573
  $wlp = null;
574
- if ( 0 === $wishlist['ID'] ) {
575
  $wlp = TInvWL_Product_Local::instance();
576
  } else {
577
- $wlp = new TInvWL_Product( $wishlist );
578
  }
579
- if ( empty( $wlp ) ) {
580
  return false;
581
  }
582
 
583
- $_product = $wlp->get_wishlist( array( 'ID' => $id ) );
584
- $_product = array_shift( $_product );
585
- if ( empty( $_product ) || empty( $_product['data'] ) ) {
586
  return false;
587
  }
588
 
@@ -592,30 +611,30 @@ class TInvWL_Public_Wishlist_View {
592
  // override global product data.
593
  $product = $_product['data'];
594
 
595
- add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
596
  $redirect_url = $_product['data']->add_to_cart_url();
597
- remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
598
 
599
  // restore global product data.
600
  $product = $_product_tmp;
601
 
602
- $quantity = apply_filters( 'tinvwl_product_add_to_cart_quantity', $quantity, $_product['data'] );
603
 
604
- if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $_product['data'], $redirect_url, $_product ) ) {
605
- wp_redirect( apply_filters( 'tinvwl_product_add_to_cart_redirect_url', $redirect_url, $_product['data'], $_product ) ); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.wp_redirect
606
  exit;
607
- } elseif ( apply_filters( 'tinvwl_allow_addtocart_in_wishlist', true, $wishlist, $owner ) ) {
608
- $add = TInvWL_Public_Cart::add( $wishlist, $id, $quantity );
609
- if ( $add ) {
610
- wc_add_to_cart_message( $add, true );
611
 
612
- if ( tinv_get_option( 'processing', 'redirect_checkout' ) ) {
613
- wp_safe_redirect( wc_get_checkout_url() );
614
  exit;
615
  }
616
 
617
- if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
618
- wp_safe_redirect( wc_get_cart_url() );
619
  exit;
620
  }
621
 
@@ -633,31 +652,32 @@ class TInvWL_Public_Wishlist_View {
633
  *
634
  * @return mixed
635
  */
636
- function htmloutput( $atts ) {
 
637
  $wishlist = $this->get_current_wishlist();
638
 
639
- if ( empty( $wishlist ) ) {
640
- $id = get_query_var( 'tinvwlID', null );
641
- if ( empty( $id ) && ( is_user_logged_in() || ! tinv_get_option( 'general', 'require_login' ) ) ) {
642
- return $this->wishlist_empty( array(), array(
643
- 'ID' => '',
644
- 'author' => get_current_user_id(),
645
- 'title' => apply_filters( 'tinvwl_default_wishlist_title', tinv_get_option( 'general', 'default_title' ) ),
646
- 'status' => 'private',
647
- 'type' => 'default',
648
  'share_key' => '',
649
- ) );
650
  }
651
 
652
  return $this->wishlist_null();
653
  }
654
 
655
- if ( 'private' === $wishlist['status'] && ! $wishlist['is_owner'] ) {
656
  return $this->wishlist_null();
657
  }
658
- if ( 'default' !== $wishlist['type'] && ! tinv_get_option( 'general', 'multi' ) ) {
659
- if ( $wishlist['is_owner'] ) {
660
- printf( '<p><a href="%s">%s</p><script type="text/javascript">window.location.href="%s"</script>', esc_attr( tinv_url_wishlist_default() ), esc_html__( 'Return to Wishlist', 'ti-woocommerce-wishlist' ), esc_attr( tinv_url_wishlist_default() ) );
661
 
662
  return false;
663
  } else {
@@ -665,68 +685,68 @@ class TInvWL_Public_Wishlist_View {
665
  }
666
  }
667
 
668
- $this->lists_per_page = absint( $atts['lists_per_page'] );
669
 
670
- if ( 10 === $this->lists_per_page && is_array( $this->get_current_products_query() ) ) {
671
  $products = $this->current_products_query;
672
  } else {
673
- $products = $this->get_current_products( $wishlist, true, $this->lists_per_page );
674
  }
675
 
676
- $wla = new TInvWL_Analytics( $wishlist, $this->_name );
677
- $wla->view_products( $wishlist, $wishlist['is_owner'] );
678
 
679
- foreach ( $products as $key => $product ) {
680
- if ( ! isset( $product['data'] ) ) {
681
- unset( $products[ $key ] );
682
  }
683
  }
684
 
685
- if ( empty( $products ) ) {
686
 
687
  $this->pages = 0;
688
 
689
- return $this->wishlist_empty( $products, $wishlist );
690
  }
691
 
692
- $wishlist_table_row = tinv_get_option( 'product_table' );
693
- $wishlist_table_row['text_add_to_cart'] = apply_filters( 'tinvwl_add_to_cart_text', tinv_get_option( 'product_table', 'text_add_to_cart' ) );
694
 
695
  $data = array(
696
- 'products' => $products,
697
- 'wishlist' => $wishlist,
698
- 'wishlist_table' => tinv_get_option( 'table' ),
699
  'wishlist_table_row' => $wishlist_table_row,
700
  );
701
 
702
- $paged = get_query_var( 'wl_paged', 1 );
703
  $paged = $this->pages < $paged ? $this->pages : $paged;
704
 
705
- if ( 1 < $paged ) {
706
- add_action( 'tinvwl_pagenation_wishlist', array( $this, 'page_prev' ) );
707
  }
708
 
709
- if ( 1 < $this->pages ) {
710
- add_action( 'tinvwl_pagenation_wishlist', array( $this, 'pages' ) );
711
  }
712
- if ( $this->pages > $paged ) {
713
- add_action( 'tinvwl_pagenation_wishlist', array( $this, 'page_next' ) );
714
  }
715
 
716
- if ( $wishlist['is_owner'] ) {
717
- tinv_wishlist_template( 'ti-wishlist.php', $data );
718
  } else {
719
- if ( class_exists( 'WC_Catalog_Visibility_Options' ) ) {
720
  global $wc_cvo;
721
- if ( 'secured' === $wc_cvo->setting( 'wc_cvo_atc' && isset( $data['wishlist_table_row']['add_to_cart'] ) ) ) {
722
- unset( $data['wishlist_table_row']['add_to_cart'] );
723
  }
724
- if ( 'secured' === $wc_cvo->setting( 'wc_cvo_prices' && isset( $data['wishlist_table_row']['colm_price'] ) ) ) {
725
- unset( $data['wishlist_table_row']['colm_price'] );
726
  }
727
  }
728
 
729
- tinv_wishlist_template( 'ti-wishlist-user.php', $data );
730
  }
731
  }
732
 
@@ -735,11 +755,12 @@ class TInvWL_Public_Wishlist_View {
735
  *
736
  * @param array $wishlist Wishlist object.
737
  */
738
- function wishlist_null( $wishlist = array() ) {
 
739
  $data = array(
740
  'wishlist' => $wishlist,
741
  );
742
- tinv_wishlist_template( 'ti-wishlist-null.php', $data );
743
  }
744
 
745
  /**
@@ -748,13 +769,14 @@ class TInvWL_Public_Wishlist_View {
748
  * @param array $products Products wishlist.
749
  * @param array $wishlist Wishlist object.
750
  */
751
- function wishlist_empty( $products = array(), $wishlist = array() ) {
 
752
  $data = array(
753
- 'products' => $products,
754
- 'wishlist' => $wishlist,
755
- 'wishlist_table' => tinv_get_option( 'table' ),
756
  );
757
- tinv_wishlist_template( 'ti-wishlist-empty.php', $data );
758
  }
759
 
760
  /**
@@ -762,38 +784,41 @@ class TInvWL_Public_Wishlist_View {
762
  *
763
  * @param array $wishlist Wishlist object.
764
  */
765
- function wishlist_header( $wishlist ) {
 
766
 
767
  $data = array(
768
  'wishlist' => $wishlist,
769
  );
770
- tinv_wishlist_template( 'ti-wishlist-header.php', $data );
771
  }
772
 
773
  /**
774
  * Prev page button
775
  */
776
- function page_prev() {
777
- $paged = get_query_var( 'wl_paged', 1 );
 
778
  $paged = $this->pages < $paged ? $this->pages : $paged;
779
  $paged = 1 < $paged ? $paged - 1 : 0;
780
- $this->page( $paged, sprintf( '<i class="ftinvwl ftinvwl-chevron-left"></i><span>%s</span>', __( 'Previous Page', 'ti-woocommerce-wishlist' ) ), array( 'class' => 'button tinv-prev' ) );
781
  }
782
 
783
  /**
784
  * Pages
785
  */
786
- function pages() {
 
787
 
788
- $paged = get_query_var( 'wl_paged', 1 );
789
  $paged = $this->pages < $paged ? $this->pages : $paged;
790
- if ( 1 === (int) $paged ) {
791
  echo '<span></span>';
792
  }
793
 
794
  echo '<span>' . $paged . '/' . $this->pages . '</span>';
795
 
796
- if ( (int) $this->pages === (int) $paged ) {
797
  echo '<span></span>';
798
  }
799
  }
@@ -801,11 +826,12 @@ class TInvWL_Public_Wishlist_View {
801
  /**
802
  * Next page button
803
  */
804
- function page_next() {
805
- $paged = get_query_var( 'wl_paged', 1 );
 
806
  $paged = $this->pages < $paged ? $this->pages : $paged;
807
  $paged = 1 < $paged ? $paged + 1 : 2;
808
- $this->page( $paged, sprintf( '<span>%s</span><i class="ftinvwl ftinvwl-chevron-right"></i>', __( 'Next Page', 'ti-woocommerce-wishlist' ) ), array( 'class' => 'button tinv-next' ) );
809
  }
810
 
811
  /**
@@ -815,14 +841,15 @@ class TInvWL_Public_Wishlist_View {
815
  * @param string $text Text button.
816
  * @param style $style Style attribute.
817
  */
818
- function page( $paged, $text, $style = array() ) {
819
- $paged = absint( $paged );
 
820
  $wishlist = $this->get_current_wishlist();
821
- $link = tinv_url_wishlist( $wishlist['share_key'], $paged, true );
822
- if ( is_array( $style ) ) {
823
- $style = TInvWL_Form::__atrtostr( $style );
824
  }
825
- printf( '<a href="%s" %s>%s</a>', esc_url( $link ), $style, $text ); // WPCS: xss ok.
826
  }
827
 
828
  /**
@@ -832,14 +859,15 @@ class TInvWL_Public_Wishlist_View {
832
  *
833
  * @return string
834
  */
835
- function shortcode( $atts = array() ) {
 
836
  $default = array(
837
  'lists_per_page' => 10,
838
  );
839
- $atts = shortcode_atts( $default, $atts );
840
 
841
  ob_start();
842
- $this->htmloutput( $atts );
843
 
844
  return ob_get_clean();
845
  }
@@ -847,12 +875,13 @@ class TInvWL_Public_Wishlist_View {
847
  /**
848
  * Get per page items for buttons
849
  */
850
- function get_per_page() {
851
- if ( ! empty( $this->lists_per_page ) ) {
852
- echo TInvWL_Form::_text( array( // WPCS: xss ok.
 
853
  'type' => 'hidden',
854
  'name' => 'lists_per_page',
855
- ), $this->lists_per_page );
856
  }
857
  }
858
  }
7
  */
8
 
9
  // If this file is called directly, abort.
10
+ if (!defined('ABSPATH')) {
11
  die;
12
  }
13
 
14
  /**
15
  * Wishlist shortcode
16
  */
17
+ class TInvWL_Public_Wishlist_View
18
+ {
19
 
20
  /**
21
  * Plugin name
87
  *
88
  * @return \TInvWL_Public_Wishlist_View
89
  */
90
+ public static function instance($plugin_name = TINVWL_PREFIX)
91
+ {
92
+ if (is_null(self::$_instance)) {
93
+ self::$_instance = new self($plugin_name);
94
  }
95
 
96
  return self::$_instance;
101
  *
102
  * @param string $plugin_name Plugin name.
103
  */
104
+ function __construct($plugin_name)
105
+ {
106
  $this->_name = $plugin_name;
107
  $this->define_hooks();
108
  }
110
  /**
111
  * Defined shortcode and hooks
112
  */
113
+ function define_hooks()
114
+ {
115
+ add_action('template_redirect', array($this, 'login_redirect'));
116
 
117
+ add_action('wp_loaded', array($this, 'login_post_redirect'), 19);
118
 
119
+ add_action('wp', array($this, 'wishlist_action'), 0);
120
+ add_action('wp_head', array($this, 'add_meta_tags'), 1);
121
 
122
+ add_action('tinvwl_before_wishlist', array($this, 'wishlist_header'));
123
 
124
+ add_action('tinvwl_after_wishlist', array('TInvWL_Public_Wishlist_Social', 'init'));
125
+ add_filter('tinvwl_wishlist_item_url', array($this, 'add_argument'), 10, 3);
126
+ add_filter('tinvwl_wishlist_item_action_add_to_cart', array($this, 'product_allow_add_to_cart'), 10, 3);
127
+ add_filter('tinvwl_wishlist_item_add_to_cart', array($this, 'external_text'), 10, 3);
128
+ add_filter('tinvwl_wishlist_item_add_to_cart', array($this, 'variable_text'), 10, 3);
129
+ add_action('tinvwl_after_wishlist_table', array($this, 'get_per_page'));
130
 
131
+ TInvWL_Public_Wishlist_Buttons::init($this->_name);
132
  }
133
 
134
  /**
135
  * Redirect back after successful login.
136
  */
137
+ public function login_post_redirect()
138
+ {
139
+ $nonce_value = isset($_REQUEST['woocommerce-login-nonce']) ? $_REQUEST['woocommerce-login-nonce'] : (isset($_REQUEST['_wpnonce']) ? $_REQUEST['_wpnonce'] : '');
140
+ if (!empty($_POST['login']) && wp_verify_nonce($nonce_value, 'woocommerce-login') && !empty($_GET['tinvwl_redirect'])) {
141
  $_POST['redirect'] = $_GET['tinvwl_redirect']; // Force WC Login form handler to do redirect.
142
  }
143
  }
145
  /**
146
  * Redirect guests to login page.
147
  */
148
+ public function login_redirect()
149
+ {
150
+ if (!wc_get_page_id('myaccount') && is_page(apply_filters('wpml_object_id', tinv_get_option('page', 'wishlist'), 'page', true)) && !is_user_logged_in() && tinv_get_option('general', 'require_login')) {
151
  $full_link = get_permalink();
152
+ $share_key = get_query_var('tinvwlID', null);
153
+ if (!empty($share_key)) {
154
+ if (get_option('permalink_structure')) {
155
+ if (!preg_match('/\/$/', $full_link)) {
156
  $full_link .= '/';
157
  }
158
  $full_link .= $share_key . '/';
159
  } else {
160
+ $full_link = add_query_arg('tinvwlID', $share_key, $full_link);
161
  }
162
  }
163
+ wp_safe_redirect(add_query_arg('tinvwl_redirect', rawurlencode($full_link), wc_get_page_permalink('myaccount')));
164
  exit;
165
  }
166
  }
174
  *
175
  * @return string
176
  */
177
+ function external_text($text, $wl_product, $_product)
178
+ {
179
  global $product;
180
  // store global product data.
181
  $_product_tmp = $product;
182
  // override global product data.
183
  $product = $_product;
184
 
185
+ if ('external' === ($product->get_type())) {
186
 
187
  $text = $product->single_add_to_cart_text();
188
 
202
  *
203
  * @return string
204
  */
205
+ function variable_text($text, $wl_product, $_product)
206
+ {
207
  global $product;
208
  // store global product data.
209
  $_product_tmp = $product;
210
  // override global product data.
211
  $product = $_product;
212
+ if (apply_filters('tinvwl_product_add_to_cart_need_redirect', false, $product, $product->get_permalink(), $wl_product)
213
+ && in_array($product->get_type(), array(
214
  'variable',
215
  'variable-subscription',
216
+ ))) {
217
 
218
  $text = $product->add_to_cart_text();
219
 
233
  *
234
  * @return type
235
  */
236
+ function add_argument($url, $wl_product, $product)
237
+ {
238
+ return add_query_arg('tiwp', $wl_product['ID'], $url);
239
  }
240
 
241
  /**
243
  *
244
  * @return array
245
  */
246
+ function get_current_wishlist()
247
+ {
248
+ if (empty($this->current_wishlist)) {
249
+ $this->current_wishlist = apply_filters('tinvwl_get_current_wishlist', tinv_wishlist_get());
250
  }
251
 
252
  return $this->current_wishlist;
257
  *
258
  * @return array
259
  */
260
+ function get_current_products_query()
261
+ {
262
+ if (!is_array($this->current_products_query)) {
263
  return false;
264
  }
265
 
275
  *
276
  * @return array
277
  */
278
+ function get_current_products($wishlist = null, $external = true, $lists_per_page = 10)
279
+ {
280
+ if (empty($wishlist) || $wishlist === $this->get_current_wishlist()) {
281
  $wishlist = $this->get_current_wishlist();
282
 
283
+ if (!$this->wishlist_products_helper) {
284
  $wlp = null;
285
+ if (isset($wishlist['ID']) && 0 === $wishlist['ID']) {
286
  $wlp = TInvWL_Product_Local::instance();
287
  } else {
288
+ $wlp = new TInvWL_Product($wishlist);
289
  }
290
  $this->wishlist_products_helper = $wlp;
291
  } else {
294
 
295
  } else {
296
  $wlp = null;
297
+ if (isset($wishlist['ID']) && 0 === $wishlist['ID']) {
298
  $wlp = TInvWL_Product_Local::instance();
299
  } else {
300
+ $wlp = new TInvWL_Product($wishlist);
301
  }
302
  }
303
 
304
+ if (empty($wlp)) {
305
  return array();
306
  }
307
 
308
+ $paged = absint(get_query_var('wl_paged', 1));
309
+ $this->pages = ceil(absint($wlp->get_wishlist(array(
310
+ 'count' => 9999999,
311
  'external' => false,
312
+ ), true)) / absint($lists_per_page));
313
 
314
  $paged = $this->pages < $paged ? $this->pages : $paged;
315
 
316
  $product_data = array(
317
+ 'count' => absint($lists_per_page),
318
+ 'offset' => absint($lists_per_page) * (absint($paged) - 1),
319
  'external' => $external,
320
  'order_by' => 'date',
321
+ 'order' => 'DESC',
322
  );
323
 
324
+ $product_data = apply_filters('tinvwl_before_get_current_product', $product_data);
325
+ $products = $wlp->get_wishlist($product_data);
326
+ $products = apply_filters('tinvwl_after_get_current_product', $products);
327
 
328
+ if (10 === absint($lists_per_page)) {
329
  $this->current_products_query = $products;
330
  }
331
 
341
  *
342
  * @return boolean
343
  */
344
+ function product_allow_add_to_cart($allow, $wlproduct, $product)
345
+ {
346
+ if (!$allow) {
347
  return false;
348
  }
349
 
350
+ return ($product->is_purchasable() || 'external' === $product->get_type()) && ($product->is_in_stock() || $product->backorders_allowed());
351
  }
352
 
353
  /**
355
  *
356
  * @return boolean
357
  */
358
+ function wishlist_action()
359
+ {
360
 
361
+ $wishlist_page_id = apply_filters('wpml_object_id', tinv_get_option('page', 'wishlist'), 'page', true);
362
 
363
+ if (is_page($wishlist_page_id)
364
+ || (is_home() && 'page' === get_option('show_on_front') && absint(get_option('page_on_front')) === $wishlist_page_id)
365
+ || (is_shop() && wc_get_page_id('shop') === $wishlist_page_id)) {
366
  $wishlist = $this->get_current_wishlist();
367
+ if (empty($wishlist)) {
368
  return false;
369
  }
370
 
371
+ if (version_compare(WC_VERSION, '3.2.0', '<')) {
372
+ if (!defined('DONOTCACHEPAGE')) {
373
+ define('DONOTCACHEPAGE', true);
374
  }
375
+ if (!defined('DONOTCACHEOBJECT')) {
376
+ define('DONOTCACHEOBJECT', true);
377
  }
378
+ if (!defined('DONOTCACHEDB')) {
379
+ define('DONOTCACHEDB', true);
380
  }
381
  } else {
382
+ WC_Cache_Helper::set_nocache_constants(true);
383
  nocache_headers();
384
  }
385
 
386
+ $is_owner = is_user_logged_in() ? (get_current_user_id() === $wishlist['author']) : $wishlist['is_owner'];
387
+ $nonce = filter_input(INPUT_POST, 'wishlist_nonce');
388
+ if ($nonce && wp_verify_nonce($nonce, 'tinvwl_wishlist_owner') && $is_owner) {
389
+ do_action('tinvwl_before_action_owner', $wishlist);
390
+ $this->wishlist_actions($wishlist, true);
391
+ do_action('tinvwl_after_action_owner', $wishlist);
392
  }
393
+ if ($nonce && wp_verify_nonce($nonce, 'tinvwl_wishlist_user') && !$is_owner) {
394
+ do_action('tinvwl_before_action_user', $wishlist);
395
+ $this->wishlist_actions($wishlist, false);
396
+ do_action('tinvwl_after_action_user', $wishlist);
397
  }
398
  }
399
  }
401
  /**
402
  * Create social meta tags
403
  */
404
+ function add_meta_tags()
405
+ {
406
+ if (is_page(apply_filters('wpml_object_id', tinv_get_option('page', 'wishlist'), 'page', true))) {
407
  $wishlist = $this->get_current_wishlist();
408
+ if ($wishlist && 0 < $wishlist['ID']) {
409
+ $this->wishlist_url = tinv_url_wishlist($wishlist['share_key']);
410
+ if ('private' !== $wishlist['status'] && tinv_get_option('social', 'facebook')) {
411
+ if (is_user_logged_in()) {
412
+ $user = get_user_by('id', $wishlist['author']);
413
+ if ($user && $user->exists()) {
414
+ $user_name = trim(sprintf('%s %s', $user->user_firstname, $user->user_lastname));
415
+ $user = @$user->display_name; // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
416
  } else {
417
  $user_name = '';
418
+ $user = '';
419
  }
420
  } else {
421
  $user_name = '';
422
+ $user = '';
423
  }
424
 
425
+ if (is_array($this->get_current_products_query())) {
426
  $products = $this->current_products_query;
427
  } else {
428
+ $products = $this->get_current_products($wishlist, true);
429
  }
430
 
431
  $products_title = array();
432
+ foreach ($products as $product) {
433
+ if (!empty($product) && !empty($product['data'])) {
434
+ $title = is_callable(array(
435
  $product['data'],
436
  'get_name'
437
+ )) ? $product['data']->get_name() : $product['data']->get_title();
438
+ if (!in_array($title, $products_title)) {
439
  $products_title[] = $title;
440
  }
441
  }
442
  }
443
+ $product = array_shift($products);
444
+ $image = '';
445
+ if (!empty($product) && !empty($product['data'])) {
446
+ list($image) = wp_get_attachment_image_src($product['data']->get_image_id(), 'full');
447
  }
448
 
449
  $this->social_image = $image;
450
 
451
 
452
+ $meta = apply_filters('tinvwl_social_header_meta', array(
453
+ 'url' => $this->wishlist_url,
454
+ 'type' => 'product.group',
455
+ 'title' => sprintf(__('%1$s by %2$s', 'ti-woocommerce-wishlist'), $wishlist['title'], (empty($user_name) ? $user : $user_name)),
456
+ 'description' => implode(', ', $products_title),
457
+ 'image' => $image,
458
+ ));
459
 
460
+ foreach ($meta as $name => $content) {
461
+ echo sprintf('<meta property="og:%s" content="%s" />', esc_attr($name), esc_attr($content));
462
  }
463
  echo "\n";
464
  }
474
  *
475
  * @return boolean
476
  */
477
+ function wishlist_actions($wishlist, $owner = false)
478
+ {
479
+ $post = filter_input_array(INPUT_POST, array(
480
+ 'wishlist_pr' => array(
481
  'filter' => FILTER_VALIDATE_INT,
482
+ 'flags' => FILTER_FORCE_ARRAY,
483
  ),
484
+ 'wishlist_qty' => array(
485
+ 'filter' => FILTER_VALIDATE_INT,
486
+ 'flags' => FILTER_FORCE_ARRAY,
487
+ 'options' => array('min_range' => 0, 'default' => 1),
488
  ),
489
  'tinvwl-add-to-cart' => FILTER_VALIDATE_INT,
490
+ 'tinvwl-remove' => FILTER_VALIDATE_INT,
491
+ 'tinvwl-action' => FILTER_SANITIZE_STRING,
492
+ ));
493
 
494
+ if (!empty($post['tinvwl-add-to-cart'])) {
495
+ $product = $post['tinvwl-add-to-cart'];
496
+ $quantity = array_key_exists($product, (array)$post['wishlist_qty']) ? $post['wishlist_qty'][$product] : 1;
497
 
498
+ return $this->button_addtocart($wishlist, $product, $quantity, $owner);
499
  }
500
+ if (!empty($post['tinvwl-remove'])) {
501
+ if (!$wishlist['is_owner']) {
502
  return false;
503
  }
504
  $product = $post['tinvwl-remove'];
505
+ if (0 === $wishlist['ID']) {
506
  $wlp = TInvWL_Product_Local::instance();
507
  } else {
508
+ $wlp = new TInvWL_Product($wishlist);
509
  }
510
+ if (empty($wlp)) {
511
  return false;
512
  }
513
+ $product_data = $wlp->get_wishlist(array('ID' => $product));
514
+ $product_data = array_shift($product_data);
515
+ if (empty($product_data)) {
516
  return false;
517
  }
518
+ $title = sprintf(__('&ldquo;%s&rdquo;', 'ti-woocommerce-wishlist'), is_callable(array(
519
  $product_data['data'],
520
  'get_name'
521
+ )) ? $product_data['data']->get_name() : $product_data['data']->get_title());
522
+ if ($wlp->remove($product_data)) {
523
+ add_action('tinvwl_before_wishlist', array(
524
  'TInvWL_Public_Wishlist_View',
525
  'check_cart_hash',
526
+ ), 99, 1);
527
+ add_action('woocommerce_set_cart_cookies', array(
528
  'TInvWL_Public_Wishlist_View',
529
  'reset_cart_hash',
530
+ ), 99, 1);
531
+ wc_add_notice(sprintf(__('%s has been removed from wishlist.', 'ti-woocommerce-wishlist'), $title));
532
  } else {
533
+ wc_add_notice(sprintf(__('%s has not been removed from wishlist.', 'ti-woocommerce-wishlist'), $title), 'error');
534
  }
535
 
536
  return true;
537
  }
538
+ do_action('tinvwl_action_' . $post['tinvwl-action'], $wishlist, $post['wishlist_pr'], $post['wishlist_qty'], $owner); // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidHookName.UseUnderscores
539
  }
540
 
541
  /**
543
  *
544
  * @param $wishlist
545
  */
546
+ public static function check_cart_hash($wishlist)
547
+ {
548
+ wp_add_inline_script('woocommerce', "
549
  jQuery(document).ready(function($){
550
  if ( typeof wc_cart_fragments_params === 'undefined' ) {
551
  return false;
558
  sessionStorage.setItem( cart_hash_key, 'empty' );
559
  }
560
  });
561
+ ");
562
  }
563
 
564
  /**
566
  *
567
  * @param bool $set
568
  */
569
+ public static function reset_cart_hash($set)
570
+ {
571
+ wc_setcookie('woocommerce_cart_hash', 'reset', time() - HOUR_IN_SECONDS);
572
  }
573
 
574
  /**
581
  *
582
  * @return boolean
583
  */
584
+ function button_addtocart($wishlist, $id, $quantity = 1, $owner = false)
585
+ {
586
+ $id = absint($id);
587
+ $quantity = absint($quantity);
588
+ if (empty($id) || empty($quantity)) {
589
  return false;
590
  }
591
 
592
  $wlp = null;
593
+ if (0 === $wishlist['ID']) {
594
  $wlp = TInvWL_Product_Local::instance();
595
  } else {
596
+ $wlp = new TInvWL_Product($wishlist);
597
  }
598
+ if (empty($wlp)) {
599
  return false;
600
  }
601
 
602
+ $_product = $wlp->get_wishlist(array('ID' => $id));
603
+ $_product = array_shift($_product);
604
+ if (empty($_product) || empty($_product['data'])) {
605
  return false;
606
  }
607
 
611
  // override global product data.
612
  $product = $_product['data'];
613
 
614
+ add_filter('clean_url', 'tinvwl_clean_url', 10, 2);
615
  $redirect_url = $_product['data']->add_to_cart_url();
616
+ remove_filter('clean_url', 'tinvwl_clean_url', 10);
617
 
618
  // restore global product data.
619
  $product = $_product_tmp;
620
 
621
+ $quantity = apply_filters('tinvwl_product_add_to_cart_quantity', $quantity, $_product['data']);
622
 
623
+ if (apply_filters('tinvwl_product_add_to_cart_need_redirect', false, $_product['data'], $redirect_url, $_product)) {
624
+ wp_redirect(apply_filters('tinvwl_product_add_to_cart_redirect_url', $redirect_url, $_product['data'], $_product)); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.wp_redirect
625
  exit;
626
+ } elseif (apply_filters('tinvwl_allow_addtocart_in_wishlist', true, $wishlist, $owner)) {
627
+ $add = TInvWL_Public_Cart::add($wishlist, $id, $quantity);
628
+ if ($add) {
629
+ wc_add_to_cart_message($add, true);
630
 
631
+ if (tinv_get_option('processing', 'redirect_checkout')) {
632
+ wp_safe_redirect(wc_get_checkout_url());
633
  exit;
634
  }
635
 
636
+ if ('yes' === get_option('woocommerce_cart_redirect_after_add')) {
637
+ wp_safe_redirect(wc_get_cart_url());
638
  exit;
639
  }
640
 
652
  *
653
  * @return mixed
654
  */
655
+ function htmloutput($atts)
656
+ {
657
  $wishlist = $this->get_current_wishlist();
658
 
659
+ if (empty($wishlist)) {
660
+ $id = get_query_var('tinvwlID', null);
661
+ if (empty($id) && (is_user_logged_in() || !tinv_get_option('general', 'require_login'))) {
662
+ return $this->wishlist_empty(array(), array(
663
+ 'ID' => '',
664
+ 'author' => get_current_user_id(),
665
+ 'title' => apply_filters('tinvwl_default_wishlist_title', tinv_get_option('general', 'default_title')),
666
+ 'status' => 'private',
667
+ 'type' => 'default',
668
  'share_key' => '',
669
+ ));
670
  }
671
 
672
  return $this->wishlist_null();
673
  }
674
 
675
+ if ('private' === $wishlist['status'] && !$wishlist['is_owner']) {
676
  return $this->wishlist_null();
677
  }
678
+ if ('default' !== $wishlist['type'] && !tinv_get_option('general', 'multi')) {
679
+ if ($wishlist['is_owner']) {
680
+ printf('<p><a href="%s">%s</p><script type="text/javascript">window.location.href="%s"</script>', esc_attr(tinv_url_wishlist_default()), esc_html__('Return to Wishlist', 'ti-woocommerce-wishlist'), esc_attr(tinv_url_wishlist_default()));
681
 
682
  return false;
683
  } else {
685
  }
686
  }
687
 
688
+ $this->lists_per_page = absint($atts['lists_per_page']);
689
 
690
+ if (10 === $this->lists_per_page && is_array($this->get_current_products_query())) {
691
  $products = $this->current_products_query;
692
  } else {
693
+ $products = $this->get_current_products($wishlist, true, $this->lists_per_page);
694
  }
695
 
696
+ $wla = new TInvWL_Analytics($wishlist, $this->_name);
697
+ $wla->view_products($wishlist, $wishlist['is_owner']);
698
 
699
+ foreach ($products as $key => $product) {
700
+ if (!isset($product['data'])) {
701
+ unset($products[$key]);
702
  }
703
  }
704
 
705
+ if (empty($products)) {
706
 
707
  $this->pages = 0;
708
 
709
+ return $this->wishlist_empty($products, $wishlist);
710
  }
711
 
712
+ $wishlist_table_row = tinv_get_option('product_table');
713
+ $wishlist_table_row['text_add_to_cart'] = apply_filters('tinvwl_add_to_cart_text', tinv_get_option('product_table', 'text_add_to_cart'));
714
 
715
  $data = array(
716
+ 'products' => $products,
717
+ 'wishlist' => $wishlist,
718
+ 'wishlist_table' => tinv_get_option('table'),
719
  'wishlist_table_row' => $wishlist_table_row,
720
  );
721
 
722
+ $paged = absint(get_query_var('wl_paged', 1));
723
  $paged = $this->pages < $paged ? $this->pages : $paged;
724
 
725
+ if (1 < $paged) {
726
+ add_action('tinvwl_pagenation_wishlist', array($this, 'page_prev'));
727
  }
728
 
729
+ if (1 < $this->pages) {
730
+ add_action('tinvwl_pagenation_wishlist', array($this, 'pages'));
731
  }
732
+ if ($this->pages > $paged) {
733
+ add_action('tinvwl_pagenation_wishlist', array($this, 'page_next'));
734
  }
735
 
736
+ if ($wishlist['is_owner']) {
737
+ tinv_wishlist_template('ti-wishlist.php', $data);
738
  } else {
739
+ if (class_exists('WC_Catalog_Visibility_Options')) {
740
  global $wc_cvo;
741
+ if ('secured' === $wc_cvo->setting('wc_cvo_atc' && isset($data['wishlist_table_row']['add_to_cart']))) {
742
+ unset($data['wishlist_table_row']['add_to_cart']);
743
  }
744
+ if ('secured' === $wc_cvo->setting('wc_cvo_prices' && isset($data['wishlist_table_row']['colm_price']))) {
745
+ unset($data['wishlist_table_row']['colm_price']);
746
  }
747
  }
748
 
749
+ tinv_wishlist_template('ti-wishlist-user.php', $data);
750
  }
751
  }
752
 
755
  *
756
  * @param array $wishlist Wishlist object.
757
  */
758
+ function wishlist_null($wishlist = array())
759
+ {
760
  $data = array(
761
  'wishlist' => $wishlist,
762
  );
763
+ tinv_wishlist_template('ti-wishlist-null.php', $data);
764
  }
765
 
766
  /**
769
  * @param array $products Products wishlist.
770
  * @param array $wishlist Wishlist object.
771
  */
772
+ function wishlist_empty($products = array(), $wishlist = array())
773
+ {
774
  $data = array(
775
+ 'products' => $products,
776
+ 'wishlist' => $wishlist,
777
+ 'wishlist_table' => tinv_get_option('table'),
778
  );
779
+ tinv_wishlist_template('ti-wishlist-empty.php', $data);
780
  }
781
 
782
  /**
784
  *
785
  * @param array $wishlist Wishlist object.
786
  */
787
+ function wishlist_header($wishlist)
788
+ {
789
 
790
  $data = array(
791
  'wishlist' => $wishlist,
792
  );
793
+ tinv_wishlist_template('ti-wishlist-header.php', $data);
794
  }
795
 
796
  /**
797
  * Prev page button
798
  */
799
+ function page_prev()
800
+ {
801
+ $paged = absint(get_query_var('wl_paged', 1));
802
  $paged = $this->pages < $paged ? $this->pages : $paged;
803
  $paged = 1 < $paged ? $paged - 1 : 0;
804
+ $this->page($paged, sprintf('<i class="ftinvwl ftinvwl-chevron-left"></i><span>%s</span>', __('Previous Page', 'ti-woocommerce-wishlist')), array('class' => 'button tinv-prev'));
805
  }
806
 
807
  /**
808
  * Pages
809
  */
810
+ function pages()
811
+ {
812
 
813
+ $paged = absint(get_query_var('wl_paged', 1));
814
  $paged = $this->pages < $paged ? $this->pages : $paged;
815
+ if (1 === (int)$paged) {
816
  echo '<span></span>';
817
  }
818
 
819
  echo '<span>' . $paged . '/' . $this->pages . '</span>';
820
 
821
+ if ((int)$this->pages === (int)$paged) {
822
  echo '<span></span>';
823
  }
824
  }
826
  /**
827
  * Next page button
828
  */
829
+ function page_next()
830
+ {
831
+ $paged = absint(get_query_var('wl_paged', 1));
832
  $paged = $this->pages < $paged ? $this->pages : $paged;
833
  $paged = 1 < $paged ? $paged + 1 : 2;
834
+ $this->page($paged, sprintf('<span>%s</span><i class="ftinvwl ftinvwl-chevron-right"></i>', __('Next Page', 'ti-woocommerce-wishlist')), array('class' => 'button tinv-next'));
835
  }
836
 
837
  /**
841
  * @param string $text Text button.
842
  * @param style $style Style attribute.
843
  */
844
+ function page($paged, $text, $style = array())
845
+ {
846
+ $paged = absint($paged);
847
  $wishlist = $this->get_current_wishlist();
848
+ $link = tinv_url_wishlist($wishlist['share_key'], $paged, true);
849
+ if (is_array($style)) {
850
+ $style = TInvWL_Form::__atrtostr($style);
851
  }
852
+ printf('<a href="%s" %s>%s</a>', esc_url($link), $style, $text); // WPCS: xss ok.
853
  }
854
 
855
  /**
859
  *
860
  * @return string
861
  */
862
+ function shortcode($atts = array())
863
+ {
864
  $default = array(
865
  'lists_per_page' => 10,
866
  );
867
+ $atts = shortcode_atts($default, $atts);
868
 
869
  ob_start();
870
+ $this->htmloutput($atts);
871
 
872
  return ob_get_clean();
873
  }
875
  /**
876
  * Get per page items for buttons
877
  */
878
+ function get_per_page()
879
+ {
880
+ if (!empty($this->lists_per_page)) {
881
+ echo TInvWL_Form::_text(array( // WPCS: xss ok.
882
  'type' => 'hidden',
883
  'name' => 'lists_per_page',
884
+ ), $this->lists_per_page);
885
  }
886
  }
887
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: templateinvaders
3
  Tags: woocommerce, wishlist, woocommerce wishlist, e-commerce, ecommerce
4
  Requires at least: 4.7
5
  Tested up to: 5.7
6
- Stable tag: 1.24.4
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
  Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
@@ -163,6 +163,15 @@ Yes, you can! Join in on our [GitHub repository](https://github.com/TemplateInva
163
 
164
 
165
  == Changelog ==
 
 
 
 
 
 
 
 
 
166
  = 1.24.4 =
167
  *Release Date - 25 March 2021*
168
 
@@ -272,128 +281,9 @@ Yes, you can! Join in on our [GitHub repository](https://github.com/TemplateInva
272
  * Updated integration with Flatsome theme
273
  * Updated integration with [WooCommerce Product Add-ons](https://woocommerce.com/products/product-add-ons/?aff=3955) plugin
274
 
275
- = 1.22.1 =
276
- *Release Date - 7 December 2020*
277
-
278
- * Added compatibility with [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/) plugin
279
- * Added compatibility with [Advanced Product Fields for WooCommerce Pro](https://www.studiowombat.com/plugin/advanced-product-fields-for-woocommerce/) plugin
280
-
281
- = 1.22.0 =
282
- *Release Date - 25 November 2020*
283
-
284
- * WordPress 5.6 support
285
- * Discontinued support for WooCommerce 2.x, minimum requirements are WooCommerce 3.0.0
286
- * PHP 8 support
287
- * Improved add to wishlist button behavior when it inserted outside add to cart form
288
- * Improved WP SHORTINIT loading for the custom AJAX endpoint
289
-
290
- = 1.21.14 =
291
- *Release Date - 17 November 2020*
292
-
293
- * Improved add to wishlist button behavior for variable product type
294
- * Fixed PHP notice in case of wrong pagination value for wishlist page
295
- * Fixed PHP notices in case wishlist ID page is not valid WP_Post object
296
-
297
- = 1.21.13 =
298
- *Release Date - 11 November 2020*
299
-
300
- * WooCommerce 4.7.x compatibility
301
-
302
- = 1.21.12 =
303
- *Release Date - 16 October 2020*
304
-
305
- * Fixed security issue related to import/export plugin settings.
306
-
307
- = 1.21.11 =
308
- *Release Date - 7 October 2020*
309
-
310
- * WooCommerce 4.6.x compatibility
311
- * Added `woocommerce_return_to_shop_text` filter introduced in WooCommerce 4.6.0
312
- * Fixed issue with add to wishlist button incorrect response for WPML additional languages
313
-
314
- = 1.21.10 =
315
- *Release Date - 2 October 2020*
316
-
317
- * Fixed WPML additional languages issue with wishlist products
318
- * Updated integration for [Advanced Product Fields (Product Options) for WooCommerce](https://wordpress.org/plugins/advanced-product-fields-for-woocommerce/) plugin
319
-
320
- = 1.21.9 =
321
- *Release Date - 29 September 2020*
322
-
323
- * Fixed integration with [WooCommerce Custom Product Addons](https://wordpress.org/plugins/woo-custom-product-addons/) plugin
324
-
325
- = 1.21.8 =
326
- *Release Date - 28 September 2020*
327
-
328
- * Fixed an issue with WPML products data
329
-
330
- = 1.21.7 =
331
- *Release Date - 17 September 2020*
332
-
333
- * WooCommerce 4.5.x compatibility
334
- * Fixed empty wishlist issue after adding a product to cart from paginated page
335
- * Fixed wishlist products counter widget issue with Avada builder
336
- * Fixed wishlist products counter issue with quantity
337
-
338
- = 1.21.6 =
339
- *Release Date - 8 September 2020*
340
-
341
- * Added integration with [Check Pincode/Zipcode for Shipping Woocommerce](https://wordpress.org/plugins/check-pincodezipcode-for-shipping-woocommerce/) plugin
342
- * Added integration for [WPC Variations Radio Buttons for WooCommerce](https://wordpress.org/plugins/wpc-variations-radio-buttons/) plugin
343
- * Updated integration with [WooCommerce Multilingual](https://wordpress.org/plugins/woocommerce-multilingual/) plugin
344
- * Fixed attributes display for variation on wishlist table
345
- * Fixed translation for template strings
346
-
347
- = 1.21.5 =
348
- *Release Date - 4 September 2020*
349
-
350
- * Fixed HTML markup validation for integration with [WPC Product Bundles for WooCommerce](https://wordpress.org/plugins/woo-product-bundle/) plugin
351
- * Use wp_kses_post instead of esc_html for sanitizing template strings to allow minimal HTML
352
-
353
- = 1.21.4 =
354
- *Release Date - 2 September 2020*
355
-
356
- * Fixed issue with custom AJAX endpoint loading
357
- * Updated integration with [WPC Product Bundles for WooCommerce](https://wordpress.org/plugins/woo-product-bundle/) plugin
358
- * Updated integration with [WP Fastest Cache](https://wordpress.org/plugins/wp-fastest-cache/) plugin
359
-
360
- = 1.21.3 =
361
- *Release Date - 26 August 2020*
362
-
363
- * Fixed issue for Flywheel Cloud sites
364
- * Fixed price value for variable parent product in wishlist
365
- * Fixed PHP error for variable products on add to wishlist event
366
-
367
- = 1.21.2 =
368
- *Release Date - 24 August 2020*
369
-
370
- * Added compatibility with WooCommerce 4.4.x
371
- * Fixed critical issue when WPML deleted all products from other languages for current wishlist
372
- * Added empty option for products counter menu multi-select form element
373
- * Fixed product name in messages for variable products
374
- * Fixed issue with [Enable jQuery Migrate Helper](https://wordpress.org/plugins/enable-jquery-migrate-helper/) plugin
375
- * Fixed integration with [WooCommerce Composite Products](https://woocommerce.com/products/composite-products/?aff=3955) plugin
376
- * Fixed integration with [Advanced Product Fields (Product Options) for WooCommerce](https://wordpress.org/plugins/advanced-product-fields-for-woocommerce/) plugin
377
-
378
- = 1.21.1 =
379
- *Release Date - 12 August 2020*
380
-
381
- * WordPress 5.5.x support
382
- * Added compatibility with WooCommerce 4.3.x
383
- * Added argument to register_rest_route method required from WordPress 5.5.0
384
- * Fixed an issue with "Hide Zero Value" feature for wishlist products counter
385
- * Fixed an issue with variable product status update when "Remove product from wishlist on second click" feature is enabled
386
-
387
- = 1.21.0 =
388
- *Release Date - 30 July 2020*
389
-
390
- * Wishlist user-side data completely refactored
391
- * Great performance improvements
392
- * Fixed integration with [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/?aff=3955) plugin
393
-
394
  [See the changelog for all versions](https://templateinvaders.com/changelogs/ti-woocommerce-wishlist-plugin-free-changelog/?utm_source=wordpressorg&utm_content=changelog).
395
 
396
  == Upgrade Notice ==
397
 
398
- = 1.21.12 =
399
- URGENT UPDATE! Fixed zero day vulnerability issue related to export/import plugin settings.
3
  Tags: woocommerce, wishlist, woocommerce wishlist, e-commerce, ecommerce
4
  Requires at least: 4.7
5
  Tested up to: 5.7
6
+ Stable tag: 1.24.5
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
  Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
163
 
164
 
165
  == Changelog ==
166
+ = 1.24.5 =
167
+ *Release Date - 30 March 2021*
168
+
169
+ * Fixed FOIT for the custom icon webfont
170
+ * Security tweak
171
+ * Forced uppercase removed from a wishlist unique share key
172
+ * Updated integration with WooCommerce TM Extra Product Options plugin
173
+ * Updated integration with [Product Options and Price Calculation Formulas for WooCommerce – Uni CPO](https://wordpress.org/plugins/uni-woo-custom-product-options/) plugin
174
+
175
  = 1.24.4 =
176
  *Release Date - 25 March 2021*
177
 
281
  * Updated integration with Flatsome theme
282
  * Updated integration with [WooCommerce Product Add-ons](https://woocommerce.com/products/product-add-ons/?aff=3955) plugin
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  [See the changelog for all versions](https://templateinvaders.com/changelogs/ti-woocommerce-wishlist-plugin-free-changelog/?utm_source=wordpressorg&utm_content=changelog).
285
 
286
  == Upgrade Notice ==
287
 
288
+ = 1.24.5 =
289
+ URGENT UPDATE! Fixed zero day cross site scripting vulnerability.
templates/ti-wishlist-user.php CHANGED
@@ -4,55 +4,55 @@
4
  *
5
  * This template can be overridden by copying it to yourtheme/woocommerce/ti-wishlist-user.php.
6
  *
7
- * @version 1.21.5
8
  * @package TInvWishlist\Template
9
  */
10
 
11
- if ( ! defined( 'ABSPATH' ) ) {
12
  exit; // Exit if accessed directly.
13
  }
14
- wp_enqueue_script( 'tinvwl' );
15
  ?>
16
  <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
17
- <?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
18
- <?php if ( function_exists( 'wc_print_notices' ) && isset( WC()->session ) ) {
19
  wc_print_notices();
20
  } ?>
21
  <?php
22
- $wl_paged = get_query_var( 'wl_paged' );
23
- $form_url = tinv_url_wishlist( $wishlist['share_key'], $wl_paged, true );
24
  ?>
25
- <form action="<?php echo esc_url( $form_url ); ?>" method="post" autocomplete="off">
26
- <?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
27
  <table class="tinvwl-table-manage-list">
28
  <thead>
29
  <tr>
30
- <?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
31
  <th class="product-cb"><input type="checkbox" class="global-cb"
32
- title="<?php _e( 'Select all for bulk action', 'ti-woocommerce-wishlist' ) ?>">
33
  </th>
34
  <?php } ?>
35
  <th class="product-thumbnail">&nbsp;</th>
36
  <th class="product-name"><span
37
- class="tinvwl-full"><?php esc_html_e( 'Product Name', 'ti-woocommerce-wishlist' ); ?></span><span
38
- class="tinvwl-mobile"><?php esc_html_e( 'Product', 'ti-woocommerce-wishlist' ); ?></span>
39
  </th>
40
- <?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
41
- <th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
42
  <?php } ?>
43
- <?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
44
- <th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
45
  <?php } ?>
46
- <?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
47
- <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
48
  <?php } ?>
49
- <?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
50
  <th class="product-action">&nbsp;</th>
51
  <?php } ?>
52
  </tr>
53
  </thead>
54
  <tbody>
55
- <?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
56
 
57
  <?php
58
 
@@ -62,112 +62,112 @@ wp_enqueue_script( 'tinvwl' );
62
  // store global post data.
63
  $_post_tmp = $post;
64
 
65
- foreach ( $products as $wl_product ) {
66
 
67
- if ( empty( $wl_product['data'] ) ) {
68
  continue;
69
  }
70
 
71
  // override global product data.
72
- $product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
73
  // override global post data.
74
- $post = get_post( $product->get_id() );
75
 
76
- unset( $wl_product['data'] );
77
- if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
78
- $product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
79
- do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
80
  ?>
81
- <tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
82
- <?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
83
  <td class="product-cb">
84
  <?php
85
- echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
86
- '<input type="checkbox" name="wishlist_pr[]" value="%d" title="%s">', esc_attr( $wl_product['ID'] ), __( 'Select for bulk action', 'ti-woocommerce-wishlist' )
87
- ), $wl_product, $product );
88
  ?>
89
  </td>
90
  <?php } ?>
91
  <td class="product-thumbnail">
92
  <?php
93
- $thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
94
 
95
- if ( ! $product->is_visible() ) {
96
  echo $thumbnail; // WPCS: xss ok.
97
  } else {
98
- printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
99
  }
100
  ?>
101
  </td>
102
  <td class="product-name">
103
  <?php
104
- if ( ! $product->is_visible() ) {
105
- echo apply_filters( 'tinvwl_wishlist_item_name', is_callable( array(
106
  $product,
107
  'get_name'
108
- ) ) ? $product->get_name() : $product->get_title(), $wl_product, $product ) . '&nbsp;'; // WPCS: xss ok.
109
  } else {
110
- echo apply_filters( 'tinvwl_wishlist_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_url ), is_callable( array(
111
  $product,
112
  'get_name'
113
- ) ) ? $product->get_name() : $product->get_title() ), $wl_product, $product ); // WPCS: xss ok.
114
  }
115
 
116
- echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
117
  ?>
118
  </td>
119
- <?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
120
  <td class="product-price">
121
  <?php
122
- echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
123
  ?>
124
  </td>
125
  <?php } ?>
126
- <?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
127
  <td class="product-date">
128
  <?php
129
- echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
130
- '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
131
- ), $wl_product, $product );
132
  ?>
133
  </td>
134
  <?php } ?>
135
- <?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
136
  <td class="product-stock">
137
  <?php
138
- $availability = (array) $product->get_availability();
139
- if ( ! array_key_exists( 'availability', $availability ) ) {
140
  $availability['availability'] = '';
141
  }
142
- if ( ! array_key_exists( 'class', $availability ) ) {
143
  $availability['class'] = '';
144
  }
145
- $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-' . ( ( 'out-of-stock' === esc_attr( $availability['class'] ) ? 'times' : 'check' ) ) . '"></i></span><span>' . wp_kses_post( $availability['availability'] ) . '</span></p>';
146
 
147
- echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
148
  ?>
149
  </td>
150
  <?php } ?>
151
- <?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
152
  <td class="product-action">
153
  <?php
154
- if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
155
  ?>
156
  <button class="button alt" name="tinvwl-add-to-cart"
157
- value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
158
- title="<?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product ) ); ?>">
159
  <i
160
  class="ftinvwl ftinvwl-shopping-cart"></i><span
161
- class="tinvwl-txt"><?php echo wp_kses_post( apply_filters( 'tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product ) ); ?></span>
162
  </button>
163
- <?php } elseif ( apply_filters( 'tinvwl_wishlist_item_action_default_loop_button', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
164
  woocommerce_template_loop_add_to_cart();
165
  } ?>
166
  </td>
167
  <?php } ?>
168
  </tr>
169
  <?php
170
- do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
171
  } // End if().
172
  } // End foreach().
173
  // restore global product data.
@@ -175,20 +175,20 @@ wp_enqueue_script( 'tinvwl' );
175
  // restore global post data.
176
  $post = $_post_tmp;
177
  ?>
178
- <?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
179
  </tbody>
180
  <tfoot>
181
  <tr>
182
  <td colspan="100">
183
- <?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
184
- <?php wp_nonce_field( 'tinvwl_wishlist_user', 'wishlist_nonce' ); ?>
185
  </td>
186
  </tr>
187
  </tfoot>
188
  </table>
189
  </form>
190
- <?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
191
  <div class="tinv-lists-nav tinv-wishlist-clear">
192
- <?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
193
  </div>
194
  </div>
4
  *
5
  * This template can be overridden by copying it to yourtheme/woocommerce/ti-wishlist-user.php.
6
  *
7
+ * @version 1.24.5
8
  * @package TInvWishlist\Template
9
  */
10
 
11
+ if (!defined('ABSPATH')) {
12
  exit; // Exit if accessed directly.
13
  }
14
+ wp_enqueue_script('tinvwl');
15
  ?>
16
  <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
17
+ <?php do_action('tinvwl_before_wishlist', $wishlist); ?>
18
+ <?php if (function_exists('wc_print_notices') && isset(WC()->session)) {
19
  wc_print_notices();
20
  } ?>
21
  <?php
22
+ $wl_paged = absint(get_query_var('wl_paged'));
23
+ $form_url = tinv_url_wishlist($wishlist['share_key'], $wl_paged, true);
24
  ?>
25
+ <form action="<?php echo esc_url($form_url); ?>" method="post" autocomplete="off">
26
+ <?php do_action('tinvwl_before_wishlist_table', $wishlist); ?>
27
  <table class="tinvwl-table-manage-list">
28
  <thead>
29
  <tr>
30
+ <?php if (isset($wishlist_table['colm_checkbox']) && $wishlist_table['colm_checkbox']) { ?>
31
  <th class="product-cb"><input type="checkbox" class="global-cb"
32
+ title="<?php _e('Select all for bulk action', 'ti-woocommerce-wishlist') ?>">
33
  </th>
34
  <?php } ?>
35
  <th class="product-thumbnail">&nbsp;</th>
36
  <th class="product-name"><span
37
+ class="tinvwl-full"><?php esc_html_e('Product Name', 'ti-woocommerce-wishlist'); ?></span><span
38
+ class="tinvwl-mobile"><?php esc_html_e('Product', 'ti-woocommerce-wishlist'); ?></span>
39
  </th>
40
+ <?php if (isset($wishlist_table_row['colm_price']) && $wishlist_table_row['colm_price']) { ?>
41
+ <th class="product-price"><?php esc_html_e('Unit Price', 'ti-woocommerce-wishlist'); ?></th>
42
  <?php } ?>
43
+ <?php if (isset($wishlist_table_row['colm_date']) && $wishlist_table_row['colm_date']) { ?>
44
+ <th class="product-date"><?php esc_html_e('Date Added', 'ti-woocommerce-wishlist'); ?></th>
45
  <?php } ?>
46
+ <?php if (isset($wishlist_table_row['colm_stock']) && $wishlist_table_row['colm_stock']) { ?>
47
+ <th class="product-stock"><?php esc_html_e('Stock Status', 'ti-woocommerce-wishlist'); ?></th>
48
  <?php } ?>
49
+ <?php if (isset($wishlist_table_row['add_to_cart']) && $wishlist_table_row['add_to_cart']) { ?>
50
  <th class="product-action">&nbsp;</th>
51
  <?php } ?>
52
  </tr>
53
  </thead>
54
  <tbody>
55
+ <?php do_action('tinvwl_wishlist_contents_before'); ?>
56
 
57
  <?php
58
 
62
  // store global post data.
63
  $_post_tmp = $post;
64
 
65
+ foreach ($products as $wl_product) {
66
 
67
+ if (empty($wl_product['data'])) {
68
  continue;
69
  }
70
 
71
  // override global product data.
72
+ $product = apply_filters('tinvwl_wishlist_item', $wl_product['data']);
73
  // override global post data.
74
+ $post = get_post($product->get_id());
75
 
76
+ unset($wl_product['data']);
77
+ if ($wl_product['quantity'] > 0 && apply_filters('tinvwl_wishlist_item_visible', true, $wl_product, $product)) {
78
+ $product_url = apply_filters('tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product);
79
+ do_action('tinvwl_wishlist_row_before', $wl_product, $product);
80
  ?>
81
+ <tr class="<?php echo esc_attr(apply_filters('tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product)); ?>">
82
+ <?php if (isset($wishlist_table['colm_checkbox']) && $wishlist_table['colm_checkbox']) { ?>
83
  <td class="product-cb">
84
  <?php
85
+ echo apply_filters('tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
86
+ '<input type="checkbox" name="wishlist_pr[]" value="%d" title="%s">', esc_attr($wl_product['ID']), __('Select for bulk action', 'ti-woocommerce-wishlist')
87
+ ), $wl_product, $product);
88
  ?>
89
  </td>
90
  <?php } ?>
91
  <td class="product-thumbnail">
92
  <?php
93
+ $thumbnail = apply_filters('tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product);
94
 
95
+ if (!$product->is_visible()) {
96
  echo $thumbnail; // WPCS: xss ok.
97
  } else {
98
+ printf('<a href="%s">%s</a>', esc_url($product_url), $thumbnail); // WPCS: xss ok.
99
  }
100
  ?>
101
  </td>
102
  <td class="product-name">
103
  <?php
104
+ if (!$product->is_visible()) {
105
+ echo apply_filters('tinvwl_wishlist_item_name', is_callable(array(
106
  $product,
107
  'get_name'
108
+ )) ? $product->get_name() : $product->get_title(), $wl_product, $product) . '&nbsp;'; // WPCS: xss ok.
109
  } else {
110
+ echo apply_filters('tinvwl_wishlist_item_name', sprintf('<a href="%s">%s</a>', esc_url($product_url), is_callable(array(
111
  $product,
112
  'get_name'
113
+ )) ? $product->get_name() : $product->get_title()), $wl_product, $product); // WPCS: xss ok.
114
  }
115
 
116
+ echo apply_filters('tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data($product, $wl_product), $wl_product, $product); // WPCS: xss ok.
117
  ?>
118
  </td>
119
+ <?php if (isset($wishlist_table_row['colm_price']) && $wishlist_table_row['colm_price']) { ?>
120
  <td class="product-price">
121
  <?php
122
+ echo apply_filters('tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product); // WPCS: xss ok.
123
  ?>
124
  </td>
125
  <?php } ?>
126
+ <?php if (isset($wishlist_table_row['colm_date']) && $wishlist_table_row['colm_date']) { ?>
127
  <td class="product-date">
128
  <?php
129
+ echo apply_filters('tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
130
+ '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date(get_option('date_format'), $wl_product['date'])
131
+ ), $wl_product, $product);
132
  ?>
133
  </td>
134
  <?php } ?>
135
+ <?php if (isset($wishlist_table_row['colm_stock']) && $wishlist_table_row['colm_stock']) { ?>
136
  <td class="product-stock">
137
  <?php
138
+ $availability = (array)$product->get_availability();
139
+ if (!array_key_exists('availability', $availability)) {
140
  $availability['availability'] = '';
141
  }
142
+ if (!array_key_exists('class', $availability)) {
143
  $availability['class'] = '';
144
  }
145
+ $availability_html = empty($availability['availability']) ? '<p class="stock ' . esc_attr($availability['class']) . '"><span><i class="ftinvwl ftinvwl-check"></i></span><span class="tinvwl-txt">' . esc_html__('In stock', 'ti-woocommerce-wishlist') . '</span></p>' : '<p class="stock ' . esc_attr($availability['class']) . '"><span><i class="ftinvwl ftinvwl-' . (('out-of-stock' === esc_attr($availability['class']) ? 'times' : 'check')) . '"></i></span><span>' . wp_kses_post($availability['availability']) . '</span></p>';
146
 
147
+ echo apply_filters('tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product); // WPCS: xss ok.
148
  ?>
149
  </td>
150
  <?php } ?>
151
+ <?php if (isset($wishlist_table_row['add_to_cart']) && $wishlist_table_row['add_to_cart']) { ?>
152
  <td class="product-action">
153
  <?php
154
+ if (apply_filters('tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product)) {
155
  ?>
156
  <button class="button alt" name="tinvwl-add-to-cart"
157
+ value="<?php echo esc_attr($wl_product['ID']); ?>"
158
+ title="<?php echo esc_html(apply_filters('tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product)); ?>">
159
  <i
160
  class="ftinvwl ftinvwl-shopping-cart"></i><span
161
+ class="tinvwl-txt"><?php echo wp_kses_post(apply_filters('tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product)); ?></span>
162
  </button>
163
+ <?php } elseif (apply_filters('tinvwl_wishlist_item_action_default_loop_button', $wishlist_table_row['add_to_cart'], $wl_product, $product)) {
164
  woocommerce_template_loop_add_to_cart();
165
  } ?>
166
  </td>
167
  <?php } ?>
168
  </tr>
169
  <?php
170
+ do_action('tinvwl_wishlist_row_after', $wl_product, $product);
171
  } // End if().
172
  } // End foreach().
173
  // restore global product data.
175
  // restore global post data.
176
  $post = $_post_tmp;
177
  ?>
178
+ <?php do_action('tinvwl_wishlist_contents_after'); ?>
179
  </tbody>
180
  <tfoot>
181
  <tr>
182
  <td colspan="100">
183
+ <?php do_action('tinvwl_after_wishlist_table', $wishlist); ?>
184
+ <?php wp_nonce_field('tinvwl_wishlist_user', 'wishlist_nonce'); ?>
185
  </td>
186
  </tr>
187
  </tfoot>
188
  </table>
189
  </form>
190
+ <?php do_action('tinvwl_after_wishlist', $wishlist); ?>
191
  <div class="tinv-lists-nav tinv-wishlist-clear">
192
+ <?php do_action('tinvwl_pagenation_wishlist', $wishlist); ?>
193
  </div>
194
  </div>
templates/ti-wishlist.php CHANGED
@@ -4,56 +4,56 @@
4
  *
5
  * This template can be overridden by copying it to yourtheme/woocommerce/ti-wishlist.php.
6
  *
7
- * @version 1.21.5
8
  * @package TInvWishlist\Template
9
  */
10
 
11
- if ( ! defined( 'ABSPATH' ) ) {
12
  exit; // Exit if accessed directly.
13
  }
14
- wp_enqueue_script( 'tinvwl' );
15
  ?>
16
  <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
17
- <?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
18
- <?php if ( function_exists( 'wc_print_notices' ) && isset( WC()->session ) ) {
19
  wc_print_notices();
20
  } ?>
21
  <?php
22
- $wl_paged = get_query_var( 'wl_paged' );
23
- $form_url = tinv_url_wishlist( $wishlist['share_key'], $wl_paged, true );
24
  ?>
25
- <form action="<?php echo esc_url( $form_url ); ?>" method="post" autocomplete="off">
26
- <?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
27
  <table class="tinvwl-table-manage-list">
28
  <thead>
29
  <tr>
30
- <?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
31
  <th class="product-cb"><input type="checkbox" class="global-cb"
32
- title="<?php _e( 'Select all for bulk action', 'ti-woocommerce-wishlist' ) ?>">
33
  </th>
34
  <?php } ?>
35
  <th class="product-remove"></th>
36
  <th class="product-thumbnail">&nbsp;</th>
37
  <th class="product-name"><span
38
- class="tinvwl-full"><?php esc_html_e( 'Product Name', 'ti-woocommerce-wishlist' ); ?></span><span
39
- class="tinvwl-mobile"><?php esc_html_e( 'Product', 'ti-woocommerce-wishlist' ); ?></span>
40
  </th>
41
- <?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
42
- <th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
43
  <?php } ?>
44
- <?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
45
- <th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
46
  <?php } ?>
47
- <?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
48
- <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
49
  <?php } ?>
50
- <?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
51
  <th class="product-action">&nbsp;</th>
52
  <?php } ?>
53
  </tr>
54
  </thead>
55
  <tbody>
56
- <?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
57
 
58
  <?php
59
 
@@ -63,119 +63,119 @@ wp_enqueue_script( 'tinvwl' );
63
  // store global post data.
64
  $_post_tmp = $post;
65
 
66
- foreach ( $products as $wl_product ) {
67
 
68
- if ( empty( $wl_product['data'] ) ) {
69
  continue;
70
  }
71
 
72
  // override global product data.
73
- $product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
74
  // override global post data.
75
- $post = get_post( $product->get_id() );
76
 
77
- unset( $wl_product['data'] );
78
- if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
79
- $product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
80
- do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
81
  ?>
82
- <tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
83
- <?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
84
  <td class="product-cb">
85
  <?php
86
- echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
87
- '<input type="checkbox" name="wishlist_pr[]" value="%d" title="%s">', esc_attr( $wl_product['ID'] ), __( 'Select for bulk action', 'ti-woocommerce-wishlist' )
88
- ), $wl_product, $product );
89
  ?>
90
  </td>
91
  <?php } ?>
92
  <td class="product-remove">
93
  <button type="submit" name="tinvwl-remove"
94
- value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
95
- title="<?php _e( 'Remove', 'ti-woocommerce-wishlist' ) ?>"><i
96
  class="ftinvwl ftinvwl-times"></i>
97
  </button>
98
  </td>
99
  <td class="product-thumbnail">
100
  <?php
101
- $thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
102
 
103
- if ( ! $product->is_visible() ) {
104
  echo $thumbnail; // WPCS: xss ok.
105
  } else {
106
- printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
107
  }
108
  ?>
109
  </td>
110
  <td class="product-name">
111
  <?php
112
- if ( ! $product->is_visible() ) {
113
- echo apply_filters( 'tinvwl_wishlist_item_name', is_callable( array(
114
  $product,
115
  'get_name'
116
- ) ) ? $product->get_name() : $product->get_title(), $wl_product, $product ) . '&nbsp;'; // WPCS: xss ok.
117
  } else {
118
- echo apply_filters( 'tinvwl_wishlist_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_url ), is_callable( array(
119
  $product,
120
  'get_name'
121
- ) ) ? $product->get_name() : $product->get_title() ), $wl_product, $product ); // WPCS: xss ok.
122
  }
123
 
124
- echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
125
  ?>
126
  </td>
127
- <?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
128
  <td class="product-price">
129
  <?php
130
- echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
131
  ?>
132
  </td>
133
  <?php } ?>
134
- <?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
135
  <td class="product-date">
136
  <?php
137
- echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
138
- '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
139
- ), $wl_product, $product );
140
  ?>
141
  </td>
142
  <?php } ?>
143
- <?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
144
  <td class="product-stock">
145
  <?php
146
- $availability = (array) $product->get_availability();
147
- if ( ! array_key_exists( 'availability', $availability ) ) {
148
  $availability['availability'] = '';
149
  }
150
- if ( ! array_key_exists( 'class', $availability ) ) {
151
  $availability['class'] = '';
152
  }
153
- $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-' . ( ( 'out-of-stock' === esc_attr( $availability['class'] ) ? 'times' : 'check' ) ) . '"></i></span><span>' . wp_kses_post( $availability['availability'] ) . '</span></p>';
154
 
155
- echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
156
  ?>
157
  </td>
158
  <?php } ?>
159
- <?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
160
  <td class="product-action">
161
  <?php
162
- if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
163
  ?>
164
  <button class="button alt" name="tinvwl-add-to-cart"
165
- value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
166
- title="<?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product ) ); ?>">
167
  <i
168
  class="ftinvwl ftinvwl-shopping-cart"></i><span
169
- class="tinvwl-txt"><?php echo wp_kses_post( apply_filters( 'tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product ) ); ?></span>
170
  </button>
171
- <?php } elseif ( apply_filters( 'tinvwl_wishlist_item_action_default_loop_button', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
172
  woocommerce_template_loop_add_to_cart();
173
  } ?>
174
  </td>
175
  <?php } ?>
176
  </tr>
177
  <?php
178
- do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
179
  } // End if().
180
  } // End foreach().
181
  // restore global product data.
@@ -183,20 +183,20 @@ wp_enqueue_script( 'tinvwl' );
183
  // restore global post data.
184
  $post = $_post_tmp;
185
  ?>
186
- <?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
187
  </tbody>
188
  <tfoot>
189
  <tr>
190
  <td colspan="100">
191
- <?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
192
- <?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
193
  </td>
194
  </tr>
195
  </tfoot>
196
  </table>
197
  </form>
198
- <?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
199
  <div class="tinv-lists-nav tinv-wishlist-clear">
200
- <?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
201
  </div>
202
  </div>
4
  *
5
  * This template can be overridden by copying it to yourtheme/woocommerce/ti-wishlist.php.
6
  *
7
+ * @version 1.24.5
8
  * @package TInvWishlist\Template
9
  */
10
 
11
+ if (!defined('ABSPATH')) {
12
  exit; // Exit if accessed directly.
13
  }
14
+ wp_enqueue_script('tinvwl');
15
  ?>
16
  <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
17
+ <?php do_action('tinvwl_before_wishlist', $wishlist); ?>
18
+ <?php if (function_exists('wc_print_notices') && isset(WC()->session)) {
19
  wc_print_notices();
20
  } ?>
21
  <?php
22
+ $wl_paged = absint(get_query_var('wl_paged'));
23
+ $form_url = tinv_url_wishlist($wishlist['share_key'], $wl_paged, true);
24
  ?>
25
+ <form action="<?php echo esc_url($form_url); ?>" method="post" autocomplete="off">
26
+ <?php do_action('tinvwl_before_wishlist_table', $wishlist); ?>
27
  <table class="tinvwl-table-manage-list">
28
  <thead>
29
  <tr>
30
+ <?php if (isset($wishlist_table['colm_checkbox']) && $wishlist_table['colm_checkbox']) { ?>
31
  <th class="product-cb"><input type="checkbox" class="global-cb"
32
+ title="<?php _e('Select all for bulk action', 'ti-woocommerce-wishlist') ?>">
33
  </th>
34
  <?php } ?>
35
  <th class="product-remove"></th>
36
  <th class="product-thumbnail">&nbsp;</th>
37
  <th class="product-name"><span
38
+ class="tinvwl-full"><?php esc_html_e('Product Name', 'ti-woocommerce-wishlist'); ?></span><span
39
+ class="tinvwl-mobile"><?php esc_html_e('Product', 'ti-woocommerce-wishlist'); ?></span>
40
  </th>
41
+ <?php if (isset($wishlist_table_row['colm_price']) && $wishlist_table_row['colm_price']) { ?>
42
+ <th class="product-price"><?php esc_html_e('Unit Price', 'ti-woocommerce-wishlist'); ?></th>
43
  <?php } ?>
44
+ <?php if (isset($wishlist_table_row['colm_date']) && $wishlist_table_row['colm_date']) { ?>
45
+ <th class="product-date"><?php esc_html_e('Date Added', 'ti-woocommerce-wishlist'); ?></th>
46
  <?php } ?>
47
+ <?php if (isset($wishlist_table_row['colm_stock']) && $wishlist_table_row['colm_stock']) { ?>
48
+ <th class="product-stock"><?php esc_html_e('Stock Status', 'ti-woocommerce-wishlist'); ?></th>
49
  <?php } ?>
50
+ <?php if (isset($wishlist_table_row['add_to_cart']) && $wishlist_table_row['add_to_cart']) { ?>
51
  <th class="product-action">&nbsp;</th>
52
  <?php } ?>
53
  </tr>
54
  </thead>
55
  <tbody>
56
+ <?php do_action('tinvwl_wishlist_contents_before'); ?>
57
 
58
  <?php
59
 
63
  // store global post data.
64
  $_post_tmp = $post;
65
 
66
+ foreach ($products as $wl_product) {
67
 
68
+ if (empty($wl_product['data'])) {
69
  continue;
70
  }
71
 
72
  // override global product data.
73
+ $product = apply_filters('tinvwl_wishlist_item', $wl_product['data']);
74
  // override global post data.
75
+ $post = get_post($product->get_id());
76
 
77
+ unset($wl_product['data']);
78
+ if ($wl_product['quantity'] > 0 && apply_filters('tinvwl_wishlist_item_visible', true, $wl_product, $product)) {
79
+ $product_url = apply_filters('tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product);
80
+ do_action('tinvwl_wishlist_row_before', $wl_product, $product);
81
  ?>
82
+ <tr class="<?php echo esc_attr(apply_filters('tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product)); ?>">
83
+ <?php if (isset($wishlist_table['colm_checkbox']) && $wishlist_table['colm_checkbox']) { ?>
84
  <td class="product-cb">
85
  <?php
86
+ echo apply_filters('tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
87
+ '<input type="checkbox" name="wishlist_pr[]" value="%d" title="%s">', esc_attr($wl_product['ID']), __('Select for bulk action', 'ti-woocommerce-wishlist')
88
+ ), $wl_product, $product);
89
  ?>
90
  </td>
91
  <?php } ?>
92
  <td class="product-remove">
93
  <button type="submit" name="tinvwl-remove"
94
+ value="<?php echo esc_attr($wl_product['ID']); ?>"
95
+ title="<?php _e('Remove', 'ti-woocommerce-wishlist') ?>"><i
96
  class="ftinvwl ftinvwl-times"></i>
97
  </button>
98
  </td>
99
  <td class="product-thumbnail">
100
  <?php
101
+ $thumbnail = apply_filters('tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product);
102
 
103
+ if (!$product->is_visible()) {
104
  echo $thumbnail; // WPCS: xss ok.
105
  } else {
106
+ printf('<a href="%s">%s</a>', esc_url($product_url), $thumbnail); // WPCS: xss ok.
107
  }
108
  ?>
109
  </td>
110
  <td class="product-name">
111
  <?php
112
+ if (!$product->is_visible()) {
113
+ echo apply_filters('tinvwl_wishlist_item_name', is_callable(array(
114
  $product,
115
  'get_name'
116
+ )) ? $product->get_name() : $product->get_title(), $wl_product, $product) . '&nbsp;'; // WPCS: xss ok.
117
  } else {
118
+ echo apply_filters('tinvwl_wishlist_item_name', sprintf('<a href="%s">%s</a>', esc_url($product_url), is_callable(array(
119
  $product,
120
  'get_name'
121
+ )) ? $product->get_name() : $product->get_title()), $wl_product, $product); // WPCS: xss ok.
122
  }
123
 
124
+ echo apply_filters('tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data($product, $wl_product), $wl_product, $product); // WPCS: xss ok.
125
  ?>
126
  </td>
127
+ <?php if (isset($wishlist_table_row['colm_price']) && $wishlist_table_row['colm_price']) { ?>
128
  <td class="product-price">
129
  <?php
130
+ echo apply_filters('tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product); // WPCS: xss ok.
131
  ?>
132
  </td>
133
  <?php } ?>
134
+ <?php if (isset($wishlist_table_row['colm_date']) && $wishlist_table_row['colm_date']) { ?>
135
  <td class="product-date">
136
  <?php
137
+ echo apply_filters('tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
138
+ '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date(get_option('date_format'), $wl_product['date'])
139
+ ), $wl_product, $product);
140
  ?>
141
  </td>
142
  <?php } ?>
143
+ <?php if (isset($wishlist_table_row['colm_stock']) && $wishlist_table_row['colm_stock']) { ?>
144
  <td class="product-stock">
145
  <?php
146
+ $availability = (array)$product->get_availability();
147
+ if (!array_key_exists('availability', $availability)) {
148
  $availability['availability'] = '';
149
  }
150
+ if (!array_key_exists('class', $availability)) {
151
  $availability['class'] = '';
152
  }
153
+ $availability_html = empty($availability['availability']) ? '<p class="stock ' . esc_attr($availability['class']) . '"><span><i class="ftinvwl ftinvwl-check"></i></span><span class="tinvwl-txt">' . esc_html__('In stock', 'ti-woocommerce-wishlist') . '</span></p>' : '<p class="stock ' . esc_attr($availability['class']) . '"><span><i class="ftinvwl ftinvwl-' . (('out-of-stock' === esc_attr($availability['class']) ? 'times' : 'check')) . '"></i></span><span>' . wp_kses_post($availability['availability']) . '</span></p>';
154
 
155
+ echo apply_filters('tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product); // WPCS: xss ok.
156
  ?>
157
  </td>
158
  <?php } ?>
159
+ <?php if (isset($wishlist_table_row['add_to_cart']) && $wishlist_table_row['add_to_cart']) { ?>
160
  <td class="product-action">
161
  <?php
162
+ if (apply_filters('tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product)) {
163
  ?>
164
  <button class="button alt" name="tinvwl-add-to-cart"
165
+ value="<?php echo esc_attr($wl_product['ID']); ?>"
166
+ title="<?php echo esc_html(apply_filters('tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product)); ?>">
167
  <i
168
  class="ftinvwl ftinvwl-shopping-cart"></i><span
169
+ class="tinvwl-txt"><?php echo wp_kses_post(apply_filters('tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product)); ?></span>
170
  </button>
171
+ <?php } elseif (apply_filters('tinvwl_wishlist_item_action_default_loop_button', $wishlist_table_row['add_to_cart'], $wl_product, $product)) {
172
  woocommerce_template_loop_add_to_cart();
173
  } ?>
174
  </td>
175
  <?php } ?>
176
  </tr>
177
  <?php
178
+ do_action('tinvwl_wishlist_row_after', $wl_product, $product);
179
  } // End if().
180
  } // End foreach().
181
  // restore global product data.
183
  // restore global post data.
184
  $post = $_post_tmp;
185
  ?>
186
+ <?php do_action('tinvwl_wishlist_contents_after'); ?>
187
  </tbody>
188
  <tfoot>
189
  <tr>
190
  <td colspan="100">
191
+ <?php do_action('tinvwl_after_wishlist_table', $wishlist); ?>
192
+ <?php wp_nonce_field('tinvwl_wishlist_owner', 'wishlist_nonce'); ?>
193
  </td>
194
  </tr>
195
  </tfoot>
196
  </table>
197
  </form>
198
+ <?php do_action('tinvwl_after_wishlist', $wishlist); ?>
199
  <div class="tinv-lists-nav tinv-wishlist-clear">
200
+ <?php do_action('tinvwl_pagenation_wishlist', $wishlist); ?>
201
  </div>
202
  </div>
ti-woocommerce-wishlist.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: TI WooCommerce Wishlist
5
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
  * Description: Wishlist functionality for your WooCommerce store.
7
- * Version: 1.24.4
8
  * Requires at least: 4.7
9
  * Tested up to: 5.7
10
  * WC requires at least: 3.0
@@ -41,7 +41,7 @@ if (!defined('TINVWL_DOMAIN')) {
41
  }
42
 
43
  if (!defined('TINVWL_FVERSION')) {
44
- define('TINVWL_FVERSION', '1.24.4');
45
  }
46
 
47
  if (!defined('TINVWL_LOAD_FREE')) {
4
  * Plugin Name: TI WooCommerce Wishlist
5
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
  * Description: Wishlist functionality for your WooCommerce store.
7
+ * Version: 1.24.5
8
  * Requires at least: 4.7
9
  * Tested up to: 5.7
10
  * WC requires at least: 3.0
41
  }
42
 
43
  if (!defined('TINVWL_FVERSION')) {
44
+ define('TINVWL_FVERSION', '1.24.5');
45
  }
46
 
47
  if (!defined('TINVWL_LOAD_FREE')) {