Version Description
Download this release
Release Info
Developer | templateinvaders |
Plugin | WooCommerce Wishlist Plugin |
Version | 1.28.3 |
Comparing to | |
See all releases |
Code changes from version 1.28.2 to 1.28.3
- assets/css/admin-form-rtl.min.css +1 -1
- assets/css/admin-form.min.css +1 -1
- assets/css/admin-rtl.min.css +1 -1
- assets/css/admin-setup-rtl.min.css +1 -1
- assets/css/admin-setup.min.css +1 -1
- assets/css/admin.min.css +1 -1
- assets/css/public-rtl.min.css +1 -1
- assets/css/public.min.css +1 -1
- assets/css/theme-rtl.min.css +1 -1
- assets/css/theme.min.css +1 -1
- assets/css/webfont-rtl.min.css +1 -1
- assets/css/webfont.min.css +1 -1
- assets/js/admin.min.js +1 -1
- assets/js/public.min.js +1 -1
- includes/tinvwl.class.php +0 -63
- languages/ti-woocommerce-wishlist.pot +6 -6
- public/tinvwl.class.php +2 -2
- readme.txt +7 -1
- ti-woocommerce-wishlist.php +2 -2
- tinv-wishlists-function.php +1020 -921
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.28.
|
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.28.3
|
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.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.28.
|
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}
|
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.28.3
|
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}
|
assets/css/webfont.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.28.
|
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}
|
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.28.3
|
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}
|
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.28.
|
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")})}),s(document).on("click",".tinvwl-chat-notice .notice-dismiss",function(t){s.post(tinvwl_comfirm.ajax_url,{action:"tinvwl_admin_chat_notice"})})}(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.28.3
|
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")})}),s(document).on("click",".tinvwl-chat-notice .notice-dismiss",function(t){s.post(tinvwl_comfirm.ajax_url,{action:"tinvwl_admin_chat_notice"})})}(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.28.
|
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):a.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=a.onPrepareList.call(t)||t,t=a.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(a.text_already_in+" ").append(n))},onAction:{redirect:function(t){a.redirectTimer&&clearTimeout(a.redirectTimer),a.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,n,o,e=c(t).eq(0);c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c("body > .tinv-wishlist").append(e),i=c("body > .tinv-wishlist").find("select, input, textarea, button, a").filter(":visible"),n=i.first(),o=i.last(),n.focus().blur(),o.on("keydown",function(t){9!==t.which||t.shiftKey||(t.preventDefault(),n.focus())}),n.on("keydown",function(t){9===t.which&&t.shiftKey&&(t.preventDefault(),o.focus())}),e.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),e.remove(),a.redirectTimer&&clearTimeout(a.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=a.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:a.api_url,method:"POST",contentType:!1,processData:!1,data:d}).done(function(t){if(a.onDialogHide.call(n.tinvwl_dialog,n),"object"===_typeof(t))for(var i in t)"function"==typeof a.onAction[i]&&a.onAction[i].call(n,t[i]);else"function"==typeof a.onAction.msg&&a.onAction.msg.call(n,t)})};var a=c.extend(!0,{},i,t);return c(this).each(function(){if(!c(this).attr("data-tinv-wl-list"))return!1;if(a.dialogbox&&a.dialogbox.length&&(this.tinvwl_dialog=a.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=a.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=c(this).nextAll(a.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){a.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=c(this).find(a.class.select).eq(0);c(this).find(a.class.newtitle).hide().val(""),n.html(""),c.each(t,function(t,i){a.onCreateWishList.call(n,i)}),a.text_create&&a.onCreateWishList.call(n,{ID:"",title:a.text_create,in:!1}),a.onMultiProductAlreadyIn.call(n,t),a.onSelectWishList.call(n,t),c(this).find(a.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=a.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),a.onDialogShow.call(this.tinvwl_dialog,this)):a.onActionProduct.call(this)});var o=this;c(this.tinvwl_dialog).find(a.class.dialogbutton).off("click").on("click",function(){var t,i=c(o.tinvwl_dialog).find(a.class.select),n=c(o.tinvwl_dialog).find(a.class.newtitle);i.val()||n.val()?a.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",a.onClick),a.onInited.call(this,a)})},c(document).ready(function(){c("body").on("click keydown",".tinvwl_add_to_wishlist_button",function(t){if("keydown"===t.type){var i=void 0!==t.key?t.key:t.keyCode;if(!("Enter"===i||13===i||0<=["Spacebar"," "].indexOf(i)||32===i))return;t.preventDefault()}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){var i=[];void 0!==o(this).attr("tinvwl_break_submit")&&(i=o(this).attr("tinvwl_break_submit").split(",")),-1!==jQuery.inArray(n.selector,i)&&(i=[]),n.rule.call(o(this))||0!==i.length||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault()),i.push(n.selector),o(this).attr("tinvwl_break_submit",i),n.rule.call(o(this))&&o(this).removeAttr("tinvwl_break_submit")})})},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.28.3
|
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):a.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=a.onPrepareList.call(t)||t,t=a.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(a.text_already_in+" ").append(n))},onAction:{redirect:function(t){a.redirectTimer&&clearTimeout(a.redirectTimer),a.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,n,o,e=c(t).eq(0);c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c("body > .tinv-wishlist").append(e),i=c("body > .tinv-wishlist").find("select, input, textarea, button, a").filter(":visible"),n=i.first(),o=i.last(),n.focus().blur(),o.on("keydown",function(t){9!==t.which||t.shiftKey||(t.preventDefault(),n.focus())}),n.on("keydown",function(t){9===t.which&&t.shiftKey&&(t.preventDefault(),o.focus())}),e.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),e.remove(),a.redirectTimer&&clearTimeout(a.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=a.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:a.api_url,method:"POST",contentType:!1,processData:!1,data:d}).done(function(t){if(a.onDialogHide.call(n.tinvwl_dialog,n),"object"===_typeof(t))for(var i in t)"function"==typeof a.onAction[i]&&a.onAction[i].call(n,t[i]);else"function"==typeof a.onAction.msg&&a.onAction.msg.call(n,t)})};var a=c.extend(!0,{},i,t);return c(this).each(function(){if(!c(this).attr("data-tinv-wl-list"))return!1;if(a.dialogbox&&a.dialogbox.length&&(this.tinvwl_dialog=a.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=a.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=c(this).nextAll(a.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){a.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=c(this).find(a.class.select).eq(0);c(this).find(a.class.newtitle).hide().val(""),n.html(""),c.each(t,function(t,i){a.onCreateWishList.call(n,i)}),a.text_create&&a.onCreateWishList.call(n,{ID:"",title:a.text_create,in:!1}),a.onMultiProductAlreadyIn.call(n,t),a.onSelectWishList.call(n,t),c(this).find(a.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=a.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),a.onDialogShow.call(this.tinvwl_dialog,this)):a.onActionProduct.call(this)});var o=this;c(this.tinvwl_dialog).find(a.class.dialogbutton).off("click").on("click",function(){var t,i=c(o.tinvwl_dialog).find(a.class.select),n=c(o.tinvwl_dialog).find(a.class.newtitle);i.val()||n.val()?a.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",a.onClick),a.onInited.call(this,a)})},c(document).ready(function(){c("body").on("click keydown",".tinvwl_add_to_wishlist_button",function(t){if("keydown"===t.type){var i=void 0!==t.key?t.key:t.keyCode;if(!("Enter"===i||13===i||0<=["Spacebar"," "].indexOf(i)||32===i))return;t.preventDefault()}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){var i=[];void 0!==o(this).attr("tinvwl_break_submit")&&(i=o(this).attr("tinvwl_break_submit").split(",")),-1!==jQuery.inArray(n.selector,i)&&(i=[]),n.rule.call(o(this))||0!==i.length||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault()),i.push(n.selector),o(this).attr("tinvwl_break_submit",i),n.rule.call(o(this))&&o(this).removeAttr("tinvwl_break_submit")})})},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/tinvwl.class.php
CHANGED
@@ -78,8 +78,6 @@ class TInvWL
|
|
78 |
Â
TInvWL_Activator::activate();
|
79 |
Â
}
|
80 |
Â
|
81 |
-
$this->rename();
|
82 |
-
|
83 |
Â
TInvWL_View::_init($this->_name, $this->_version);
|
84 |
Â
TInvWL_Form::_init($this->_name);
|
85 |
Â
|
@@ -99,67 +97,6 @@ class TInvWL
|
|
99 |
Â
$this->rest_api = TInvWL_API::init();
|
100 |
Â
}
|
101 |
Â
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Rename "wishlist" word across the plugin.
|
105 |
-
*/
|
106 |
-
private function rename()
|
107 |
-
{
|
108 |
-
$this->rename = tinv_get_option('rename', 'rename');
|
109 |
-
$this->rename_single = tinv_get_option('rename', 'rename_single');
|
110 |
-
$this->rename_plural = tinv_get_option('rename', 'rename_plural');
|
111 |
-
|
112 |
-
if ($this->rename && $this->rename_single) {
|
113 |
-
add_filter('gettext', array($this, 'translations'), 999, 3);
|
114 |
-
add_filter('ngettext', array($this, 'translations_n'), 999, 5);
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
|
119 |
-
function translations_n($translation, $single, $plural, $number, $domain)
|
120 |
-
{
|
121 |
-
return $this->translation_update($translation, $domain);
|
122 |
-
}
|
123 |
-
|
124 |
-
function translations($translation, $text, $domain)
|
125 |
-
{
|
126 |
-
return $this->translation_update($translation, $domain);
|
127 |
-
}
|
128 |
-
|
129 |
-
private function translation_update($text, $domain)
|
130 |
-
{
|
131 |
-
if ('ti-woocommerce-wishlist' === $domain) {
|
132 |
-
|
133 |
-
$translations = ['wishlist' => [$this->rename_single, $this->rename_plural ? $this->rename_plural : $this->rename_single . 's']];
|
134 |
-
|
135 |
-
$text = preg_replace_callback('~\b[a-z]+(?:(?<=(s)))?~i', function ($m) use ($translations) {
|
136 |
-
$lower = strtolower($m[0]);
|
137 |
-
$rep = $m[0];
|
138 |
-
if (isset($translations[$lower])) {
|
139 |
-
$rep = is_array($translations[$lower]) ? $translations[$lower][0] : $translations[$lower];
|
140 |
-
} elseif (isset($m[1])) {
|
141 |
-
$sing = substr($lower, 0, -1);
|
142 |
-
if (isset($translations[$sing]))
|
143 |
-
$rep = is_array($translations[$sing]) ? $translations[$sing][1] : $translations[$sing] . 's';
|
144 |
-
} else {
|
145 |
-
return $rep;
|
146 |
-
}
|
147 |
-
|
148 |
-
if ($m[0] == $lower)
|
149 |
-
return $rep;
|
150 |
-
elseif ($m[0] == strtoupper($lower))
|
151 |
-
return strtoupper($rep);
|
152 |
-
elseif ($m[0] == ucfirst($lower))
|
153 |
-
return ucfirst($rep);
|
154 |
-
|
155 |
-
return $rep;
|
156 |
-
}, $text);
|
157 |
-
|
158 |
-
}
|
159 |
-
return $text;
|
160 |
-
}
|
161 |
-
|
162 |
-
|
163 |
Â
/**
|
164 |
Â
* Set localization
|
165 |
Â
*/
|
78 |
Â
TInvWL_Activator::activate();
|
79 |
Â
}
|
80 |
Â
|
Â
|
|
Â
|
|
81 |
Â
TInvWL_View::_init($this->_name, $this->_version);
|
82 |
Â
TInvWL_Form::_init($this->_name);
|
83 |
Â
|
97 |
Â
$this->rest_api = TInvWL_API::init();
|
98 |
Â
}
|
99 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
100 |
Â
/**
|
101 |
Â
* Set localization
|
102 |
Â
*/
|
languages/ti-woocommerce-wishlist.pot
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
# Copyright (C) 2021 TI WooCommerce Wishlist Plugin - 1.28.
|
2 |
-
# This file is distributed under the same license as the TI WooCommerce Wishlist Plugin - 1.28.
|
3 |
Â
msgid ""
|
4 |
Â
msgstr ""
|
5 |
-
"Project-Id-Version: TI WooCommerce Wishlist Plugin - 1.28.
|
6 |
Â
"MIME-Version: 1.0\n"
|
7 |
Â
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
Â
"Content-Transfer-Encoding: 8bit\n"
|
@@ -952,15 +952,15 @@ msgstr ""
|
|
952 |
Â
msgid "%1$s is conflicted with %2$s %3$s. Deactivating %1$s."
|
953 |
Â
msgstr ""
|
954 |
Â
|
955 |
-
#: includes/tinvwl.class.php:
|
956 |
Â
msgid "Settings"
|
957 |
Â
msgstr ""
|
958 |
Â
|
959 |
-
#: includes/tinvwl.class.php:
|
960 |
Â
msgid "Premium Version"
|
961 |
Â
msgstr ""
|
962 |
Â
|
963 |
-
#: includes/tinvwl.class.php:
|
964 |
Â
msgid "Live Demo"
|
965 |
Â
msgstr ""
|
966 |
Â
|
1 |
+
# Copyright (C) 2021 TI WooCommerce Wishlist Plugin - 1.28.3
|
2 |
+
# This file is distributed under the same license as the TI WooCommerce Wishlist Plugin - 1.28.3 package.
|
3 |
Â
msgid ""
|
4 |
Â
msgstr ""
|
5 |
+
"Project-Id-Version: TI WooCommerce Wishlist Plugin - 1.28.3\n"
|
6 |
Â
"MIME-Version: 1.0\n"
|
7 |
Â
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
Â
"Content-Transfer-Encoding: 8bit\n"
|
952 |
Â
msgid "%1$s is conflicted with %2$s %3$s. Deactivating %1$s."
|
953 |
Â
msgstr ""
|
954 |
Â
|
955 |
+
#: includes/tinvwl.class.php:176
|
956 |
Â
msgid "Settings"
|
957 |
Â
msgstr ""
|
958 |
Â
|
959 |
+
#: includes/tinvwl.class.php:177
|
960 |
Â
msgid "Premium Version"
|
961 |
Â
msgstr ""
|
962 |
Â
|
963 |
+
#: includes/tinvwl.class.php:178
|
964 |
Â
msgid "Live Demo"
|
965 |
Â
msgstr ""
|
966 |
Â
|
public/tinvwl.class.php
CHANGED
@@ -302,8 +302,8 @@ class TInvWL_Public_TInvWL
|
|
302 |
Â
if ($language_codes && (defined('POLYLANG_VERSION') || defined('ICL_PLUGIN_PATH'))) {
|
303 |
Â
add_rewrite_rule('^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/wl_page/([0-9]{1,})/{0,1}$', 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&wl_paged=$matches[5]&lang=$matches[1]', 'top');
|
304 |
Â
self::$rules_raw['^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/wl_page/([0-9]{1,})/{0,1}$'] = 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&wl_paged=$matches[5]&lang=$matches[1]';
|
305 |
-
add_rewrite_rule('^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/{0,1}$', 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&
|
306 |
-
self::$rules_raw['^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/{0,1}$'] = 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&
|
307 |
Â
}
|
308 |
Â
|
309 |
Â
// Wishlist on frontpage.
|
302 |
Â
if ($language_codes && (defined('POLYLANG_VERSION') || defined('ICL_PLUGIN_PATH'))) {
|
303 |
Â
add_rewrite_rule('^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/wl_page/([0-9]{1,})/{0,1}$', 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&wl_paged=$matches[5]&lang=$matches[1]', 'top');
|
304 |
Â
self::$rules_raw['^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/wl_page/([0-9]{1,})/{0,1}$'] = 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&wl_paged=$matches[5]&lang=$matches[1]';
|
305 |
+
add_rewrite_rule('^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/{0,1}$', 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&lang=$matches[1]', 'top');
|
306 |
+
self::$rules_raw['^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/{0,1}$'] = 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&lang=$matches[1]';
|
307 |
Â
}
|
308 |
Â
|
309 |
Â
// Wishlist on frontpage.
|
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.8
|
6 |
-
Stable tag: 1.28.
|
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,12 @@ Yes, you can! Join in on our [GitHub repository](https://github.com/TemplateInva
|
|
163 |
Â
|
164 |
Â
|
165 |
Â
== Changelog ==
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
166 |
Â
= 1.28.2 =
|
167 |
Â
*Release Date - 23 August 2021*
|
168 |
Â
|
3 |
Â
Tags: woocommerce, wishlist, woocommerce wishlist, e-commerce, ecommerce
|
4 |
Â
Requires at least: 4.7
|
5 |
Â
Tested up to: 5.8
|
6 |
+
Stable tag: 1.28.3
|
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.28.2 =
|
167 |
+
*Release Date - 25 August 2021*
|
168 |
+
|
169 |
+
* Fixed permalink issue for multilingual setups
|
170 |
+
* Fixed rename feature issues
|
171 |
+
|
172 |
Â
= 1.28.2 =
|
173 |
Â
*Release Date - 23 August 2021*
|
174 |
Â
|
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.28.
|
8 |
Â
* Requires at least: 4.7
|
9 |
Â
* Tested up to: 5.8
|
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.28.
|
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.28.3
|
8 |
Â
* Requires at least: 4.7
|
9 |
Â
* Tested up to: 5.8
|
10 |
Â
* WC requires at least: 3.0
|
41 |
Â
}
|
42 |
Â
|
43 |
Â
if (!defined('TINVWL_FVERSION')) {
|
44 |
+
define('TINVWL_FVERSION', '1.28.3');
|
45 |
Â
}
|
46 |
Â
|
47 |
Â
if (!defined('TINVWL_LOAD_FREE')) {
|
tinv-wishlists-function.php
CHANGED
@@ -1,921 +1,1020 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Basic function for plugin
|
4 |
-
*
|
5 |
-
* @since 1.0.0
|
6 |
-
* @package TInvWishlist
|
7 |
-
*/
|
8 |
-
|
9 |
-
// If this file is called directly, abort.
|
10 |
-
if (
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
|
15 |
-
if (
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Extract options from database or default array settings.
|
19 |
-
*
|
20 |
-
* @param string $category Name category settings.
|
21 |
-
* @param string $option Name paremetr. If is empty string, then function return array category settings.
|
22 |
-
*
|
23 |
-
* @return mixed
|
24 |
-
*/
|
25 |
-
function tinv_get_option(
|
26 |
-
|
27 |
-
$
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
*
|
53 |
-
*
|
54 |
-
* @param string $
|
55 |
-
*
|
56 |
-
*
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
return $values
|
68 |
-
}
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
*
|
80 |
-
*
|
81 |
-
*
|
82 |
-
* @
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
if (
|
91 |
-
return
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
*
|
105 |
-
*
|
106 |
-
*
|
107 |
-
* @
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
}
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
if (
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
}
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
}
|
344 |
-
}
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
}
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
}
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
if (
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
$
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
*
|
521 |
-
*
|
522 |
-
*
|
523 |
-
*
|
524 |
-
* @
|
525 |
-
*/
|
526 |
-
function
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
*
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
}
|
600 |
-
|
601 |
-
if (
|
602 |
-
|
603 |
-
/**
|
604 |
-
*
|
605 |
-
*
|
606 |
-
* @param
|
607 |
-
*
|
608 |
-
* @
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
*
|
667 |
-
*/
|
668 |
-
function
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
$
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
*
|
798 |
-
*
|
799 |
-
*
|
800 |
-
* @
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
if (
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
}
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
}
|
885 |
-
|
886 |
-
if (
|
887 |
-
|
888 |
-
|
889 |
-
*
|
890 |
-
*
|
891 |
-
* @param array $
|
892 |
-
*
|
893 |
-
*
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
$
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Basic function for plugin
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
* @package TInvWishlist
|
7 |
+
*/
|
8 |
+
|
9 |
+
// If this file is called directly, abort.
|
10 |
+
if (!defined('ABSPATH')) {
|
11 |
+
die;
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
if (!function_exists('tinv_get_option')) {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Extract options from database or default array settings.
|
19 |
+
*
|
20 |
+
* @param string $category Name category settings.
|
21 |
+
* @param string $option Name paremetr. If is empty string, then function return array category settings.
|
22 |
+
*
|
23 |
+
* @return mixed
|
24 |
+
*/
|
25 |
+
function tinv_get_option($category, $option = '')
|
26 |
+
{
|
27 |
+
$prefix = TINVWL_PREFIX . '-';
|
28 |
+
$values = get_option($prefix . $category, array());
|
29 |
+
if (empty($values)) {
|
30 |
+
$values = tinv_get_option_defaults($category);
|
31 |
+
}
|
32 |
+
if (empty($option)) {
|
33 |
+
return $values;
|
34 |
+
} else {
|
35 |
+
if (array_key_exists($option, (array)$values)) {
|
36 |
+
return $values[$option];
|
37 |
+
} else {
|
38 |
+
$values = tinv_get_option_defaults($category);
|
39 |
+
if (array_key_exists($option, (array)$values)) {
|
40 |
+
return $values[$option];
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
return null;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
if (!function_exists('tinv_get_option_admin')) {
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Extract options from database or default array settings.
|
53 |
+
*
|
54 |
+
* @param string $category Name category settings.
|
55 |
+
* @param string $option Name paremetr. If is empty string, then function return array category settings.
|
56 |
+
*
|
57 |
+
* @return mixed
|
58 |
+
*/
|
59 |
+
function tinv_get_option_admin($category, $option = '')
|
60 |
+
{
|
61 |
+
$prefix = TINVWL_PREFIX . '-';
|
62 |
+
$values = get_option($prefix . $category, array());
|
63 |
+
if (empty($values)) {
|
64 |
+
$values = array();
|
65 |
+
}
|
66 |
+
if (empty($option)) {
|
67 |
+
return $values;
|
68 |
+
} elseif (array_key_exists($option, $values)) {
|
69 |
+
return $values[$option];
|
70 |
+
}
|
71 |
+
|
72 |
+
return null;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
if (!function_exists('tinv_style')) {
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Get style for custom style
|
80 |
+
*
|
81 |
+
* @param string $selector Selector style.
|
82 |
+
* @param string $element Attribute name.
|
83 |
+
*
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
function tinv_style($selector = '', $element = '')
|
87 |
+
{
|
88 |
+
$key = md5($selector . '||' . $element);
|
89 |
+
$values = get_option(TINVWL_PREFIX . '-style_options', array());
|
90 |
+
if (empty($values)) {
|
91 |
+
return '';
|
92 |
+
}
|
93 |
+
if (array_key_exists($key, $values)) {
|
94 |
+
return $values[$key];
|
95 |
+
}
|
96 |
+
|
97 |
+
return '';
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
if (!function_exists('tinv_update_option')) {
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Update options in database.
|
105 |
+
*
|
106 |
+
* @param string $category Name category settings.
|
107 |
+
* @param string $option Name paremetr. If is empty string, then function update array category settings.
|
108 |
+
* @param mixed $value Value option.
|
109 |
+
*
|
110 |
+
* @return boolean
|
111 |
+
*/
|
112 |
+
function tinv_update_option($category, $option = '', $value = false)
|
113 |
+
{
|
114 |
+
$prefix = TINVWL_PREFIX . '-';
|
115 |
+
if (empty($option)) {
|
116 |
+
if (is_array($value)) {
|
117 |
+
update_option($prefix . $category, $value);
|
118 |
+
|
119 |
+
return true;
|
120 |
+
}
|
121 |
+
} else {
|
122 |
+
$values = get_option($prefix . $category, array());
|
123 |
+
|
124 |
+
$values[$option] = $value;
|
125 |
+
update_option($prefix . $category, $values);
|
126 |
+
|
127 |
+
return true;
|
128 |
+
}
|
129 |
+
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Rename class
|
136 |
+
*/
|
137 |
+
class TInvWLRename
|
138 |
+
{
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Rename "wishlist" word across the plugin.
|
142 |
+
*/
|
143 |
+
function rename()
|
144 |
+
{
|
145 |
+
$this->rename = tinv_get_option('rename', 'rename');
|
146 |
+
$this->rename_single = tinv_get_option('rename', 'rename_single');
|
147 |
+
$this->rename_plural = tinv_get_option('rename', 'rename_plural');
|
148 |
+
|
149 |
+
if ($this->rename && $this->rename_single) {
|
150 |
+
add_filter('gettext', array($this, 'translations'), 999, 3);
|
151 |
+
add_filter('ngettext', array($this, 'translations_n'), 999, 5);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
function translations_n($translation, $single, $plural, $number, $domain)
|
157 |
+
{
|
158 |
+
return $this->translation_update($translation, $domain);
|
159 |
+
}
|
160 |
+
|
161 |
+
function translations($translation, $text, $domain)
|
162 |
+
{
|
163 |
+
return $this->translation_update($translation, $domain);
|
164 |
+
}
|
165 |
+
|
166 |
+
private function translation_update($text, $domain)
|
167 |
+
{
|
168 |
+
if ('ti-woocommerce-wishlist' === $domain) {
|
169 |
+
|
170 |
+
$translations = ['wishlist' => [$this->rename_single, $this->rename_plural ? $this->rename_plural : $this->rename_single . 's']];
|
171 |
+
|
172 |
+
$text = preg_replace_callback('~\b[a-z]+(?:(?<=(s)))?~i', function ($m) use ($translations) {
|
173 |
+
$lower = strtolower($m[0]);
|
174 |
+
$rep = $m[0];
|
175 |
+
if (isset($translations[$lower])) {
|
176 |
+
$rep = is_array($translations[$lower]) ? $translations[$lower][0] : $translations[$lower];
|
177 |
+
} elseif (isset($m[1])) {
|
178 |
+
$sing = substr($lower, 0, -1);
|
179 |
+
if (isset($translations[$sing]))
|
180 |
+
$rep = is_array($translations[$sing]) ? $translations[$sing][1] : $translations[$sing] . 's';
|
181 |
+
} else {
|
182 |
+
return $rep;
|
183 |
+
}
|
184 |
+
|
185 |
+
if ($m[0] == $lower)
|
186 |
+
return $rep;
|
187 |
+
elseif ($m[0] == strtoupper($lower))
|
188 |
+
return strtoupper($rep);
|
189 |
+
elseif ($m[0] == ucfirst($lower))
|
190 |
+
return ucfirst($rep);
|
191 |
+
|
192 |
+
return $rep;
|
193 |
+
}, $text);
|
194 |
+
|
195 |
+
}
|
196 |
+
return $text;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
$tinvwl_rename = new TInvWLRename();
|
201 |
+
$tinvwl_rename->rename();
|
202 |
+
|
203 |
+
if (!function_exists('tinv_wishlist_template')) {
|
204 |
+
|
205 |
+
/**
|
206 |
+
* The function overwrites the method output templates woocommerce
|
207 |
+
*
|
208 |
+
* @param string $template_name Name file template.
|
209 |
+
* @param array $args Array variable in template.
|
210 |
+
* @param string $template_path Customization path.
|
211 |
+
*/
|
212 |
+
function tinv_wishlist_template($template_name, $args = array(), $template_path = '')
|
213 |
+
{
|
214 |
+
if (function_exists('wc_get_template')) {
|
215 |
+
wc_get_template($template_name, $args, $template_path);
|
216 |
+
} else {
|
217 |
+
woocommerce_get_template($template_name, $args, $template_path);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
if (!function_exists('tinv_wishlist_locate_template')) {
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Overwrites path for email and other template
|
226 |
+
*
|
227 |
+
* @param string $template_name Requered Template file.
|
228 |
+
* @param string $template_path Template path.
|
229 |
+
* @param string $default_path Template default path.
|
230 |
+
*
|
231 |
+
* @return mixed
|
232 |
+
*/
|
233 |
+
function tinv_wishlist_locate_template($template_name, $template_path = '', $default_path = '')
|
234 |
+
{
|
235 |
+
$prefix = 'ti-';
|
236 |
+
|
237 |
+
if (substr(basename($template_name), 0, strlen($prefix)) !== $prefix) {
|
238 |
+
return;
|
239 |
+
}
|
240 |
+
|
241 |
+
if (!$template_path) {
|
242 |
+
$template_path = WC()->template_path();
|
243 |
+
}
|
244 |
+
|
245 |
+
if (!$default_path) {
|
246 |
+
$default_path = TINVWL_PATH . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
|
247 |
+
}
|
248 |
+
|
249 |
+
// Look within passed path within the theme - this is priority.
|
250 |
+
$template = locate_template(array(
|
251 |
+
trailingslashit($template_path) . $template_name,
|
252 |
+
$template_name,
|
253 |
+
));
|
254 |
+
|
255 |
+
// Get default template.
|
256 |
+
if (!$template && file_exists($default_path . $template_name)) {
|
257 |
+
$template = $default_path . $template_name;
|
258 |
+
}
|
259 |
+
|
260 |
+
// Return what we found.
|
261 |
+
return apply_filters('tinvwl_locate_template', $template, $template_name, $template_path);
|
262 |
+
}
|
263 |
+
} // End if().
|
264 |
+
|
265 |
+
if (!function_exists('tinv_wishlist_template_html')) {
|
266 |
+
|
267 |
+
/**
|
268 |
+
* The function overwrites the method return templates woocommerce
|
269 |
+
*
|
270 |
+
* @param string $template_name Name file template.
|
271 |
+
* @param array $args Array variable in template.
|
272 |
+
* @param string $template_path Customization path.
|
273 |
+
*
|
274 |
+
* @return string
|
275 |
+
*/
|
276 |
+
function tinv_wishlist_template_html($template_name, $args = array(), $template_path = '')
|
277 |
+
{
|
278 |
+
ob_start();
|
279 |
+
tinv_wishlist_template($template_name, $args, $template_path);
|
280 |
+
|
281 |
+
return ob_get_clean();
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
if (!function_exists('tinv_wishlist_get_item_data')) {
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Extract meta attributes for product
|
289 |
+
*
|
290 |
+
* @param object $product Object selected product.
|
291 |
+
* @param array $wl_product Wishlist selected product.
|
292 |
+
* @param boolean $flat Return text or template.
|
293 |
+
*
|
294 |
+
* @return string
|
295 |
+
*/
|
296 |
+
function tinv_wishlist_get_item_data($product, $wl_product = array(), $flat = false)
|
297 |
+
{
|
298 |
+
$item_data = array();
|
299 |
+
$variation_id = $product->is_type('variation') ? $product->get_id() : 0;
|
300 |
+
$variation_data = $product->is_type('variation') ? wc_get_product_variation_attributes($product->get_id()) : array();
|
301 |
+
if (!empty($variation_id) && is_array($variation_data) && is_array($wl_product)) {
|
302 |
+
foreach ($variation_data as $name => $value) {
|
303 |
+
if ('' === $value) {
|
304 |
+
// Could be any value that saved to a custom meta.
|
305 |
+
if (array_key_exists('meta', $wl_product) && array_key_exists($name, $wl_product['meta'])) {
|
306 |
+
$value = $wl_product['meta'][$name];
|
307 |
+
} else {
|
308 |
+
continue;
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
$taxonomy = wc_attribute_taxonomy_name(str_replace('attribute_pa_', '', urldecode($name)));
|
313 |
+
|
314 |
+
// If this is a term slug, get the term's nice name.
|
315 |
+
if (taxonomy_exists($taxonomy)) {
|
316 |
+
$term = get_term_by('slug', $value, $taxonomy); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.get_term_by
|
317 |
+
if (!is_wp_error($term) && $term && $term->name) {
|
318 |
+
$value = $term->name;
|
319 |
+
}
|
320 |
+
$label = wc_attribute_label($taxonomy);
|
321 |
+
|
322 |
+
// If this is a custom option slug, get the options name.
|
323 |
+
} else {
|
324 |
+
$value = apply_filters('woocommerce_variation_option_name', $value);
|
325 |
+
$product_attributes = $product->get_attributes();
|
326 |
+
$_name = str_replace('attribute_', '', $name);
|
327 |
+
if (isset($product_attributes[$_name])) {
|
328 |
+
$label = wc_attribute_label($_name, $product);
|
329 |
+
} else {
|
330 |
+
$label = $name;
|
331 |
+
}
|
332 |
+
}
|
333 |
+
if ('' === $value || wc_is_attribute_in_product_name($value, is_callable(array(
|
334 |
+
$product,
|
335 |
+
'get_name'
|
336 |
+
)) ? $product->get_name() : $product->get_title())) {
|
337 |
+
continue;
|
338 |
+
}
|
339 |
+
$item_data[] = array(
|
340 |
+
'key' => $label,
|
341 |
+
'value' => $value,
|
342 |
+
);
|
343 |
+
} // End foreach().
|
344 |
+
} // End if().
|
345 |
+
|
346 |
+
// Filter item data to allow 3rd parties to add more to the array.
|
347 |
+
$item_data = apply_filters('tinvwl_wishlist_get_item_data', $item_data, $product);
|
348 |
+
|
349 |
+
// Format item data ready to display.
|
350 |
+
foreach ($item_data as $key => $data) {
|
351 |
+
// Set hidden to true to not display meta on cart.
|
352 |
+
if (!empty($data['hidden'])) {
|
353 |
+
unset($item_data[$key]);
|
354 |
+
continue;
|
355 |
+
}
|
356 |
+
$item_data[$key]['key'] = !empty($data['key']) ? $data['key'] : $data['name'];
|
357 |
+
$item_data[$key]['display'] = !empty($data['display']) ? $data['display'] : $data['value'];
|
358 |
+
}
|
359 |
+
|
360 |
+
// Output flat or in list format.
|
361 |
+
if (0 < count($item_data)) {
|
362 |
+
ob_start();
|
363 |
+
if ($flat) {
|
364 |
+
foreach ($item_data as $data) {
|
365 |
+
echo esc_html($data['key']) . ': ' . wp_kses_post($data['display']) . '<br>';
|
366 |
+
}
|
367 |
+
} else {
|
368 |
+
tinv_wishlist_template('ti-wishlist-item-data.php', array('item_data' => $item_data));
|
369 |
+
}
|
370 |
+
|
371 |
+
return ob_get_clean();
|
372 |
+
}
|
373 |
+
|
374 |
+
return '';
|
375 |
+
}
|
376 |
+
} // End if().
|
377 |
+
|
378 |
+
if (!function_exists('tinv_wishlist_get')) {
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Return Wishlist by id or share key
|
382 |
+
*
|
383 |
+
* @param mixed $id Integer wishlist ID, or Share Key wishlist.
|
384 |
+
* @param boolean $toend Switches to the extract the default or guest wishlist.
|
385 |
+
*
|
386 |
+
* @return array
|
387 |
+
*/
|
388 |
+
function tinv_wishlist_get($id = '', $toend = true)
|
389 |
+
{
|
390 |
+
$wl = new TInvWL_Wishlist();
|
391 |
+
$wishlist = null;
|
392 |
+
if (empty($id)) {
|
393 |
+
$id = get_query_var('tinvwlID', null);
|
394 |
+
}
|
395 |
+
|
396 |
+
if (!empty($id)) {
|
397 |
+
if (is_integer($id)) {
|
398 |
+
$wishlist = $wl->get_by_id($id);
|
399 |
+
}
|
400 |
+
if (empty($wishlist)) {
|
401 |
+
$wishlist = $wl->get_by_share_key($id);
|
402 |
+
}
|
403 |
+
|
404 |
+
if (is_array($wishlist)) {
|
405 |
+
$wishlist['is_owner'] = false;
|
406 |
+
if (is_user_logged_in()) {
|
407 |
+
$wishlist['is_owner'] = get_current_user_id() == $wishlist['author']; // WPCS: loose comparison ok.
|
408 |
+
} else {
|
409 |
+
$wishlist['is_owner'] = $wl->get_sharekey() === $wishlist['share_key']; // WPCS: loose comparison ok.
|
410 |
+
}
|
411 |
+
}
|
412 |
+
} elseif (is_user_logged_in() && $toend) {
|
413 |
+
$wishlist = $wl->add_user_default();
|
414 |
+
|
415 |
+
$wishlist['is_owner'] = true;
|
416 |
+
} elseif ($toend) {
|
417 |
+
$wishlist = $wl->get_by_sharekey_default();
|
418 |
+
if (!empty($wishlist)) {
|
419 |
+
$wishlist = array_shift($wishlist);
|
420 |
+
$wishlist['is_owner'] = $wl->get_sharekey() === $wishlist['share_key'];
|
421 |
+
}
|
422 |
+
}
|
423 |
+
|
424 |
+
return $wishlist;
|
425 |
+
}
|
426 |
+
} // End if().
|
427 |
+
|
428 |
+
if (!function_exists('tinv_url_wishlist_default')) {
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Return the default wishlist url
|
432 |
+
*
|
433 |
+
* @return string
|
434 |
+
*/
|
435 |
+
function tinv_url_wishlist_default()
|
436 |
+
{
|
437 |
+
$page = apply_filters('wpml_object_id', tinv_get_option('page', 'wishlist'), 'page', true); // @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited
|
438 |
+
if (empty($page)) {
|
439 |
+
return '';
|
440 |
+
}
|
441 |
+
$link = get_permalink($page);
|
442 |
+
|
443 |
+
return $link;
|
444 |
+
}
|
445 |
+
}
|
446 |
+
|
447 |
+
if (!function_exists('tinv_url_wishlist_by_key')) {
|
448 |
+
|
449 |
+
/**
|
450 |
+
* Return the wishlist url by share key
|
451 |
+
*
|
452 |
+
* @param string $share_key Share Key wishlist.
|
453 |
+
* @param integer $paged Page.
|
454 |
+
*
|
455 |
+
* @return string
|
456 |
+
*/
|
457 |
+
function tinv_url_wishlist_by_key($share_key, $paged = 1)
|
458 |
+
{
|
459 |
+
$paged = absint($paged);
|
460 |
+
$paged = 1 < $paged ? $paged : 1;
|
461 |
+
$link = tinv_url_wishlist_default();
|
462 |
+
if (empty($link)) {
|
463 |
+
return $link;
|
464 |
+
}
|
465 |
+
|
466 |
+
if (1 < $paged) {
|
467 |
+
$link = add_query_arg('wl_paged', $paged, $link);
|
468 |
+
}
|
469 |
+
|
470 |
+
if ($share_key) {
|
471 |
+
if (get_option('permalink_structure')) {
|
472 |
+
$suffix = '';
|
473 |
+
if (preg_match('/([^\?]+)\?*?(.*)/i', $link, $_link)) {
|
474 |
+
$link = $_link[1];
|
475 |
+
$suffix = $_link[2];
|
476 |
+
}
|
477 |
+
if (!preg_match('/\/$/', $link)) {
|
478 |
+
$link .= '/';
|
479 |
+
}
|
480 |
+
$link .= $share_key . '/' . $suffix;
|
481 |
+
} else {
|
482 |
+
$link = add_query_arg('tinvwlID', $share_key, $link);
|
483 |
+
}
|
484 |
+
}
|
485 |
+
|
486 |
+
return $link;
|
487 |
+
}
|
488 |
+
} // End if().
|
489 |
+
|
490 |
+
if (!function_exists('tinv_url_wishlist')) {
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Return the wishlist url by id or share key
|
494 |
+
*
|
495 |
+
* @param mixed $id Integer wishlist ID, or Share Key wishlist.
|
496 |
+
* @param integer $paged Page.
|
497 |
+
* @param boolean $full Return full url or shroted url for logged in user.
|
498 |
+
*
|
499 |
+
* @return string
|
500 |
+
*/
|
501 |
+
function tinv_url_wishlist($id = '', $paged = 1, $full = true)
|
502 |
+
{
|
503 |
+
$share_key = $id;
|
504 |
+
if (!(is_string($id) && preg_match('/^[A-Fa-f0-9]{6}$/', $id))) {
|
505 |
+
$wishlist = tinv_wishlist_get($id, false);
|
506 |
+
$share_key = $wishlist['share_key'];
|
507 |
+
}
|
508 |
+
|
509 |
+
return tinv_url_wishlist_by_key($share_key, $paged);
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
if (!function_exists('tinv_wishlist_status')) {
|
514 |
+
|
515 |
+
/**
|
516 |
+
* Check status free or premium plugin and disable free
|
517 |
+
*
|
518 |
+
* @param string $transient Plugin transient name.
|
519 |
+
*
|
520 |
+
* @return string
|
521 |
+
* @global string $s
|
522 |
+
*
|
523 |
+
* @global string $status
|
524 |
+
* @global string $page
|
525 |
+
*/
|
526 |
+
function tinv_wishlist_status($transient)
|
527 |
+
{
|
528 |
+
if (TINVWL_LOAD_FREE === $transient) {
|
529 |
+
TInvWL_PluginExtend::deactivate_self(TINVWL_LOAD_FREE);
|
530 |
+
|
531 |
+
return 'plugins.php';
|
532 |
+
}
|
533 |
+
if (TINVWL_LOAD_PREMIUM === $transient) {
|
534 |
+
if (is_plugin_active(TINVWL_LOAD_FREE)) {
|
535 |
+
TInvWL_PluginExtend::deactivate_self(TINVWL_LOAD_FREE);
|
536 |
+
if (!function_exists('wp_create_nonce')) {
|
537 |
+
return 'plugins.php';
|
538 |
+
}
|
539 |
+
|
540 |
+
global $status, $page, $s;
|
541 |
+
$redirect = 'plugins.php?';
|
542 |
+
$redirect .= http_build_query(array(
|
543 |
+
'action' => 'activate',
|
544 |
+
'plugin' => $transient,
|
545 |
+
'plugin_status' => $status,
|
546 |
+
'paged' => $page,
|
547 |
+
's' => $s,
|
548 |
+
));
|
549 |
+
$redirect = esc_url_raw(add_query_arg('_wpnonce', wp_create_nonce('activate-plugin_' . $transient), $redirect));
|
550 |
+
|
551 |
+
return $redirect;
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
return false;
|
556 |
+
}
|
557 |
+
} // End if().
|
558 |
+
|
559 |
+
if (!function_exists('tinvwl_body_classes')) {
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Add custom class
|
563 |
+
*
|
564 |
+
* @param array $classes Current classes.
|
565 |
+
*
|
566 |
+
* @return array
|
567 |
+
*/
|
568 |
+
function tinvwl_body_classes($classes)
|
569 |
+
{
|
570 |
+
if (tinv_get_option('style', 'customstyle')) {
|
571 |
+
$classes[] = 'tinvwl-theme-style';
|
572 |
+
} else {
|
573 |
+
$classes[] = 'tinvwl-custom-style';
|
574 |
+
}
|
575 |
+
|
576 |
+
return $classes;
|
577 |
+
}
|
578 |
+
|
579 |
+
add_filter('body_class', 'tinvwl_body_classes');
|
580 |
+
}
|
581 |
+
|
582 |
+
if (!function_exists('tinvwl_shortcode_addtowishlist')) {
|
583 |
+
|
584 |
+
/**
|
585 |
+
* Shortcode Add To Wishlist
|
586 |
+
*
|
587 |
+
* @param array $atts Array parameter from shortcode.
|
588 |
+
*
|
589 |
+
* @return string
|
590 |
+
*/
|
591 |
+
function tinvwl_shortcode_addtowishlist($atts = array())
|
592 |
+
{
|
593 |
+
$class = TInvWL_Public_AddToWishlist::instance();
|
594 |
+
|
595 |
+
return $class->shortcode($atts);
|
596 |
+
}
|
597 |
+
|
598 |
+
add_shortcode('ti_wishlists_addtowishlist', 'tinvwl_shortcode_addtowishlist');
|
599 |
+
}
|
600 |
+
|
601 |
+
if (!function_exists('tinvwl_shortcode_view')) {
|
602 |
+
|
603 |
+
/**
|
604 |
+
* Shortcode view Wishlist
|
605 |
+
*
|
606 |
+
* @param array $atts Array parameter from shortcode.
|
607 |
+
*
|
608 |
+
* @return string
|
609 |
+
*/
|
610 |
+
function tinvwl_shortcode_view($atts = array())
|
611 |
+
{
|
612 |
+
$class = TInvWL_Public_Wishlist_View::instance();
|
613 |
+
|
614 |
+
return $class->shortcode($atts);
|
615 |
+
}
|
616 |
+
|
617 |
+
add_shortcode('ti_wishlistsview', 'tinvwl_shortcode_view');
|
618 |
+
}
|
619 |
+
|
620 |
+
if (!function_exists('tinvwl_shortcode_products_counter')) {
|
621 |
+
|
622 |
+
/**
|
623 |
+
* Shortcode view Wishlist
|
624 |
+
*
|
625 |
+
* @param array $atts Array parameter from shortcode.
|
626 |
+
*
|
627 |
+
* @return string
|
628 |
+
*/
|
629 |
+
function tinvwl_shortcode_products_counter($atts = array())
|
630 |
+
{
|
631 |
+
$class = TInvWL_Public_WishlistCounter::instance();
|
632 |
+
|
633 |
+
return $class->shortcode($atts);
|
634 |
+
}
|
635 |
+
|
636 |
+
add_shortcode('ti_wishlist_products_counter', 'tinvwl_shortcode_products_counter');
|
637 |
+
}
|
638 |
+
|
639 |
+
if (!function_exists('tinvwl_view_addto_html')) {
|
640 |
+
|
641 |
+
/**
|
642 |
+
* Show button Add to Wishlsit
|
643 |
+
*/
|
644 |
+
function tinvwl_view_addto_html()
|
645 |
+
{
|
646 |
+
$class = TInvWL_Public_AddToWishlist::instance();
|
647 |
+
$class->htmloutput();
|
648 |
+
}
|
649 |
+
}
|
650 |
+
|
651 |
+
if (!function_exists('tinvwl_view_addto_htmlout')) {
|
652 |
+
|
653 |
+
/**
|
654 |
+
* Show button Add to Wishlsit, if product is not purchasable
|
655 |
+
*/
|
656 |
+
function tinvwl_view_addto_htmlout()
|
657 |
+
{
|
658 |
+
$class = TInvWL_Public_AddToWishlist::instance();
|
659 |
+
$class->htmloutput_out();
|
660 |
+
}
|
661 |
+
}
|
662 |
+
|
663 |
+
if (!function_exists('tinvwl_view_addto_htmlloop')) {
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Show button Add to Wishlsit, in loop
|
667 |
+
*/
|
668 |
+
function tinvwl_view_addto_htmlloop()
|
669 |
+
{
|
670 |
+
$class = TInvWL_Public_AddToWishlist::instance();
|
671 |
+
$class->htmloutput_loop();
|
672 |
+
}
|
673 |
+
}
|
674 |
+
|
675 |
+
if (!function_exists('tinvwl_clean_url')) {
|
676 |
+
|
677 |
+
/**
|
678 |
+
* Clear esc_url to original
|
679 |
+
*
|
680 |
+
* @param string $good_protocol_url Cleared URL.
|
681 |
+
* @param string $original_url Original URL.
|
682 |
+
*
|
683 |
+
* @return string
|
684 |
+
*/
|
685 |
+
function tinvwl_clean_url($good_protocol_url, $original_url)
|
686 |
+
{
|
687 |
+
return $original_url;
|
688 |
+
}
|
689 |
+
}
|
690 |
+
|
691 |
+
if (!function_exists('tinvwl_add_to_cart_need_redirect')) {
|
692 |
+
|
693 |
+
/**
|
694 |
+
* Check if the product is third-party, or has another link added to the cart then redirect to the product page.
|
695 |
+
*
|
696 |
+
* @param boolean $redirect Default value to redirect.
|
697 |
+
* @param \WC_Product $_product Product data.
|
698 |
+
* @param string $redirect_url Current url for redirect.
|
699 |
+
*
|
700 |
+
* @return boolean
|
701 |
+
*/
|
702 |
+
function tinvwl_add_to_cart_need_redirect($redirect, $_product, $redirect_url)
|
703 |
+
{
|
704 |
+
if ($redirect) {
|
705 |
+
return true;
|
706 |
+
}
|
707 |
+
|
708 |
+
if ('external' === $_product->get_type()) {
|
709 |
+
return true;
|
710 |
+
}
|
711 |
+
|
712 |
+
$need_url_data = array_merge(array(
|
713 |
+
'variation_id' => $_product->is_type('variation') ? $_product->get_id() : 0,
|
714 |
+
'add-to-cart' => $_product->is_type('variation') ? $_product->get_parent_id() : $_product->get_id(),
|
715 |
+
), array_map('urlencode', array()));
|
716 |
+
|
717 |
+
$need_url_data = array_filter($need_url_data);
|
718 |
+
|
719 |
+
$need_url = apply_filters('tinvwl_product_add_to_cart_redirect_slug_original', remove_query_arg('added-to-cart', (version_compare(WC_VERSION, '3.8.0', '<') ? add_query_arg($need_url_data) : add_query_arg($need_url_data, ''))), $_product);
|
720 |
+
$need_url_full = apply_filters('tinvwl_product_add_to_cart_redirect_url_original', remove_query_arg('added-to-cart', add_query_arg($need_url_data, $_product->get_permalink())), $_product);
|
721 |
+
|
722 |
+
global $product;
|
723 |
+
// store global product data.
|
724 |
+
$_product_tmp = $product;
|
725 |
+
// override global product data.
|
726 |
+
$product = $_product;
|
727 |
+
|
728 |
+
add_filter('clean_url', 'tinvwl_clean_url', 10, 2);
|
729 |
+
do_action('before_get_redirect_url');
|
730 |
+
$_redirect_url = apply_filters('tinvwl_product_add_to_cart_redirect_url', $_product->add_to_cart_url(), $_product);
|
731 |
+
do_action('after_get_redirect_url');
|
732 |
+
remove_filter('clean_url', 'tinvwl_clean_url', 10);
|
733 |
+
|
734 |
+
// restore global product data.
|
735 |
+
$product = $_product_tmp;
|
736 |
+
|
737 |
+
if ($_redirect_url !== $need_url && $_redirect_url !== $need_url_full) {
|
738 |
+
return true;
|
739 |
+
}
|
740 |
+
|
741 |
+
return $redirect;
|
742 |
+
}
|
743 |
+
|
744 |
+
add_filter('tinvwl_product_add_to_cart_need_redirect', 'tinvwl_add_to_cart_need_redirect', 10, 3);
|
745 |
+
} // End if().
|
746 |
+
|
747 |
+
if (!function_exists('tinvwl_meta_validate_cart_add')) {
|
748 |
+
|
749 |
+
/**
|
750 |
+
* Checks the ability to add a product
|
751 |
+
*
|
752 |
+
* @param boolean $redirect Default value to redirect.
|
753 |
+
* @param \WC_Product $product Product data.
|
754 |
+
* @param string $redirect_url Current url for redirect.
|
755 |
+
* @param array $wl_product Wishlist Product.
|
756 |
+
*
|
757 |
+
* @return boolean
|
758 |
+
*/
|
759 |
+
function tinvwl_meta_validate_cart_add($redirect, $product, $redirect_url, $wl_product)
|
760 |
+
{
|
761 |
+
if ($redirect && array_key_exists('meta', $wl_product) && !empty($wl_product['meta'])) {
|
762 |
+
|
763 |
+
$wl_product = apply_filters('tinvwl_addproduct_tocart', $wl_product);
|
764 |
+
|
765 |
+
TInvWL_Public_Cart::prepare_post($wl_product);
|
766 |
+
|
767 |
+
$product_id = apply_filters('woocommerce_add_to_cart_product_id', absint($wl_product['product_id']));
|
768 |
+
$quantity = empty($wl_product['quantity']) ? 1 : wc_stock_amount($wl_product['quantity']);
|
769 |
+
$variation_id = $wl_product['variation_id'];
|
770 |
+
$variations = $product->is_type('variation') ? wc_get_product_variation_attributes($product->get_id()) : array();
|
771 |
+
$passed_validation = $product->is_purchasable() && ($product->is_in_stock() || $product->backorders_allowed()) && 'external' !== $product->get_type();
|
772 |
+
ob_start();
|
773 |
+
if (function_exists('wc_clear_notices')) {
|
774 |
+
wc_clear_notices();
|
775 |
+
}
|
776 |
+
$passed_validation = apply_filters('woocommerce_add_to_cart_validation', $passed_validation, $product_id, $quantity, $variation_id, $variations);
|
777 |
+
if (function_exists('wc_get_notices')) {
|
778 |
+
$wc_errors = wc_get_notices('error');
|
779 |
+
}
|
780 |
+
$wc_output = ob_get_clean();
|
781 |
+
if ($passed_validation && empty($wc_errors) && empty($wc_output)) {
|
782 |
+
$redirect = false;
|
783 |
+
}
|
784 |
+
|
785 |
+
TInvWL_Public_Cart::unprepare_post();
|
786 |
+
}
|
787 |
+
|
788 |
+
return $redirect;
|
789 |
+
}
|
790 |
+
|
791 |
+
add_filter('tinvwl_product_add_to_cart_need_redirect', 'tinvwl_meta_validate_cart_add', 90, 4);
|
792 |
+
} // End if().
|
793 |
+
|
794 |
+
if (!function_exists('tinv_wishlist_print_meta')) {
|
795 |
+
|
796 |
+
/**
|
797 |
+
* Print meta data for wishlist form
|
798 |
+
*
|
799 |
+
* @param array $meta Meta Array.
|
800 |
+
* @param boolean $flat Return text or template.
|
801 |
+
*
|
802 |
+
* @return string
|
803 |
+
*/
|
804 |
+
function tinv_wishlist_print_meta($meta = array(), $flat = false)
|
805 |
+
{
|
806 |
+
if (!is_array($meta)) {
|
807 |
+
$meta = array();
|
808 |
+
}
|
809 |
+
$product_id = $variation_id = 0;
|
810 |
+
if (array_key_exists('product_id', $meta)) {
|
811 |
+
$product_id = $meta['product_id'];
|
812 |
+
}
|
813 |
+
if (array_key_exists('variation_id', $meta)) {
|
814 |
+
$variation_id = $meta['variation_id'];
|
815 |
+
}
|
816 |
+
foreach (array('add-to-cart', 'product_id', 'variation_id', 'quantity', 'action', 'variation') as $field) {
|
817 |
+
if (array_key_exists($field, $meta)) {
|
818 |
+
unset($meta[$field]);
|
819 |
+
}
|
820 |
+
}
|
821 |
+
$meta = array_filter($meta);
|
822 |
+
if (empty($meta)) {
|
823 |
+
return '';
|
824 |
+
}
|
825 |
+
$item_data = array();
|
826 |
+
foreach ($meta as $key => $value) {
|
827 |
+
if (!preg_match('/^\_/', $key)) {
|
828 |
+
$item_data[$key] = array(
|
829 |
+
'key' => $key,
|
830 |
+
'display' => $value,
|
831 |
+
);
|
832 |
+
}
|
833 |
+
}
|
834 |
+
|
835 |
+
foreach (array_keys($item_data) as $key) {
|
836 |
+
if (strpos($key, 'attribute_') === 0) {
|
837 |
+
unset($item_data[$key]);
|
838 |
+
}
|
839 |
+
}
|
840 |
+
|
841 |
+
$item_data = apply_filters('tinvwl_wishlist_item_meta_post', $item_data, $product_id, $variation_id);
|
842 |
+
foreach ($item_data as $key => $data) {
|
843 |
+
if (is_object($data['display']) || is_array($data['display'])) {
|
844 |
+
$item_data[$key]['display'] = json_encode($data['display']);
|
845 |
+
}
|
846 |
+
}
|
847 |
+
ob_start();
|
848 |
+
if ($flat) {
|
849 |
+
foreach ($item_data as $data) {
|
850 |
+
echo esc_html($data['key']) . ': ' . wp_kses_post($data['display']) . '<br>';
|
851 |
+
}
|
852 |
+
} else {
|
853 |
+
if ($item_data) {
|
854 |
+
tinv_wishlist_template('ti-wishlist-item-data.php', array('item_data' => $item_data));
|
855 |
+
}
|
856 |
+
}
|
857 |
+
|
858 |
+
return apply_filters('tinvwl_wishlist_item_meta_wishlist', ob_get_clean());
|
859 |
+
}
|
860 |
+
} // End if().
|
861 |
+
|
862 |
+
if (!function_exists('tinv_wishlistmeta')) {
|
863 |
+
|
864 |
+
/**
|
865 |
+
* Show new meta data
|
866 |
+
*
|
867 |
+
* @param string $meta Print meta.
|
868 |
+
* @param array $wl_product Wishlist product.
|
869 |
+
* @param \WC_Product $product Woocommerce product.
|
870 |
+
*
|
871 |
+
* @return string
|
872 |
+
*/
|
873 |
+
function tinv_wishlistmeta($meta, $wl_product, $product)
|
874 |
+
{
|
875 |
+
if (array_key_exists('meta', $wl_product)) {
|
876 |
+
$wlmeta = apply_filters('tinvwl_wishlist_item_meta_wishlist_output', tinv_wishlist_print_meta($wl_product['meta']), $wl_product, $product);
|
877 |
+
}
|
878 |
+
$meta .= $wlmeta;
|
879 |
+
|
880 |
+
return $meta;
|
881 |
+
}
|
882 |
+
|
883 |
+
add_filter('tinvwl_wishlist_item_meta_data', 'tinv_wishlistmeta', 10, 3);
|
884 |
+
}
|
885 |
+
|
886 |
+
if (!function_exists('tinvwl_add_to_cart_item_meta_post')) {
|
887 |
+
|
888 |
+
/**
|
889 |
+
* Save post data to cart item
|
890 |
+
*
|
891 |
+
* @param array $cart_item_data Array with cart imet information.
|
892 |
+
* @param string $cart_item_key Cart item key.
|
893 |
+
*
|
894 |
+
* @return array
|
895 |
+
*/
|
896 |
+
function tinvwl_add_to_cart_item_meta_post($cart_item_data, $cart_item_key)
|
897 |
+
{
|
898 |
+
$postdata = $_POST; // @codingStandardsIgnoreLine WordPress.VIP.SuperGlobalInputUsage.AccessDetected
|
899 |
+
|
900 |
+
$postdata = apply_filters('tinvwl_product_prepare_meta', $postdata);
|
901 |
+
|
902 |
+
if (array_key_exists('variation_id', $postdata) && !empty($postdata['variation_id'])) {
|
903 |
+
foreach ($postdata as $key => $field) {
|
904 |
+
if (preg_match('/^attribute\_/', $key)) {
|
905 |
+
unset($postdata[$key]);
|
906 |
+
}
|
907 |
+
}
|
908 |
+
}
|
909 |
+
foreach (array('add-to-cart', 'product_id', 'variation_id', 'quantity') as $field) {
|
910 |
+
if (array_key_exists($field, $postdata)) {
|
911 |
+
unset($postdata[$field]);
|
912 |
+
}
|
913 |
+
}
|
914 |
+
$postdata = array_filter($postdata);
|
915 |
+
if (empty($postdata)) {
|
916 |
+
return $cart_item_data;
|
917 |
+
}
|
918 |
+
ksort($postdata);
|
919 |
+
|
920 |
+
$cart_item_data['tinvwl_formdata'] = $postdata;
|
921 |
+
|
922 |
+
return $cart_item_data;
|
923 |
+
}
|
924 |
+
|
925 |
+
add_action('woocommerce_add_cart_item', 'tinvwl_add_to_cart_item_meta_post', 10, 2);
|
926 |
+
} // End if().
|
927 |
+
|
928 |
+
if (!function_exists('tinvwl_set_utm')) {
|
929 |
+
|
930 |
+
/**
|
931 |
+
* Set UTM sources.
|
932 |
+
*/
|
933 |
+
function tinvwl_set_utm()
|
934 |
+
{
|
935 |
+
|
936 |
+
// Forcing partners UTM.
|
937 |
+
if (class_exists('Ocean_Extra') && !defined('TINVWL_PARTNER') && !defined('TINVWL_CAMPAIGN')) {
|
938 |
+
define('TINVWL_PARTNER', 'oceanwporg');
|
939 |
+
define('TINVWL_CAMPAIGN', 'oceanwp_theme');
|
940 |
+
}
|
941 |
+
|
942 |
+
// Set a source.
|
943 |
+
$source = get_option(TINVWL_PREFIX . '_utm_source');
|
944 |
+
if (!$source || $source !== defined('TINVWL_PARTNER')) {
|
945 |
+
$source = defined('TINVWL_PARTNER') ? TINVWL_PARTNER : 'wordpress_org';
|
946 |
+
update_option(TINVWL_PREFIX . '_utm_source', $source);
|
947 |
+
}
|
948 |
+
|
949 |
+
define('TINVWL_UTM_SOURCE', $source);
|
950 |
+
|
951 |
+
// Set a medium.
|
952 |
+
$medium = get_option(TINVWL_PREFIX . '_utm_medium');
|
953 |
+
if (!$medium || ('organic' === $medium && defined('TINVWL_PARTNER'))) {
|
954 |
+
$medium = defined('TINVWL_PARTNER') ? 'integration' : 'organic';
|
955 |
+
update_option(TINVWL_PREFIX . '_utm_medium', $medium);
|
956 |
+
}
|
957 |
+
|
958 |
+
define('TINVWL_UTM_MEDIUM', $medium);
|
959 |
+
|
960 |
+
// Set a campaign.
|
961 |
+
$campaign = get_option(TINVWL_PREFIX . '_utm_campaign');
|
962 |
+
if (!$campaign || $campaign !== defined('TINVWL_CAMPAIGN')) {
|
963 |
+
$campaign = defined('TINVWL_PARTNER') ? (defined('TINVWL_CAMPAIGN') ? TINVWL_CAMPAIGN : TINVWL_PARTNER) : 'organic';
|
964 |
+
update_option(TINVWL_PREFIX . '_utm_campaign', $campaign);
|
965 |
+
}
|
966 |
+
|
967 |
+
define('TINVWL_UTM_CAMPAIGN', $campaign);
|
968 |
+
}
|
969 |
+
} // End if().
|
970 |
+
|
971 |
+
if (!function_exists('is_wishlist')) {
|
972 |
+
|
973 |
+
/**
|
974 |
+
* is_wishlist - Returns true when viewing the wishlist page.
|
975 |
+
*
|
976 |
+
* @return bool
|
977 |
+
*/
|
978 |
+
function is_wishlist()
|
979 |
+
{
|
980 |
+
return (is_page(apply_filters('wpml_object_id', tinv_get_option('page', 'wishlist'), 'page', true)));
|
981 |
+
}
|
982 |
+
}
|
983 |
+
|
984 |
+
if (!function_exists('tinvwl_get_wishlist_products')) {
|
985 |
+
/**
|
986 |
+
* Get wishlist products for default user wishlist or by ID or SHAREKEY
|
987 |
+
*
|
988 |
+
* @param int $wishlist_id by ID or SHAREKEY, 0 = default wishlist of current user
|
989 |
+
* @param array $data query parameters for get() method of TInvWL_Product() class.
|
990 |
+
*
|
991 |
+
* @return array|bool
|
992 |
+
*/
|
993 |
+
function tinvwl_get_wishlist_products($wishlist_id = 0, $data = array())
|
994 |
+
{
|
995 |
+
$wishlist = tinv_wishlist_get($wishlist_id);
|
996 |
+
if (empty($wishlist)) {
|
997 |
+
return false;
|
998 |
+
}
|
999 |
+
$wlp = new TInvWL_Product($wishlist);
|
1000 |
+
$products = $wlp->get_wishlist($data);
|
1001 |
+
|
1002 |
+
if (empty($products)) {
|
1003 |
+
return false;
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
return $products;
|
1007 |
+
}
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
add_action('init', function () {
|
1011 |
+
if (!is_user_logged_in()) {
|
1012 |
+
add_filter('nonce_user_logged_out', function ($uid, $action = -1) {
|
1013 |
+
if ($action === 'wp_rest') {
|
1014 |
+
return get_current_user_id();
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
return $uid;
|
1018 |
+
}, 99, 2);
|
1019 |
+
}
|
1020 |
+
});
|