YITH WooCommerce Wishlist - Version 3.0.7

Version Description

  • Released on 03 March 2020 =

  • New: support for WordPress 5.4

  • New: support for WooCommerce 4.0

  • New: improved checks on user capabilities

  • New: added wishlist widgets to Elementor

  • Update: plugin framework

  • Tweak: added check on user permission level for all wishlist actions

  • Tweak: escape output on templates

  • Fix: custom css not being loaded in the page

  • Fix: compatibility with YITH Infinite Scrolling when ajax loading is enabled

  • Fix: hide share section on wishlist page when "Share wishlist" option is disabled

  • Fix: assign correct css rule to border color for Wishlist Table

  • Dev: added yith_wcwl_reload_fragments trigger to refresh wishlist fragments

  • Dev: added yith_wcwl_remove_hidden_products_via_query filter

  • Dev: added yith_wcwl_show_add_to_wishlist filter, to allow dev selectively hide Add to Wishlist buttons

  • Dev: new actions on wishlist-view.php template (thanks to Jory)

  • Dev: added .editorconfig (thanks to Jory)

Download this release

Release Info

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

Code changes from version 3.0.6 to 3.0.7

Files changed (42) hide show
  1. .editorconfig +26 -0
  2. README.md +98 -21
  3. README.txt +22 -3
  4. assets/css/style.css +1 -1
  5. assets/css/unminified/style.css +86 -4
  6. assets/js/jquery.yith-wcwl.js +1 -1
  7. assets/js/unminified/jquery.yith-wcwl.js +136 -13
  8. includes/class.yith-wcwl-admin.php +9 -9
  9. includes/class.yith-wcwl-ajax-handler.php +57 -59
  10. includes/class.yith-wcwl-frontend.php +661 -645
  11. includes/class.yith-wcwl-install.php +359 -357
  12. includes/class.yith-wcwl-shortcode.php +49 -8
  13. includes/class.yith-wcwl-wishlist.php +71 -5
  14. includes/class.yith-wcwl.php +769 -769
  15. includes/data-stores/class.yith-wcwl-wishlist-data-store.php +23 -14
  16. includes/data-stores/class.yith-wcwl-wishlist-item-data-store.php +30 -6
  17. includes/functions.yith-wcwl.php +277 -251
  18. includes/widgets/elementor/class.yith-wcwl-elementor-add-to-wishlist.php +214 -0
  19. includes/widgets/elementor/class.yith-wcwl-elementor-wishlist.php +156 -0
  20. init.php +12 -12
  21. plugin-fw/assets/js/yit-plugin-panel.js +9 -0
  22. plugin-fw/assets/js/yit-plugin-panel.min.js +8 -1
  23. plugin-fw/init.php +2 -2
  24. plugin-fw/languages/yith-plugin-fw-el.mo +0 -0
  25. plugin-fw/languages/yith-plugin-fw-el.po +118 -89
  26. plugin-fw/lib/yit-plugin-panel-wc.php +24 -20
  27. plugin-fw/lib/yit-plugin-panel.php +8 -7
  28. plugin-fw/lib/yith-system-status.php +45 -39
  29. plugin-fw/templates/panel/panel-field-container.php +4 -2
  30. templates/add-to-wishlist-added.php +5 -5
  31. templates/add-to-wishlist-browse.php +20 -20
  32. templates/add-to-wishlist-button.php +21 -21
  33. templates/add-to-wishlist-remove.php +26 -26
  34. templates/add-to-wishlist.php +34 -34
  35. templates/share.php +67 -67
  36. templates/wishlist-view-footer-mobile.php +88 -88
  37. templates/wishlist-view-footer.php +87 -87
  38. templates/wishlist-view-header.php +19 -18
  39. templates/wishlist-view-mobile.php +232 -225
  40. templates/wishlist-view.php +300 -244
  41. templates/wishlist.php +3 -3
  42. uninstall.php +11 -11
.editorconfig ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is for unifying the coding style for different editors and IDEs
2
+ # editorconfig.org
3
+ # https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
4
+
5
+ # WordPress Coding Standards
6
+ # http://make.wordpress.org/core/handbook/coding-standards/
7
+
8
+ root = true
9
+
10
+ [*]
11
+ charset = utf-8
12
+ end_of_line = lf
13
+ indent_style = tab
14
+ indent_size = 4
15
+ tab_width = 4
16
+ insert_final_newline = true
17
+ trim_trailing_whitespace = true
18
+ # spaces_around_operators = true
19
+ # spaces_around_brackets = both
20
+
21
+ [*.txt]
22
+ trim_trailing_whitespace = false
23
+
24
+ [*.yml]
25
+ indent_style = space
26
+ indent_size = 2
README.md CHANGED
@@ -13,16 +13,64 @@ If you are not a developer, please, use the [YITH WooCommerce Wishlist plugin pa
13
 
14
  ## About plugin
15
 
16
- What can really make the difference in conversions and amount of sales is without a doubt the freedom to share your own wishlist, even on social networks, and increase indirect sales: can you imagine the sales volume you can generate during holidays or birthdays, when relatives and friends will be looking for the wishlist of your clients to buy a gift?
17
 
18
- OOffer to your visitors a chance to add the products of your WooCommerce store to a wishlist page. With YITH WooCommerce Wishlist you can add a link on each product detail page
19
- to add the products to the wishlist page. The plugin will create the specific page for you and the products will be added on this page. Afterwards, you will be able to add them to the cart or remove them.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ## Getting started
22
 
23
  * [Installation Guide](#quick-guide)
24
  * [Languages](#available-languages)
25
  * [Documentation](#documentation)
 
26
  * [Changelog](#changelog)
27
  * [Support](#support)
28
  * [Reporting Security Issue](#reporting-security-issues)
@@ -70,27 +118,56 @@ You can find the official documentation of the plugin [here](https://docs.yithem
70
 
71
  We're also working hard to release a developer guide; please, follow our [social channels](http://twitter.com/yithemes) to be informed about any update.
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ## Changelog
74
 
75
- ### 3.0.6 Released on 04 February 2020
76
-
77
- * Tweak: avoid redirect for guest users if wishlist page is set to my-account
78
- * Tweak: minor improvements to localization
79
- * Tweak: update wrong text domains
80
- * Tweak: changed default value for ATW icons
81
- * Tweak: set wishlist session cookie JIT
82
- * Tweak: use secure cookie for sessions, when possible (thanks to Ahmed)
83
- * Tweak: improved cache handling for get_default_wishlist method
84
- * Tweak: even if system cannot set session cookie, calculate session_id and use it for the entire execution
85
- * Update: Italian language
86
  * Update: plugin framework
87
- * Fix: prevent error if list doesn't exists
88
- * Fix: issue with wishlist_id query param
89
- * Fix: items query now search for product in original language
90
- * Fix: returning correct wishlist and user id to yith_wcwl_added_to_wishlist and yith_wcwl_removed_from_wishlist actions (thanks to danielbitzer)
91
- * Fix: issue with default value for yith_wcwl_positions option
92
- * Fix: added key name to avoid DB error during install or update procedure
93
- * Dev: added yith_wcwl_shortcode_share_link_url filter
 
 
 
 
94
 
95
  ## Support
96
 
13
 
14
  ## About plugin
15
 
16
+ The wishlist is one of the most powerful and popular tools in an ecommerce shop. Thanks to the wishlist, users can:
17
 
18
+ * Save their favourite products, find them quickly and easily at a later time and buy them.
19
+ * Share the wishlist with relatives and friends for Christmas, birthdays and similar occasions so they can buy them one of the products from the list.
20
+ * Share the wishlist on social networks and get indirect advertising for your store.
21
+
22
+ This means that you’ll be able to loyalise customers, push them to buy and attract new customers any time a wishlist is shared. Not bad for one plugin only, don’t you think?
23
+
24
+ Our YITH WooCommerce Wishlist has more than **700,000 active installations** and that’s why it’s **the most popular wishlist plugin ever.**
25
+
26
+ To celebrate this record and say thanks to all the plugin users, we’ve decided to release a new 3.0 version that has improved the design tremendously and added many new options.
27
+
28
+ **If you like the new design, please, [leave a review](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/reviews/#new-post) to help the plugin grow!**
29
+
30
+ [Free version live demo >](https://plugins.yithemes.com/yith-woocommerce-wishlist-free/)
31
+ [Documentation >](https://docs.yithemes.com/yith-woocommerce-wishlist)
32
+
33
+ ### Basic features
34
+
35
+ * Select a page for your wishlist
36
+ * Select where to show the shortcode ‘Add to wishlist’
37
+ * Show the ‘Remove from wishlist’ button when the product is in the Wishlist
38
+ * Show the ‘Add to wishlist’ button also on the Shop page
39
+ * Customise columns that will be displayed in the wishlist table
40
+ * Product variation support (if the user selects a specific color or size and then adds it to the wishlist, this details will be saved)
41
+
42
+ ### Premium features
43
+
44
+ [Premium version live demo >](https://plugins.yithemes.com/yith-woocommerce-wishlist/)
45
+
46
+ The free version of our plugin works like a charm, but the premium one is an even more powerful tool to increase sales and conversions. By upgrading to the premium version, you can:
47
+
48
+ * View the wishlists created by logged-in customers
49
+ * View a list of popular products (added to wishlists)
50
+ * Send promotionals email to users who have added a specific product to their wishlist
51
+ * Show the ‘Ask for an estimate’ button to let customers send the content of their wishlist to the admin and get a quotation
52
+ * Add optional notes to the quote request
53
+ * Enable/disable the wishlist features for unlogged users
54
+ * Show a notice to unlogged users: invite them to log in to benefit from all the wishlist functionalities
55
+ * Allow users to create as many wishlists as they want
56
+ * Allow users to manage wishlists, rename and delete them, add or remove items
57
+ * Allow users to search and see registered wishlists
58
+ * Allow users to set visibility options for each wishlist, by making them either public (visible to everyone), private (visible to the owner only) or shared (visible only to people it has been shared with)
59
+ * Show multiple ‘Add to Cart’ buttons in the wishlist table
60
+ * Show product price variations (Amazon style)
61
+ * Allow users to move an element from one wishlist to another, right from the wishlist table
62
+ * Allow users to drag and drop products to arrange their order in the wishlist
63
+ * Choose modern & beautiful layouts for the wishlist page and tables
64
+ * Provide your customers with nice widgets to help them find their wishlist quickly and easily.
65
+
66
+ [GET THE PREMIUM VERSION HERE with a 100% Money Back guarantee >](https://yithemes.com/themes/plugins/yith-woocommerce-wishlist/)
67
 
68
  ## Getting started
69
 
70
  * [Installation Guide](#quick-guide)
71
  * [Languages](#available-languages)
72
  * [Documentation](#documentation)
73
+ * [FAQ](#faq)
74
  * [Changelog](#changelog)
75
  * [Support](#support)
76
  * [Reporting Security Issue](#reporting-security-issues)
118
 
119
  We're also working hard to release a developer guide; please, follow our [social channels](http://twitter.com/yithemes) to be informed about any update.
120
 
121
+ ## FAQ
122
+
123
+ **Does YITH WooCommerce Wishlist allows adding an “add to wishlist” button on the products on shop page and archive pages?**
124
+
125
+ Yes, from version 3.0 the plugin also allows showing the Add to wishlist button on your **shop page, category pages, product shortcodes, product sliders,** and all the other places where the WooCommerce products’ loop is used.
126
+
127
+ **Can I customize the wishlist page?**
128
+
129
+ Yes, the page is a simple template and you can override it by putting the file template "wishlist.php" inside the "woocommerce" folder of the theme folder.
130
+
131
+ **Can I move the position of "Add to wishlist" button?**
132
+
133
+ Yes, you can move the button to another default position or you can also use the shortcode inside your theme code.
134
+
135
+ **Can I change the style of "Add to wishlist" button?**
136
+
137
+ Yes, you can change the colors of background, text and border or apply a custom css. You can also use a link or a button for the "Add to wishlist" feature.
138
+
139
+ **Wishlist page returns a 404 error?**
140
+
141
+ Try to regenerate permalinks from Settings -> Permalinks by simply saving them again.
142
+
143
+ **Have you encountered anomalies after plugin update, that did not exist in the previous version?**
144
+
145
+ This might depend on the fact that your theme overrides plugin templates. Check if the developer of your theme has released a compatibility update with version 3.0 or later of YITH WooCommerce Wishlist. As an alternative you can try the plugin in WordPress default theme to leave out any possible influences by the theme.
146
+
147
+ **I am currently using Wishlist plugin with Catalog Mode enabled in my site. Prices for products should disappear, yet they still appear in the wishlist page. Can I remove them?**
148
+
149
+ Yes, of course you can. To avoid Wishlist page to show product prices, you can hide price column from wishlist table. Go to YITH -> Wishlist -> Wishlist Page Options and disable option "Product price".
150
+
151
  ## Changelog
152
 
153
+ ### 3.0.7 - Released on 03 March 2020
154
+
155
+ * New: support for WordPress 5.4
156
+ * New: support for WooCommerce 4.0
157
+ * New: improved checks on user capabilities
158
+ * New: added wishlist widgets to Elementor
 
 
 
 
 
159
  * Update: plugin framework
160
+ * Tweak: added check on user permission level for all wishlist actions
161
+ * Tweak: escape output on templates
162
+ * Fix: custom css not being loaded in the page
163
+ * Fix: compatibility with YITH Infinite Scrolling when ajax loading is enabled
164
+ * Fix: hide share section on wishlist page when "Share wishlist" option is disabled
165
+ * Fix: assign correct css rule to border color for Wishlist Table
166
+ * Dev: added yith_wcwl_reload_fragments trigger to refresh wishlist fragments
167
+ * Dev: added yith_wcwl_remove_hidden_products_via_query filter
168
+ * Dev: added yith_wcwl_show_add_to_wishlist filter, to allow dev selectively hide Add to Wishlist buttons
169
+ * Dev: new actions on wishlist-view.php template (thanks to Jory)
170
+ * Dev: added .editorconfig (thanks to Jory)
171
 
172
  ## Support
173
 
README.txt CHANGED
@@ -3,13 +3,13 @@
3
  Contributors: yithemes
4
  Tags: wishlist, woocommerce, products, yit, e-commerce, shop, ecommerce wishlist, yith, woocommerce wishlist, shop wishlist
5
  Requires at least: 4.0
6
- Tested up to: 5.3
7
- Stable tag: 3.0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  YITH WooCommerce Wishlist add all Wishlist features to your website. Needs WooCommerce to work.
12
- WooCommerce 3.9.x compatible.
13
 
14
  == Description ==
15
 
@@ -112,6 +112,25 @@ Yes, of course you can. To avoid Wishlist page to show product prices, you can h
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  = 3.0.6 – Released on 04 February 2020 =
116
 
117
  * Tweak: avoid redirect for guest users if wishlist page is set to my-account
3
  Contributors: yithemes
4
  Tags: wishlist, woocommerce, products, yit, e-commerce, shop, ecommerce wishlist, yith, woocommerce wishlist, shop wishlist
5
  Requires at least: 4.0
6
+ Tested up to: 5.4
7
+ Stable tag: 3.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  YITH WooCommerce Wishlist add all Wishlist features to your website. Needs WooCommerce to work.
12
+ WooCommerce 4.0.x compatible.
13
 
14
  == Description ==
15
 
112
 
113
  == Changelog ==
114
 
115
+ = 3.0.7 - Released on 03 March 2020 =
116
+
117
+ * New: support for WordPress 5.4
118
+ * New: support for WooCommerce 4.0
119
+ * New: improved checks on user capabilities
120
+ * New: added wishlist widgets to Elementor
121
+ * Update: plugin framework
122
+ * Tweak: added check on user permission level for all wishlist actions
123
+ * Tweak: escape output on templates
124
+ * Fix: custom css not being loaded in the page
125
+ * Fix: compatibility with YITH Infinite Scrolling when ajax loading is enabled
126
+ * Fix: hide share section on wishlist page when "Share wishlist" option is disabled
127
+ * Fix: assign correct css rule to border color for Wishlist Table
128
+ * Dev: added yith_wcwl_reload_fragments trigger to refresh wishlist fragments
129
+ * Dev: added yith_wcwl_remove_hidden_products_via_query filter
130
+ * Dev: added yith_wcwl_show_add_to_wishlist filter, to allow dev selectively hide Add to Wishlist buttons
131
+ * Dev: new actions on wishlist-view.php template (thanks to Jory)
132
+ * Dev: added .editorconfig (thanks to Jory)
133
+
134
  = 3.0.6 – Released on 04 February 2020 =
135
 
136
  * Tweak: avoid redirect for guest users if wishlist page is set to my-account
assets/css/style.css CHANGED
@@ -1 +1 @@
1
- .woocommerce a.selectBox{background:#fff;min-width:100px;margin-right:10px;color:inherit}.woocommerce a.selectBox,.woocommerce a.selectBox:hover{border-bottom:1px solid #bbb!important}.woocommerce a.selectBox:hover{color:inherit}.woocommerce a.selectBox:focus{border:1px solid #ccc}.selectBox-dropdown .selectBox-label{vertical-align:middle;padding:3px 8px}.selectBox-dropdown .selectBox-arrow{border:none;background:url(../images/jquery.selectBox-arrow.png) center right no-repeat}.selectBox-dropdown.selectBox-menuShowing .selectBox-arrow{background:url(../images/jquery.selectBox-arrow.png) center left no-repeat}.selectBox-dropdown-menu{border-bottom-left-radius:3px;border-bottom-right-radius:3px;padding:5px;font-size:80%}.selectBox-dropdown-menu li a{color:inherit;padding:5px 8px;border-radius:3px}.selectBox-dropdown-menu a:hover{color:inherit;text-decoration:none}select.selectBox.change-wishlist{max-width:100px}.selectBox.change-wishlist{width:auto!important}.change-wishlist-selectBox-dropdown-menu{width:auto!important}.yith-wcwl-with-pretty-photo{overflow:hidden}.woocommerce .wishlist-fragment .blockUI.blockOverlay::before,.woocommerce .yith-wcwl-popup-form .blockUI.blockOverlay::before{display:none}.yith-wcwl-popup{display:none}.yith-wcwl-popup-content h3{text-align:center;font-size:1.5em}.yith-wcwl-popup-content .heading-icon,.yith-wcwl-popup-feedback .heading-icon{text-align:center;display:block;font-size:70px;color:#333;margin-bottom:15px}.yith-wcwl-popup-content .popup-description{text-align:center;font-weight:600;margin-bottom:15px}.yith-wcwl-popup-content .popup-description a.show-tab.active{cursor:inherit;color:inherit;pointer-events:none}.yith-wcwl-popup-feedback p.feedback{margin-top:1.5em;text-align:center;font-size:1.1rem;font-weight:600}.yith-wcwl-popup-content label{display:block}.yith-wcwl-popup-content input[type=text],.yith-wcwl-popup-content select{padding:10px 7px}.yith-wcwl-popup-content .create{display:none}.yith-wcwl-popup-content .yith-wcwl-second-row{display:none}.yith-wcwl-popup-footer{margin-top:15px}.yith-wcwl-popup-footer .button.wishlist-submit{display:block;width:100%;text-align:center}.pp_pic_holder.pp_woocommerce.feedback{max-width:450px!important}.pp_pic_holder.pp_woocommerce.feedback .pp_content{width:auto!important}.yith-wcwl-popup-feedback{margin-top:2em;margin-bottom:2em}.yith-wcwl-add-button.with-dropdown{position:relative;padding:15px 0}.yes-js .yith-wcwl-add-button ul.yith-wcwl-dropdown{display:none;list-style:none;margin-bottom:0;padding:5px 25px;border:1px solid #cdcdcd;background:#fff;position:absolute;z-index:15;top:calc(100% - 5px);min-width:200px}.yith-wcwl-add-button.show-dropdown ul.yith-wcwl-dropdown{display:block}.yith-wcwl-add-button ul.yith-wcwl-dropdown li{padding:15px;padding-left:0;text-transform:uppercase;font-size:.8em}.yith-wcwl-add-button ul.yith-wcwl-dropdown li a{font-size:1em!important;color:inherit;box-shadow:none}.yith-wcwl-add-button ul.yith-wcwl-dropdown li a:hover{color:initial}.yith-wcwl-add-button ul.yith-wcwl-dropdown li:before{font-family:FontAwesome;content:'\f067';margin-right:15px}.yith-wcwl-add-button ul.yith-wcwl-dropdown li:not(:last-child){border-bottom:1px solid #cdcdcd}.yith-wcwl-add-to-wishlist .separator+[data-title]{display:inline-block}.yith-wcwl-add-to-wishlist .with-tooltip{position:relative}.yith-wcwl-tooltip{z-index:10;padding:5px 10px;border-radius:5px;text-align:center;top:calc(100% + 5px);pointer-events:none;cursor:initial;font-size:.6875rem;line-height:normal;display:none}.with-dropdown .yith-wcwl-tooltip{top:auto;bottom:calc(100% + 10px)}.with-tooltip .yith-wcwl-tooltip{position:absolute}.with-tooltip .yith-wcwl-tooltip:before{content:'';display:block;position:absolute;top:-5px;left:calc(50% - 2px);width:0;height:0;background:0 0!important;border-left:5px solid transparent!important;border-right:5px solid transparent!important;border-bottom:5px solid}.with-dropdown .with-tooltip .yith-wcwl-tooltip:before{bottom:-5px;top:auto;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid;border-bottom:none}#yith-wcwl-popup-message{font-weight:700;line-height:50px;text-align:center;background:#fff;-webkit-box-shadow:0 0 15px rgba(0,0,0,.3);-moz-box-shadow:0 0 15px rgba(0,0,0,.3);box-shadow:0 0 15px rgba(0,0,0,.3);position:fixed;top:50%;left:50%;padding:7px 40px;z-index:10000}.wishlist-title{display:inline-block}.wishlist-title h2{display:inline-block;padding:5px}.wishlist-title.wishlist-title-with-form h2:hover{background:#efefef}.wishlist-title a.show-title-form{cursor:pointer;visibility:hidden}.wishlist-title:hover a.show-title-form{visibility:visible}.yes-js #yith-wcwl-form .hidden-title-form{display:none;margin:25px 0 39px}table.wishlist_table{font-size:80%}table.wishlist_table tr{position:relative}table.wishlist_table thead th{border-top:1px solid;padding:16px 12px}table.wishlist_table tbody td{padding:16px 12px}table.wishlist_table tbody td,table.wishlist_table thead th{border-color:#e7e7e7}.wishlist_table tr td,.wishlist_table tr th.product-checkbox,.wishlist_table tr th.wishlist-delete{text-align:center;background:#fff}.wishlist_table tr th.product-checkbox{vertical-align:middle;width:40px}.wishlist_table tr th.product-remove{vertical-align:middle;width:40px}.wishlist_table tr th.product-thumbnail{width:80px}.wishlist_table tfoot td,.wishlist_table tr td.product-name,.wishlist_table tr td.product-thumbnail,.wishlist_table tr td.wishlist-name,.wishlist_table tr td.wishlist-privacy{text-align:left}.wishlist_table tr td.product-remove{padding:16px 0}.wishlist_table tr td.product-thumbnail a{display:block;border:none;max-width:80px}.wishlist_table tr td.product-thumbnail a img{width:100%}.wishlist_table tr td.product-arrange{cursor:grab}.wishlist_table tr td.product-arrange:active{cursor:grabbing}.wishlist_table .product-stock-status span.wishlist-in-stock{color:#297e29}.wishlist_table .product-stock-status span.wishlist-out-of-stock{color:red}.wishlist_table .product-add-to-cart span.dateadded{display:block}.wishlist_table .product-add-to-cart a{display:table!important;margin:0 auto 5px!important;text-align:center}.wishlist_table .product-add-to-cart a.button{padding:6px 25px!important}.wishlist_table .product-add-to-cart a>img{display:inline;max-width:2em}.wishlist_table .price-variation{display:block}.wishlist_table .price-variation.decrease .variation-rate{color:red}.wishlist_table .price-variation .old-price{display:block}.wishlist_table a.button{white-space:normal;margin-bottom:5px!important}.wishlist_table.modern_grid{list-style:none;margin:0 -7px 35px;font-size:0}.wishlist_table.modern_grid li{display:inline-block;vertical-align:top;width:33.33%;padding:0 7px;margin-bottom:15px}.wishlist_table.images_grid li.wishlist-empty,.wishlist_table.modern_grid li.wishlist-empty{width:100%;font-size:1rem}.wishlist_table.images_grid li.show{z-index:10}.wishlist_table.modern_grid li .item-wrapper{display:table;margin:0 -7px}.wishlist_table.modern_grid li .item-details,.wishlist_table.modern_grid li .product-thumbnail{display:table-cell;vertical-align:top;box-sizing:border-box;width:50%;padding:0 7px;font-size:1rem}.wishlist_table.images_grid li .product-thumbnail,.wishlist_table.modern_grid li .product-thumbnail{position:relative}.wishlist_table.images_grid li .product-thumbnail .product-checkbox,.wishlist_table.modern_grid li .product-thumbnail .product-checkbox{position:absolute;top:7px;left:15px;z-index:2}.wishlist_table.modern_grid li .product-thumbnail>a{display:block}.wishlist_table.modern_grid li .product-thumbnail>a img{display:block}.wishlist_table.images_grid li.show .product-thumbnail>a img,.wishlist_table.images_grid li:hover .product-thumbnail>a img{filter:brightness(1.1)}.wishlist_table.modern_grid.wishlist_view li .item-details{position:relative}.wishlist_table.modern_grid.wishlist_view li .item-details:before{content:'';display:block;top:0;bottom:0;left:7px;background:#fff;position:absolute;right:7px;z-index:0;border:1px solid #cdcdcd}.wishlist_table.images_grid li .item-details{display:none;position:absolute;z-index:2;bottom:15px;left:calc(50% - 150px);width:300px;background:#fff;padding:10px 20px;-webkit-box-shadow:0 0 15px rgba(0,0,0,.3);-moz-box-shadow:0 0 15px rgba(0,0,0,.3);box-shadow:0 0 15px rgba(0,0,0,.3)}.wishlist_table.images_grid li.show .item-details{display:block}.wishlist_table.modern_grid li .item-details .item-details-wrapper{padding:15px 20px;line-height:normal;position:relative}.wishlist_table.images_grid li .item-details a.close{position:absolute;top:10px;right:20px}.wishlist_table.images_grid li .item-details h3,.wishlist_table.mobile li .item-details h3,.wishlist_table.modern_grid li .item-details h3{margin-bottom:7px}.wishlist_table.images_grid li .item-details table.item-details-table,.wishlist_table.mobile li .item-details table.item-details-table,.wishlist_table.mobile li table.additional-info,.wishlist_table.modern_grid li .item-details table.item-details-table{border:none;margin-bottom:7px}.wishlist_table.images_grid li .item-details table.item-details-table td,.wishlist_table.mobile li .item-details table.item-details-table td,.wishlist_table.mobile li table.additional-info td,.wishlist_table.modern_grid li .item-details table.item-details-table td{border:none;font-size:.7em;padding:3px;vertical-align:top}.wishlist_table.images_grid li .item-details table.item-details-table td.label,.wishlist_table.mobile li .item-details table.item-details-table td.label,.wishlist_table.mobile li table.additional-info td.label,.wishlist_table.modern_grid li .item-details table.item-details-table td.label{text-align:left;font-weight:700;width:40%}.wishlist_table.images_grid li .item-details table.item-details-table td.value,.wishlist_table.mobile li .item-details table.item-details-table td.value,.wishlist_table.mobile li table.additional-info td.value,.wishlist_table.modern_grid li .item-details table.item-details-table td.value{text-align:right}.wishlist_table.modern_grid li .item-details table.item-details-table td.value a.selectBox{margin-right:0}.wishlist_table.images_grid li .item-details table.item-details-table td.value input,.wishlist_table.mobile li table.additional-info td.value input,.wishlist_table.modern_grid li .item-details table.item-details-table td.value input{width:auto}.wishlist_table.images_grid li .item-details .product-add-to-cart,.wishlist_table.modern_grid li .item-details .product-add-to-cart{text-align:center;margin-bottom:7px}.wishlist_table.images_grid li .item-details .move-to-another-wishlist,.wishlist_table.modern_grid li .item-details .move-to-another-wishlist{text-align:center;margin-bottom:7px}.wishlist_table.images_grid li .item-details .product-remove,.wishlist_table.modern_grid li .item-details .product-remove{text-align:right}.wishlist_table.images_grid li .item-details .product-remove a,.wishlist_table.modern_grid li .item-details .product-remove a{border:none;border-radius:0;display:inline-block}.wishlist_table.mobile{list-style:none;margin-left:0}.wishlist_table.mobile li{margin-bottom:7px}.wishlist_table.mobile li .product-checkbox{display:inline-block;width:20px;vertical-align:top}.wishlist_table.mobile li .item-wrapper{display:inline-block;width:calc(100% - 25px);vertical-align:top;margin-bottom:7px}.wishlist_table.wishlist_manage_table.mobile li .item-wrapper{width:100%}.wishlist_table.mobile li .item-wrapper .product-thumbnail{display:inline-block;max-width:60px;margin-right:10px}.wishlist_table.mobile li .item-wrapper .item-details{display:inline-block;width:calc(100% - 80px);vertical-align:top}.wishlist_table.mobile.with-checkbox li .additional-info-wrapper{padding-left:20px}.wishlist_table.mobile li .additional-info-wrapper .move-to-another-wishlist,.wishlist_table.mobile li .additional-info-wrapper .product-add-to-cart{text-align:center;margin-bottom:7px}.wishlist_table.mobile li .additional-info-wrapper .product-remove{text-align:right}a.add_to_wishlist{cursor:pointer}.yith-wcwl-add-to-wishlist .feedback .yith-wcwl-icon{margin-right:5px}.yith-wcwl-add-to-wishlist a.add_to_wishlist>img,.yith-wcwl-add-to-wishlist a.delete_item>img,.yith-wcwl-add-to-wishlist a.move_to_another_wishlist>img{max-width:32px;display:inline-block;margin-right:10px}a.add_to_wishlist+a.view-wishlist,a.delete_item+a.view-wishlist{margin-left:15px}.summary .single_add_to_wishlist.button,div.product .woocommerce-price-and-add .single_add_to_wishlist.button{margin:0}.wishlist_table .add_to_cart.button{padding:7px 12px;line-height:normal}.yith-wcwl-add-to-wishlist{margin-top:10px}.hidden-title-form a.hide-title-form i,.hidden-title-form button i,.wishlist-title a.show-title-form i,.wishlist_manage_table tfoot a.create-new-wishlist i,.wishlist_manage_table tfoot button.submit-wishlist-changes i,.wishlist_table .add_to_cart.button i,.wishlist_table .ask-an-estimate-button i,.yith-wcwl-add-button>a i,.yith-wcwl-wishlist-new button i,.yith-wcwl-wishlist-search-form button.wishlist-search-button i{margin-right:10px}.hidden-title-form a.hide-title-form,.wishlist-title a.show-title-form,.wishlist_manage_table a.create-new-wishlist,.wishlist_manage_table button.submit-wishlist-changes,.wishlist_table .add_to_cart.button,.wishlist_table a.ask-an-estimate-button,.woocommerce .yith-wcwl-wishlist-new button,.yith-wcwl-add-button a.add_to_wishlist,.yith-wcwl-popup-button a.add_to_wishlist,.yith-wcwl-wishlist-search-form button.wishlist-search-button{margin:0;box-shadow:none;text-shadow:none}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist{position:absolute;z-index:10;margin:0;top:10px;left:10px}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .with-dropdown{padding:0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .add_to_wishlist,.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .disabled_item,.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .open-pretty-photo{font-size:0;background:0 0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .delete_item,.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .move_to_another_wishlist{font-size:0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .feedback{display:none}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .feedback+a{font-size:0;background:0 0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist i{font-size:1.6rem;margin:0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist img{margin:0}.woocommerce .wishlist-title{margin-bottom:30px}.woocommerce .wishlist-title h2{vertical-align:middle;margin-bottom:0}.woocommerce .hidden-title-form button{padding:7px 24px;vertical-align:middle;border:none;position:relative}.woocommerce .hidden-title-form button:active{top:1px}.woocommerce .hidden-title-form a.hide-title-form{vertical-align:middle;line-height:normal}.woocommerce .back-to-all-wishlists{margin-bottom:20px}.woocommerce #content table.wishlist_table.cart a.remove{color:#c3c3c3;margin:0 auto}.woocommerce #content table.wishlist_table.cart a.remove:hover{background-color:#c3c3c3;color:#fff}.yith-wcwl-share{margin-bottom:35px}.yith-wcwl-share h4.yith-wcwl-share-title{margin:10px 0}.yith-wcwl-share ul{margin:5px 0;padding:0}.entry-content .yith-wcwl-share ul li,.yith-wcwl-share ul li{display:inline-block;margin-left:0;margin-right:0}.yith-wcwl-share li a{color:#fff;text-align:center;text-decoration:none;line-height:1;padding:5px;display:block;border:none;min-width:26px;min-height:26px}.yith-wcwl-share li a:hover{color:#fff}.yith-wcwl-share li a>img{max-width:1em}.copy-trigger{cursor:pointer}.woocommerce .ask-an-estimate-button>img{max-width:1em;display:inline;margin-right:5px}#ask_an_estimate_popup{display:none}.wishlist-ask-an-estimate-popup .ask-an-estimate-button-popup{width:100%}.wishlist-ask-an-estimate-popup .woocommerce-error{margin-bottom:0}.wishlist-ask-an-estimate-popup #additional_notes{min-height:150px}.ask-an-estimate-confirmation{padding:0 30px;text-align:center}.yith_wcwl_wishlist_footer>div{margin-bottom:15px}.yith_wcwl_wishlist_footer .yith_wcwl_wishlist_bulk_action{float:left}.yith_wcwl_wishlist_footer .yith_wcwl_wishlist_bulk_action #bulk_actions{min-width:250px}.yith_wcwl_wishlist_footer .yith_wcwl_wishlist_update{float:right}.yith_wcwl_wishlist_footer .yith-wcwl-share{float:left;clear:both}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action{float:right}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action>*{vertical-align:middle}.yith_wcwl_wishlist_update+.yith_wcwl_footer_additional_action{clear:both}.wishlist-page-links{clear:both}#move_to_another_wishlist{display:none}.yith-wcwl-wishlist-new{padding:20px 0}.yith-wcwl-popup-content .yith-wcwl-wishlist-new{padding:0}.yith-wcwl-wishlist-new .wishlist-name{display:inline-block}.yith-wcwl-wishlist-new .wishlist-privacy-radio label{display:block}.yith-wcwl-popup-content .create-wishlist-button{margin-top:15px;width:100%}#create_new_wishlist{display:none}.wishlist_manage_table select{vertical-align:middle;margin-right:10px}.wishlist_manage_table td.wishlist-name .wishlist-title{margin-bottom:0}.wishlist_manage_table td.wishlist-name .hidden-title-form{margin:0!important}.wishlist_manage_table td.wishlist-name .hidden-title-form input[type=text]{width:100%;min-width:0}table.wishlist_manage_table tfoot td{text-align:right;padding:24px 12px}.wishlist_manage_table tfoot button.submit-wishlist-changes{padding:7px 24px;vertical-align:middle;border:1px solid;border-radius:3px;position:relative;line-height:normal}.wishlist_manage_table tfoot button.submit-wishlist-changes:active{top:1px}.wishlist_manage_table tfoot a.create-new-wishlist{vertical-align:middle;line-height:normal;padding:7px 24px}.wishlist_manage_table.modern_grid li .item-wrapper{display:block;margin:0;padding:40px 50px;background:#fff;border:1px solid #cdcdcd}.wishlist_manage_table.modern_grid li .item-details,.wishlist_manage_table.modern_grid li .product-thumbnail{display:block;width:100%;padding:0}.wishlist_manage_table.modern_grid li .product-thumbnail img:first-child{width:100%;margin-bottom:15px}.wishlist_manage_table.modern_grid li .product-thumbnail img{width:calc(50% - 8px)}.wishlist_manage_table.modern_grid li .product-thumbnail img:nth-child(3){margin-left:15px}.wishlist_manage_table.modern_grid li .wishlist-title-with-form{display:block}.wishlist_manage_table.modern_grid li .wishlist-title-with-form h3{display:inline-block}.wishlist_manage_table.modern_grid li .wishlist-title-with-form .show-title-form,.wishlist_manage_table.modern_grid li .wishlist-title-with-form .show-title-form:hover{visibility:visible;float:right;margin:0;background:0 0;color:inherit}.wishlist_manage_table.modern_grid li .wishlist-title-with-form .show-title-form i{margin:0}.wishlist_manage_table.modern_grid li .hidden-title-form{margin-top:0!important}.wishlist_manage_table.modern_grid li .hidden-title-form input[type=text]{width:100%;min-width:0}.wishlist_manage_table.mobile li{margin-bottom:30px}.wishlist_manage_table.mobile li .item-wrapper .item-details{width:100%}.wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title-with-form{display:block;border-bottom:1px solid #cdcdcd;position:relative}.wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title-with-form a.show-title-form{position:absolute;right:0;top:0;visibility:visible}.wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title-with-form a.show-title-form i{margin-right:0}.wishlist_manage_table.mobile li .item-details table.item-details-table td.value a.selectBox{margin-right:0}.wishlist_manage_table.mobile li .item-details table.item-details-table td.value a.wishlist-download{float:left}.yith-wcwl-wishlist-search-form{text-align:center;padding:20px 0}.yith-wcwl-wishlist-search-form #wishlist_search{display:inline-block;max-width:300px;vertical-align:middle}.yith-wcwl-wishlist-search-form button.wishlist-search-button{display:inline-block;padding:7px 24px;vertical-align:middle;border:1px solid;border-radius:3px;position:relative;line-height:normal}.yith-wcwl-wishlist-search-form button.wishlist-search-button i{margin:0}.yith-wcwl-wishlist-search-form button.wishlist-search-button:active{top:1px}.yith-wcwl-search-results .wishlist-owner{text-align:left}.yith-wcwl-search-results .wishlist-owner .thumb{display:inline-block;margin-right:15px}.yith-wcwl-add-to-wishlist .ajax-loading{box-shadow:none!important;-moz-box-shadow:none!important;-webkit-box-shadow:none!important;display:inline!important;margin-left:5px;vertical-align:middle;visibility:hidden;width:16px!important;height:16px!important}.widget_yith-wcwl-lists ul.dropdown li{padding:0}.widget_yith-wcwl-lists ul.dropdown ul.lists>li a,.widget_yith-wcwl-lists ul.dropdown>li a{display:block;padding:5px 15px}.widget_yith-wcwl-lists ul.dropdown ul.lists>li a{padding:5px 25px}.widget_yith-wcwl-lists ul.dropdown>li.lists-section{border-bottom:1px solid #e7e7e7}.widget_yith-wcwl-lists ul.dropdown ul.lists{margin:0}.widget_yith-wcwl-items .mini{position:relative}.widget_yith-wcwl-items .heading{text-align:center;cursor:pointer}.widget_yith-wcwl-items .mini .heading{display:inline-block}.widget_yith-wcwl-items .heading a{color:inherit}.widget_yith-wcwl-items .extended .heading .items-counter{position:relative}.widget_yith-wcwl-items .extended .heading .items-counter i{font-size:70px;position:relative;margin-bottom:10px}.widget_yith-wcwl-items .mini .heading .items-counter i{font-size:30px}.widget_yith-wcwl-items .extended .heading .items-counter .items-count{display:block;position:absolute;left:0;right:0;text-align:center;top:calc(50% - 20px);font-size:1rem}.widget_yith-wcwl-items .mini .heading .items-counter .items-count{font-size:1rem}.widget_yith-wcwl-items .extended .heading h3:after{content:'';display:block;max-width:80px;border-bottom:1px solid #cdcdcd;margin:10px auto}.widget_yith-wcwl-items .mini .list{position:absolute;z-index:1;left:0;background:#fff;padding:25px 40px;display:none;-webkit-box-shadow:0 0 15px rgba(0,0,0,.3);-moz-box-shadow:0 0 15px rgba(0,0,0,.3);box-shadow:0 0 15px rgba(0,0,0,.3)}.widget_yith-wcwl-items .mini:hover .list{display:block}.widget_yith-wcwl-items ul.product_list_widget{margin-bottom:40px!important}.widget_yith-wcwl-items p.empty-wishlist{margin-bottom:0!important}.widget_yith-wcwl-items .mini ul.product_list_widget{margin-left:-20px}.widget_yith-wcwl-items ul.product_list_widget li{display:table}.widget_yith-wcwl-items ul.product_list_widget li:not(:last-child){margin-bottom:10px}.widget_yith-wcwl-items ul.product_list_widget li .image-thumb,.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info,.widget_yith-wcwl-items ul.product_list_widget li .remove_from_all_wishlists{display:table-cell;vertical-align:middle}.widget_yith-wcwl-items ul.product_list_widget li .remove_from_all_wishlists{font-size:1.2rem}.widget_yith-wcwl-items ul.product_list_widget li .image-thumb img{margin-left:10px;max-width:40px}.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info{display:inline-block;vertical-align:middle;margin-left:10px}.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info a{display:inline-block}.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info>*{display:block}.widget_yith-wcwl-items .show-wishlist,.widget_yith-wcwl-items a.add_all_to_cart{display:block!important}.widget_yith-wcwl-items .show-wishlist{margin-bottom:10px}.widget_yith-wcwl-items a.add_all_to_cart{text-align:center}@media(max-width:768px){.yith_wcwl_wishlist_bulk_action select{width:100%;margin-bottom:15px}.yith_wcwl_wishlist_bulk_action input{float:right}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action{float:none}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action .ask-an-estimate-button{width:100%;text-align:center}}
1
+ .woocommerce a.selectBox{background:#fff;min-width:100px;margin-right:10px;color:inherit}.woocommerce a.selectBox,.woocommerce a.selectBox:hover{border-bottom:1px solid #bbb!important}.woocommerce a.selectBox:hover{color:inherit}.woocommerce a.selectBox:focus{border:1px solid #ccc}.selectBox-dropdown .selectBox-label{vertical-align:middle;padding:3px 8px}.selectBox-dropdown .selectBox-arrow{border:none;background:url(../images/jquery.selectBox-arrow.png) center right no-repeat}.selectBox-dropdown.selectBox-menuShowing .selectBox-arrow{background:url(../images/jquery.selectBox-arrow.png) center left no-repeat}.selectBox-dropdown-menu{border-bottom-left-radius:3px;border-bottom-right-radius:3px;padding:5px;font-size:80%}.selectBox-dropdown-menu li a{color:inherit;padding:5px 8px;border-radius:3px}.selectBox-dropdown-menu a:hover{color:inherit;text-decoration:none}select.selectBox.change-wishlist{max-width:100px}.selectBox.change-wishlist{width:auto!important}.change-wishlist-selectBox-dropdown-menu{width:auto!important}.yith-wcwl-with-pretty-photo{overflow:hidden}.woocommerce .wishlist-fragment .blockUI.blockOverlay::before,.woocommerce .yith-wcwl-popup-form .blockUI.blockOverlay::before{display:none}.yith-wcwl-popup{display:none}.yith-wcwl-popup-content h3{text-align:center;font-size:1.5em}.yith-wcwl-popup-content .heading-icon,.yith-wcwl-popup-feedback .heading-icon{text-align:center;display:block;font-size:70px;color:#333;margin-bottom:15px}.yith-wcwl-popup-content .popup-description{text-align:center;font-weight:600;margin-bottom:15px}.yith-wcwl-popup-content .popup-description a.show-tab.active{cursor:inherit;color:inherit;pointer-events:none}.yith-wcwl-popup-feedback p.feedback{margin-top:1.5em;text-align:center;font-size:1.1rem;font-weight:600}.yith-wcwl-popup-content label{display:block}.yith-wcwl-popup-content input[type=text],.yith-wcwl-popup-content select{padding:10px 7px}.yith-wcwl-popup-content .create{display:none}.yith-wcwl-popup-content .yith-wcwl-second-row{display:none}.yith-wcwl-popup-footer{margin-top:15px}.yith-wcwl-popup-footer .button.wishlist-submit{display:block;width:100%;text-align:center}.pp_pic_holder.pp_woocommerce.feedback{max-width:450px!important}.pp_pic_holder.pp_woocommerce.feedback .pp_content{width:auto!important}.yith-wcwl-popup-feedback{margin-top:2em;margin-bottom:2em}.yith-wcwl-add-button.with-dropdown{position:relative;padding:15px 0}.yes-js .yith-wcwl-add-button ul.yith-wcwl-dropdown{display:none;list-style:none;margin-bottom:0;padding:5px 25px;border:1px solid #cdcdcd;background:#fff;position:absolute;z-index:15;top:calc(100% - 5px);min-width:200px}.yith-wcwl-add-button.show-dropdown ul.yith-wcwl-dropdown{display:block}.yith-wcwl-add-button ul.yith-wcwl-dropdown li{padding:15px;padding-left:0;text-transform:uppercase;font-size:.8em}.yith-wcwl-add-button ul.yith-wcwl-dropdown li a{font-size:1em!important;color:inherit;box-shadow:none}.yith-wcwl-add-button ul.yith-wcwl-dropdown li a:hover{color:initial}.yith-wcwl-add-button ul.yith-wcwl-dropdown li:before{font-family:FontAwesome;content:'\f067';margin-right:15px}.yith-wcwl-add-button ul.yith-wcwl-dropdown li:not(:last-child){border-bottom:1px solid #cdcdcd}.yith-wcwl-add-to-wishlist .separator+[data-title]{display:inline-block}.yith-wcwl-add-to-wishlist .with-tooltip{position:relative}.yith-wcwl-tooltip{z-index:10;padding:5px 10px;border-radius:5px;text-align:center;top:calc(100% + 5px);pointer-events:none;cursor:initial;font-size:.6875rem;line-height:normal;display:none}.with-dropdown .yith-wcwl-tooltip{top:auto;bottom:calc(100% + 10px)}.with-tooltip .yith-wcwl-tooltip{position:absolute}.with-tooltip .yith-wcwl-tooltip:before{content:'';display:block;position:absolute;top:-5px;left:calc(50% - 2px);width:0;height:0;background:0 0!important;border-left:5px solid transparent!important;border-right:5px solid transparent!important;border-bottom:5px solid}.with-dropdown .with-tooltip .yith-wcwl-tooltip:before{bottom:-5px;top:auto;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid;border-bottom:none}#yith-wcwl-popup-message{font-weight:700;line-height:50px;text-align:center;background:#fff;-webkit-box-shadow:0 0 15px rgba(0,0,0,.3);-moz-box-shadow:0 0 15px rgba(0,0,0,.3);box-shadow:0 0 15px rgba(0,0,0,.3);position:fixed;top:50%;left:50%;padding:7px 40px;z-index:10000}.wishlist-title{display:inline-block}.wishlist-title h2{display:inline-block;padding:5px}.wishlist-title.wishlist-title-with-form h2:hover{background:#efefef}.wishlist-title a.show-title-form{cursor:pointer;visibility:hidden}.wishlist-title:hover a.show-title-form{visibility:visible}.yes-js #yith-wcwl-form .hidden-title-form{display:none;margin:25px 0 39px}table.wishlist_table{font-size:80%}table.wishlist_table tr{position:relative}table.wishlist_table thead th{border-top:1px solid;padding:16px 12px}table.wishlist_table tbody td{padding:16px 12px}table.wishlist_table tbody td,table.wishlist_table thead th{border-color:#e7e7e7}.wishlist_table tr td,.wishlist_table tr th.product-checkbox,.wishlist_table tr th.wishlist-delete{text-align:center}.wishlist_table tr th.product-checkbox{vertical-align:middle;width:40px}.wishlist_table tr th.product-remove{vertical-align:middle;width:40px}.wishlist_table tr th.product-thumbnail{width:80px}.wishlist_table tfoot td,.wishlist_table tr td.product-name,.wishlist_table tr td.product-thumbnail,.wishlist_table tr td.wishlist-name,.wishlist_table tr td.wishlist-privacy{text-align:left}.wishlist_table tr td.product-remove{padding:16px 0}.wishlist_table tr td.product-thumbnail a{display:block;border:none;max-width:80px}.wishlist_table tr td.product-thumbnail a img{width:100%}.wishlist_table tr td.product-arrange{cursor:grab}.wishlist_table tr td.product-arrange:active{cursor:grabbing}.wishlist_table .product-stock-status span.wishlist-in-stock{color:#297e29}.wishlist_table .product-stock-status span.wishlist-out-of-stock{color:red}.wishlist_table .product-add-to-cart span.dateadded{display:block}.wishlist_table .product-add-to-cart a{display:table!important;margin:0 auto 5px!important;text-align:center}.wishlist_table .product-add-to-cart a.button{padding:6px 25px!important}.wishlist_table .product-add-to-cart a>img{display:inline;max-width:2em}.wishlist_table .price-variation{display:block}.wishlist_table .price-variation.decrease .variation-rate{color:red}.wishlist_table .price-variation .old-price{display:block}.wishlist_table a.button{white-space:normal;margin-bottom:5px!important}.wishlist_table.modern_grid{list-style:none;margin:0 -7px 35px;font-size:0}.wishlist_table.modern_grid li{display:inline-block;vertical-align:top;width:33.33%;padding:0 7px;margin-bottom:15px}.wishlist_table.images_grid li.wishlist-empty,.wishlist_table.modern_grid li.wishlist-empty{width:100%;font-size:1rem}.wishlist_table.images_grid li.show{z-index:10}.wishlist_table.modern_grid li .item-wrapper{display:table;margin:0 -7px}.wishlist_table.modern_grid li .item-details,.wishlist_table.modern_grid li .product-thumbnail{display:table-cell;vertical-align:top;box-sizing:border-box;width:50%;padding:0 7px;font-size:1rem}.wishlist_table.images_grid li .product-thumbnail,.wishlist_table.modern_grid li .product-thumbnail{position:relative}.wishlist_table.images_grid li .product-thumbnail .product-checkbox,.wishlist_table.modern_grid li .product-thumbnail .product-checkbox{position:absolute;top:7px;left:15px;z-index:2}.wishlist_table.modern_grid li .product-thumbnail>a{display:block}.wishlist_table.modern_grid li .product-thumbnail>a img{display:block}.wishlist_table.images_grid li.show .product-thumbnail>a img,.wishlist_table.images_grid li:hover .product-thumbnail>a img{filter:brightness(1.1)}.wishlist_table.modern_grid.wishlist_view li .item-details{position:relative}.wishlist_table.modern_grid.wishlist_view li .item-details:before{content:'';display:block;top:0;bottom:0;left:7px;background:#fff;position:absolute;right:7px;z-index:0;border:1px solid #cdcdcd}.wishlist_table.images_grid li .item-details{display:none;position:absolute;z-index:2;bottom:15px;left:calc(50% - 150px);width:300px;background:#fff;padding:10px 20px;-webkit-box-shadow:0 0 15px rgba(0,0,0,.3);-moz-box-shadow:0 0 15px rgba(0,0,0,.3);box-shadow:0 0 15px rgba(0,0,0,.3)}.wishlist_table.images_grid li.show .item-details{display:block}.wishlist_table.modern_grid li .item-details .item-details-wrapper{padding:15px 20px;line-height:normal;position:relative}.wishlist_table.images_grid li .item-details a.close{position:absolute;top:10px;right:20px}.wishlist_table.images_grid li .item-details h3,.wishlist_table.mobile li .item-details h3,.wishlist_table.modern_grid li .item-details h3{margin-bottom:7px}.wishlist_table.images_grid li .item-details table.item-details-table,.wishlist_table.mobile li .item-details table.item-details-table,.wishlist_table.mobile li table.additional-info,.wishlist_table.modern_grid li .item-details table.item-details-table{border:none;margin-bottom:7px}.wishlist_table.images_grid li .item-details table.item-details-table td,.wishlist_table.mobile li .item-details table.item-details-table td,.wishlist_table.mobile li table.additional-info td,.wishlist_table.modern_grid li .item-details table.item-details-table td{border:none;font-size:.7em;padding:3px;vertical-align:top}.wishlist_table.images_grid li .item-details table.item-details-table td.label,.wishlist_table.mobile li .item-details table.item-details-table td.label,.wishlist_table.mobile li table.additional-info td.label,.wishlist_table.modern_grid li .item-details table.item-details-table td.label{text-align:left;font-weight:700;width:40%}.wishlist_table.images_grid li .item-details table.item-details-table td.value,.wishlist_table.mobile li .item-details table.item-details-table td.value,.wishlist_table.mobile li table.additional-info td.value,.wishlist_table.modern_grid li .item-details table.item-details-table td.value{text-align:right}.wishlist_table.modern_grid li .item-details table.item-details-table td.value a.selectBox{margin-right:0}.wishlist_table.images_grid li .item-details table.item-details-table td.value input,.wishlist_table.mobile li table.additional-info td.value input,.wishlist_table.modern_grid li .item-details table.item-details-table td.value input{width:auto}.wishlist_table.images_grid li .item-details .product-add-to-cart,.wishlist_table.modern_grid li .item-details .product-add-to-cart{text-align:center;margin-bottom:7px}.wishlist_table.images_grid li .item-details .move-to-another-wishlist,.wishlist_table.modern_grid li .item-details .move-to-another-wishlist{text-align:center;margin-bottom:7px}.wishlist_table.images_grid li .item-details .product-remove,.wishlist_table.modern_grid li .item-details .product-remove{text-align:right}.wishlist_table.images_grid li .item-details .product-remove a,.wishlist_table.modern_grid li .item-details .product-remove a{border:none;border-radius:0;display:inline-block}.wishlist_table.mobile{list-style:none;margin-left:0}.wishlist_table.mobile li{margin-bottom:7px}.wishlist_table.mobile li .product-checkbox{display:inline-block;width:20px;vertical-align:top}.wishlist_table.mobile li .item-wrapper{display:inline-block;width:calc(100% - 25px);vertical-align:top;margin-bottom:7px}.wishlist_table.wishlist_manage_table.mobile li .item-wrapper{width:100%}.wishlist_table.mobile li .item-wrapper .product-thumbnail{display:inline-block;max-width:60px;margin-right:10px}.wishlist_table.mobile li .item-wrapper .item-details{display:inline-block;width:calc(100% - 80px);vertical-align:top}.wishlist_table.mobile.with-checkbox li .additional-info-wrapper{padding-left:20px}.wishlist_table.mobile li .additional-info-wrapper .move-to-another-wishlist,.wishlist_table.mobile li .additional-info-wrapper .product-add-to-cart{text-align:center;margin-bottom:7px}.wishlist_table.mobile li .additional-info-wrapper .product-remove{text-align:right}a.add_to_wishlist{cursor:pointer}.yith-wcwl-add-to-wishlist .feedback .yith-wcwl-icon{margin-right:5px}.yith-wcwl-add-to-wishlist a.add_to_wishlist>img,.yith-wcwl-add-to-wishlist a.delete_item>img,.yith-wcwl-add-to-wishlist a.move_to_another_wishlist>img{max-width:32px;display:inline-block;margin-right:10px}a.add_to_wishlist+a.view-wishlist,a.delete_item+a.view-wishlist{margin-left:15px}.summary .single_add_to_wishlist.button,div.product .woocommerce-price-and-add .single_add_to_wishlist.button{margin:0}.wishlist_table .add_to_cart.button{padding:7px 12px;line-height:normal}.yith-wcwl-add-to-wishlist{margin-top:10px}.hidden-title-form a.hide-title-form i,.hidden-title-form button i,.wishlist-title a.show-title-form i,.wishlist_manage_table tfoot a.create-new-wishlist i,.wishlist_manage_table tfoot button.submit-wishlist-changes i,.wishlist_table .add_to_cart.button i,.wishlist_table .ask-an-estimate-button i,.yith-wcwl-add-button>a i,.yith-wcwl-wishlist-new button i,.yith-wcwl-wishlist-search-form button.wishlist-search-button i{margin-right:10px}.hidden-title-form a.hide-title-form,.wishlist-title a.show-title-form,.wishlist_manage_table a.create-new-wishlist,.wishlist_manage_table button.submit-wishlist-changes,.wishlist_table .add_to_cart.button,.wishlist_table a.ask-an-estimate-button,.woocommerce .yith-wcwl-wishlist-new button,.yith-wcwl-add-button a.add_to_wishlist,.yith-wcwl-popup-button a.add_to_wishlist,.yith-wcwl-wishlist-search-form button.wishlist-search-button{margin:0;box-shadow:none;text-shadow:none}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist{position:absolute;z-index:10;margin:0;top:10px;left:10px}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .with-dropdown{padding:0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .add_to_wishlist,.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .disabled_item,.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .open-pretty-photo{font-size:0;background:0 0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .delete_item,.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .move_to_another_wishlist{font-size:0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .feedback{display:none}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist .feedback+a{font-size:0;background:0 0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist i{font-size:1.6rem;margin:0}.add-to-wishlist-before_image .yith-wcwl-add-to-wishlist img{margin:0}.woocommerce .wishlist-title{margin-bottom:30px}.woocommerce .wishlist-title h2{vertical-align:middle;margin-bottom:0}.woocommerce .hidden-title-form button{padding:7px 24px;vertical-align:middle;border:none;position:relative}.woocommerce .hidden-title-form button:active{top:1px}.woocommerce .hidden-title-form a.hide-title-form{vertical-align:middle;line-height:normal}.woocommerce .back-to-all-wishlists{margin-bottom:20px}.woocommerce #content table.wishlist_table.cart a.remove{color:#c3c3c3;margin:0 auto}.woocommerce #content table.wishlist_table.cart a.remove:hover{background-color:#c3c3c3;color:#fff}.yith-wcwl-share{margin-bottom:35px}.yith-wcwl-share h4.yith-wcwl-share-title{margin:10px 0}.yith-wcwl-share ul{margin:5px 0;padding:0}.entry-content .yith-wcwl-share ul li,.yith-wcwl-share ul li{display:inline-block;margin-left:0;margin-right:0}.yith-wcwl-share li a{color:#fff;text-align:center;text-decoration:none;line-height:1;padding:5px;display:block;border:none;min-width:26px;min-height:26px}.yith-wcwl-share li a:hover{color:#fff}.yith-wcwl-share li a>img{max-width:1em}.copy-trigger{cursor:pointer}.woocommerce .ask-an-estimate-button>img{max-width:1em;display:inline;margin-right:5px}#ask_an_estimate_popup{display:none}.wishlist-ask-an-estimate-popup .ask-an-estimate-button-popup{width:100%}.wishlist-ask-an-estimate-popup .woocommerce-error{margin-bottom:0}.wishlist-ask-an-estimate-popup #additional_notes{min-height:150px}.ask-an-estimate-confirmation{padding:0 30px;text-align:center}.yith_wcwl_wishlist_footer>div{margin-bottom:15px}.yith_wcwl_wishlist_footer .yith_wcwl_wishlist_bulk_action{float:left}.yith_wcwl_wishlist_footer .yith_wcwl_wishlist_bulk_action #bulk_actions{min-width:250px}.yith_wcwl_wishlist_footer .yith_wcwl_wishlist_update{float:right}.yith_wcwl_wishlist_footer .yith-wcwl-share{float:left;clear:both}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action{float:right}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action>*{vertical-align:middle}.yith_wcwl_wishlist_update+.yith_wcwl_footer_additional_action{clear:both}.wishlist-page-links{clear:both}#move_to_another_wishlist{display:none}.yith-wcwl-wishlist-new{padding:20px 0}.yith-wcwl-popup-content .yith-wcwl-wishlist-new{padding:0}.yith-wcwl-wishlist-new .wishlist-name{display:inline-block}.yith-wcwl-wishlist-new .wishlist-privacy-radio label{display:block}.yith-wcwl-popup-content .create-wishlist-button{margin-top:15px;width:100%}#create_new_wishlist{display:none}.wishlist_manage_table select{vertical-align:middle;margin-right:10px}.wishlist_manage_table td.wishlist-name .wishlist-title{margin-bottom:0}.wishlist_manage_table td.wishlist-name .wishlist-title .show-title-form{display:inline-block;padding:0;border:none;background:0 0;top:0;margin:0}.wishlist_manage_table td.wishlist-name a.show-title-form i{padding:5px;margin:0}.wishlist_manage_table td.wishlist-name:hover a.show-title-form{visibility:visible}.wishlist_manage_table td.wishlist-name .hidden-title-form{margin:0!important}.wishlist_manage_table td.wishlist-name .hidden-title-form input[type=text]{width:100%;min-width:0}.wishlist_manage_table td.wishlist-name .hidden-title-form{position:relative}.wishlist_manage_table td.wishlist-name .hidden-title-form .edit-title-buttons{position:absolute;right:0;top:0}.wishlist_manage_table td.wishlist-name .hidden-title-form a{float:right;cursor:pointer;margin-left:5px}.wishlist_manage_table td.wishlist-name .hidden-title-form a i{padding:5px;margin:0}table.wishlist_manage_table tfoot td{text-align:right;padding:24px 12px}.wishlist_manage_table tfoot button.submit-wishlist-changes{padding:7px 24px;vertical-align:middle;border:1px solid;border-radius:3px;position:relative;line-height:normal}.wishlist_manage_table tfoot button.submit-wishlist-changes:active{top:1px}.wishlist_manage_table tfoot a.create-new-wishlist{vertical-align:middle;line-height:normal;padding:7px 24px}.wishlist_manage_table.modern_grid li .item-wrapper{display:block;margin:0;padding:40px 50px;background:#fff;border:1px solid #cdcdcd}.wishlist_manage_table.modern_grid li .item-details,.wishlist_manage_table.modern_grid li .product-thumbnail{display:block;width:100%;padding:0}.wishlist_manage_table.modern_grid li .item-details .hidden-title-form{position:relative}.wishlist_manage_table.modern_grid li .item-details .hidden-title-form .edit-title-buttons{position:absolute;right:0;top:0}.wishlist_manage_table.modern_grid li .item-details .hidden-title-form .edit-title-buttons a{float:right;line-height:1;cursor:pointer;margin-left:5px}.wishlist_manage_table.modern_grid li .item-details .hidden-title-form .edit-title-buttons a i{padding:5px;margin:0}.wishlist_manage_table.modern_grid li .product-thumbnail img:first-child{width:100%;margin-bottom:15px}.wishlist_manage_table.modern_grid li .product-thumbnail img{width:calc(50% - 8px)}.wishlist_manage_table.modern_grid li .product-thumbnail img:nth-child(3){margin-left:15px}.wishlist_manage_table.modern_grid li .wishlist-title-with-form{display:block}.wishlist_manage_table.modern_grid li .wishlist-title-with-form h3{display:inline-block}.wishlist_manage_table.modern_grid li .wishlist-title-with-form .show-title-form,.wishlist_manage_table.modern_grid li .wishlist-title-with-form .show-title-form:hover{visibility:visible;float:right;margin:0;background:0 0;color:inherit}.wishlist_manage_table.modern_grid li .wishlist-title-with-form .show-title-form i{margin:0}.wishlist_manage_table.modern_grid li .hidden-title-form{margin-top:0!important}.wishlist_manage_table.modern_grid li .hidden-title-form input[type=text]{width:100%;min-width:0}.wishlist_manage_table.mobile li{margin-bottom:30px}.wishlist_manage_table.mobile li .item-wrapper .item-details{width:100%}.wishlist_manage_table.mobile li .item-details .hidden-title-form{position:relative}.wishlist_manage_table.mobile li .item-details .hidden-title-form input[type=text]{width:100%}.wishlist_manage_table.mobile li .item-details .hidden-title-form .edit-title-buttons{position:absolute;right:0;top:0}.wishlist_manage_table.mobile li .item-details .hidden-title-form .edit-title-buttons a{float:right;line-height:1;cursor:pointer;margin-left:5px}.wishlist_manage_table.mobile li .item-details .hidden-title-form .edit-title-buttons a i{padding:5px;margin:0}.wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title{display:block;border-bottom:1px solid #cdcdcd;position:relative}.wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title-with-form a.show-title-form{position:absolute;right:0;top:0;visibility:visible}.wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title-with-form a.show-title-form i{margin-right:0}.wishlist_manage_table.mobile li .item-details table.item-details-table td.value a.selectBox{margin-right:0}.wishlist_manage_table.mobile li .item-details table.item-details-table td.value a.wishlist-download{float:left}.yith-wcwl-wishlist-search-form{text-align:center;padding:20px 0}.yith-wcwl-wishlist-search-form #wishlist_search{display:inline-block;max-width:300px;vertical-align:middle}.yith-wcwl-wishlist-search-form button.wishlist-search-button{display:inline-block;padding:7px 24px;vertical-align:middle;border:1px solid;border-radius:3px;position:relative;line-height:normal}.yith-wcwl-wishlist-search-form button.wishlist-search-button i{margin:0}.yith-wcwl-wishlist-search-form button.wishlist-search-button:active{top:1px}.yith-wcwl-search-results .wishlist-owner{text-align:left}.yith-wcwl-search-results .wishlist-owner .thumb{display:inline-block;margin-right:15px}.yith-wcwl-add-to-wishlist .ajax-loading{box-shadow:none!important;-moz-box-shadow:none!important;-webkit-box-shadow:none!important;display:inline!important;margin-left:5px;vertical-align:middle;visibility:hidden;width:16px!important;height:16px!important}.widget_yith-wcwl-lists ul.dropdown li{padding:0}.widget_yith-wcwl-lists ul.dropdown ul.lists>li a,.widget_yith-wcwl-lists ul.dropdown>li a{display:block;padding:5px 15px}.widget_yith-wcwl-lists ul.dropdown ul.lists>li a{padding:5px 25px}.widget_yith-wcwl-lists ul.dropdown>li.lists-section{border-bottom:1px solid #e7e7e7}.widget_yith-wcwl-lists ul.dropdown ul.lists{margin:0}.widget_yith-wcwl-items .mini{position:relative}.widget_yith-wcwl-items .heading{text-align:center;cursor:pointer}.widget_yith-wcwl-items .mini .heading{display:inline-block}.widget_yith-wcwl-items .heading a{color:inherit}.widget_yith-wcwl-items .extended .heading .items-counter{position:relative}.widget_yith-wcwl-items .extended .heading .items-counter i{font-size:70px;position:relative;margin-bottom:10px}.widget_yith-wcwl-items .mini .heading .items-counter i{font-size:30px}.widget_yith-wcwl-items .extended .heading .items-counter .items-count{display:block;position:absolute;left:0;right:0;text-align:center;top:calc(50% - 20px);font-size:1rem}.widget_yith-wcwl-items .mini .heading .items-counter .items-count{font-size:1rem}.widget_yith-wcwl-items .extended .heading h3:after{content:'';display:block;max-width:80px;border-bottom:1px solid #cdcdcd;margin:10px auto}.widget_yith-wcwl-items .mini .list{position:absolute;z-index:1;left:0;background:#fff;padding:25px 40px;display:none;-webkit-box-shadow:0 0 15px rgba(0,0,0,.3);-moz-box-shadow:0 0 15px rgba(0,0,0,.3);box-shadow:0 0 15px rgba(0,0,0,.3)}.widget_yith-wcwl-items .mini:hover .list{display:block}.widget_yith-wcwl-items ul.product_list_widget{margin-bottom:40px!important}.widget_yith-wcwl-items p.empty-wishlist{margin-bottom:0!important}.widget_yith-wcwl-items .mini ul.product_list_widget{margin-left:-20px}.widget_yith-wcwl-items ul.product_list_widget li{display:table}.widget_yith-wcwl-items ul.product_list_widget li:not(:last-child){margin-bottom:10px}.widget_yith-wcwl-items ul.product_list_widget li .image-thumb,.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info,.widget_yith-wcwl-items ul.product_list_widget li .remove_from_all_wishlists{display:table-cell;vertical-align:middle}.widget_yith-wcwl-items ul.product_list_widget li .remove_from_all_wishlists{font-size:1.2rem}.widget_yith-wcwl-items ul.product_list_widget li .image-thumb img{margin-left:10px;max-width:40px}.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info{display:inline-block;vertical-align:middle;margin-left:10px}.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info a{display:inline-block}.widget_yith-wcwl-items ul.product_list_widget li .mini-cart-item-info>*{display:block}.widget_yith-wcwl-items .show-wishlist,.widget_yith-wcwl-items a.add_all_to_cart{display:block!important}.widget_yith-wcwl-items .show-wishlist{margin-bottom:10px}.widget_yith-wcwl-items a.add_all_to_cart{text-align:center}@media(max-width:768px){.yith_wcwl_wishlist_bulk_action select{width:100%;margin-bottom:15px}.yith_wcwl_wishlist_bulk_action input{float:right}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action{float:none}.yith_wcwl_wishlist_footer .yith_wcwl_footer_additional_action .ask-an-estimate-button{width:100%;text-align:center}}
assets/css/unminified/style.css CHANGED
@@ -377,7 +377,6 @@ table.wishlist_table tbody td{
377
  .wishlist_table tr th.wishlist-delete,
378
  .wishlist_table tr th.product-checkbox {
379
  text-align: center;
380
- background: #fff;
381
  }
382
 
383
  .wishlist_table tr th.product-checkbox {
@@ -1018,6 +1017,24 @@ div.product .woocommerce-price-and-add .single_add_to_wishlist.button {
1018
  margin-bottom: 0;
1019
  }
1020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1021
  .wishlist_manage_table td.wishlist-name .hidden-title-form{
1022
  margin: 0!important;
1023
  }
@@ -1027,6 +1044,27 @@ div.product .woocommerce-price-and-add .single_add_to_wishlist.button {
1027
  min-width: 0;
1028
  }
1029
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1030
  table.wishlist_manage_table tfoot td{
1031
  text-align: right;
1032
  padding: 24px 12px;
@@ -1067,8 +1105,26 @@ table.wishlist_manage_table tfoot td{
1067
  padding: 0;
1068
  }
1069
 
1070
- .wishlist_manage_table.modern_grid li .item-details table.item-details-table td{
1071
- /*font-size: 1em;*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1072
  }
1073
 
1074
  .wishlist_manage_table.modern_grid li .product-thumbnail img:first-child{
@@ -1123,7 +1179,33 @@ table.wishlist_manage_table tfoot td{
1123
  width: 100%;
1124
  }
1125
 
1126
- .wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title-with-form{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1127
  display: block;
1128
  border-bottom: 1px solid #cdcdcd;
1129
  position: relative;
377
  .wishlist_table tr th.wishlist-delete,
378
  .wishlist_table tr th.product-checkbox {
379
  text-align: center;
 
380
  }
381
 
382
  .wishlist_table tr th.product-checkbox {
1017
  margin-bottom: 0;
1018
  }
1019
 
1020
+ .wishlist_manage_table td.wishlist-name .wishlist-title .show-title-form{
1021
+ display: inline-block;
1022
+ padding: 0;
1023
+ border: none;
1024
+ background: none;
1025
+ top: 0;
1026
+ margin: 0;
1027
+ }
1028
+
1029
+ .wishlist_manage_table td.wishlist-name a.show-title-form i{
1030
+ padding: 5px;
1031
+ margin: 0;
1032
+ }
1033
+
1034
+ .wishlist_manage_table td.wishlist-name:hover a.show-title-form{
1035
+ visibility: visible;
1036
+ }
1037
+
1038
  .wishlist_manage_table td.wishlist-name .hidden-title-form{
1039
  margin: 0!important;
1040
  }
1044
  min-width: 0;
1045
  }
1046
 
1047
+ .wishlist_manage_table td.wishlist-name .hidden-title-form{
1048
+ position: relative;
1049
+ }
1050
+
1051
+ .wishlist_manage_table td.wishlist-name .hidden-title-form .edit-title-buttons{
1052
+ position: absolute;
1053
+ right: 0;
1054
+ top: 0;
1055
+ }
1056
+
1057
+ .wishlist_manage_table td.wishlist-name .hidden-title-form a{
1058
+ float: right;
1059
+ cursor: pointer;
1060
+ margin-left: 5px;
1061
+ }
1062
+
1063
+ .wishlist_manage_table td.wishlist-name .hidden-title-form a i{
1064
+ padding: 5px;
1065
+ margin: 0;
1066
+ }
1067
+
1068
  table.wishlist_manage_table tfoot td{
1069
  text-align: right;
1070
  padding: 24px 12px;
1105
  padding: 0;
1106
  }
1107
 
1108
+ .wishlist_manage_table.modern_grid li .item-details .hidden-title-form{
1109
+ position: relative;
1110
+ }
1111
+
1112
+ .wishlist_manage_table.modern_grid li .item-details .hidden-title-form .edit-title-buttons{
1113
+ position: absolute;
1114
+ right: 0;
1115
+ top: 0;
1116
+ }
1117
+
1118
+ .wishlist_manage_table.modern_grid li .item-details .hidden-title-form .edit-title-buttons a{
1119
+ float: right;
1120
+ line-height: 1;
1121
+ cursor: pointer;
1122
+ margin-left: 5px;
1123
+ }
1124
+
1125
+ .wishlist_manage_table.modern_grid li .item-details .hidden-title-form .edit-title-buttons a i{
1126
+ padding: 5px;
1127
+ margin: 0;
1128
  }
1129
 
1130
  .wishlist_manage_table.modern_grid li .product-thumbnail img:first-child{
1179
  width: 100%;
1180
  }
1181
 
1182
+ .wishlist_manage_table.mobile li .item-details .hidden-title-form{
1183
+ position: relative;
1184
+ }
1185
+
1186
+ .wishlist_manage_table.mobile li .item-details .hidden-title-form input[type="text"]{
1187
+ width: 100%;
1188
+ }
1189
+
1190
+ .wishlist_manage_table.mobile li .item-details .hidden-title-form .edit-title-buttons{
1191
+ position: absolute;
1192
+ right: 0;
1193
+ top: 0;
1194
+ }
1195
+
1196
+ .wishlist_manage_table.mobile li .item-details .hidden-title-form .edit-title-buttons a{
1197
+ float: right;
1198
+ line-height: 1;
1199
+ cursor: pointer;
1200
+ margin-left: 5px;
1201
+ }
1202
+
1203
+ .wishlist_manage_table.mobile li .item-details .hidden-title-form .edit-title-buttons a i{
1204
+ padding: 5px;
1205
+ margin: 0;
1206
+ }
1207
+
1208
+ .wishlist_manage_table.mobile li .item-wrapper .item-details .wishlist-title{
1209
  display: block;
1210
  border-bottom: 1px solid #cdcdcd;
1211
  position: relative;
assets/js/jquery.yith-wcwl.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(r){function i(){void 0!==r.fn.selectBox&&r("select.selectBox").filter(":visible").not(".enhanced").selectBox().addClass("enhanced")}function e(){if(void 0!==r.prettyPhoto){var t={hook:"data-rel",social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,overlay_gallery:!1,default_width:500,changepicturecallback:function(){i(),r(".wishlist-select").change(),r(document).trigger("yith_wcwl_popup_opened",[this])},markup:'<div class="pp_pic_holder"><div class="ppt">&nbsp;</div><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content_container"><div class="pp_left"><div class="pp_right"><div class="pp_content"><div class="pp_loaderIcon"></div><div class="pp_fade"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details"><a class="pp_close" href="#">Close</a></div></div></div></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div><div class="pp_overlay yith-wcwl-overlay"></div>'};r('a[data-rel^="prettyPhoto[add_to_wishlist_"]').add('a[data-rel="prettyPhoto[ask_an_estimate]"]').add('a[data-rel="prettyPhoto[create_wishlist]"]').unbind("click").prettyPhoto(t),r('a[data-rel="prettyPhoto[move_to_another_wishlist]"]').on("click",function(){var t=r(this),i=r("#move_to_another_wishlist").find("form"),e=i.find(".row-id"),a=t.closest("[data-row-id]").data("row-id");e.length&&e.remove(),i.append('<input type="hidden" name="row_id" class="row-id" value="'+a+'"/>')}).prettyPhoto(t),new MutationObserver(function(t,i){for(var e in t){var a=t[e];"childList"===a.type&&(void 0!==a.addedNodes&&a.addedNodes.forEach(function(t){t.classList.contains("yith-wcwl-overlay")&&r("body").addClass("yith-wcwl-with-pretty-photo")}),void 0!==a.removedNodes&&a.removedNodes.forEach(function(t){t.classList.contains("yith-wcwl-overlay")&&r("body").removeClass("yith-wcwl-with-pretty-photo")}))}}).observe(document.body,{childList:!0})}}function a(){r(".wishlist_table").find('.product-checkbox input[type="checkbox"]').off("change").on("change",function(){var t=r(this);t.parent().removeClass("checked").removeClass("unchecked").addClass(t.is(":checked")?"checked":"unchecked")}).trigger("change")}function o(){r(".add_to_cart").filter("[data-icon]").not(".icon-added").each(function(){var t,i=r(this),e=i.data("icon");t=e.match(/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi)?r("<img/>",{src:e}):r("<i/>",{class:"fa "+e}),i.prepend(t).addClass("icon-added")})}function h(){i(),e(),a(),o(),d(),n(),_(),l(),c(),r(document).trigger("yith_wcwl_init_after_ajax")}function n(){yith_wcwl_l10n.enable_tooltip&&r(".yith-wcwl-add-to-wishlist").find("[data-title]").each(function(){var t=r(this);t.hasClass("tooltip-added")||(t.on("mouseenter",function(){var t,i=r(this),e=null,a=i.outerWidth(),o=0;e=r("<span>",{class:"yith-wcwl-tooltip",text:i.data("title")}),i.append(e),t=e.outerWidth()+6,e.outerWidth(t),o=(a-t)/2,e.css({left:o.toFixed(0)+"px"}).fadeIn(200),i.addClass("with-tooltip")}).on("mouseleave",function(){var t=r(this);t.find(".yith-wcwl-tooltip").fadeOut(200,function(){t.removeClass("with-tooltip").find(".yith-wcwl-tooltip").remove()})}),t.addClass("tooltip-added"))})}function d(){r(".yith-wcwl-add-button").filter(".with-dropdown").on("mouseleave",function(){var t=r(this).find(".yith-wcwl-dropdown");t.length&&t.fadeOut(200)}).children("a").on("mouseenter",function(){var t=r(this).closest(".with-dropdown"),i=t.find(".yith-wcwl-dropdown");i.length&&i.children().length&&t.find(".yith-wcwl-dropdown").fadeIn(200)})}function l(){void 0!==yith_wcwl_l10n.enable_drag_n_drop&&yith_wcwl_l10n.enable_drag_n_drop&&r(".wishlist_table").each(function(){var e=r(this),a=!1;e.sortable({items:"[data-row-id]",helper:function(t,i){return i.children().each(function(){r(this).width(r(this).width())}),i},update:function(){var t=e.find("[data-row-id]"),i=[];t.length&&(a&&a.abort(),t.each(function(){var t=r(this);i.push(t.data("row-id"))}),a=r.ajax({data:{action:yith_wcwl_l10n.actions.sort_wishlist_items,positions:i,wishlist_token:e.data("token"),page:e.data("page"),per_page:e.data("per-page")},method:"POST",url:yith_wcwl_l10n.ajax_url}))}})})}function c(){r(".copy-trigger").on("click",function(){var t=r(".copy-target");if(0<t.length)if(t.is("input"))s()?t[0].setSelectionRange(0,9999):t.select(),document.execCommand("copy");else{var i=r("<input/>",{val:t.text(),type:"text"});b("body").append(i),s()?i[0].setSelectionRange(0,9999):i.select(),document.execCommand("copy"),i.remove()}})}function _(){r(".wishlist_table").filter(".images_grid").not(".enhanced").on("click","[data-row-id] .product-thumbnail a",function(t){var i=r(this).closest("[data-row-id]"),e=i.siblings("[data-row-id]"),a=i.find(".item-details");t.preventDefault(),a.length&&(e.removeClass("show"),i.toggleClass("show"))}).on("click","[data-row-id] a.close",function(t){var i=r(this).closest("[data-row-id]"),e=i.find(".item-details");t.preventDefault(),e.length&&i.removeClass("show")}).on("click","[data-row-id] a.remove_from_wishlist",function(t){var i=r(this);return t.stopPropagation(),f(i),!1}).addClass("enhanced"),r(document).on("click",function(t){r(t.target).closest("[data-row-id]").length||r(".wishlist_table").filter(".images_grid").find(".show").removeClass("show")}).on("added_to_cart",function(){r(".wishlist_table").filter(".images_grid").find(".show").removeClass("show")})}function w(i,t,e){i.action=yith_wcwl_l10n.actions.move_to_another_wishlist_action,""!==i.wishlist_token&&""!==i.destination_wishlist_token&&""!==i.item_id&&r.ajax({beforeSend:t,url:yith_wcwl_l10n.ajax_url,data:i,dataType:"json",method:"post",success:function(t){e(t),h(),r("body").trigger("moved_to_another_wishlist",[r(this),i.item_id])}})}function f(i){var t=i.parents(".cart.wishlist_table"),e=i.parents("[data-row-id]"),a=e.data("row-id"),o=t.data("id"),n=t.data("token"),s={action:yith_wcwl_l10n.actions.remove_from_wishlist_action,remove_from_wishlist:a,wishlist_id:o,wishlist_token:n,fragments:C(a)};r.ajax({beforeSend:function(){y(t)},complete:function(){k(t)},data:s,method:"post",success:function(t){void 0!==t.fragments&&j(t.fragments),h(),r("body").trigger("removed_from_wishlist",[i,e])},url:yith_wcwl_l10n.ajax_url})}function p(t){var i=r(this),e=i.closest(".wishlist_table"),a=null;t.preventDefault(),(a=e.length?i.closest("[data-wishlist-id]").find(".wishlist-title"):i.parents(".wishlist-title")).next().show(),a.hide()}function u(t){var i=r(this);t.preventDefault(),i.parents(".hidden-title-form").hide(),i.parents(".hidden-title-form").prev().show()}function m(t){if(void 0!==r.prettyPhoto&&void 0!==r.prettyPhoto.close)if(void 0!==t){var i=r(".pp_content_container"),e=i.find(".pp_content"),a=i.find(".yith-wcwl-popup-form"),o=a.closest(".pp_pic_holder");if(a.length){var n=r("<div/>",{class:"yith-wcwl-popup-feedback"});n.append(r("<i/>",{class:"fa fa-check heading-icon"})),n.append(r("<p/>",{class:"feedback",html:t})),n.css("display","none"),e.css("height","auto"),a.after(n),a.fadeOut(200,function(){n.fadeIn()}),o.addClass("feedback"),o.css("left",r(window).innerWidth()/2-o.outerWidth()/2+"px"),setTimeout(m,yith_wcwl_l10n.popup_timeout)}}else try{r.prettyPhoto.close()}catch(t){}}function v(t){var i=r("#yith-wcwl-popup-message"),e=r("#yith-wcwl-message");yith_wcwl_l10n.enable_notices&&(e.html(t),i.css("margin-left","-"+r(i).width()+"px").fadeIn(),window.setTimeout(function(){i.fadeOut()},yith_wcwl_l10n.popup_timeout))}function g(n){var t=r("select.wishlist-select"),i=r("ul.yith-wcwl-dropdown");t.each(function(){var e=r(this),t=e.find("option"),i=t.filter('[value="new"]');t.not(i).remove(),r.each(n,function(t,i){r("<option>",{value:i.id,html:i.wishlist_name}).appendTo(e)}),e.append(i)}),i.each(function(){var e=r(this),t=e.find("li"),i=e.closest(".yith-wcwl-add-button").children("a.add_to_wishlist"),a=i.attr("data-product-id"),o=i.attr("data-product-type");t.remove(),r.each(n,function(t,i){r("<li>").append(r("<a>",{rel:"nofollow",html:i.wishlist_name,class:"add_to_wishlist",href:i.add_to_this_wishlist_url,"data-product-id":a,"data-product-type":o,"data-wishlist-id":i.id})).appendTo(e)})})}function y(t){void 0!==r.fn.block&&t.fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+yith_wcwl_l10n.ajax_loader_url+") no-repeat center",backgroundSize:"40px 40px",opacity:1}})}function k(t){void 0!==r.fn.unblock&&t.stop(!0).css("opacity","1").unblock()}function x(){if(navigator.cookieEnabled)return!0;document.cookie="cookietest=1";var t=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}function C(t){var e={},i=r(".wishlist-fragment");return t&&("object"==typeof t?((t=r.extend({s:"",firstLoad:!1},t)).s&&(i=i.not("[data-fragment-ref]").add(i.filter('[data-fragment-ref="'+t.s+'"]'))),t.firstLoad&&(i=i.filter(".on-first-load"))):"string"!=typeof t&&"number"!=typeof t||(i=i.not("[data-fragment-ref]").add(i.filter('[data-fragment-ref="'+t+'"]')))),i.each(function(){var t=r(this),i=t.attr("class");e[i]=t.data("fragment-options")}),e}function j(t){r.each(t,function(t,i){var e="."+t.split(" ").filter(function(t){return t.length&&"exists"!==t}).join("."),a=r(e),o=r(i).filter(e);o.length||(o=r(i).find(e)),a.length&&o.length&&a.replaceWith(o)})}function s(){return navigator.userAgent.match(/ipad|iphone/i)}r(document).on("yith_wcwl_init",function(){var t=r(this),s="undefined"!=typeof wc_add_to_cart_params&&null!==wc_add_to_cart_params?wc_add_to_cart_params.cart_redirect_after_add:"";t.on("click",".add_to_wishlist",function(t){var a=r(this),i=a.attr("data-product-id"),o=r(".add-to-wishlist-"+i),e={add_to_wishlist:i,product_type:a.data("product-type"),wishlist_id:a.data("wishlist-id"),action:yith_wcwl_l10n.actions.add_to_wishlist_action,fragments:C(i)};if(t.preventDefault(),jQuery(document.body).trigger("adding_to_wishlist"),yith_wcwl_l10n.multi_wishlist&&yith_wcwl_l10n.modal_enable){var n=a.parents(".yith-wcwl-popup-footer").prev(".yith-wcwl-popup-content"),s=n.find(".wishlist-select"),d=n.find(".wishlist-name"),l=n.find(".wishlist-visibility").filter(":checked");if(e.wishlist_id=s.is(":visible")?s.val():"new",e.wishlist_name=d.val(),e.wishlist_visibility=l.val(),"new"===e.wishlist_id&&!e.wishlist_name)return d.closest("p").addClass("woocommerce-invalid"),!1;d.closest("p").removeClass("woocommerce-invalid")}if(x())return r.ajax({type:"POST",url:yith_wcwl_l10n.ajax_url,data:e,dataType:"json",beforeSend:function(){y(a)},complete:function(){k(a)},success:function(t){var i=t.result,e=t.message;yith_wcwl_l10n.multi_wishlist?(m(e),void 0!==t.user_wishlists&&g(t.user_wishlists)):v(e),"true"!==i&&"exists"!==i||(void 0!==t.fragments&&j(t.fragments),yith_wcwl_l10n.multi_wishlist&&!yith_wcwl_l10n.hide_add_button||o.find(".yith-wcwl-add-button").remove(),o.addClass("exists")),h(),r("body").trigger("added_to_wishlist",[a,o])}}),!1;alert(yith_wcwl_l10n.labels.cookie_disabled)}),t.on("click",".wishlist_table .remove_from_wishlist",function(t){var i=r(this);return t.preventDefault(),f(i),!1}),t.on("adding_to_cart","body",function(t,i,e){void 0!==i&&void 0!==e&&i.closest(".wishlist_table").length&&(e.remove_from_wishlist_after_add_to_cart=i.closest("[data-row-id]").data("row-id"),e.wishlist_id=i.closest(".wishlist_table").data("id"),"undefined"!=typeof wc_add_to_cart_params&&(wc_add_to_cart_params.cart_redirect_after_add=yith_wcwl_l10n.redirect_to_cart),"undefined"!=typeof yith_wccl_general&&(yith_wccl_general.cart_redirect=yith_wcwl_l10n.redirect_to_cart))}),t.on("added_to_cart","body",function(t,i,e,a){if(void 0!==a&&a.closest(".wishlist_table").length){"undefined"!=typeof wc_add_to_cart_params&&(wc_add_to_cart_params.cart_redirect_after_add=s),"undefined"!=typeof yith_wccl_general&&(yith_wccl_general.cart_redirect=s);var o=a.closest("[data-row-id]"),n=o.closest(".wishlist-fragment").data("fragment-options");a.removeClass("added"),o.find(".added_to_cart").remove(),yith_wcwl_l10n.remove_from_wishlist_after_add_to_cart&&n.is_user_owner&&o.remove()}}),t.on("added_to_cart","body",function(){var t=r(".woocommerce-message");0===t.length?r("#yith-wcwl-form").prepend(yith_wcwl_l10n.labels.added_to_cart_message):t.fadeOut(300,function(){r(this).replaceWith(yith_wcwl_l10n.labels.added_to_cart_message).fadeIn()})}),t.on("cart_page_refreshed","body",h),t.on("click",".show-title-form",p),t.on("click",".wishlist-title-with-form h2",p),t.on("click",".remove_from_all_wishlists",function(t){var i=r(this),e=i.attr("data-product-id"),a=i.data("wishlist-id"),o=i.closest(".content"),n={action:yith_wcwl_l10n.actions.remove_from_all_wishlists,prod_id:e,wishlist_id:a,fragments:C(e)};t.preventDefault(),r.ajax({beforeSend:function(){y(o)},complete:function(){k(o)},data:n,dataType:"json",method:"post",success:function(t){void 0!==t.fragments&&j(t.fragments),h()},url:yith_wcwl_l10n.ajax_url})}),t.on("click",".hide-title-form",u),t.on("change",".change-wishlist",function(){var t=r(this),i=t.parents(".cart.wishlist_table"),e=i.data("token"),a=t.parents("[data-row-id]").data("row-id");w({wishlist_token:e,destination_wishlist_token:t.val(),item_id:a,fragments:C()},function(){y(i)},function(t){void 0!==t.fragments&&j(t.fragments),k(i)})}),t.on("click",".yith-wcwl-popup-footer .move_to_wishlist",function(){var e=r(this),t=e.attr("data-product-id"),i=e.data("origin-wishlist-id"),a=e.closest("form"),o=a.find(".wishlist-select").val(),n=a.find(".wishlist-name"),s=n.val(),d=a.find(".wishlist-visibility").filter(":checked").val();if("new"===o&&!s)return n.closest("p").addClass("woocommerce-invalid"),!1;n.closest("p").removeClass("woocommerce-invalid"),w({wishlist_token:i,destination_wishlist_token:o,item_id:t,wishlist_name:s,wishlist_visibility:d,fragments:C(t)},function(){y(e)},function(t){var i=t.message;yith_wcwl_l10n.multi_wishlist?(m(i),void 0!==t.user_wishlists&&g(t.user_wishlists)):v(i),void 0!==t.fragments&&j(t.fragments),h(),k(e)})}),t.on("click",".delete_item",function(){var a=r(this),t=a.attr("data-product-id"),i=a.data("item-id"),o=r(".add-to-wishlist-"+t);return r.ajax({url:yith_wcwl_l10n.ajax_url,data:{action:yith_wcwl_l10n.actions.delete_item_action,item_id:i,fragments:C(t)},dataType:"json",beforeSend:function(){y(a)},complete:function(){k(a)},method:"post",success:function(t){var i=t.fragments,e=t.message;yith_wcwl_l10n.multi_wishlist&&m(e),a.closest(".yith-wcwl-remove-button").length||v(e),void 0!==i&&j(i),h(),r("body").trigger("removed_from_wishlist",[a,o])}}),!1}),t.on("change",".yith-wcwl-popup-content .wishlist-select",function(){var t=r(this);"new"===t.val()?t.parents(".yith-wcwl-first-row").next(".yith-wcwl-second-row").show():t.parents(".yith-wcwl-first-row").next(".yith-wcwl-second-row").hide()}),t.on("change","#bulk_add_to_cart",function(){var t=r(this),i=t.closest(".wishlist_table").find("[data-row-id]").find('input[type="checkbox"]:not(:disabled)');t.is(":checked")?i.attr("checked","checked").change():i.removeAttr("checked").change()}),t.on("submit",".wishlist-ask-an-estimate-popup",function(){var t=r(this),e=t.closest("form"),a=t.closest(".pp_content"),i=e.serialize();return r.ajax({beforeSend:function(){y(e)},complete:function(){k(e)},data:i+"&action="+yith_wcwl_l10n.actions.ask_an_estimate,dataType:"json",method:"post",success:function(t){if(void 0!==t.result&&t.result){var i=t.template;void 0!==i&&(e.replaceWith(i),a.css("height","auto"),setTimeout(m,3e3))}else void 0!==t.message&&(e.find(".woocommerce-error").remove(),e.find(".popup-description").after(r("<div>",{text:t.message,class:"woocommerce-error"})))},url:yith_wcwl_l10n.ajax_url}),!1}),t.on("click",".yith-wfbt-add-wishlist",function(t){t.preventDefault();var i=r(this),e=r("#yith-wcwl-form");r("html, body").animate({scrollTop:e.offset().top},500),function(t,e){var i=t.data("data-product-id"),a=r(document).find(".cart.wishlist_table"),o=a.data("pagination"),n=a.data("per-page"),s=a.data("id"),d=a.data("token"),l={action:yith_wcwl_l10n.actions.reload_wishlist_and_adding_elem_action,pagination:o,per_page:n,wishlist_id:s,wishlist_token:d,add_to_wishlist:i,product_type:t.data("product-type")};if(!x())return alert(yith_wcwl_l10n.labels.cookie_disabled);r.ajax({type:"POST",url:yith_wcwl_l10n.ajax_url,data:l,dataType:"html",beforeSend:function(){y(a)},complete:function(){k(a)},success:function(t){var i=r(t).find("#yith-wcwl-form");e.replaceWith(i),h()}})}(i,e)}),t.on("submit",".yith-wcwl-popup-form",function(){return!1}),t.on("yith_infs_added_elem",function(){e()}),t.on("found_variation",function(t,i){var a=r(t.target).data("product_id"),o=i.variation_id,e=r('.add_to_wishlist[data-product-id="'+a+'"]').add('.add_to_wishlist[data-original-product-id="'+a+'"]');a&&o&&e.length&&e.each(function(){var t,i=r(this),e=i.closest(".yith-wcwl-add-to-wishlist");i.attr("data-original-product-id",a),i.attr("data-product-id",o),console.log(i,i.attr("data-product-id")),e.length&&(void 0!==(t=e.data("fragment-options"))&&(t.product_id=o,e.data("fragment-options",t)),e.removeClass(function(t,i){return i.match(/add-to-wishlist-\S+/g).join(" ")}).addClass("add-to-wishlist-"+o).attr("data-fragment-ref",o))})}),t.on("reset_data",function(t){var o=r(t.target).data("product_id"),i=r('.add_to_wishlist[data-original-product-id="'+o+'"]');o&&i.length&&i.each(function(){var t,i=r(this),e=i.closest(".yith-wcwl-add-to-wishlist"),a=i.attr("data-product-id");i.attr("data-product-id",o),i.attr("data-original-product-id",""),e.length&&(void 0!==(t=e.data("fragment-options"))&&(t.product_id=o,e.data("fragment-options",t)),e.removeClass("add-to-wishlist-"+a).addClass("add-to-wishlist-"+o).attr("data-fragment-ref",o))})}),t.on("yith_wcwl_fragments_loaded",function(t){r(".variations_form").find(".variations select").last().change()}),function(){if(!yith_wcwl_l10n.enable_notices)return;if(r(".yith-wcwl-add-to-wishlist").length&&!r("#yith-wcwl-popup-message").length){var t=r("<div>").attr("id","yith-wcwl-message"),i=r("<div>").attr("id","yith-wcwl-popup-message").html(t).hide();r("body").prepend(i)}}(),n(),d(),l(),function(){var n,s;r(".wishlist_table").on("change",".product-quantity input",function(){var t=r(this),i=t.closest("[data-row-id]"),e=i.data("row-id"),a=t.closest(".wishlist_table"),o=a.data("token");clearTimeout(s),i.find(".add_to_cart").data("quantity",t.val()),s=setTimeout(function(){n&&n.abort(),n=r.ajax({beforeSend:function(){y(a)},complete:function(){k(a)},data:{product_id:e,wishlist_token:o,quantity:t.val(),action:yith_wcwl_l10n.actions.update_item_quantity},method:"POST",url:yith_wcwl_l10n.ajax_url})},1e3)})}(),_(),r(document).on("click",".show-tab",function(t){var i=r(this),e=i.closest(".yith-wcwl-popup-content"),a=i.data("tab"),o=e.find(".tab").filter("."+a);if(t.preventDefault(),!o.length)return!1;i.addClass("active").siblings(".show-tab").removeClass("active"),o.show().siblings(".tab").hide(),"create"===a?e.prepend('<input type="hidden" id="new_wishlist_selector" class="wishlist-select" value="new">'):e.find("#new_wishlist_selector").remove()}),r(document).on("change",".wishlist-select",function(t){var i=r(this),e=i.closest(".yith-wcwl-popup-content"),a=i.closest(".tab"),o=e.find(".tab.create"),n=e.find(".show-tab"),s=n.filter('[data-tab="create"]');"new"===i.val()&&o.length&&(a.hide(),o.show(),n.removeClass("active"),s.addClass("active"),i.find("option").removeProp("selected"),i.change())}),i(),a(),e(),o(),function(){var c=!1;r(window).on("resize",function(t){var i=r(".wishlist_table.responsive"),e=i.is(".mobile"),a=window.matchMedia("(max-width: 768px)"),o=i.closest("form"),n=o.attr("class"),s=o.data("fragment-options"),d={},l=!1;i.length&&(a.matches&&i&&!e?(s.is_mobile="yes",l=!0):!a.matches&&i&&e&&(s.is_mobile="no",l=!0),l&&(c&&c.abort(),d[n]=s,c=r.ajax({beforeSend:function(){y(i)},complete:function(){k(i)},data:{action:yith_wcwl_l10n.actions.load_mobile_action,fragments:d},method:"post",success:function(t){void 0!==t.fragments&&(j(t.fragments),h(),r(document).trigger("yith_wcwl_responsive_template",[e,t.fragments]))},url:yith_wcwl_l10n.ajax_url})))})}(),c(),function(){if(!yith_wcwl_l10n.enable_ajax_loading)return;var i=C({firstLoad:!0});if(!i)return;r.ajax({data:{action:yith_wcwl_l10n.actions.load_fragments,fragments:i},method:"post",success:function(t){void 0!==t.fragments&&(j(t.fragments),h(),r(document).trigger("yith_wcwl_fragments_loaded",[i,t.fragments]))},url:yith_wcwl_l10n.ajax_url})}()}).trigger("yith_wcwl_init")});
1
+ jQuery(document).ready(function(r){function i(){void 0!==r.fn.selectBox&&r("select.selectBox").filter(":visible").not(".enhanced").selectBox().addClass("enhanced")}function e(){if(void 0!==r.prettyPhoto){var t={hook:"data-rel",social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,overlay_gallery:!1,default_width:500,changepicturecallback:function(){i(),r(".wishlist-select").change(),r(document).trigger("yith_wcwl_popup_opened",[this])},markup:'<div class="pp_pic_holder"><div class="ppt">&nbsp;</div><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content_container"><div class="pp_left"><div class="pp_right"><div class="pp_content"><div class="pp_loaderIcon"></div><div class="pp_fade"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details"><a class="pp_close" href="#">Close</a></div></div></div></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div><div class="pp_overlay yith-wcwl-overlay"></div>'};r('a[data-rel^="prettyPhoto[add_to_wishlist_"]').add('a[data-rel="prettyPhoto[ask_an_estimate]"]').add('a[data-rel="prettyPhoto[create_wishlist]"]').unbind("click").prettyPhoto(t),r('a[data-rel="prettyPhoto[move_to_another_wishlist]"]').on("click",function(){var t=r(this),i=r("#move_to_another_wishlist").find("form"),e=i.find(".row-id"),a=t.closest("[data-row-id]").data("row-id");e.length&&e.remove(),i.append('<input type="hidden" name="row_id" class="row-id" value="'+a+'"/>')}).prettyPhoto(t),new MutationObserver(function(t,i){for(var e in t){var a=t[e];"childList"===a.type&&(void 0!==a.addedNodes&&a.addedNodes.forEach(function(t){t.classList.contains("yith-wcwl-overlay")&&r("body").addClass("yith-wcwl-with-pretty-photo")}),void 0!==a.removedNodes&&a.removedNodes.forEach(function(t){t.classList.contains("yith-wcwl-overlay")&&r("body").removeClass("yith-wcwl-with-pretty-photo")}))}}).observe(document.body,{childList:!0})}}function a(){r(".wishlist_table").find('.product-checkbox input[type="checkbox"]').off("change").on("change",function(){var t=r(this);t.parent().removeClass("checked").removeClass("unchecked").addClass(t.is(":checked")?"checked":"unchecked")}).trigger("change")}function o(){r(".add_to_cart").filter("[data-icon]").not(".icon-added").each(function(){var t,i=r(this),e=i.data("icon");t=e.match(/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi)?r("<img/>",{src:e}):r("<i/>",{class:"fa "+e}),i.prepend(t).addClass("icon-added")})}function h(){i(),e(),a(),o(),d(),n(),_(),l(),c(),r(document).trigger("yith_wcwl_init_after_ajax")}function n(){yith_wcwl_l10n.enable_tooltip&&r(".yith-wcwl-add-to-wishlist").find("[data-title]").each(function(){var t=r(this);t.hasClass("tooltip-added")||(t.on("mouseenter",function(){var t,i=r(this),e=null,a=i.outerWidth(),o=0;e=r("<span>",{class:"yith-wcwl-tooltip",text:i.data("title")}),i.append(e),t=e.outerWidth()+6,e.outerWidth(t),o=(a-t)/2,e.css({left:o.toFixed(0)+"px"}).fadeIn(200),i.addClass("with-tooltip")}).on("mouseleave",function(){var t=r(this);t.find(".yith-wcwl-tooltip").fadeOut(200,function(){t.removeClass("with-tooltip").find(".yith-wcwl-tooltip").remove()})}),t.addClass("tooltip-added"))})}function d(){r(".yith-wcwl-add-button").filter(".with-dropdown").on("mouseleave",function(){var t=r(this).find(".yith-wcwl-dropdown");t.length&&t.fadeOut(200)}).children("a").on("mouseenter",function(){var t=r(this).closest(".with-dropdown"),i=t.find(".yith-wcwl-dropdown");i.length&&i.children().length&&t.find(".yith-wcwl-dropdown").fadeIn(200)})}function l(){void 0!==yith_wcwl_l10n.enable_drag_n_drop&&yith_wcwl_l10n.enable_drag_n_drop&&r(".wishlist_table").filter(".sortable").not(".no-interactions").each(function(){var e=r(this),a=!1;e.sortable({items:"[data-row-id]",helper:function(t,i){return i.children().each(function(){r(this).width(r(this).width())}),i},update:function(){var t=e.find("[data-row-id]"),i=[];t.length&&(a&&a.abort(),t.each(function(){var t=r(this);i.push(t.data("row-id"))}),a=r.ajax({data:{action:yith_wcwl_l10n.actions.sort_wishlist_items,positions:i,wishlist_token:e.data("token"),page:e.data("page"),per_page:e.data("per-page")},method:"POST",url:yith_wcwl_l10n.ajax_url}))}})})}function c(){r(".copy-trigger").on("click",function(){var t=r(".copy-target");if(0<t.length)if(t.is("input"))s()?t[0].setSelectionRange(0,9999):t.select(),document.execCommand("copy");else{var i=r("<input/>",{val:t.text(),type:"text"});b("body").append(i),s()?i[0].setSelectionRange(0,9999):i.select(),document.execCommand("copy"),i.remove()}})}function _(){r(".wishlist_table").filter(".images_grid").not(".enhanced").on("click","[data-row-id] .product-thumbnail a",function(t){var i=r(this).closest("[data-row-id]"),e=i.siblings("[data-row-id]"),a=i.find(".item-details");t.preventDefault(),a.length&&(e.removeClass("show"),i.toggleClass("show"))}).on("click","[data-row-id] a.close",function(t){var i=r(this).closest("[data-row-id]"),e=i.find(".item-details");t.preventDefault(),e.length&&i.removeClass("show")}).on("click","[data-row-id] a.remove_from_wishlist",function(t){var i=r(this);return t.stopPropagation(),f(i),!1}).addClass("enhanced"),r(document).on("click",function(t){r(t.target).closest("[data-row-id]").length||r(".wishlist_table").filter(".images_grid").find(".show").removeClass("show")}).on("added_to_cart",function(){r(".wishlist_table").filter(".images_grid").find(".show").removeClass("show")})}function w(i,t,e){i.action=yith_wcwl_l10n.actions.move_to_another_wishlist_action,""!==i.wishlist_token&&""!==i.destination_wishlist_token&&""!==i.item_id&&r.ajax({beforeSend:t,url:yith_wcwl_l10n.ajax_url,data:i,dataType:"json",method:"post",success:function(t){e(t),h(),r("body").trigger("moved_to_another_wishlist",[r(this),i.item_id])}})}function f(i){var t=i.parents(".cart.wishlist_table"),e=i.parents("[data-row-id]"),a=e.data("row-id"),o=t.data("id"),n=t.data("token"),s={action:yith_wcwl_l10n.actions.remove_from_wishlist_action,remove_from_wishlist:a,wishlist_id:o,wishlist_token:n,fragments:T(a)};r.ajax({beforeSend:function(){x(t)},complete:function(){j(t)},data:s,method:"post",success:function(t){void 0!==t.fragments&&P(t.fragments),h(),r("body").trigger("removed_from_wishlist",[i,e])},url:yith_wcwl_l10n.ajax_url})}function p(t){var i=r(this),e=i.closest(".wishlist_table"),a=null;t.preventDefault(),(a=e.length?i.closest("[data-wishlist-id]").find(".wishlist-title"):i.parents(".wishlist-title")).next().show().find('input[type="text"]').focus(),a.hide()}function u(t){var i=r(this);t.preventDefault(),i.parents(".hidden-title-form").hide(),i.parents(".hidden-title-form").prev().show()}function m(t){var i,e=r(this),a=e.closest(".hidden-title-form"),o=e.closest("[data-wishlist-id]").data("wishlist-id"),n=a.find('input[type="text"]'),s=n.val();if(t.preventDefault(),!s)return a.addClass("woocommerce-invalid"),void n.focus();i={action:yith_wcwl_l10n.actions.save_title_action,wishlist_id:o,title:s,fragments:T()},r.ajax({type:"POST",url:yith_wcwl_l10n.ajax_url,data:i,dataType:"json",beforeSend:function(){x(a)},complete:function(){j(a)},success:function(t){var i=t.fragments;t.result?(a.hide(),a.prev().find(".wishlist-anchor").text(s).end().show()):(a.addClass("woocommerce-invalid"),n.focus()),void 0!==i&&P(i)}})}function v(t){var i=r(this),e=i.val(),a=i.closest("[data-wishlist-id]").data("wishlist-id"),o={action:yith_wcwl_l10n.actions.save_privacy_action,wishlist_id:a,privacy:e,fragments:T()};r.ajax({type:"POST",url:yith_wcwl_l10n.ajax_url,data:o,dataType:"json",success:function(t){var i=t.fragments;void 0!==i&&P(i)}})}function y(t){if(void 0!==r.prettyPhoto&&void 0!==r.prettyPhoto.close)if(void 0!==t){var i=r(".pp_content_container"),e=i.find(".pp_content"),a=i.find(".yith-wcwl-popup-form"),o=a.closest(".pp_pic_holder");if(a.length){var n=r("<div/>",{class:"yith-wcwl-popup-feedback"});n.append(r("<i/>",{class:"fa fa-check heading-icon"})),n.append(r("<p/>",{class:"feedback",html:t})),n.css("display","none"),e.css("height","auto"),a.after(n),a.fadeOut(200,function(){n.fadeIn()}),o.addClass("feedback"),o.css("left",r(window).innerWidth()/2-o.outerWidth()/2+"px"),setTimeout(y,yith_wcwl_l10n.popup_timeout)}}else try{r.prettyPhoto.close()}catch(t){}}function g(t){var i=r("#yith-wcwl-popup-message"),e=r("#yith-wcwl-message"),a=void 0!==yith_wcwl_l10n.popup_timeout?yith_wcwl_l10n.popup_timeout:3e3;void 0!==yith_wcwl_l10n.enable_notices&&!yith_wcwl_l10n.enable_notices||(e.html(t),i.css("margin-left","-"+r(i).width()+"px").fadeIn(),window.setTimeout(function(){i.fadeOut()},a))}function k(n){var t=r("select.wishlist-select"),i=r("ul.yith-wcwl-dropdown");t.each(function(){var e=r(this),t=e.find("option"),i=t.filter('[value="new"]');t.not(i).remove(),r.each(n,function(t,i){r("<option>",{value:i.id,html:i.wishlist_name}).appendTo(e)}),e.append(i)}),i.each(function(){var e=r(this),t=e.find("li"),i=e.closest(".yith-wcwl-add-button").children("a.add_to_wishlist"),a=i.attr("data-product-id"),o=i.attr("data-product-type");t.remove(),r.each(n,function(t,i){r("<li>").append(r("<a>",{rel:"nofollow",html:i.wishlist_name,class:"add_to_wishlist",href:i.add_to_this_wishlist_url,"data-product-id":a,"data-product-type":o,"data-wishlist-id":i.id})).appendTo(e)})})}function x(t){void 0!==r.fn.block&&t.fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+yith_wcwl_l10n.ajax_loader_url+") no-repeat center",backgroundSize:"40px 40px",opacity:1}})}function j(t){void 0!==r.fn.unblock&&t.stop(!0).css("opacity","1").unblock()}function C(){if(navigator.cookieEnabled)return!0;document.cookie="cookietest=1";var t=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}function T(t){var e={},i=null;return t?"object"==typeof t?(i=(t=r.extend({s:"",container:r(document),firstLoad:!1},t)).container.find(".wishlist-fragment"),t.s&&(i=i.not("[data-fragment-ref]").add(i.filter('[data-fragment-ref="'+t.s+'"]'))),t.firstLoad&&(i=i.filter(".on-first-load"))):(i=r(".wishlist-fragment"),"string"!=typeof t&&"number"!=typeof t||(i=i.not("[data-fragment-ref]").add(i.filter('[data-fragment-ref="'+t+'"]')))):i=r(".wishlist-fragment"),i.each(function(){var t=r(this),i=t.attr("class");e[i]=t.data("fragment-options")}),e}function S(t){if(yith_wcwl_l10n.enable_ajax_loading){var i=T(t=r.extend({firstLoad:!0},t));i&&r.ajax({data:{action:yith_wcwl_l10n.actions.load_fragments,fragments:i},method:"post",success:function(t){void 0!==t.fragments&&(P(t.fragments),h(),r(document).trigger("yith_wcwl_fragments_loaded",[i,t.fragments]))},url:yith_wcwl_l10n.ajax_url})}}function P(t){r.each(t,function(t,i){var e="."+t.split(" ").filter(function(t){return t.length&&"exists"!==t}).join("."),a=r(e),o=r(i).filter(e);o.length||(o=r(i).find(e)),a.length&&o.length&&a.replaceWith(o)})}function s(){return navigator.userAgent.match(/ipad|iphone/i)}r(document).on("yith_wcwl_init",function(){var t=r(this),s="undefined"!=typeof wc_add_to_cart_params&&null!==wc_add_to_cart_params?wc_add_to_cart_params.cart_redirect_after_add:"";t.on("click",".add_to_wishlist",function(t){var a=r(this),i=a.attr("data-product-id"),o=r(".add-to-wishlist-"+i),e={add_to_wishlist:i,product_type:a.data("product-type"),wishlist_id:a.data("wishlist-id"),action:yith_wcwl_l10n.actions.add_to_wishlist_action,fragments:T(i)};if(t.preventDefault(),jQuery(document.body).trigger("adding_to_wishlist"),yith_wcwl_l10n.multi_wishlist&&yith_wcwl_l10n.modal_enable){var n=a.parents(".yith-wcwl-popup-footer").prev(".yith-wcwl-popup-content"),s=n.find(".wishlist-select"),d=n.find(".wishlist-name"),l=n.find(".wishlist-visibility").filter(":checked");if(e.wishlist_id=s.is(":visible")?s.val():"new",e.wishlist_name=d.val(),e.wishlist_visibility=l.val(),"new"===e.wishlist_id&&!e.wishlist_name)return d.closest("p").addClass("woocommerce-invalid"),!1;d.closest("p").removeClass("woocommerce-invalid")}if(C())return r.ajax({type:"POST",url:yith_wcwl_l10n.ajax_url,data:e,dataType:"json",beforeSend:function(){x(a)},complete:function(){j(a)},success:function(t){var i=t.result,e=t.message;yith_wcwl_l10n.multi_wishlist?(y(e),void 0!==t.user_wishlists&&k(t.user_wishlists)):g(e),"true"!==i&&"exists"!==i||(void 0!==t.fragments&&P(t.fragments),yith_wcwl_l10n.multi_wishlist&&!yith_wcwl_l10n.hide_add_button||o.find(".yith-wcwl-add-button").remove(),o.addClass("exists")),h(),r("body").trigger("added_to_wishlist",[a,o])}}),!1;alert(yith_wcwl_l10n.labels.cookie_disabled)}),t.on("click",".wishlist_table .remove_from_wishlist",function(t){var i=r(this);return t.preventDefault(),f(i),!1}),t.on("adding_to_cart","body",function(t,i,e){void 0!==i&&void 0!==e&&i.closest(".wishlist_table").length&&(e.remove_from_wishlist_after_add_to_cart=i.closest("[data-row-id]").data("row-id"),e.wishlist_id=i.closest(".wishlist_table").data("id"),"undefined"!=typeof wc_add_to_cart_params&&(wc_add_to_cart_params.cart_redirect_after_add=yith_wcwl_l10n.redirect_to_cart),"undefined"!=typeof yith_wccl_general&&(yith_wccl_general.cart_redirect=yith_wcwl_l10n.redirect_to_cart))}),t.on("added_to_cart","body",function(t,i,e,a){if(void 0!==a&&a.closest(".wishlist_table").length){"undefined"!=typeof wc_add_to_cart_params&&(wc_add_to_cart_params.cart_redirect_after_add=s),"undefined"!=typeof yith_wccl_general&&(yith_wccl_general.cart_redirect=s);var o=a.closest("[data-row-id]"),n=o.closest(".wishlist-fragment").data("fragment-options");a.removeClass("added"),o.find(".added_to_cart").remove(),yith_wcwl_l10n.remove_from_wishlist_after_add_to_cart&&n.is_user_owner&&o.remove()}}),t.on("added_to_cart","body",function(){var t=r(".woocommerce-message");0===t.length?r("#yith-wcwl-form").prepend(yith_wcwl_l10n.labels.added_to_cart_message):t.fadeOut(300,function(){r(this).replaceWith(yith_wcwl_l10n.labels.added_to_cart_message).fadeIn()})}),t.on("cart_page_refreshed","body",h),t.on("click",".show-title-form",p),t.on("click",".wishlist-title-with-form h2",p),t.on("click",".remove_from_all_wishlists",function(t){var i=r(this),e=i.attr("data-product-id"),a=i.data("wishlist-id"),o=i.closest(".content"),n={action:yith_wcwl_l10n.actions.remove_from_all_wishlists,prod_id:e,wishlist_id:a,fragments:T(e)};t.preventDefault(),r.ajax({beforeSend:function(){x(o)},complete:function(){j(o)},data:n,dataType:"json",method:"post",success:function(t){void 0!==t.fragments&&P(t.fragments),h()},url:yith_wcwl_l10n.ajax_url})}),t.on("click",".hide-title-form",u),t.on("click",".save-title-form",m),t.on("change",".wishlist_manage_table .wishlist-visibility",v),t.on("change",".change-wishlist",function(){var t=r(this),i=t.parents(".cart.wishlist_table"),e=i.data("token"),a=t.parents("[data-row-id]").data("row-id");w({wishlist_token:e,destination_wishlist_token:t.val(),item_id:a,fragments:T()},function(){x(i)},function(t){void 0!==t.fragments&&P(t.fragments),j(i)})}),t.on("click",".yith-wcwl-popup-footer .move_to_wishlist",function(){var e=r(this),t=e.attr("data-product-id"),i=e.data("origin-wishlist-id"),a=e.closest("form"),o=a.find(".wishlist-select").val(),n=a.find(".wishlist-name"),s=n.val(),d=a.find(".wishlist-visibility").filter(":checked").val();if("new"===o&&!s)return n.closest("p").addClass("woocommerce-invalid"),!1;n.closest("p").removeClass("woocommerce-invalid"),w({wishlist_token:i,destination_wishlist_token:o,item_id:t,wishlist_name:s,wishlist_visibility:d,fragments:T(t)},function(){x(e)},function(t){var i=t.message;yith_wcwl_l10n.multi_wishlist?(y(i),void 0!==t.user_wishlists&&k(t.user_wishlists)):g(i),void 0!==t.fragments&&P(t.fragments),h(),j(e)})}),t.on("click",".delete_item",function(){var a=r(this),t=a.attr("data-product-id"),i=a.data("item-id"),o=r(".add-to-wishlist-"+t);return r.ajax({url:yith_wcwl_l10n.ajax_url,data:{action:yith_wcwl_l10n.actions.delete_item_action,item_id:i,fragments:T(t)},dataType:"json",beforeSend:function(){x(a)},complete:function(){j(a)},method:"post",success:function(t){var i=t.fragments,e=t.message;yith_wcwl_l10n.multi_wishlist&&y(e),a.closest(".yith-wcwl-remove-button").length||g(e),void 0!==i&&P(i),h(),r("body").trigger("removed_from_wishlist",[a,o])}}),!1}),t.on("change",".yith-wcwl-popup-content .wishlist-select",function(){var t=r(this);"new"===t.val()?t.parents(".yith-wcwl-first-row").next(".yith-wcwl-second-row").show():t.parents(".yith-wcwl-first-row").next(".yith-wcwl-second-row").hide()}),t.on("change","#bulk_add_to_cart",function(){var t=r(this),i=t.closest(".wishlist_table").find("[data-row-id]").find('input[type="checkbox"]:not(:disabled)');t.is(":checked")?i.attr("checked","checked").change():i.removeAttr("checked").change()}),t.on("submit",".wishlist-ask-an-estimate-popup",function(){var t=r(this),e=t.closest("form"),a=t.closest(".pp_content"),i=e.serialize();return r.ajax({beforeSend:function(){x(e)},complete:function(){j(e)},data:i+"&action="+yith_wcwl_l10n.actions.ask_an_estimate,dataType:"json",method:"post",success:function(t){if(void 0!==t.result&&t.result){var i=t.template;void 0!==i&&(e.replaceWith(i),a.css("height","auto"),setTimeout(y,3e3))}else void 0!==t.message&&(e.find(".woocommerce-error").remove(),e.find(".popup-description").after(r("<div>",{text:t.message,class:"woocommerce-error"})))},url:yith_wcwl_l10n.ajax_url}),!1}),t.on("click",".yith-wfbt-add-wishlist",function(t){t.preventDefault();var i=r(this),e=r("#yith-wcwl-form");r("html, body").animate({scrollTop:e.offset().top},500),function(t,e){var i=t.data("data-product-id"),a=r(document).find(".cart.wishlist_table"),o=a.data("pagination"),n=a.data("per-page"),s=a.data("id"),d=a.data("token"),l={action:yith_wcwl_l10n.actions.reload_wishlist_and_adding_elem_action,pagination:o,per_page:n,wishlist_id:s,wishlist_token:d,add_to_wishlist:i,product_type:t.data("product-type")};if(!C())return alert(yith_wcwl_l10n.labels.cookie_disabled);r.ajax({type:"POST",url:yith_wcwl_l10n.ajax_url,data:l,dataType:"html",beforeSend:function(){x(a)},complete:function(){j(a)},success:function(t){var i=r(t).find("#yith-wcwl-form");e.replaceWith(i),h()}})}(i,e)}),t.on("submit",".yith-wcwl-popup-form",function(){return!1}),t.on("yith_infs_added_elem",function(){e()}),t.on("found_variation",function(t,i){var a=r(t.target).data("product_id"),o=i.variation_id,e=r('.add_to_wishlist[data-product-id="'+a+'"]').add('.add_to_wishlist[data-original-product-id="'+a+'"]');a&&o&&e.length&&e.each(function(){var t,i=r(this),e=i.closest(".yith-wcwl-add-to-wishlist");i.attr("data-original-product-id",a),i.attr("data-product-id",o),console.log(i,i.attr("data-product-id")),e.length&&(void 0!==(t=e.data("fragment-options"))&&(t.product_id=o,e.data("fragment-options",t)),e.removeClass(function(t,i){return i.match(/add-to-wishlist-\S+/g).join(" ")}).addClass("add-to-wishlist-"+o).attr("data-fragment-ref",o))})}),t.on("reset_data",function(t){var o=r(t.target).data("product_id"),i=r('.add_to_wishlist[data-original-product-id="'+o+'"]');o&&i.length&&i.each(function(){var t,i=r(this),e=i.closest(".yith-wcwl-add-to-wishlist"),a=i.attr("data-product-id");i.attr("data-product-id",o),i.attr("data-original-product-id",""),e.length&&(void 0!==(t=e.data("fragment-options"))&&(t.product_id=o,e.data("fragment-options",t)),e.removeClass("add-to-wishlist-"+a).addClass("add-to-wishlist-"+o).attr("data-fragment-ref",o))})}),t.on("yith_wcwl_reload_fragments",S),t.on("yith_infs_added_elem",function(t,i){S({container:i,firstLoad:!1})}),t.on("yith_wcwl_fragments_loaded",function(t){r(".variations_form").find(".variations select").last().change()}),function(){if(void 0!==yith_wcwl_l10n.enable_notices&&!yith_wcwl_l10n.enable_notices)return;if(r(".yith-wcwl-add-to-wishlist").length&&!r("#yith-wcwl-popup-message").length){var t=r("<div>").attr("id","yith-wcwl-message"),i=r("<div>").attr("id","yith-wcwl-popup-message").html(t).hide();r("body").prepend(i)}}(),n(),d(),l(),function(){var n,s;r(".wishlist_table").on("change",".product-quantity input",function(){var t=r(this),i=t.closest("[data-row-id]"),e=i.data("row-id"),a=t.closest(".wishlist_table"),o=a.data("token");clearTimeout(s),i.find(".add_to_cart").data("quantity",t.val()),s=setTimeout(function(){n&&n.abort(),n=r.ajax({beforeSend:function(){x(a)},complete:function(){j(a)},data:{product_id:e,wishlist_token:o,quantity:t.val(),action:yith_wcwl_l10n.actions.update_item_quantity},method:"POST",url:yith_wcwl_l10n.ajax_url})},1e3)})}(),_(),r(document).on("click",".show-tab",function(t){var i=r(this),e=i.closest(".yith-wcwl-popup-content"),a=i.data("tab"),o=e.find(".tab").filter("."+a);if(t.preventDefault(),!o.length)return!1;i.addClass("active").siblings(".show-tab").removeClass("active"),o.show().siblings(".tab").hide(),"create"===a?e.prepend('<input type="hidden" id="new_wishlist_selector" class="wishlist-select" value="new">'):e.find("#new_wishlist_selector").remove()}),r(document).on("change",".wishlist-select",function(t){var i=r(this),e=i.closest(".yith-wcwl-popup-content"),a=i.closest(".tab"),o=e.find(".tab.create"),n=e.find(".show-tab"),s=n.filter('[data-tab="create"]');"new"===i.val()&&o.length&&(a.hide(),o.show(),n.removeClass("active"),s.addClass("active"),i.find("option").removeProp("selected"),i.change())}),i(),a(),e(),o(),function(){var c=!1;r(window).on("resize",function(t){var i=r(".wishlist_table.responsive"),e=i.is(".mobile"),a=window.matchMedia("(max-width: 768px)"),o=i.closest("form"),n=o.attr("class"),s=o.data("fragment-options"),d={},l=!1;i.length&&(a.matches&&i&&!e?(s.is_mobile="yes",l=!0):!a.matches&&i&&e&&(s.is_mobile="no",l=!0),l&&(c&&c.abort(),d[n]=s,c=r.ajax({beforeSend:function(){x(i)},complete:function(){j(i)},data:{action:yith_wcwl_l10n.actions.load_mobile_action,fragments:d},method:"post",success:function(t){void 0!==t.fragments&&(P(t.fragments),h(),r(document).trigger("yith_wcwl_responsive_template",[e,t.fragments]))},url:yith_wcwl_l10n.ajax_url})))})}(),c(),S()}).trigger("yith_wcwl_init")});
assets/js/unminified/jquery.yith-wcwl.js CHANGED
@@ -197,6 +197,10 @@ jQuery( document ).ready( function( $ ){
197
 
198
  t.on( 'click', '.hide-title-form', hide_title_form );
199
 
 
 
 
 
200
  t.on( 'change', '.change-wishlist', function(){
201
  var t = $(this),
202
  table = t.parents( '.cart.wishlist_table'),
@@ -482,6 +486,15 @@ jQuery( document ).ready( function( $ ){
482
  } );
483
  } );
484
 
 
 
 
 
 
 
 
 
 
485
  t.on( 'yith_wcwl_fragments_loaded', function( ev ){
486
  $( '.variations_form' ).find( '.variations select' ).last().change();
487
  } );
@@ -756,7 +769,7 @@ jQuery( document ).ready( function( $ ){
756
  * @since 2.0.0
757
  */
758
  function init_wishlist_popup() {
759
- if( ! yith_wcwl_l10n.enable_notices ){
760
  return;
761
  }
762
 
@@ -811,7 +824,7 @@ jQuery( document ).ready( function( $ ){
811
  return;
812
  }
813
 
814
- $('.wishlist_table').each( function(){
815
  var t = $(this),
816
  jqxhr = false;
817
 
@@ -1268,7 +1281,7 @@ jQuery( document ).ready( function( $ ){
1268
  title = t.parents( '.wishlist-title' );
1269
  }
1270
 
1271
- title.next().show();
1272
  title.hide();
1273
  }
1274
 
@@ -1284,7 +1297,103 @@ jQuery( document ).ready( function( $ ){
1284
  ev.preventDefault();
1285
 
1286
  t.parents( '.hidden-title-form').hide();
1287
- t.parents( '.hidden-title-form').prev().show ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1288
  }
1289
 
1290
  /* === UTILS === */
@@ -1343,9 +1452,10 @@ jQuery( document ).ready( function( $ ){
1343
  */
1344
  function print_message( response_message ) {
1345
  var msgPopup = $( '#yith-wcwl-popup-message' ),
1346
- msg = $( '#yith-wcwl-message' );
 
1347
 
1348
- if( ! yith_wcwl_l10n.enable_notices ){
1349
  return;
1350
  }
1351
 
@@ -1353,7 +1463,7 @@ jQuery( document ).ready( function( $ ){
1353
  msgPopup.css( 'margin-left', '-' + $( msgPopup ).width() + 'px' ).fadeIn();
1354
  window.setTimeout( function() {
1355
  msgPopup.fadeOut();
1356
- }, yith_wcwl_l10n.popup_timeout );
1357
  }
1358
 
1359
  /**
@@ -1467,15 +1577,18 @@ jQuery( document ).ready( function( $ ){
1467
  */
1468
  function retrieve_fragments( search ) {
1469
  var options = {},
1470
- fragments = $('.wishlist-fragment');
1471
 
1472
  if( search ){
1473
  if( typeof search === 'object' ){
1474
  search = $.extend( {
1475
  s: '',
 
1476
  firstLoad: false
1477
  }, search );
1478
 
 
 
1479
  if( search.s ){
1480
  fragments = fragments.not('[data-fragment-ref]').add(fragments.filter('[data-fragment-ref="' + search.s + '"]'));
1481
  }
@@ -1484,10 +1597,17 @@ jQuery( document ).ready( function( $ ){
1484
  fragments = fragments.filter( '.on-first-load' );
1485
  }
1486
  }
1487
- else if( typeof search == 'string' || typeof search == 'number' ) {
1488
- fragments = fragments.not('[data-fragment-ref]').add(fragments.filter('[data-fragment-ref="' + search + '"]'));
 
 
 
 
1489
  }
1490
  }
 
 
 
1491
 
1492
  fragments.each( function(){
1493
  var t = $(this),
@@ -1502,16 +1622,19 @@ jQuery( document ).ready( function( $ ){
1502
  /**
1503
  * Load fragments on page loading
1504
  *
 
1505
  * @since 3.0.0
1506
  */
1507
- function load_fragments() {
1508
  if( ! yith_wcwl_l10n.enable_ajax_loading ){
1509
  return;
1510
  }
1511
 
1512
- var fragments = retrieve_fragments( {
1513
  firstLoad: true
1514
- } );
 
 
1515
 
1516
  if( ! fragments ){
1517
  return;
197
 
198
  t.on( 'click', '.hide-title-form', hide_title_form );
199
 
200
+ t.on( 'click', '.save-title-form', submit_title_form );
201
+
202
+ t.on( 'change', '.wishlist_manage_table .wishlist-visibility', save_privacy );
203
+
204
  t.on( 'change', '.change-wishlist', function(){
205
  var t = $(this),
206
  table = t.parents( '.cart.wishlist_table'),
486
  } );
487
  } );
488
 
489
+ t.on( 'yith_wcwl_reload_fragments', load_fragments );
490
+
491
+ t.on( 'yith_infs_added_elem', function( ev, elem ){
492
+ load_fragments( {
493
+ container: elem,
494
+ firstLoad: false
495
+ } );
496
+ } );
497
+
498
  t.on( 'yith_wcwl_fragments_loaded', function( ev ){
499
  $( '.variations_form' ).find( '.variations select' ).last().change();
500
  } );
769
  * @since 2.0.0
770
  */
771
  function init_wishlist_popup() {
772
+ if( typeof yith_wcwl_l10n.enable_notices != 'undefined' && ! yith_wcwl_l10n.enable_notices ){
773
  return;
774
  }
775
 
824
  return;
825
  }
826
 
827
+ $('.wishlist_table').filter('.sortable').not('.no-interactions').each( function(){
828
  var t = $(this),
829
  jqxhr = false;
830
 
1281
  title = t.parents( '.wishlist-title' );
1282
  }
1283
 
1284
+ title.next().show().find('input[type="text"]').focus();
1285
  title.hide();
1286
  }
1287
 
1297
  ev.preventDefault();
1298
 
1299
  t.parents( '.hidden-title-form').hide();
1300
+ t.parents( '.hidden-title-form').prev().show();
1301
+ }
1302
+
1303
+ /**
1304
+ * Submit form to save a new wishlist title
1305
+ *
1306
+ * @param ev event
1307
+ * @return void
1308
+ * @since 2.0.7
1309
+ */
1310
+ function submit_title_form( ev ) {
1311
+ var t = $(this),
1312
+ form = t.closest( '.hidden-title-form' ),
1313
+ row = t.closest( '[data-wishlist-id]' ),
1314
+ wishlist_id = row.data( 'wishlist-id' ),
1315
+ title_input = form.find( 'input[type="text"]' ),
1316
+ new_title = title_input.val(),
1317
+ data = {};
1318
+
1319
+ ev.preventDefault();
1320
+
1321
+ if( ! new_title ){
1322
+ form.addClass('woocommerce-invalid');
1323
+ title_input.focus();
1324
+ return;
1325
+ }
1326
+
1327
+ data = {
1328
+ action: yith_wcwl_l10n.actions.save_title_action,
1329
+ wishlist_id: wishlist_id,
1330
+ title: new_title,
1331
+ fragments: retrieve_fragments()
1332
+ };
1333
+
1334
+ $.ajax({
1335
+ type: 'POST',
1336
+ url: yith_wcwl_l10n.ajax_url,
1337
+ data: data,
1338
+ dataType: 'json',
1339
+ beforeSend: function(){
1340
+ block( form );
1341
+ },
1342
+ complete: function(){
1343
+ unblock( form );
1344
+ },
1345
+ success: function( response ) {
1346
+ var fragments = response.fragments,
1347
+ status = response.result;
1348
+
1349
+ if( status ) {
1350
+ form.hide();
1351
+ form.prev().find('.wishlist-anchor').text( new_title ).end().show();
1352
+ }
1353
+ else{
1354
+ form.addClass( 'woocommerce-invalid' );
1355
+ title_input.focus();
1356
+ }
1357
+
1358
+ if( typeof fragments != 'undefined' ){
1359
+ replace_fragments( fragments );
1360
+ }
1361
+ }
1362
+ });
1363
+ }
1364
+
1365
+ /**
1366
+ * Submit form to save a new wishlist privacy
1367
+ *
1368
+ * @param ev event
1369
+ * @return void
1370
+ * @since 2.0.7
1371
+ */
1372
+ function save_privacy( ev ){
1373
+ var t = $(this),
1374
+ new_privacy = t.val(),
1375
+ row = t.closest( '[data-wishlist-id]' ),
1376
+ wishlist_id = row.data( 'wishlist-id' ),
1377
+ data = {
1378
+ action: yith_wcwl_l10n.actions.save_privacy_action,
1379
+ wishlist_id: wishlist_id,
1380
+ privacy: new_privacy,
1381
+ fragments: retrieve_fragments()
1382
+ };
1383
+
1384
+ $.ajax({
1385
+ type: 'POST',
1386
+ url: yith_wcwl_l10n.ajax_url,
1387
+ data: data,
1388
+ dataType: 'json',
1389
+ success: function( response ) {
1390
+ var fragments = response.fragments;
1391
+
1392
+ if( typeof fragments != 'undefined' ){
1393
+ replace_fragments( fragments );
1394
+ }
1395
+ }
1396
+ });
1397
  }
1398
 
1399
  /* === UTILS === */
1452
  */
1453
  function print_message( response_message ) {
1454
  var msgPopup = $( '#yith-wcwl-popup-message' ),
1455
+ msg = $( '#yith-wcwl-message' ),
1456
+ timeout = typeof yith_wcwl_l10n.popup_timeout != 'undefined' ? yith_wcwl_l10n.popup_timeout : 3000;
1457
 
1458
+ if( typeof yith_wcwl_l10n.enable_notices != 'undefined' && ! yith_wcwl_l10n.enable_notices ){
1459
  return;
1460
  }
1461
 
1463
  msgPopup.css( 'margin-left', '-' + $( msgPopup ).width() + 'px' ).fadeIn();
1464
  window.setTimeout( function() {
1465
  msgPopup.fadeOut();
1466
+ }, timeout );
1467
  }
1468
 
1469
  /**
1577
  */
1578
  function retrieve_fragments( search ) {
1579
  var options = {},
1580
+ fragments = null;
1581
 
1582
  if( search ){
1583
  if( typeof search === 'object' ){
1584
  search = $.extend( {
1585
  s: '',
1586
+ container: $(document),
1587
  firstLoad: false
1588
  }, search );
1589
 
1590
+ fragments = search.container.find( '.wishlist-fragment' );
1591
+
1592
  if( search.s ){
1593
  fragments = fragments.not('[data-fragment-ref]').add(fragments.filter('[data-fragment-ref="' + search.s + '"]'));
1594
  }
1597
  fragments = fragments.filter( '.on-first-load' );
1598
  }
1599
  }
1600
+ else {
1601
+ fragments = $('.wishlist-fragment');
1602
+
1603
+ if (typeof search == 'string' || typeof search == 'number') {
1604
+ fragments = fragments.not('[data-fragment-ref]').add(fragments.filter('[data-fragment-ref="' + search + '"]'));
1605
+ }
1606
  }
1607
  }
1608
+ else{
1609
+ fragments = $('.wishlist-fragment');
1610
+ }
1611
 
1612
  fragments.each( function(){
1613
  var t = $(this),
1622
  /**
1623
  * Load fragments on page loading
1624
  *
1625
+ * @param search string Ref to search among all fragments in the page
1626
  * @since 3.0.0
1627
  */
1628
+ function load_fragments( search ) {
1629
  if( ! yith_wcwl_l10n.enable_ajax_loading ){
1630
  return;
1631
  }
1632
 
1633
+ search = $.extend( {
1634
  firstLoad: true
1635
+ }, search );
1636
+
1637
+ var fragments = retrieve_fragments( search );
1638
 
1639
  if( ! fragments ){
1640
  return;
includes/class.yith-wcwl-admin.php CHANGED
@@ -155,7 +155,7 @@ if ( ! class_exists( 'YITH_WCWL_Admin' ) ) {
155
  // update database
156
  YITH_WCWL_Install()->update( $stored_db_version );
157
  do_action( 'yith_wcwl_updated' );
158
- }
159
 
160
  // Plugin installed
161
  do_action( 'yith_wcwl_installed' );
@@ -234,17 +234,17 @@ if ( ! class_exists( 'YITH_WCWL_Admin' ) ) {
234
  * Adds yith-disabled class
235
  * Adds class to fields when required, and when disabled state cannot be achieved any other way (eg. by dependencies)
236
  *
237
- * @param $classes array Array of field extra classes
238
- * @param $field array Array of field data
239
- *
240
- * @return array Filtered array of extra classes
241
  */
242
  public function mark_options_disabled( $classes, $field ) {
243
- if( isset( $field['id'] ) && 'yith_wfbt_enable_integration' == $field['id'] && ! ( defined( 'YITH_WFBT' ) && YITH_WFBT ) ){
244
- $classes[] = 'yith-disabled';
245
- }
246
 
247
- return $classes;
248
  }
249
 
250
  /**
155
  // update database
156
  YITH_WCWL_Install()->update( $stored_db_version );
157
  do_action( 'yith_wcwl_updated' );
158
+ }
159
 
160
  // Plugin installed
161
  do_action( 'yith_wcwl_installed' );
234
  * Adds yith-disabled class
235
  * Adds class to fields when required, and when disabled state cannot be achieved any other way (eg. by dependencies)
236
  *
237
+ * @param $classes array Array of field extra classes
238
+ * @param $field array Array of field data
239
+ *
240
+ * @return array Filtered array of extra classes
241
  */
242
  public function mark_options_disabled( $classes, $field ) {
243
+ if( isset( $field['id'] ) && 'yith_wfbt_enable_integration' == $field['id'] && ! ( defined( 'YITH_WFBT' ) && YITH_WFBT ) ){
244
+ $classes[] = 'yith-disabled';
245
+ }
246
 
247
+ return $classes;
248
  }
249
 
250
  /**
includes/class.yith-wcwl-ajax-handler.php CHANGED
@@ -58,43 +58,44 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
58
  try {
59
  YITH_WCWL()->add();
60
 
61
- $return = 'true';
62
  $message = apply_filters( 'yith_wcwl_product_added_to_wishlist_message', get_option( 'yith_wcwl_product_added_text' ) );
63
- }
64
- catch( YITH_WCWL_Exception $e ){
65
- $return = $e->getTextualCode();
66
  $message = apply_filters( 'yith_wcwl_error_adding_to_wishlist_message', $e->getMessage() );
67
- }
68
- catch( Exception $e ){
69
- $return = 'error';
70
  $message = apply_filters( 'yith_wcwl_error_adding_to_wishlist_message', $e->getMessage() );
71
  }
72
 
73
- $product_id = isset( $_REQUEST['add_to_wishlist'] ) ? intval( $_REQUEST['add_to_wishlist'] ) : false;
74
- $fragments = isset( $_REQUEST['fragments'] ) ? $_REQUEST['fragments'] : false;
75
  $wishlist_url = YITH_WCWL()->get_last_operation_url();
76
 
77
  $wishlists = YITH_WCWL_Wishlist_Factory::get_wishlists();
 
78
  $wishlists_to_prompt = array();
79
 
80
- foreach( $wishlists as $wishlist ){
81
  $wishlists_to_prompt[] = array(
82
- 'id' => $wishlist->get_id(),
83
- 'wishlist_name' => $wishlist->get_formatted_name(),
84
- 'add_to_this_wishlist_url' => $product_id ? add_query_arg( array(
85
- 'add_to_wishlist' => $product_id,
86
- 'wishlist_id' => $wishlist->get_id()
87
- ) ) : ''
 
 
88
  );
89
  }
90
 
91
- if( in_array( $return, array( 'exists', 'true' ) ) ){
92
  // search for related fragments
93
- if( ! empty( $fragments ) && ! empty( $product_id ) ){
94
- foreach( $fragments as $id => $options ){
95
- if( strpos( $id, 'add-to-wishlist-' . $product_id ) ){
96
- $fragments[ $id ]['wishlist_url'] = $wishlist_url;
97
- $fragments[ $id ]['added_to_wishlist'] = $return == 'true';
98
  }
99
  }
100
  }
@@ -102,12 +103,12 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
102
 
103
  wp_send_json(
104
  apply_filters( 'yith_wcwl_ajax_add_return_params', array(
105
- 'prod_id' => $product_id,
106
- 'result' => $return,
107
- 'message' => $message,
108
- 'fragments' => self::refresh_fragments( $fragments ),
109
  'user_wishlists' => $wishlists_to_prompt,
110
- 'wishlist_url' => $wishlist_url
111
  ) )
112
  );
113
  }
@@ -118,18 +119,17 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
118
  * @return void
119
  */
120
  public static function remove_from_wishlist() {
121
- try{
122
  YITH_WCWL()->remove();
123
  $message = apply_filters( 'yith_wcwl_product_removed_text', __( 'Product successfully removed.', 'yith-woocommerce-wishlist' ) );
124
- }
125
- catch( Exception $e ){
126
  $message = $e->getMessage();
127
  }
128
 
129
  wc_add_notice( $message );
130
 
131
  wp_send_json( array(
132
- 'fragments' => self::refresh_fragments( isset( $_REQUEST['fragments'] ) ? $_REQUEST['fragments'] : false )
133
  ) );
134
  }
135
 
@@ -142,20 +142,20 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
142
  */
143
  public static function delete_item() {
144
  $item_id = isset( $_POST['item_id'] ) ? intval( $_POST['item_id'] ) : false;
145
- $return = array(
146
- 'result' => false
147
  );
148
 
149
- if( $item_id ){
150
  $item = YITH_WCWL_Wishlist_Factory::get_wishlist_item( $item_id );
151
 
152
- if( $item ){
153
  $item->delete();
154
 
155
  $return = array(
156
- 'result' => true,
157
- 'message' => apply_filters( 'yith_wcwl_product_removed_text', __( 'Product successfully removed.', 'yith-woocommerce-wishlist' ) ),
158
- 'fragments' => YITH_WCWL_Ajax_Handler::refresh_fragments( isset( $_REQUEST['fragments'] ) ? $_REQUEST['fragments'] : false )
159
  );
160
  }
161
  }
@@ -171,7 +171,7 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
171
  */
172
  public static function load_fragments() {
173
  wp_send_json( array(
174
- 'fragments' => self::refresh_fragments( isset( $_POST['fragments'] ) ? $_POST['fragments'] : false )
175
  ) );
176
  }
177
 
@@ -182,29 +182,27 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
182
  * @since 1.0.0
183
  */
184
  public static function reload_wishlist_and_adding_elem() {
185
- $type_msg = 'success';
186
 
187
  try {
188
  YITH_WCWL()->add();
189
  $message = apply_filters( 'yith_wcwl_product_added_to_wishlist_message', get_option( 'yith_wcwl_product_added_text' ) );
190
- }
191
- catch( YITH_WCWL_Exception $e ){
192
- $message = $e->getMessage();
193
  $type_msg = $e->getTextualCode();
194
- }
195
- catch( Exception $e ){
196
- $message = $e->getMessage();
197
  $type_msg = 'error';
198
  }
199
 
200
  $wishlist_token = isset( $_REQUEST['wishlist_token'] ) ? $_REQUEST['wishlist_token'] : false;
201
 
202
  $atts = array( 'wishlist_id' => $wishlist_token );
203
- if( isset( $_REQUEST['pagination'] ) ){
204
  $atts['pagination'] = $_REQUEST['pagination'];
205
  }
206
 
207
- if( isset( $_REQUEST['per_page'] ) ){
208
  $atts['per_page'] = $_REQUEST['per_page'];
209
  }
210
 
@@ -212,7 +210,7 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
212
 
213
  wc_add_notice( $message, $type_msg );
214
 
215
- echo '<div>'. YITH_WCWL_Shortcode::wishlist( $atts ) . '</div>';
216
 
217
  echo ob_get_clean();
218
  die();
@@ -229,10 +227,10 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
229
  global $yith_wcwl_is_mobile;
230
 
231
  $fragments = isset( $_POST['fragments'] ) ? $_POST['fragments'] : false;
232
- $result = array();
233
 
234
- if( ! empty( $fragments ) ){
235
- foreach( $fragments as $id => $options ){
236
  $yith_wcwl_is_mobile = isset( $options['is_mobile'] ) ? 'yes' == $options['is_mobile'] : false;
237
 
238
  $result = array_merge( $result, self::refresh_fragments( array( $id => $options ) ) );
@@ -240,7 +238,7 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
240
  }
241
 
242
  wp_send_json( array(
243
- 'fragments' => $result
244
  ) );
245
  }
246
 
@@ -253,16 +251,16 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
253
  public static function refresh_fragments( $fragments ) {
254
  $result = array();
255
 
256
- if( ! empty( $fragments ) ){
257
- foreach( $fragments as $id => $options ){
258
  $options = YITH_WCWL_Frontend()->decode_fragment_options( $options );
259
- $item = isset( $options['item'] ) ? $options['item'] : false;
260
 
261
- if( ! $item ){
262
  continue;
263
  }
264
 
265
- switch( $item ){
266
  case 'add_to_wishlist':
267
  case 'wishlist':
268
  $result[ $id ] = YITH_WCWL_Shortcode::$item( $options );
@@ -284,4 +282,4 @@ if ( ! class_exists( 'YITH_WCWL_Ajax_Handler' ) ) {
284
  }
285
  }
286
  }
287
- YITH_WCWL_Ajax_Handler::init();
58
  try {
59
  YITH_WCWL()->add();
60
 
61
+ $return = 'true';
62
  $message = apply_filters( 'yith_wcwl_product_added_to_wishlist_message', get_option( 'yith_wcwl_product_added_text' ) );
63
+ } catch ( YITH_WCWL_Exception $e ) {
64
+ $return = $e->getTextualCode();
 
65
  $message = apply_filters( 'yith_wcwl_error_adding_to_wishlist_message', $e->getMessage() );
66
+ } catch ( Exception $e ) {
67
+ $return = 'error';
 
68
  $message = apply_filters( 'yith_wcwl_error_adding_to_wishlist_message', $e->getMessage() );
69
  }
70
 
71
+ $product_id = isset( $_REQUEST['add_to_wishlist'] ) ? intval( $_REQUEST['add_to_wishlist'] ) : false;
72
+ $fragments = isset( $_REQUEST['fragments'] ) ? $_REQUEST['fragments'] : false;
73
  $wishlist_url = YITH_WCWL()->get_last_operation_url();
74
 
75
  $wishlists = YITH_WCWL_Wishlist_Factory::get_wishlists();
76
+
77
  $wishlists_to_prompt = array();
78
 
79
+ foreach ( $wishlists as $wishlist ) {
80
  $wishlists_to_prompt[] = array(
81
+ 'id' => $wishlist->get_id(),
82
+ 'wishlist_name' => $wishlist->get_formatted_name(),
83
+ 'add_to_this_wishlist_url' => $product_id ? add_query_arg(
84
+ array(
85
+ 'add_to_wishlist' => $product_id,
86
+ 'wishlist_id' => $wishlist->get_id(),
87
+ )
88
+ ) : '',
89
  );
90
  }
91
 
92
+ if ( in_array( $return, array( 'exists', 'true' ) ) ) {
93
  // search for related fragments
94
+ if ( ! empty( $fragments ) && ! empty( $product_id ) ) {
95
+ foreach ( $fragments as $id => $options ) {
96
+ if ( strpos( $id, 'add-to-wishlist-' . $product_id ) ) {
97
+ $fragments[ $id ]['wishlist_url'] = $wishlist_url;
98
+ $fragments[ $id ]['added_to_wishlist'] = 'true' == $return;
99
  }
100
  }
101
  }
103
 
104
  wp_send_json(
105
  apply_filters( 'yith_wcwl_ajax_add_return_params', array(
106
+ 'prod_id' => $product_id,
107
+ 'result' => $return,
108
+ 'message' => $message,
109
+ 'fragments' => self::refresh_fragments( $fragments ),
110
  'user_wishlists' => $wishlists_to_prompt,
111
+ 'wishlist_url' => $wishlist_url,
112
  ) )
113
  );
114
  }
119
  * @return void
120
  */
121
  public static function remove_from_wishlist() {
122
+ try {
123
  YITH_WCWL()->remove();
124
  $message = apply_filters( 'yith_wcwl_product_removed_text', __( 'Product successfully removed.', 'yith-woocommerce-wishlist' ) );
125
+ } catch ( Exception $e ) {
 
126
  $message = $e->getMessage();
127
  }
128
 
129
  wc_add_notice( $message );
130
 
131
  wp_send_json( array(
132
+ 'fragments' => self::refresh_fragments( isset( $_REQUEST['fragments'] ) ? $_REQUEST['fragments'] : false ),
133
  ) );
134
  }
135
 
142
  */
143
  public static function delete_item() {
144
  $item_id = isset( $_POST['item_id'] ) ? intval( $_POST['item_id'] ) : false;
145
+ $return = array(
146
+ 'result' => false,
147
  );
148
 
149
+ if ( $item_id ) {
150
  $item = YITH_WCWL_Wishlist_Factory::get_wishlist_item( $item_id );
151
 
152
+ if ( $item ) {
153
  $item->delete();
154
 
155
  $return = array(
156
+ 'result' => true,
157
+ 'message' => apply_filters( 'yith_wcwl_product_removed_text', __( 'Product successfully removed.', 'yith-woocommerce-wishlist' ) ),
158
+ 'fragments' => YITH_WCWL_Ajax_Handler::refresh_fragments( isset( $_REQUEST['fragments'] ) ? $_REQUEST['fragments'] : false ),
159
  );
160
  }
161
  }
171
  */
172
  public static function load_fragments() {
173
  wp_send_json( array(
174
+ 'fragments' => self::refresh_fragments( isset( $_POST['fragments'] ) ? $_POST['fragments'] : false ),
175
  ) );
176
  }
177
 
182
  * @since 1.0.0
183
  */
184
  public static function reload_wishlist_and_adding_elem() {
185
+ $type_msg = 'success';
186
 
187
  try {
188
  YITH_WCWL()->add();
189
  $message = apply_filters( 'yith_wcwl_product_added_to_wishlist_message', get_option( 'yith_wcwl_product_added_text' ) );
190
+ } catch ( YITH_WCWL_Exception $e ) {
191
+ $message = $e->getMessage();
 
192
  $type_msg = $e->getTextualCode();
193
+ } catch ( Exception $e ) {
194
+ $message = $e->getMessage();
 
195
  $type_msg = 'error';
196
  }
197
 
198
  $wishlist_token = isset( $_REQUEST['wishlist_token'] ) ? $_REQUEST['wishlist_token'] : false;
199
 
200
  $atts = array( 'wishlist_id' => $wishlist_token );
201
+ if ( isset( $_REQUEST['pagination'] ) ) {
202
  $atts['pagination'] = $_REQUEST['pagination'];
203
  }
204
 
205
+ if ( isset( $_REQUEST['per_page'] ) ) {
206
  $atts['per_page'] = $_REQUEST['per_page'];
207
  }
208
 
210
 
211
  wc_add_notice( $message, $type_msg );
212
 
213
+ echo '<div>' . YITH_WCWL_Shortcode::wishlist( $atts ) . '</div>';
214
 
215
  echo ob_get_clean();
216
  die();
227
  global $yith_wcwl_is_mobile;
228
 
229
  $fragments = isset( $_POST['fragments'] ) ? $_POST['fragments'] : false;
230
+ $result = array();
231
 
232
+ if ( ! empty( $fragments ) ) {
233
+ foreach ( $fragments as $id => $options ) {
234
  $yith_wcwl_is_mobile = isset( $options['is_mobile'] ) ? 'yes' == $options['is_mobile'] : false;
235
 
236
  $result = array_merge( $result, self::refresh_fragments( array( $id => $options ) ) );
238
  }
239
 
240
  wp_send_json( array(
241
+ 'fragments' => $result,
242
  ) );
243
  }
244
 
251
  public static function refresh_fragments( $fragments ) {
252
  $result = array();
253
 
254
+ if ( ! empty( $fragments ) ) {
255
+ foreach ( $fragments as $id => $options ) {
256
  $options = YITH_WCWL_Frontend()->decode_fragment_options( $options );
257
+ $item = isset( $options['item'] ) ? $options['item'] : false;
258
 
259
+ if ( ! $item ) {
260
  continue;
261
  }
262
 
263
+ switch ( $item ) {
264
  case 'add_to_wishlist':
265
  case 'wishlist':
266
  $result[ $id ] = YITH_WCWL_Shortcode::$item( $options );
282
  }
283
  }
284
  }
285
+ YITH_WCWL_Ajax_Handler::init();
includes/class.yith-wcwl-frontend.php CHANGED
@@ -33,7 +33,7 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
33
  * @var string
34
  * @since 1.0.0
35
  */
36
- public $version = '3.0.6';
37
 
38
  /**
39
  * Plugin database version
@@ -82,9 +82,9 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
82
  add_filter( 'option_yith_wcwl_add_to_cart_icon', array( $this, 'update_font_awesome_classes' ) );
83
 
84
  // init class
85
- add_action( 'init', array( $this, 'init' ), 0 );
86
 
87
- // templates
88
  add_action( 'wp_head', array( $this, 'add_button' ) );
89
  add_filter( 'body_class', array( $this, 'add_body_class' ) );
90
  add_action( 'template_redirect', array( $this, 'add_nocache_headers' ) );
@@ -98,15 +98,15 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
98
 
99
  // scripts
100
  add_action( 'wp_head', array( $this, 'detect_javascript' ), 0 );
101
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_stuffs' ) );
102
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
103
 
104
- // add YITH WooCommerce Frequently Bought Together Premium shortcode
105
- add_action( 'yith_wcwl_after_wishlist_form', array( $this, 'yith_wcfbt_shortcode' ), 10, 1 );
106
  add_filter( 'woocommerce_add_to_cart_redirect', array( $this, 'yith_wfbt_redirect_after_add_to_cart' ), 10, 1 );
107
 
108
- // YITH WCWL Loaded
109
- do_action( 'yith_wcwl_loaded' );
110
  }
111
 
112
  /**
@@ -122,8 +122,8 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
122
  $this->_convert_cookies_to_session();
123
 
124
  // register assets
125
- $this->register_styles();
126
- $this->register_scripts();
127
  }
128
 
129
  /* === ADD TO WISHLIST */
@@ -177,6 +177,16 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
177
  * @since 2.2.2
178
  */
179
  public function print_button() {
 
 
 
 
 
 
 
 
 
 
180
  echo do_shortcode( "[yith_wcwl_add_to_wishlist]" );
181
  }
182
 
@@ -215,23 +225,23 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
215
  }
216
 
217
  /**
218
- * Send nocache headers on wishlist page
219
- *
220
- * @return void
221
- * @since 3.0.0
222
  */
223
  public function add_nocache_headers() {
224
- if( ! headers_sent() && yith_wcwl_is_wishlist_page() ){
225
- wc_nocache_headers();
226
- }
227
  }
228
 
229
  /* === SCRIPTS AND ASSETS === */
230
 
231
  /**
232
- * Register styles required by the plugin
233
- *
234
- * @return void
235
  */
236
  public function register_styles() {
237
  $woocommerce_base = WC()->template_path();
@@ -249,7 +259,7 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
249
  ) );
250
 
251
  if( ! $located ){
252
- wp_register_style( 'yith-wcwl-main', YITH_WCWL_URL . 'assets/css/style.css', array( 'jquery-selectBox', 'yith-wcwl-font-awesome' ), $this->version );
253
  }
254
  else{
255
  $stylesheet_directory = get_stylesheet_directory();
@@ -260,24 +270,24 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
260
  $style_url = ( strpos( $located, $stylesheet_directory ) !== false ) ? str_replace( $stylesheet_directory, $stylesheet_directory_uri, $located ) : str_replace( $template_directory, $template_directory_uri, $located );
261
 
262
  wp_register_style( 'yith-wcwl-user-main', $style_url, array( 'jquery-selectBox', 'yith-wcwl-font-awesome' ), $this->version );
263
- }
264
 
265
  // theme specific assets
266
- $current_theme = wp_get_theme();
267
 
268
  if( $current_theme->exists() ){
269
- $theme_slug = $current_theme->Template;
270
 
271
- if( file_exists( YITH_WCWL_DIR . 'assets/css/themes/' . $theme_slug . '.css' ) ){
272
- wp_register_style( 'yith-wcwl-theme', YITH_WCWL_URL . 'assets/css/themes/' . $theme_slug . '.css', array( $located ? 'yith-wcwl-user-main' : 'yith-wcwl-main' ), $this->version );
273
- }
274
- }
275
  }
276
 
277
  /**
278
- * Register scripts required by the plugin
279
- *
280
- * @return void
281
  */
282
  public function register_scripts() {
283
  $woocommerce_base = WC()->template_path();
@@ -313,8 +323,8 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
313
  * @since 1.0.0
314
  */
315
  public function enqueue_styles_and_stuffs() {
316
- // libraries
317
- wp_enqueue_style( 'woocommerce_prettyPhoto_css' );
318
  wp_enqueue_style( 'jquery-selectBox' );
319
  wp_enqueue_style( 'yith-wcwl-font-awesome' );
320
 
@@ -328,17 +338,17 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
328
 
329
  // theme specific style
330
  if( wp_style_is( 'yith-wcwl-theme', 'registered' ) ){
331
- wp_enqueue_style( 'yith-wcwl-theme' );;
332
- }
333
 
334
  // custom style
335
  $this->enqueue_custom_style();
336
  }
337
 
338
  /**
339
- * Enqueue style dynamically generated by the plugin
340
- *
341
- * @return void
342
  */
343
  public function enqueue_custom_style() {
344
  $custom_css = $this->_build_custom_css();
@@ -357,7 +367,7 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
357
  * @since 1.0.0
358
  */
359
  public function enqueue_scripts() {
360
- wp_enqueue_script( 'prettyPhoto' );
361
  wp_enqueue_script( 'jquery-selectBox' );
362
 
363
  if ( ! wp_script_is( 'jquery-yith-wcwl-user', 'registered' ) ) {
@@ -369,33 +379,35 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
369
  }
370
 
371
  /**
372
- * Return localize array
373
- *
374
- * @return array Array with variables to be localized inside js
375
- * @since 2.2.3
376
  */
377
  public function get_localize() {
378
- return apply_filters( 'yith_wcwl_localize_script', array(
379
- 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
380
- 'redirect_to_cart' => get_option( 'yith_wcwl_redirect_cart' ),
381
- 'multi_wishlist' => false,
382
- 'hide_add_button' => apply_filters( 'yith_wcwl_hide_add_button', true ),
383
- 'enable_ajax_loading' => 'yes' == get_option( 'yith_wcwl_ajax_enable', 'no' ),
384
- 'ajax_loader_url' => YITH_WCWL_URL . 'assets/images/ajax-loader-alt.svg',
385
- 'remove_from_wishlist_after_add_to_cart' => get_option( 'yith_wcwl_remove_after_add_to_cart' ) == 'yes',
386
- 'labels' => array(
387
- 'cookie_disabled' => __( 'We are sorry, but this feature is available only if cookies on your browser are enabled.', 'yith-woocommerce-wishlist' ),
388
- 'added_to_cart_message' => sprintf( '<div class="woocommerce-notices-wrapper"><div class="woocommerce-message" role="alert">%s</div></div>', apply_filters( 'yith_wcwl_added_to_cart_message', __( 'Product added to cart successfully', 'yith-woocommerce-wishlist' ) ) )
389
- ),
390
- 'actions' => array(
391
- 'add_to_wishlist_action' => 'add_to_wishlist',
392
- 'remove_from_wishlist_action' => 'remove_from_wishlist',
393
- 'reload_wishlist_and_adding_elem_action' => 'reload_wishlist_and_adding_elem',
394
- 'load_mobile_action' => 'load_mobile',
395
- 'delete_item_action' => 'delete_item',
396
- 'load_fragments' => 'load_fragments'
397
- )
398
- ) );
 
 
399
  }
400
 
401
  /**
@@ -416,46 +428,46 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
416
 
417
  /* === TEMPLATES === */
418
 
419
- /**
420
- * Include main wishlist template
421
- *
422
- * @var $var array Array of parameters for current view
423
- * @return void
424
- */
425
  public function main_wishlist_content( $var ) {
426
- $template = isset( $var['template_part'] ) ? $var['template_part'] : 'view';
427
- $layout = ! empty( $var['layout'] ) ? $var['layout'] : '';
428
 
429
  yith_wcwl_get_template_part( $template, '', $layout, $var );
430
- }
431
-
432
- /**
433
- * Include wishlist header template
434
- *
435
- * @var $var array Array of parameters for current view
436
- * @return void
437
- */
438
  public function wishlist_header( $var ) {
439
- $template = isset( $var['template_part'] ) ? $var['template_part'] : 'view';
440
  $layout = ! empty( $var['layout'] ) ? $var['layout'] : '';
441
 
442
- yith_wcwl_get_template_part( $template, 'header', $layout, $var );
443
- }
444
 
445
- /**
446
- * Include wishlist footer template
447
- *
448
- * @var $var array Array of parameters for current view
449
- * @return void
450
- */
451
  public function wishlist_footer( $var ) {
452
  $template = isset( $var['template_part'] ) ? $var['template_part'] : 'view';
453
  $layout = ! empty( $var['layout'] ) ? $var['layout'] : '';
454
 
455
  yith_wcwl_get_template_part( $template, 'footer', $layout, $var );
456
- }
457
 
458
- /* === TEMPLATE MODIFICATIONS === */
459
 
460
  /**
461
  * Add class to products when Add to Wishlist is shown on loop
@@ -488,90 +500,90 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
488
 
489
  /* === UTILS === */
490
 
491
- /**
492
- * Format options that will sent through AJAX calls to refresh arguments
493
- *
494
- * @param $options array Array of options
495
- * @param $context string Widget/Shortcode that will use the options
496
- * @return array Array of formatted options
497
- * @since 3.0.0
498
- */
499
  public function format_fragment_options( $options, $context = '' ) {
500
- // removes unusable values, and changes options common for all fragments
501
- if( ! empty( $options ) ){
502
- foreach( $options as $id => $value ){
503
- if( is_object( $value ) || is_array( $value ) ){
504
- // remove item if type is not supported
505
- unset( $options[ $id ] );
506
- }
507
- elseif( 'ajax_loading' == $id ){
508
- $options['ajax_loading'] = false;
509
- }
510
- }
511
- }
512
 
513
- // applies context specific changes
514
- if( ! empty( $context ) ){
515
- $options['item'] = $context;
516
-
517
- switch( $context ) {
518
- case 'add_to_wishlist':
519
- unset( $options['template_part'] );
520
- unset( $options['label'] );
521
- unset( $options['exists'] );
522
- unset( $options['icon'] );
523
- unset( $options['link_classes'] );
524
- unset( $options['link_popup_classes'] );
525
- unset( $options['container_classes'] );
526
- unset( $options['found_in_list'] );
527
- unset( $options['found_item'] );
528
- unset( $options['popup_title'] );
529
- break;
530
- }
531
- }
532
 
533
- return $options;
534
- }
535
 
536
- /**
537
- * Decode options that comes from the fragment
538
- *
539
- * @param $options array Options for the fragments
540
- * @return array Filtered options for the fragment
541
- */
542
  public function decode_fragment_options( $options ) {
543
- if( ! empty( $options ) ){
544
- foreach( $options as $id => $value ){
545
- if( 'true' == $value ){
546
- $options[ $id ] = true;
547
- }
548
- elseif( 'false' == $value ){
549
- $options[ $id ] = false;
550
- }
551
- }
552
- }
553
 
554
- return $options;
555
- }
556
 
557
  /**
558
  * Alter add to cart button when on wishlist page
559
- *
560
- * @return void
561
- * @since 2.0.0
562
- * @version 3.0.0
563
  */
564
  public function alter_add_to_cart_button(){
565
- add_filter( 'woocommerce_loop_add_to_cart_args', array( $this, 'alter_add_to_cart_args' ) );
566
- add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'alter_add_to_cart_text' ), 10, 2 );
567
- add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'alter_add_to_cart_url' ), 10, 2 );
568
  }
569
 
570
  /**
571
- * Restore default Add to Cart button, after wishlist handling
572
- *
573
- * @return void
574
- * @since 3.0.0
575
  */
576
  public function restore_add_to_cart_button() {
577
  remove_filter( 'woocommerce_loop_add_to_cart_args', array( $this, 'alter_add_to_cart_args' ) );
@@ -582,51 +594,51 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
582
  /**
583
  * Changes arguments used to print Add to Cart button on wishlist (classes and attributes)
584
  *
585
- * @param $args array Array of arguments
586
- * @return array Array of filtered arguments
587
- * @since 3.0.0
588
  */
589
  public function alter_add_to_cart_args( $args ) {
590
  $use_custom_button = get_option( 'yith_wcwl_add_to_cart_style' );
591
  $button_class = in_array( $use_custom_button, array( 'button_custom', 'button_default' ) );
592
  $icon = get_option( 'yith_wcwl_add_to_cart_icon' );
593
  $custom_icon = get_option( 'yith_wcwl_add_to_cart_custom_icon' );
594
- $classes = isset( $args['class'] ) ? explode( ' ', $args['class'] ) : array();
595
 
596
- if( ! $button_class && $pos = array_search( 'button', $classes ) !== false ){
597
- unset( $classes[ $pos ] );
598
- }
599
- elseif( $button_class ){
600
- $classes[] = 'button';
601
- }
602
 
603
- $classes[] = 'add_to_cart';
604
- $classes[] = 'alt';
605
 
606
- $args['class'] = implode( ' ', $classes );
607
 
608
  if( 'button_custom' == $use_custom_button && $icon != 'none' ) {
609
  if( ! isset( $args['attributes'] ) ){
610
  $args['attributes'] = array();
611
- }
612
 
613
  if( $icon != 'custom' ) {
614
  $args['attributes']['data-icon'] = $icon;
615
  }
616
  elseif( $custom_icon ){
617
  $args['attributes']['data-icon'] = $custom_icon;
618
- }
619
  }
620
 
621
- return $args;
622
  }
623
 
624
  /**
625
- * Filter Add to Cart button label on wishlist page
626
- *
627
- * @param $text string Button label
628
- * @param \WC_Product Current product
629
- * @return string Filtered label
630
  */
631
  public function alter_add_to_cart_text( $text, $product ) {
632
  $label_option = get_option( 'yith_wcwl_add_to_cart_text', __( 'Add to cart', 'yith-woocommerce-wishlist' ) );
@@ -636,50 +648,50 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
636
  }
637
 
638
  /**
639
- * Filter Add to Cart button url on wishlist page
640
- *
641
- * @param $url string Url to the Add to Cart
642
- * @param $product \WC_Product Current product
643
- * @return string Filtered url
644
  */
645
  public function alter_add_to_cart_url( $url, $product ) {
646
- global $yith_wcwl_wishlist_token;
647
-
648
- if( $yith_wcwl_wishlist_token ){
649
- $wishlist = yith_wcwl_get_wishlist( $yith_wcwl_wishlist_token );
650
-
651
- if( ! $wishlist ){
652
- return $url;
653
- }
654
-
655
- $wishlist_id = $wishlist->get_id();
656
- $item = $wishlist->get_product( $product->get_id() );
657
-
658
- if( wp_doing_ajax() ){
659
- $url = add_query_arg( 'add-to-cart', $product->get_id(), YITH_WCWL()->get_wishlist_url( 'view/' . $yith_wcwl_wishlist_token ) );
660
- }
661
-
662
- if( $product->is_type( array( 'simple', 'variation' ) ) && get_option( 'yith_wcwl_redirect_cart' ) == 'yes' ){
663
- $url = add_query_arg( 'add-to-cart', $product->get_id(), wc_get_cart_url() );
664
- }
665
-
666
- if( ! $product->is_type( 'external' ) && get_option( 'yith_wcwl_remove_after_add_to_cart' ) == 'yes' ){
667
- $url = add_query_arg(
668
- array(
669
- 'remove_from_wishlist_after_add_to_cart' => $product->get_id(),
670
- 'wishlist_id' => $wishlist_id,
671
- 'wishlist_token' => $yith_wcwl_wishlist_token
672
- ),
673
- $url
674
- );
675
- }
676
-
677
- if( $item && 'yes' == get_option( 'yith_wcwl_quantity_show' ) ){
678
- $url = add_query_arg( 'quantity', $item->get_quantity(), $url );
679
- }
680
- }
681
 
682
- return apply_filters( 'yit_wcwl_add_to_cart_redirect_url', esc_url_raw( $url ), $url, $product );
683
  }
684
 
685
  /**
@@ -819,421 +831,425 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
819
  }
820
 
821
  /**
822
- * Generate CSS code to append to each page, to apply custom style to wishlist elements
823
  *
824
  * @param $rules array Array of additional rules to add to default ones
825
  * @return string Generated CSS code
826
  */
827
  protected function _build_custom_css( $rules = array() ){
828
- $generated_code = '';
829
- $rules = apply_filters( 'yith_wcwl_custom_css_rules', array_merge( array(
830
- 'color_add_to_wishlist' => array(
831
- 'selector' => '.woocommerce a.add_to_wishlist.button.alt',
832
- 'rules' => array(
833
- 'background' => array(
834
- 'rule' => 'background-color: %1$s; background: %1$s',
835
- 'default' => '#333333'
836
- ),
837
- 'text' => array(
838
- 'rule' => 'color: %s',
839
- 'default' => '#ffffff'
840
- ),
841
- 'border' => array(
842
- 'rule' => 'border-color: %s',
843
- 'default' => '#333333'
844
- ),
845
- 'background_hover' => array(
846
- 'rule' => 'background-color: %1$s; background: %1$s',
847
- 'default' => '#4F4F4F',
848
- 'status' => ':hover'
849
- ),
850
- 'text_hover' => array(
851
- 'rule' => 'color: %s',
852
- 'default' => '#ffffff',
853
- 'status' => ':hover'
854
- ),
855
- 'border_hover' => array(
856
- 'rule' => 'border-color: %s',
857
- 'default' => '#4F4F4F',
858
- 'status' => ':hover'
859
- )
860
- ),
861
- 'deps' => array(
862
- 'yith_wcwl_add_to_wishlist_style' => 'button_custom'
863
- )
864
- ),
865
- 'rounded_corners_radius' => array(
866
- 'selector' => '.woocommerce a.add_to_wishlist.button.alt',
867
- 'rules' => array(
868
- 'rule' => 'border-radius: %dpx',
869
- 'default' => 16
870
- ),
871
- 'deps' => array(
872
- 'yith_wcwl_add_to_wishlist_style' => 'button_custom'
873
- )
874
- ),
875
- 'color_add_to_cart' => array(
876
- 'selector' => '.woocommerce .wishlist_table a.add_to_cart.button.alt',
877
- 'rules' => array(
878
- 'background' => array(
879
- 'rule' => 'background: %1$s; background-color: %1$s;',
880
- 'default' => '#333333'
881
- ),
882
- 'text' => array(
883
- 'rule' => 'color: %s',
884
- 'default' => '#ffffff'
885
- ),
886
- 'border' => array(
887
- 'rule' => 'border-color: %s',
888
- 'default' => '#333333'
889
- ),
890
- 'background_hover' => array(
891
- 'rule' => 'background: %1$s; background-color: %1$s;',
892
- 'default' => '#4F4F4F',
893
- 'status' => ':hover'
894
- ),
895
- 'text_hover' => array(
896
- 'rule' => 'color: %s',
897
- 'default' => '#ffffff',
898
- 'status' => ':hover'
899
- ),
900
- 'border_hover' => array(
901
- 'rule' => 'border-color: %s',
902
- 'default' => '#4F4F4F',
903
- 'status' => ':hover'
904
- )
905
- ),
906
- 'deps' => array(
907
- 'yith_wcwl_add_to_cart_style' => 'button_custom'
908
- )
909
- ),
910
- 'add_to_cart_rounded_corners_radius' => array(
911
- 'selector' => '.woocommerce .wishlist_table a.add_to_cart.button.alt',
912
- 'rules' => array(
913
- 'rule' => 'border-radius: %dpx',
914
- 'default' => 16
915
- ),
916
- 'deps' => array(
917
- 'yith_wcwl_add_to_cart_style' => 'button_custom',
918
- )
919
- ),
920
- 'color_button_style_1' => array(
921
- 'selector' => '.woocommerce .hidden-title-form button,
922
- .yith-wcwl-wishlist-new .create-wishlist-button,
923
- .wishlist_manage_table tfoot button.submit-wishlist-changes,
924
- .yith-wcwl-wishlist-search-form button.wishlist-search-button',
925
- 'rules' => array(
926
- 'background' => array(
927
- 'rule' => 'background: %1$s; background-color: %1$s;',
928
- 'default' => '#333333'
929
- ),
930
- 'text' => array(
931
- 'rule' => 'color: %s',
932
- 'default' => '#ffffff'
933
- ),
934
- 'border' => array(
935
- 'rule' => 'border-color: %s',
936
- 'default' => '#333333'
937
- ),
938
- 'background_hover' => array(
939
- 'rule' => 'background: %1$s; background-color: %1$s;',
940
- 'default' => '#333333',
941
- 'status' => ':hover'
942
- ),
943
- 'text_hover' => array(
944
- 'rule' => 'color: %s',
945
- 'default' => '#ffffff',
946
- 'status' => ':hover'
947
- ),
948
- 'border_hover' => array(
949
- 'rule' => 'border-color: %s',
950
- 'default' => '#333333',
951
- 'status' => ':hover'
952
- )
953
- ),
954
- 'deps' => array(
955
- 'yith_wcwl_add_to_cart_style' => 'button_custom'
956
- )
957
- ),
958
- 'color_button_style_2' => array(
959
- 'selector' => '.woocommerce .wishlist-title a.show-title-form,
960
- .woocommerce .hidden-title-form a.hide-title-form,
961
- .wishlist_manage_table tfoot a.create-new-wishlist',
962
- 'rules' => array(
963
- 'background' => array(
964
- 'rule' => 'background: %1$s; background-color: %1$s;',
965
- 'default' => '#333333'
966
- ),
967
- 'text' => array(
968
- 'rule' => 'color: %s',
969
- 'default' => '#ffffff'
970
- ),
971
- 'border' => array(
972
- 'rule' => 'border-color: %s',
973
- 'default' => '#333333'
974
- ),
975
- 'background_hover' => array(
976
- 'rule' => 'background: %1$s; background-color: %1$s;',
977
- 'default' => '#333333',
978
- 'status' => ':hover'
979
- ),
980
- 'text_hover' => array(
981
- 'rule' => 'color: %s',
982
- 'default' => '#ffffff',
983
- 'status' => ':hover'
984
- ),
985
- 'border_hover' => array(
986
- 'rule' => 'border-color: %s',
987
- 'default' => '#333333',
988
- 'status' => ':hover'
989
- )
990
- ),
991
- 'deps' => array(
992
- 'yith_wcwl_add_to_cart_style' => 'button_custom'
993
- )
994
- ),
995
- 'color_wishlist_table' => array(
996
- 'selector' => '.woocommerce table.shop_table.wishlist_table',
997
- 'rules' => array(
998
- 'background' => array(
999
- 'rule' => 'background: %1$s; background-color: %1$s;',
1000
- 'default' => '#FFFFFF'
1001
- ),
1002
- 'text' => array(
1003
- 'rule' => 'color: %s',
1004
- 'default' => '#6D6C6C'
1005
- ),
1006
- 'border' => array(
1007
- 'rule' => 'background: %1$s; background-color: %1$s;',
1008
- 'default' => '#FFFFFF'
1009
- )
1010
- ),
1011
- 'deps' => array(
1012
- 'yith_wcwl_add_to_cart_style' => 'button_custom'
1013
- )
1014
- ),
1015
- 'color_headers_background' => array(
1016
- 'selector' => '.wishlist_table thead,
1017
- .wishlist_table tfoot,
1018
- .widget_yith-wcwl-lists ul.dropdown li.current a,
1019
- .widget_yith-wcwl-lists ul.dropdown li a:hover,
1020
- .selectBox-dropdown-menu.selectBox-options li.selectBox-selected a,
1021
- .selectBox-dropdown-menu.selectBox-options li.selectBox-hover a',
1022
- 'rules' => array(
1023
- 'rule' => 'background: %1$s; background-color: %1$s;',
1024
- 'default' => '#F4F4F4'
1025
- ),
1026
- 'deps' => array(
1027
- 'yith_wcwl_add_to_cart_style' => 'button_custom'
1028
- )
1029
- ),
1030
- 'color_share_button' => array(
1031
- 'selector' => '.yith-wcwl-share li a',
1032
- 'rules' => array(
1033
- 'color' => array(
1034
- 'rule' => 'color: %s;',
1035
- 'default' => '#FFFFFF'
1036
- ),
1037
- 'color_hover' => array(
1038
- 'rule' => 'color: %s;',
1039
- 'status' => ':hover',
1040
- 'default' => '#FFFFFF'
1041
- )
1042
- ),
1043
- 'deps' => array(
1044
- 'yith_wcwl_enable_share' => 'yes'
1045
- )
1046
- ),
1047
- 'color_fb_button' => array(
1048
- 'selector' => '.yith-wcwl-share a.facebook',
1049
- 'rules' => array(
1050
- 'background' => array(
1051
- 'rule' => 'background: %1$s; background-color: %1$s;',
1052
- 'default' => '#39599E'
1053
- ),
1054
- 'background_hover' => array(
1055
- 'rule' => 'background: %1$s; background-color: %1$s;',
1056
- 'status' => ':hover',
1057
- 'default' => '#39599E'
1058
- )
1059
- ),
1060
- 'deps' => array(
1061
- 'yith_wcwl_enable_share' => 'yes',
1062
- 'yith_wcwl_share_fb' => 'yes',
1063
- )
1064
- ),
1065
- 'color_tw_button' => array(
1066
- 'selector' => '.yith-wcwl-share a.twitter',
1067
- 'rules' => array(
1068
- 'background' => array(
1069
- 'rule' => 'background: %1$s; background-color: %1$s;',
1070
- 'default' => '#45AFE2'
1071
- ),
1072
- 'background_hover' => array(
1073
- 'rule' => 'background: %1$s; background-color: %1$s;',
1074
- 'status' => ':hover',
1075
- 'default' => '#39599E'
1076
- )
1077
- ),
1078
- 'deps' => array(
1079
- 'yith_wcwl_enable_share' => 'yes',
1080
- 'yith_wcwl_share_twitter' => 'yes',
1081
- )
1082
- ),
1083
- 'color_pr_button' => array(
1084
- 'selector' => '.yith-wcwl-share a.pinterest',
1085
- 'rules' => array(
1086
- 'background' => array(
1087
- 'rule' => 'background: %1$s; background-color: %1$s;',
1088
- 'default' => '#AB2E31'
1089
- ),
1090
- 'background_hover' => array(
1091
- 'rule' => 'background: %1$s; background-color: %1$s;',
1092
- 'status' => ':hover',
1093
- 'default' => '#39599E'
1094
- )
1095
- ),
1096
- 'deps' => array(
1097
- 'yith_wcwl_enable_share' => 'yes',
1098
- 'yith_wcwl_share_pinterest' => 'yes',
1099
- )
1100
- ),
1101
- 'color_em_button' => array(
1102
- 'selector' => '.yith-wcwl-share a.email',
1103
- 'rules' => array(
1104
- 'background' => array(
1105
- 'rule' => 'background: %1$s; background-color: %1$s;',
1106
- 'default' => '#FBB102'
1107
- ),
1108
- 'background_hover' => array(
1109
- 'rule' => 'background: %1$s; background-color: %1$s;',
1110
- 'status' => ':hover',
1111
- 'default' => '#39599E'
1112
- )
1113
- ),
1114
- 'deps' => array(
1115
- 'yith_wcwl_enable_share' => 'yes',
1116
- 'yith_wcwl_share_email' => 'yes',
1117
- )
1118
- ),
1119
- 'color_wa_button' => array(
1120
- 'selector' => '.yith-wcwl-share a.whatsapp',
1121
- 'rules' => array(
1122
- 'background' => array(
1123
- 'rule' => 'background: %1$s; background-color: %1$s;',
1124
- 'default' => '#00A901'
1125
- ),
1126
- 'background_hover' => array(
1127
- 'rule' => 'background: %1$s; background-color: %1$s;',
1128
- 'status' => ':hover',
1129
- 'default' => '#39599E'
1130
- )
1131
- ),
1132
- 'deps' => array(
1133
- 'yith_wcwl_enable_share' => 'yes',
1134
- 'yith_wcwl_share_whatsapp' => 'yes',
1135
- )
1136
- ),
1137
- ), $rules ) );
1138
-
1139
- if( empty( $rules ) ){
1140
- return $generated_code;
1141
- }
1142
 
1143
- // retrieve dependencies
1144
  $deps_list = wp_list_pluck( $rules, 'deps' );
1145
  $dependencies = array();
1146
 
1147
  if( ! empty( $deps_list ) ){
1148
- foreach( $deps_list as $rule => $deps ){
1149
- foreach( $deps as $dep_rule => $dep_value ){
1150
- if( ! isset( $dependencies[ $dep_rule ] ) ){
1151
- $dependencies[ $dep_rule ] = get_option( $dep_rule );
1152
- }
1153
- }
1154
- }
1155
- }
1156
 
1157
- foreach( $rules as $id => $rule ){
1158
- // check dependencies first
1159
- if( ! empty( $rule['deps'] ) ){
1160
- foreach( $rule['deps'] as $dep_rule => $dep_value ){
1161
- if( ! isset( $dependencies[ $dep_rule ] ) || $dependencies[ $dep_rule ] != $dep_value ){
1162
- continue 2;
1163
- }
1164
- }
1165
- }
1166
-
1167
- // retrieve values from db
1168
- $values = get_option( "yith_wcwl_{$id}" );
1169
- $new_rules = array();
1170
- $rules_code = '';
1171
-
1172
- // if we have a single-valued option, just search for the rule to apply
1173
- if( isset( $rule['rules']['rule'] ) ){
1174
- $status = isset( $rule['rules']['status'] ) ? $rule['rules']['status'] : '';
1175
-
1176
- if( ! isset( $new_rules[ $status ] ) ){
1177
- $new_rules[ $status ] = array();
1178
- }
1179
-
1180
- $new_rules[ $status ][] = $this->_build_css_rule( $rule['rules']['rule'], $values, $rule['rules']['default'] );
1181
- }
1182
-
1183
- // otherwise cycle through rules, and generate CSS code
1184
- else{
1185
- foreach( $rule['rules'] as $property => $css ){
1186
- $status = isset( $css['status'] ) ? $css['status'] : '';
1187
-
1188
- if( ! isset( $new_rules[ $status ] ) ){
1189
- $new_rules[ $status ] = array();
1190
- }
1191
-
1192
- $new_rules[ $status ][] = $this->_build_css_rule( $css['rule'], isset( $values[ $property ] ) ? $values[ $property ] : false, $css['default'] );
1193
- }
1194
- }
1195
-
1196
- // if code was generated, prepend selector
1197
- if( ! empty( $new_rules ) ){
1198
- foreach( $new_rules as $status => $rules ){
1199
- $selector = $rule['selector'];
1200
-
1201
- if( ! empty( $status ) ){
1202
- $updated_selector = array();
1203
- $split_selectors = explode( ',', $rule['selector'] );
1204
-
1205
- foreach( $split_selectors as $split_selector ){
1206
- $updated_selector[] = $split_selector . $status;
1207
- }
1208
-
1209
- $selector = implode( ',', $updated_selector );
1210
- }
1211
-
1212
- $rules_code .= $selector . '{' . implode( '', $rules ) . '}';
1213
- }
1214
- }
1215
-
1216
- // append new rule to generated CSS
1217
- $generated_code .= $rules_code;
1218
- }
1219
 
1220
- return $generated_code;
1221
- }
 
1222
 
1223
- /**
1224
- * Generate each single CSS rule that will be included in custom plugin CSS
1225
- *
1226
- * @param $rule string Rule to use; placeholders may be applied to be replaced with value {@see sprintf}
1227
- * @param $value string Value to inject inside rule, replacing placeholders
1228
- * @param $default string Default value, to be used instead of value when it is empty
1229
- *
1230
- * @return string Formatted CSS rule
1231
- */
1232
- protected function _build_css_rule( $rule, $value, $default = '' ){
1233
- $value = ( '0' === $value || ( ! empty( $value ) && ! is_array( $value ) ) ) ? $value : $default;
1234
 
1235
- return sprintf( rtrim( $rule, ';' ) . ';', $value );
1236
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1237
 
1238
  /**
1239
  * Destroy serialize cookies, to prevent major vulnerability
@@ -1278,39 +1294,39 @@ if ( ! class_exists( 'YITH_WCWL_Frontend' ) ) {
1278
  }
1279
 
1280
  /**
1281
- * Convert wishlist stored into cookies into
1282
  */
1283
  protected function _convert_cookies_to_session(){
1284
  $cookie = yith_getcookie( 'yith_wcwl_products' );
1285
 
1286
- if( ! empty( $cookie ) ){
1287
 
1288
- $default_list = YITH_WCWL_Wishlist_Factory::get_default_wishlist();
1289
 
1290
- if( ! $default_list ){
1291
- return false;
1292
- }
1293
 
1294
- foreach ( $cookie as $item ){
1295
- if( $default_list->has_product( $item['prod_id'] ) ){
1296
- continue;
1297
- }
1298
 
1299
- $new_item = new YITH_WCWL_Wishlist_Item();
1300
 
1301
- $new_item->set_product_id( $item['prod_id'] );
1302
- $new_item->set_quantity( $item['quantity'] );
1303
 
1304
- if( isset( $item['dateadded'] ) ){
1305
- $new_item->set_date_added( $item['dateadded'] );
1306
- }
1307
 
1308
- $default_list->add_item( $new_item );
1309
- }
1310
 
1311
- $default_list->save();
1312
 
1313
- yith_destroycookie( 'yith_wcwl_products' );
1314
  }
1315
  }
1316
  }
33
  * @var string
34
  * @since 1.0.0
35
  */
36
+ public $version = '3.0.7';
37
 
38
  /**
39
  * Plugin database version
82
  add_filter( 'option_yith_wcwl_add_to_cart_icon', array( $this, 'update_font_awesome_classes' ) );
83
 
84
  // init class
85
+ add_action( 'init', array( $this, 'init' ), 0 );
86
 
87
+ // templates
88
  add_action( 'wp_head', array( $this, 'add_button' ) );
89
  add_filter( 'body_class', array( $this, 'add_body_class' ) );
90
  add_action( 'template_redirect', array( $this, 'add_nocache_headers' ) );
98
 
99
  // scripts
100
  add_action( 'wp_head', array( $this, 'detect_javascript' ), 0 );
101
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_stuffs' ) );
102
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
103
 
104
+ // add YITH WooCommerce Frequently Bought Together Premium shortcode
105
+ add_action( 'yith_wcwl_after_wishlist_form', array( $this, 'yith_wcfbt_shortcode' ), 10, 1 );
106
  add_filter( 'woocommerce_add_to_cart_redirect', array( $this, 'yith_wfbt_redirect_after_add_to_cart' ), 10, 1 );
107
 
108
+ // YITH WCWL Loaded
109
+ do_action( 'yith_wcwl_loaded' );
110
  }
111
 
112
  /**
122
  $this->_convert_cookies_to_session();
123
 
124
  // register assets
125
+ $this->register_styles();
126
+ $this->register_scripts();
127
  }
128
 
129
  /* === ADD TO WISHLIST */
177
  * @since 2.2.2
178
  */
179
  public function print_button() {
180
+ /**
181
+ * Developers can use this filter to remove ATW button selectively from specific pages or products
182
+ * You can use global $product or $post to execute checks
183
+ *
184
+ * @since 3.0.7
185
+ */
186
+ if( ! apply_filters( 'yith_wcwl_show_add_to_wishlist', true ) ){
187
+ return;
188
+ }
189
+
190
  echo do_shortcode( "[yith_wcwl_add_to_wishlist]" );
191
  }
192
 
225
  }
226
 
227
  /**
228
+ * Send nocache headers on wishlist page
229
+ *
230
+ * @return void
231
+ * @since 3.0.0
232
  */
233
  public function add_nocache_headers() {
234
+ if( ! headers_sent() && yith_wcwl_is_wishlist_page() ){
235
+ wc_nocache_headers();
236
+ }
237
  }
238
 
239
  /* === SCRIPTS AND ASSETS === */
240
 
241
  /**
242
+ * Register styles required by the plugin
243
+ *
244
+ * @return void
245
  */
246
  public function register_styles() {
247
  $woocommerce_base = WC()->template_path();
259
  ) );
260
 
261
  if( ! $located ){
262
+ wp_register_style( 'yith-wcwl-main', YITH_WCWL_URL . 'assets/css/style.css', array( 'jquery-selectBox', 'yith-wcwl-font-awesome' ), $this->version );
263
  }
264
  else{
265
  $stylesheet_directory = get_stylesheet_directory();
270
  $style_url = ( strpos( $located, $stylesheet_directory ) !== false ) ? str_replace( $stylesheet_directory, $stylesheet_directory_uri, $located ) : str_replace( $template_directory, $template_directory_uri, $located );
271
 
272
  wp_register_style( 'yith-wcwl-user-main', $style_url, array( 'jquery-selectBox', 'yith-wcwl-font-awesome' ), $this->version );
273
+ }
274
 
275
  // theme specific assets
276
+ $current_theme = wp_get_theme();
277
 
278
  if( $current_theme->exists() ){
279
+ $theme_slug = $current_theme->Template;
280
 
281
+ if( file_exists( YITH_WCWL_DIR . 'assets/css/themes/' . $theme_slug . '.css' ) ){
282
+ wp_register_style( 'yith-wcwl-theme', YITH_WCWL_URL . 'assets/css/themes/' . $theme_slug . '.css', array( $located ? 'yith-wcwl-user-main' : 'yith-wcwl-main' ), $this->version );
283
+ }
284
+ }
285
  }
286
 
287
  /**
288
+ * Register scripts required by the plugin
289
+ *
290
+ * @return void
291
  */
292
  public function register_scripts() {
293
  $woocommerce_base = WC()->template_path();
323
  * @since 1.0.0
324
  */
325
  public function enqueue_styles_and_stuffs() {
326
+ // libraries
327
+ wp_enqueue_style( 'woocommerce_prettyPhoto_css' );
328
  wp_enqueue_style( 'jquery-selectBox' );
329
  wp_enqueue_style( 'yith-wcwl-font-awesome' );
330
 
338
 
339
  // theme specific style
340
  if( wp_style_is( 'yith-wcwl-theme', 'registered' ) ){
341
+ wp_enqueue_style( 'yith-wcwl-theme' );;
342
+ }
343
 
344
  // custom style
345
  $this->enqueue_custom_style();
346
  }
347
 
348
  /**
349
+ * Enqueue style dynamically generated by the plugin
350
+ *
351
+ * @return void
352
  */
353
  public function enqueue_custom_style() {
354
  $custom_css = $this->_build_custom_css();
367
  * @since 1.0.0
368
  */
369
  public function enqueue_scripts() {
370
+ wp_enqueue_script( 'prettyPhoto' );
371
  wp_enqueue_script( 'jquery-selectBox' );
372
 
373
  if ( ! wp_script_is( 'jquery-yith-wcwl-user', 'registered' ) ) {
379
  }
380
 
381
  /**
382
+ * Return localize array
383
+ *
384
+ * @return array Array with variables to be localized inside js
385
+ * @since 2.2.3
386
  */
387
  public function get_localize() {
388
+ return apply_filters( 'yith_wcwl_localize_script', array(
389
+ 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
390
+ 'redirect_to_cart' => get_option( 'yith_wcwl_redirect_cart' ),
391
+ 'multi_wishlist' => false,
392
+ 'hide_add_button' => apply_filters( 'yith_wcwl_hide_add_button', true ),
393
+ 'enable_ajax_loading' => 'yes' == get_option( 'yith_wcwl_ajax_enable', 'no' ),
394
+ 'ajax_loader_url' => YITH_WCWL_URL . 'assets/images/ajax-loader-alt.svg',
395
+ 'remove_from_wishlist_after_add_to_cart' => get_option( 'yith_wcwl_remove_after_add_to_cart' ) == 'yes',
396
+ 'labels' => array(
397
+ 'cookie_disabled' => __( 'We are sorry, but this feature is available only if cookies on your browser are enabled.', 'yith-woocommerce-wishlist' ),
398
+ 'added_to_cart_message' => sprintf( '<div class="woocommerce-notices-wrapper"><div class="woocommerce-message" role="alert">%s</div></div>', apply_filters( 'yith_wcwl_added_to_cart_message', __( 'Product added to cart successfully', 'yith-woocommerce-wishlist' ) ) )
399
+ ),
400
+ 'actions' => array(
401
+ 'add_to_wishlist_action' => 'add_to_wishlist',
402
+ 'remove_from_wishlist_action' => 'remove_from_wishlist',
403
+ 'reload_wishlist_and_adding_elem_action' => 'reload_wishlist_and_adding_elem',
404
+ 'load_mobile_action' => 'load_mobile',
405
+ 'delete_item_action' => 'delete_item',
406
+ 'save_title_action' => 'save_title',
407
+ 'save_privacy_action' => 'save_privacy',
408
+ 'load_fragments' => 'load_fragments'
409
+ )
410
+ ) );
411
  }
412
 
413
  /**
428
 
429
  /* === TEMPLATES === */
430
 
431
+ /**
432
+ * Include main wishlist template
433
+ *
434
+ * @var $var array Array of parameters for current view
435
+ * @return void
436
+ */
437
  public function main_wishlist_content( $var ) {
438
+ $template = isset( $var['template_part'] ) ? $var['template_part'] : 'view';
439
+ $layout = ! empty( $var['layout'] ) ? $var['layout'] : '';
440
 
441
  yith_wcwl_get_template_part( $template, '', $layout, $var );
442
+ }
443
+
444
+ /**
445
+ * Include wishlist header template
446
+ *
447
+ * @var $var array Array of parameters for current view
448
+ * @return void
449
+ */
450
  public function wishlist_header( $var ) {
451
+ $template = isset( $var['template_part'] ) ? $var['template_part'] : 'view';
452
  $layout = ! empty( $var['layout'] ) ? $var['layout'] : '';
453
 
454
+ yith_wcwl_get_template_part( $template, 'header', $layout, $var );
455
+ }
456
 
457
+ /**
458
+ * Include wishlist footer template
459
+ *
460
+ * @var $var array Array of parameters for current view
461
+ * @return void
462
+ */
463
  public function wishlist_footer( $var ) {
464
  $template = isset( $var['template_part'] ) ? $var['template_part'] : 'view';
465
  $layout = ! empty( $var['layout'] ) ? $var['layout'] : '';
466
 
467
  yith_wcwl_get_template_part( $template, 'footer', $layout, $var );
468
+ }
469
 
470
+ /* === TEMPLATE MODIFICATIONS === */
471
 
472
  /**
473
  * Add class to products when Add to Wishlist is shown on loop
500
 
501
  /* === UTILS === */
502
 
503
+ /**
504
+ * Format options that will sent through AJAX calls to refresh arguments
505
+ *
506
+ * @param $options array Array of options
507
+ * @param $context string Widget/Shortcode that will use the options
508
+ * @return array Array of formatted options
509
+ * @since 3.0.0
510
+ */
511
  public function format_fragment_options( $options, $context = '' ) {
512
+ // removes unusable values, and changes options common for all fragments
513
+ if( ! empty( $options ) ){
514
+ foreach( $options as $id => $value ){
515
+ if( is_object( $value ) || is_array( $value ) ){
516
+ // remove item if type is not supported
517
+ unset( $options[ $id ] );
518
+ }
519
+ elseif( 'ajax_loading' == $id ){
520
+ $options['ajax_loading'] = false;
521
+ }
522
+ }
523
+ }
524
 
525
+ // applies context specific changes
526
+ if( ! empty( $context ) ){
527
+ $options['item'] = $context;
528
+
529
+ switch( $context ) {
530
+ case 'add_to_wishlist':
531
+ unset( $options['template_part'] );
532
+ unset( $options['label'] );
533
+ unset( $options['exists'] );
534
+ unset( $options['icon'] );
535
+ unset( $options['link_classes'] );
536
+ unset( $options['link_popup_classes'] );
537
+ unset( $options['container_classes'] );
538
+ unset( $options['found_in_list'] );
539
+ unset( $options['found_item'] );
540
+ unset( $options['popup_title'] );
541
+ break;
542
+ }
543
+ }
544
 
545
+ return $options;
546
+ }
547
 
548
+ /**
549
+ * Decode options that comes from the fragment
550
+ *
551
+ * @param $options array Options for the fragments
552
+ * @return array Filtered options for the fragment
553
+ */
554
  public function decode_fragment_options( $options ) {
555
+ if( ! empty( $options ) ){
556
+ foreach( $options as $id => $value ){
557
+ if( 'true' == $value ){
558
+ $options[ $id ] = true;
559
+ }
560
+ elseif( 'false' == $value ){
561
+ $options[ $id ] = false;
562
+ }
563
+ }
564
+ }
565
 
566
+ return $options;
567
+ }
568
 
569
  /**
570
  * Alter add to cart button when on wishlist page
571
+ *
572
+ * @return void
573
+ * @since 2.0.0
574
+ * @version 3.0.0
575
  */
576
  public function alter_add_to_cart_button(){
577
+ add_filter( 'woocommerce_loop_add_to_cart_args', array( $this, 'alter_add_to_cart_args' ) );
578
+ add_filter( 'woocommerce_product_add_to_cart_text', array( $this, 'alter_add_to_cart_text' ), 10, 2 );
579
+ add_filter( 'woocommerce_product_add_to_cart_url', array( $this, 'alter_add_to_cart_url' ), 10, 2 );
580
  }
581
 
582
  /**
583
+ * Restore default Add to Cart button, after wishlist handling
584
+ *
585
+ * @return void
586
+ * @since 3.0.0
587
  */
588
  public function restore_add_to_cart_button() {
589
  remove_filter( 'woocommerce_loop_add_to_cart_args', array( $this, 'alter_add_to_cart_args' ) );
594
  /**
595
  * Changes arguments used to print Add to Cart button on wishlist (classes and attributes)
596
  *
597
+ * @param $args array Array of arguments
598
+ * @return array Array of filtered arguments
599
+ * @since 3.0.0
600
  */
601
  public function alter_add_to_cart_args( $args ) {
602
  $use_custom_button = get_option( 'yith_wcwl_add_to_cart_style' );
603
  $button_class = in_array( $use_custom_button, array( 'button_custom', 'button_default' ) );
604
  $icon = get_option( 'yith_wcwl_add_to_cart_icon' );
605
  $custom_icon = get_option( 'yith_wcwl_add_to_cart_custom_icon' );
606
+ $classes = isset( $args['class'] ) ? explode( ' ', $args['class'] ) : array();
607
 
608
+ if( ! $button_class && $pos = array_search( 'button', $classes ) !== false ){
609
+ unset( $classes[ $pos ] );
610
+ }
611
+ elseif( $button_class ){
612
+ $classes[] = 'button';
613
+ }
614
 
615
+ $classes[] = 'add_to_cart';
616
+ $classes[] = 'alt';
617
 
618
+ $args['class'] = implode( ' ', $classes );
619
 
620
  if( 'button_custom' == $use_custom_button && $icon != 'none' ) {
621
  if( ! isset( $args['attributes'] ) ){
622
  $args['attributes'] = array();
623
+ }
624
 
625
  if( $icon != 'custom' ) {
626
  $args['attributes']['data-icon'] = $icon;
627
  }
628
  elseif( $custom_icon ){
629
  $args['attributes']['data-icon'] = $custom_icon;
630
+ }
631
  }
632
 
633
+ return $args;
634
  }
635
 
636
  /**
637
+ * Filter Add to Cart button label on wishlist page
638
+ *
639
+ * @param $text string Button label
640
+ * @param \WC_Product Current product
641
+ * @return string Filtered label
642
  */
643
  public function alter_add_to_cart_text( $text, $product ) {
644
  $label_option = get_option( 'yith_wcwl_add_to_cart_text', __( 'Add to cart', 'yith-woocommerce-wishlist' ) );
648
  }
649
 
650
  /**
651
+ * Filter Add to Cart button url on wishlist page
652
+ *
653
+ * @param $url string Url to the Add to Cart
654
+ * @param $product \WC_Product Current product
655
+ * @return string Filtered url
656
  */
657
  public function alter_add_to_cart_url( $url, $product ) {
658
+ global $yith_wcwl_wishlist_token;
659
+
660
+ if( $yith_wcwl_wishlist_token ){
661
+ $wishlist = yith_wcwl_get_wishlist( $yith_wcwl_wishlist_token );
662
+
663
+ if( ! $wishlist ){
664
+ return $url;
665
+ }
666
+
667
+ $wishlist_id = $wishlist->get_id();
668
+ $item = $wishlist->get_product( $product->get_id() );
669
+
670
+ if( wp_doing_ajax() ){
671
+ $url = add_query_arg( 'add-to-cart', $product->get_id(), YITH_WCWL()->get_wishlist_url( 'view/' . $yith_wcwl_wishlist_token ) );
672
+ }
673
+
674
+ if( $product->is_type( array( 'simple', 'variation' ) ) && get_option( 'yith_wcwl_redirect_cart' ) == 'yes' ){
675
+ $url = add_query_arg( 'add-to-cart', $product->get_id(), wc_get_cart_url() );
676
+ }
677
+
678
+ if( ! $product->is_type( 'external' ) && get_option( 'yith_wcwl_remove_after_add_to_cart' ) == 'yes' ){
679
+ $url = add_query_arg(
680
+ array(
681
+ 'remove_from_wishlist_after_add_to_cart' => $product->get_id(),
682
+ 'wishlist_id' => $wishlist_id,
683
+ 'wishlist_token' => $yith_wcwl_wishlist_token
684
+ ),
685
+ $url
686
+ );
687
+ }
688
+
689
+ if( $item && 'yes' == get_option( 'yith_wcwl_quantity_show' ) ){
690
+ $url = add_query_arg( 'quantity', $item->get_quantity(), $url );
691
+ }
692
+ }
693
 
694
+ return apply_filters( 'yit_wcwl_add_to_cart_redirect_url', esc_url_raw( $url ), $url, $product );
695
  }
696
 
697
  /**
831
  }
832
 
833
  /**
834
+ * Generate CSS code to append to each page, to apply custom style to wishlist elements
835
  *
836
  * @param $rules array Array of additional rules to add to default ones
837
  * @return string Generated CSS code
838
  */
839
  protected function _build_custom_css( $rules = array() ){
840
+ $generated_code = '';
841
+ $rules = apply_filters( 'yith_wcwl_custom_css_rules', array_merge( array(
842
+ 'color_add_to_wishlist' => array(
843
+ 'selector' => '.woocommerce a.add_to_wishlist.button.alt',
844
+ 'rules' => array(
845
+ 'background' => array(
846
+ 'rule' => 'background-color: %1$s; background: %1$s',
847
+ 'default' => '#333333'
848
+ ),
849
+ 'text' => array(
850
+ 'rule' => 'color: %s',
851
+ 'default' => '#ffffff'
852
+ ),
853
+ 'border' => array(
854
+ 'rule' => 'border-color: %s',
855
+ 'default' => '#333333'
856
+ ),
857
+ 'background_hover' => array(
858
+ 'rule' => 'background-color: %1$s; background: %1$s',
859
+ 'default' => '#4F4F4F',
860
+ 'status' => ':hover'
861
+ ),
862
+ 'text_hover' => array(
863
+ 'rule' => 'color: %s',
864
+ 'default' => '#ffffff',
865
+ 'status' => ':hover'
866
+ ),
867
+ 'border_hover' => array(
868
+ 'rule' => 'border-color: %s',
869
+ 'default' => '#4F4F4F',
870
+ 'status' => ':hover'
871
+ )
872
+ ),
873
+ 'deps' => array(
874
+ 'yith_wcwl_add_to_wishlist_style' => 'button_custom'
875
+ )
876
+ ),
877
+ 'rounded_corners_radius' => array(
878
+ 'selector' => '.woocommerce a.add_to_wishlist.button.alt',
879
+ 'rules' => array(
880
+ 'rule' => 'border-radius: %dpx',
881
+ 'default' => 16
882
+ ),
883
+ 'deps' => array(
884
+ 'yith_wcwl_add_to_wishlist_style' => 'button_custom'
885
+ )
886
+ ),
887
+ 'color_add_to_cart' => array(
888
+ 'selector' => '.woocommerce .wishlist_table a.add_to_cart.button.alt',
889
+ 'rules' => array(
890
+ 'background' => array(
891
+ 'rule' => 'background: %1$s; background-color: %1$s;',
892
+ 'default' => '#333333'
893
+ ),
894
+ 'text' => array(
895
+ 'rule' => 'color: %s',
896
+ 'default' => '#ffffff'
897
+ ),
898
+ 'border' => array(
899
+ 'rule' => 'border-color: %s',
900
+ 'default' => '#333333'
901
+ ),
902
+ 'background_hover' => array(
903
+ 'rule' => 'background: %1$s; background-color: %1$s;',
904
+ 'default' => '#4F4F4F',
905
+ 'status' => ':hover'
906
+ ),
907
+ 'text_hover' => array(
908
+ 'rule' => 'color: %s',
909
+ 'default' => '#ffffff',
910
+ 'status' => ':hover'
911
+ ),
912
+ 'border_hover' => array(
913
+ 'rule' => 'border-color: %s',
914
+ 'default' => '#4F4F4F',
915
+ 'status' => ':hover'
916
+ )
917
+ ),
918
+ 'deps' => array(
919
+ 'yith_wcwl_add_to_cart_style' => 'button_custom'
920
+ )
921
+ ),
922
+ 'add_to_cart_rounded_corners_radius' => array(
923
+ 'selector' => '.woocommerce .wishlist_table a.add_to_cart.button.alt',
924
+ 'rules' => array(
925
+ 'rule' => 'border-radius: %dpx',
926
+ 'default' => 16
927
+ ),
928
+ 'deps' => array(
929
+ 'yith_wcwl_add_to_cart_style' => 'button_custom',
930
+ )
931
+ ),
932
+ 'color_button_style_1' => array(
933
+ 'selector' => '.woocommerce .hidden-title-form button,
934
+ .yith-wcwl-wishlist-new .create-wishlist-button,
935
+ .wishlist_manage_table tfoot button.submit-wishlist-changes,
936
+ .yith-wcwl-wishlist-search-form button.wishlist-search-button',
937
+ 'rules' => array(
938
+ 'background' => array(
939
+ 'rule' => 'background: %1$s; background-color: %1$s;',
940
+ 'default' => '#333333'
941
+ ),
942
+ 'text' => array(
943
+ 'rule' => 'color: %s',
944
+ 'default' => '#ffffff'
945
+ ),
946
+ 'border' => array(
947
+ 'rule' => 'border-color: %s',
948
+ 'default' => '#333333'
949
+ ),
950
+ 'background_hover' => array(
951
+ 'rule' => 'background: %1$s; background-color: %1$s;',
952
+ 'default' => '#333333',
953
+ 'status' => ':hover'
954
+ ),
955
+ 'text_hover' => array(
956
+ 'rule' => 'color: %s',
957
+ 'default' => '#ffffff',
958
+ 'status' => ':hover'
959
+ ),
960
+ 'border_hover' => array(
961
+ 'rule' => 'border-color: %s',
962
+ 'default' => '#333333',
963
+ 'status' => ':hover'
964
+ )
965
+ ),
966
+ 'deps' => array(
967
+ 'yith_wcwl_add_to_cart_style' => 'button_custom'
968
+ )
969
+ ),
970
+ 'color_button_style_2' => array(
971
+ 'selector' => '.woocommerce .wishlist-title a.show-title-form,
972
+ .woocommerce .hidden-title-form a.hide-title-form,
973
+ .wishlist_manage_table tfoot a.create-new-wishlist',
974
+ 'rules' => array(
975
+ 'background' => array(
976
+ 'rule' => 'background: %1$s; background-color: %1$s;',
977
+ 'default' => '#333333'
978
+ ),
979
+ 'text' => array(
980
+ 'rule' => 'color: %s',
981
+ 'default' => '#ffffff'
982
+ ),
983
+ 'border' => array(
984
+ 'rule' => 'border-color: %s',
985
+ 'default' => '#333333'
986
+ ),
987
+ 'background_hover' => array(
988
+ 'rule' => 'background: %1$s; background-color: %1$s;',
989
+ 'default' => '#333333',
990
+ 'status' => ':hover'
991
+ ),
992
+ 'text_hover' => array(
993
+ 'rule' => 'color: %s',
994
+ 'default' => '#ffffff',
995
+ 'status' => ':hover'
996
+ ),
997
+ 'border_hover' => array(
998
+ 'rule' => 'border-color: %s',
999
+ 'default' => '#333333',
1000
+ 'status' => ':hover'
1001
+ )
1002
+ ),
1003
+ 'deps' => array(
1004
+ 'yith_wcwl_add_to_cart_style' => 'button_custom'
1005
+ )
1006
+ ),
1007
+ 'color_wishlist_table' => array(
1008
+ 'selector' => '.woocommerce table.shop_table.wishlist_table tr td',
1009
+ 'rules' => array(
1010
+ 'background' => array(
1011
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1012
+ 'default' => '#FFFFFF'
1013
+ ),
1014
+ 'text' => array(
1015
+ 'rule' => 'color: %s',
1016
+ 'default' => '#6D6C6C'
1017
+ ),
1018
+ 'border' => array(
1019
+ 'rule' => 'border-color: %s;',
1020
+ 'default' => '#FFFFFF'
1021
+ )
1022
+ ),
1023
+ 'deps' => array(
1024
+ 'yith_wcwl_add_to_cart_style' => 'button_custom'
1025
+ )
1026
+ ),
1027
+ 'color_headers_background' => array(
1028
+ 'selector' => '.wishlist_table thead tr th,
1029
+ .wishlist_table tfoot td td,
1030
+ .widget_yith-wcwl-lists ul.dropdown li.current a,
1031
+ .widget_yith-wcwl-lists ul.dropdown li a:hover,
1032
+ .selectBox-dropdown-menu.selectBox-options li.selectBox-selected a,
1033
+ .selectBox-dropdown-menu.selectBox-options li.selectBox-hover a',
1034
+ 'rules' => array(
1035
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1036
+ 'default' => '#F4F4F4'
1037
+ ),
1038
+ 'deps' => array(
1039
+ 'yith_wcwl_add_to_cart_style' => 'button_custom'
1040
+ )
1041
+ ),
1042
+ 'color_share_button' => array(
1043
+ 'selector' => '.yith-wcwl-share li a',
1044
+ 'rules' => array(
1045
+ 'color' => array(
1046
+ 'rule' => 'color: %s;',
1047
+ 'default' => '#FFFFFF'
1048
+ ),
1049
+ 'color_hover' => array(
1050
+ 'rule' => 'color: %s;',
1051
+ 'status' => ':hover',
1052
+ 'default' => '#FFFFFF'
1053
+ )
1054
+ ),
1055
+ 'deps' => array(
1056
+ 'yith_wcwl_enable_share' => 'yes'
1057
+ )
1058
+ ),
1059
+ 'color_fb_button' => array(
1060
+ 'selector' => '.yith-wcwl-share a.facebook',
1061
+ 'rules' => array(
1062
+ 'background' => array(
1063
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1064
+ 'default' => '#39599E'
1065
+ ),
1066
+ 'background_hover' => array(
1067
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1068
+ 'status' => ':hover',
1069
+ 'default' => '#39599E'
1070
+ )
1071
+ ),
1072
+ 'deps' => array(
1073
+ 'yith_wcwl_enable_share' => 'yes',
1074
+ 'yith_wcwl_share_fb' => 'yes',
1075
+ )
1076
+ ),
1077
+ 'color_tw_button' => array(
1078
+ 'selector' => '.yith-wcwl-share a.twitter',
1079
+ 'rules' => array(
1080
+ 'background' => array(
1081
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1082
+ 'default' => '#45AFE2'
1083
+ ),
1084
+ 'background_hover' => array(
1085
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1086
+ 'status' => ':hover',
1087
+ 'default' => '#39599E'
1088
+ )
1089
+ ),
1090
+ 'deps' => array(
1091
+ 'yith_wcwl_enable_share' => 'yes',
1092
+ 'yith_wcwl_share_twitter' => 'yes',
1093
+ )
1094
+ ),
1095
+ 'color_pr_button' => array(
1096
+ 'selector' => '.yith-wcwl-share a.pinterest',
1097
+ 'rules' => array(
1098
+ 'background' => array(
1099
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1100
+ 'default' => '#AB2E31'
1101
+ ),
1102
+ 'background_hover' => array(
1103
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1104
+ 'status' => ':hover',
1105
+ 'default' => '#39599E'
1106
+ )
1107
+ ),
1108
+ 'deps' => array(
1109
+ 'yith_wcwl_enable_share' => 'yes',
1110
+ 'yith_wcwl_share_pinterest' => 'yes',
1111
+ )
1112
+ ),
1113
+ 'color_em_button' => array(
1114
+ 'selector' => '.yith-wcwl-share a.email',
1115
+ 'rules' => array(
1116
+ 'background' => array(
1117
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1118
+ 'default' => '#FBB102'
1119
+ ),
1120
+ 'background_hover' => array(
1121
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1122
+ 'status' => ':hover',
1123
+ 'default' => '#39599E'
1124
+ )
1125
+ ),
1126
+ 'deps' => array(
1127
+ 'yith_wcwl_enable_share' => 'yes',
1128
+ 'yith_wcwl_share_email' => 'yes',
1129
+ )
1130
+ ),
1131
+ 'color_wa_button' => array(
1132
+ 'selector' => '.yith-wcwl-share a.whatsapp',
1133
+ 'rules' => array(
1134
+ 'background' => array(
1135
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1136
+ 'default' => '#00A901'
1137
+ ),
1138
+ 'background_hover' => array(
1139
+ 'rule' => 'background: %1$s; background-color: %1$s;',
1140
+ 'status' => ':hover',
1141
+ 'default' => '#39599E'
1142
+ )
1143
+ ),
1144
+ 'deps' => array(
1145
+ 'yith_wcwl_enable_share' => 'yes',
1146
+ 'yith_wcwl_share_whatsapp' => 'yes',
1147
+ )
1148
+ ),
1149
+ ), $rules ) );
1150
+
1151
+ if( empty( $rules ) ){
1152
+ return $generated_code;
1153
+ }
1154
 
1155
+ // retrieve dependencies
1156
  $deps_list = wp_list_pluck( $rules, 'deps' );
1157
  $dependencies = array();
1158
 
1159
  if( ! empty( $deps_list ) ){
1160
+ foreach( $deps_list as $rule => $deps ){
1161
+ foreach( $deps as $dep_rule => $dep_value ){
1162
+ if( ! isset( $dependencies[ $dep_rule ] ) ){
1163
+ $dependencies[ $dep_rule ] = get_option( $dep_rule );
1164
+ }
1165
+ }
1166
+ }
1167
+ }
1168
 
1169
+ foreach( $rules as $id => $rule ){
1170
+ // check dependencies first
1171
+ if( ! empty( $rule['deps'] ) ){
1172
+ foreach( $rule['deps'] as $dep_rule => $dep_value ){
1173
+ if( ! isset( $dependencies[ $dep_rule ] ) || $dependencies[ $dep_rule ] != $dep_value ){
1174
+ continue 2;
1175
+ }
1176
+ }
1177
+ }
1178
+
1179
+ // retrieve values from db
1180
+ $values = get_option( "yith_wcwl_{$id}" );
1181
+ $new_rules = array();
1182
+ $rules_code = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1183
 
1184
+ // if we have a single-valued option, just search for the rule to apply
1185
+ if( isset( $rule['rules']['rule'] ) ){
1186
+ $status = isset( $rule['rules']['status'] ) ? $rule['rules']['status'] : '';
1187
 
1188
+ if( ! isset( $new_rules[ $status ] ) ){
1189
+ $new_rules[ $status ] = array();
1190
+ }
1191
+
1192
+ $new_rules[ $status ][] = $this->_build_css_rule( $rule['rules']['rule'], $values, $rule['rules']['default'] );
1193
+ }
 
 
 
 
 
1194
 
1195
+ // otherwise cycle through rules, and generate CSS code
1196
+ else{
1197
+ foreach( $rule['rules'] as $property => $css ){
1198
+ $status = isset( $css['status'] ) ? $css['status'] : '';
1199
+
1200
+ if( ! isset( $new_rules[ $status ] ) ){
1201
+ $new_rules[ $status ] = array();
1202
+ }
1203
+
1204
+ $new_rules[ $status ][] = $this->_build_css_rule( $css['rule'], isset( $values[ $property ] ) ? $values[ $property ] : false, $css['default'] );
1205
+ }
1206
+ }
1207
+
1208
+ // if code was generated, prepend selector
1209
+ if( ! empty( $new_rules ) ){
1210
+ foreach( $new_rules as $status => $rules ){
1211
+ $selector = $rule['selector'];
1212
+
1213
+ if( ! empty( $status ) ){
1214
+ $updated_selector = array();
1215
+ $split_selectors = explode( ',', $rule['selector'] );
1216
+
1217
+ foreach( $split_selectors as $split_selector ){
1218
+ $updated_selector[] = $split_selector . $status;
1219
+ }
1220
+
1221
+ $selector = implode( ',', $updated_selector );
1222
+ }
1223
+
1224
+ $rules_code .= $selector . '{' . implode( '', $rules ) . '}';
1225
+ }
1226
+ }
1227
+
1228
+ // append new rule to generated CSS
1229
+ $generated_code .= $rules_code;
1230
+ }
1231
+
1232
+ if( $custom_css = get_option( 'yith_wcwl_custom_css' ) ){
1233
+ $generated_code .= $custom_css;
1234
+ }
1235
+
1236
+ return $generated_code;
1237
+ }
1238
+
1239
+ /**
1240
+ * Generate each single CSS rule that will be included in custom plugin CSS
1241
+ *
1242
+ * @param $rule string Rule to use; placeholders may be applied to be replaced with value {@see sprintf}
1243
+ * @param $value string Value to inject inside rule, replacing placeholders
1244
+ * @param $default string Default value, to be used instead of value when it is empty
1245
+ *
1246
+ * @return string Formatted CSS rule
1247
+ */
1248
+ protected function _build_css_rule( $rule, $value, $default = '' ){
1249
+ $value = ( '0' === $value || ( ! empty( $value ) && ! is_array( $value ) ) ) ? $value : $default;
1250
+
1251
+ return sprintf( rtrim( $rule, ';' ) . ';', $value );
1252
+ }
1253
 
1254
  /**
1255
  * Destroy serialize cookies, to prevent major vulnerability
1294
  }
1295
 
1296
  /**
1297
+ * Convert wishlist stored into cookies into
1298
  */
1299
  protected function _convert_cookies_to_session(){
1300
  $cookie = yith_getcookie( 'yith_wcwl_products' );
1301
 
1302
+ if( ! empty( $cookie ) ){
1303
 
1304
+ $default_list = YITH_WCWL_Wishlist_Factory::get_default_wishlist();
1305
 
1306
+ if( ! $default_list ){
1307
+ return false;
1308
+ }
1309
 
1310
+ foreach ( $cookie as $item ){
1311
+ if( $default_list->has_product( $item['prod_id'] ) ){
1312
+ continue;
1313
+ }
1314
 
1315
+ $new_item = new YITH_WCWL_Wishlist_Item();
1316
 
1317
+ $new_item->set_product_id( $item['prod_id'] );
1318
+ $new_item->set_quantity( $item['quantity'] );
1319
 
1320
+ if( isset( $item['dateadded'] ) ){
1321
+ $new_item->set_date_added( $item['dateadded'] );
1322
+ }
1323
 
1324
+ $default_list->add_item( $new_item );
1325
+ }
1326
 
1327
+ $default_list->save();
1328
 
1329
+ yith_destroycookie( 'yith_wcwl_products' );
1330
  }
1331
  }
1332
  }
includes/class.yith-wcwl-install.php CHANGED
@@ -8,371 +8,373 @@
8
  */
9
 
10
  if ( !defined( 'YITH_WCWL' ) ) {
11
- exit;
12
  } // Exit if accessed directly
13
 
14
  if ( !class_exists( 'YITH_WCWL_Install' ) ) {
15
- /**
16
- * Install plugin table and create the wishlist page
17
- *
18
- * @since 1.0.0
19
- */
20
- class YITH_WCWL_Install {
21
-
22
- /**
23
- * Single instance of the class
24
- *
25
- * @var \YITH_WCWL_Install
26
- * @since 2.0.0
27
- */
28
- protected static $instance;
29
-
30
- /**
31
- * Items table name
32
- *
33
- * @var string
34
- * @access private
35
- * @since 1.0.0
36
- */
37
- private $_table_items;
38
-
39
- /**
40
- * Items table name
41
- *
42
- * @var string
43
- * @access private
44
- * @since 1.0.0
45
- */
46
- private $_table_wishlists;
47
-
48
- /**
49
- * Returns single instance of the class
50
- *
51
- * @return \YITH_WCWL_Install
52
- * @since 2.0.0
53
- */
54
- public static function get_instance(){
55
- if( is_null( self::$instance ) ){
56
- self::$instance = new self();
57
- }
58
-
59
- return self::$instance;
60
- }
61
-
62
- /**
63
- * Constructor.
64
- *
65
- * @since 1.0.0
66
- */
67
- public function __construct() {
68
- global $wpdb;
69
-
70
- // define local private attribute
71
- $this->_table_items = $wpdb->prefix . 'yith_wcwl';
72
- $this->_table_wishlists = $wpdb->prefix . 'yith_wcwl_lists';
73
-
74
- // add custom field to global $wpdb
75
- $wpdb->yith_wcwl_items = $this->_table_items;
76
- $wpdb->yith_wcwl_wishlists = $this->_table_wishlists;
77
-
78
- // define constant to use allover the application
79
- define( 'YITH_WCWL_ITEMS_TABLE', $this->_table_items );
80
- define( 'YITH_WCWL_WISHLISTS_TABLE', $this->_table_wishlists );
81
-
82
- /**
83
- * @deprecated
84
- */
85
- define( 'YITH_WCWL_TABLE', $this->_table_items );
86
- }
87
-
88
- /**
89
- * Init db structure of the plugin
90
- *
91
- * @since 1.0.0
92
- */
93
- public function init() {
94
- $this->_add_tables();
95
- $this->_add_pages();
96
-
97
- $this->register_current_version();
98
- }
99
-
100
- /**
101
- * Update db structure of the plugin
102
- *
103
- * @param $current_version string Version from which we're updating
104
- *
105
- * @ince 3.0.0
106
- */
107
- public function update( $current_version ) {
108
- if( version_compare( $current_version, '1.0.0', '<' ) ){
109
- $this->_update_100();
110
- }
111
-
112
- if( version_compare( $current_version, '2.0.0', '<' ) ){
113
- $this->_update_200();
114
- }
115
-
116
- if( version_compare( $current_version, '3.0.0', '<' ) ){
117
- $this->_update_300();
118
- }
119
-
120
- $this->register_current_version();
121
- }
122
-
123
- /**
124
- * Register current version of plugin and database sctructure
125
- *
126
- * @since 3.0.0
127
- */
128
- public function register_current_version() {
129
- delete_option( 'yith_wcwl_version' );
130
- update_option( 'yith_wcwl_version', YITH_WCWL_VERSION );
131
-
132
- delete_option( 'yith_wcwl_db_version' );
133
- update_option( 'yith_wcwl_db_version', YITH_WCWL_DB_VERSION );
134
- }
135
-
136
- /**
137
- * Check if the table of the plugin already exists.
138
- *
139
- * @return bool
140
- * @since 1.0.0
141
- */
142
- public function is_installed() {
143
- global $wpdb;
144
- $number_of_tables = $wpdb->query("SHOW TABLES LIKE '{$this->_table_items}%'" );
145
-
146
- return (bool) ( $number_of_tables == 2 );
147
- }
148
-
149
- /**
150
- * Update from 0.x to 1.0
151
- */
152
- private function _update_100() {
153
- flush_rewrite_rules();
154
- }
155
-
156
- /**
157
- * Update from version 1.0 to 2.0
158
- *
159
- * @since 2.0.0
160
- */
161
- private function _update_200() {
162
- // update tables
163
- $this->_add_tables();
164
- }
165
-
166
- /**
167
- * Update from version 2.0 to 3.0
168
- *
169
- * @since 3.0.0
170
- */
171
- private function _update_300() {
172
- // update tables
173
- $this->_add_tables();
174
-
175
- // update color options
176
- $options = array(
177
- 'color_add_to_wishlist',
178
- 'color_add_to_cart',
179
- 'color_button_style_1',
180
- 'color_button_style_2',
181
- 'color_wishlist_table'
182
- );
183
-
184
- foreach( $options as $option ){
185
- $base_option_name = "yith_wcwl_{$option}";
186
-
187
- $background = get_option( "{$base_option_name}_background" );
188
- $color = get_option( "{$base_option_name}_color" );
189
- $border = get_option( "{$base_option_name}_border_color" );
190
-
191
- if( 'color_wishlist_table' != $option ) {
192
- $background_hover = get_option( "{$base_option_name}_hover_background" );
193
- $color_hover = get_option( "{$base_option_name}_hover_color" );
194
- $border_hover = get_option( "{$base_option_name}_hover_border_color" );
195
- }
196
-
197
- update_option( $base_option_name, array_merge(
198
- ! empty( $background ) ? array( 'background' => $background ) : array(),
199
- ! empty( $color ) ? array( 'text' => $color ) : array(),
200
- ! empty( $border ) ? array( 'border' => $border ) : array(),
201
- ! empty( $background_hover ) ? array( 'background_hover' => $background_hover ) : array(),
202
- ! empty( $color_hover ) ? array( 'text_hover' => $color_hover ) : array(),
203
- ! empty( $border_hover ) ? array( 'border_hover' => $border_hover ) : array()
204
- ) );
205
- }
206
-
207
- // duplicate options
208
- $options = array(
209
- 'yith_wcwl_color_button_style_1' => array(
210
- 'yith_wcwl_color_ask_an_estimate'
211
- ),
212
- 'yith_wcwl_color_button_style_1_hover' => array(
213
- 'yith_wcwl_color_ask_an_estimate_hover'
214
- ),
215
- 'woocommerce_promotion_mail_settings' => array(
216
- 'woocommerce_yith_wcwl_promotion_mail_settings'
217
- )
218
- );
219
-
220
- foreach( $options as $original_option => $destinations ){
221
- $option_value = get_option( $option );
222
-
223
- if( $option_value ){
224
- foreach( $destinations as $destination ){
225
- update_option( $destination, $option_value );
226
- }
227
- }
228
- }
229
-
230
- // button style options
231
- $use_buttons = get_option( 'yith_wcwl_use_button' );
232
- $use_theme_style = get_option( 'yith_wcwl_frontend_css' );
233
-
234
- if( $use_buttons == 'yes' && $use_theme_style == 'no' ){
235
- $destination_value = 'button_custom';
236
- }
237
- elseif( $use_buttons == 'yes' ){
238
- $destination_value = 'button_default';
239
- }
240
- else {
241
- $destination_value = 'link';
242
- }
243
-
244
- update_option( 'yith_wcwl_add_to_wishlist_style', $destination_value );
245
- update_option( 'yith_wcwl_add_to_cart_style', $destination_value );
246
- update_option( 'yith_wcwl_ask_an_estimate_style', $destination_value );
247
-
248
- // rounded corners options
249
- $rounded_corners = get_option( 'yith_wcwl_rounded_corners' );
 
 
250
  $radius_value = 'yes' == $rounded_corners ? 16 : 0;
251
 
252
  update_option( 'yith_wcwl_rounded_corners_radius', $radius_value );
253
  update_option( 'yith_wcwl_add_to_cart_rounded_corners_radius', $radius_value );
254
  update_option( 'yith_wcwl_ask_an_estimate_rounded_corners_radius', $radius_value );
255
- }
256
-
257
- /**
258
- * Add tables for a fresh installation
259
- *
260
- * @return void
261
- * @access private
262
- * @since 1.0.0
263
- */
264
- private function _add_tables() {
265
- $this->_add_wishlists_table();
266
- $this->_add_items_table();
267
- }
268
-
269
- /**
270
- * Add the wishlists table to the database.
271
- *
272
- * @return void
273
- * @access private
274
- * @since 1.0.0
275
- */
276
- private function _add_wishlists_table() {
277
- global $wpdb;
278
-
279
- if( ! $this->is_installed() || version_compare( get_option( 'yith_wcwl_db_version' ), '3.0.0', '<' ) ){
280
- $sql = "CREATE TABLE {$this->_table_wishlists} (
281
- ID INT( 11 ) NOT NULL AUTO_INCREMENT,
282
- user_id INT( 11 ) NULL DEFAULT NULL,
283
- session_id VARCHAR( 255 ) DEFAULT NULL,
284
- wishlist_slug VARCHAR( 200 ) NOT NULL,
285
- wishlist_name TEXT,
286
- wishlist_token VARCHAR( 64 ) NOT NULL UNIQUE,
287
- wishlist_privacy TINYINT( 1 ) NOT NULL DEFAULT 0,
288
- is_default TINYINT( 1 ) NOT NULL DEFAULT 0,
289
- dateadded timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
290
- expiration timestamp NULL DEFAULT NULL,
291
- PRIMARY KEY ( ID ),
292
- KEY wishlist_slug ( wishlist_slug )
293
- ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
294
-
295
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
296
- dbDelta( $sql );
297
- }
298
-
299
- return;
300
- }
301
-
302
- /**
303
- * Add the items table to the database.
304
- *
305
- * @return void
306
- * @access private
307
- * @since 1.0.0
308
- */
309
- private function _add_items_table() {
310
- global $wpdb;
311
-
312
- if( ! $this->is_installed() || version_compare( get_option( 'yith_wcwl_db_version' ), '3.0.0', '<' ) ) {
313
- $sql = "CREATE TABLE {$this->_table_items} (
314
- ID int( 11 ) NOT NULL AUTO_INCREMENT,
315
- prod_id int( 11 ) NOT NULL,
316
- quantity int( 11 ) NOT NULL,
317
- user_id int( 11 ) NULL DEFAULT NULL,
318
- wishlist_id int( 11 ) NULL,
319
- position int( 11 ) DEFAULT 0,
320
- original_price DECIMAL( 9,3 ) NULL DEFAULT NULL,
321
- original_currency CHAR( 3 ) NULL DEFAULT NULL,
322
- dateadded timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
323
- on_sale tinyint NOT NULL DEFAULT 0,
324
- PRIMARY KEY ( ID ),
325
- KEY prod_id ( prod_id )
326
- ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
327
-
328
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
329
- dbDelta( $sql );
330
- }
331
-
332
- return;
333
- }
334
-
335
- /**
336
- * Add a page "Wishlist".
337
- *
338
- * @return void
339
- * @since 1.0.0
340
- */
341
- private function _add_pages() {
342
- global $wpdb;
343
-
344
- $option_value = get_option( 'yith-wcwl-page-id' );
345
-
346
- if ( $option_value > 0 && get_post( $option_value ) ) {
347
- return;
348
- }
349
-
350
- $page_found = $wpdb->get_var( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_name` = 'wishlist' LIMIT 1;" );
351
-
352
- if ( $page_found ) {
353
- if ( ! $option_value ) {
354
- update_option( 'yith-wcwl-page-id', $page_found );
355
- }
356
-
357
- return;
358
- }
359
-
360
- $page_data = array(
361
- 'post_status' => 'publish',
362
- 'post_type' => 'page',
363
- 'post_author' => 1,
364
- 'post_name' => esc_sql( _x( 'wishlist', 'page_slug', 'yith-woocommerce-wishlist' ) ),
365
- 'post_title' => __( 'Wishlist', 'yith-woocommerce-wishlist' ),
366
- 'post_content' => '[yith_wcwl_wishlist]',
367
- 'post_parent' => 0,
368
- 'comment_status' => 'closed'
369
- );
370
- $page_id = wp_insert_post( $page_data );
371
-
372
- update_option( 'yith-wcwl-page-id', $page_id );
373
- update_option( 'yith_wcwl_wishlist_page_id', $page_id );
374
- }
375
- }
376
  }
377
 
378
  /**
8
  */
9
 
10
  if ( !defined( 'YITH_WCWL' ) ) {
11
+ exit;
12
  } // Exit if accessed directly
13
 
14
  if ( !class_exists( 'YITH_WCWL_Install' ) ) {
15
+ /**
16
+ * Install plugin table and create the wishlist page
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ class YITH_WCWL_Install {
21
+
22
+ /**
23
+ * Single instance of the class
24
+ *
25
+ * @var \YITH_WCWL_Install
26
+ * @since 2.0.0
27
+ */
28
+ protected static $instance;
29
+
30
+ /**
31
+ * Items table name
32
+ *
33
+ * @var string
34
+ * @access private
35
+ * @since 1.0.0
36
+ */
37
+ private $_table_items;
38
+
39
+ /**
40
+ * Items table name
41
+ *
42
+ * @var string
43
+ * @access private
44
+ * @since 1.0.0
45
+ */
46
+ private $_table_wishlists;
47
+
48
+ /**
49
+ * Returns single instance of the class
50
+ *
51
+ * @return \YITH_WCWL_Install
52
+ * @since 2.0.0
53
+ */
54
+ public static function get_instance(){
55
+ if( is_null( self::$instance ) ){
56
+ self::$instance = new self();
57
+ }
58
+
59
+ return self::$instance;
60
+ }
61
+
62
+ /**
63
+ * Constructor.
64
+ *
65
+ * @since 1.0.0
66
+ */
67
+ public function __construct() {
68
+ global $wpdb;
69
+
70
+ // define local private attribute
71
+ $this->_table_items = $wpdb->prefix . 'yith_wcwl';
72
+ $this->_table_wishlists = $wpdb->prefix . 'yith_wcwl_lists';
73
+
74
+ // add custom field to global $wpdb
75
+ $wpdb->yith_wcwl_items = $this->_table_items;
76
+ $wpdb->yith_wcwl_wishlists = $this->_table_wishlists;
77
+
78
+ // define constant to use allover the application
79
+ define( 'YITH_WCWL_ITEMS_TABLE', $this->_table_items );
80
+ define( 'YITH_WCWL_WISHLISTS_TABLE', $this->_table_wishlists );
81
+
82
+ /**
83
+ * @deprecated
84
+ */
85
+ define( 'YITH_WCWL_TABLE', $this->_table_items );
86
+ }
87
+
88
+ /**
89
+ * Init db structure of the plugin
90
+ *
91
+ * @since 1.0.0
92
+ */
93
+ public function init() {
94
+ $this->_add_tables();
95
+ $this->_add_pages();
96
+
97
+ $this->register_current_version();
98
+ }
99
+
100
+ /**
101
+ * Update db structure of the plugin
102
+ *
103
+ * @param $current_version string Version from which we're updating
104
+ *
105
+ * @ince 3.0.0
106
+ */
107
+ public function update( $current_version ) {
108
+ if( version_compare( $current_version, '1.0.0', '<' ) ){
109
+ $this->_update_100();
110
+ }
111
+
112
+ if( version_compare( $current_version, '2.0.0', '<' ) ){
113
+ $this->_update_200();
114
+ }
115
+
116
+ if( version_compare( $current_version, '3.0.0', '<' ) ){
117
+ $this->_update_300();
118
+ }
119
+
120
+ // TODO (3.1): _update_310() should call ->_add_tables(), to update db structure and size of external id columns
121
+
122
+ $this->register_current_version();
123
+ }
124
+
125
+ /**
126
+ * Register current version of plugin and database sctructure
127
+ *
128
+ * @since 3.0.0
129
+ */
130
+ public function register_current_version() {
131
+ delete_option( 'yith_wcwl_version' );
132
+ update_option( 'yith_wcwl_version', YITH_WCWL_VERSION );
133
+
134
+ delete_option( 'yith_wcwl_db_version' );
135
+ update_option( 'yith_wcwl_db_version', YITH_WCWL_DB_VERSION );
136
+ }
137
+
138
+ /**
139
+ * Check if the table of the plugin already exists.
140
+ *
141
+ * @return bool
142
+ * @since 1.0.0
143
+ */
144
+ public function is_installed() {
145
+ global $wpdb;
146
+ $number_of_tables = $wpdb->query("SHOW TABLES LIKE '{$this->_table_items}%'" );
147
+
148
+ return (bool) ( $number_of_tables == 2 );
149
+ }
150
+
151
+ /**
152
+ * Update from 0.x to 1.0
153
+ */
154
+ private function _update_100() {
155
+ flush_rewrite_rules();
156
+ }
157
+
158
+ /**
159
+ * Update from version 1.0 to 2.0
160
+ *
161
+ * @since 2.0.0
162
+ */
163
+ private function _update_200() {
164
+ // update tables
165
+ $this->_add_tables();
166
+ }
167
+
168
+ /**
169
+ * Update from version 2.0 to 3.0
170
+ *
171
+ * @since 3.0.0
172
+ */
173
+ private function _update_300() {
174
+ // update tables
175
+ $this->_add_tables();
176
+
177
+ // update color options
178
+ $options = array(
179
+ 'color_add_to_wishlist',
180
+ 'color_add_to_cart',
181
+ 'color_button_style_1',
182
+ 'color_button_style_2',
183
+ 'color_wishlist_table'
184
+ );
185
+
186
+ foreach( $options as $option ){
187
+ $base_option_name = "yith_wcwl_{$option}";
188
+
189
+ $background = get_option( "{$base_option_name}_background" );
190
+ $color = get_option( "{$base_option_name}_color" );
191
+ $border = get_option( "{$base_option_name}_border_color" );
192
+
193
+ if( 'color_wishlist_table' != $option ) {
194
+ $background_hover = get_option( "{$base_option_name}_hover_background" );
195
+ $color_hover = get_option( "{$base_option_name}_hover_color" );
196
+ $border_hover = get_option( "{$base_option_name}_hover_border_color" );
197
+ }
198
+
199
+ update_option( $base_option_name, array_merge(
200
+ ! empty( $background ) ? array( 'background' => $background ) : array(),
201
+ ! empty( $color ) ? array( 'text' => $color ) : array(),
202
+ ! empty( $border ) ? array( 'border' => $border ) : array(),
203
+ ! empty( $background_hover ) ? array( 'background_hover' => $background_hover ) : array(),
204
+ ! empty( $color_hover ) ? array( 'text_hover' => $color_hover ) : array(),
205
+ ! empty( $border_hover ) ? array( 'border_hover' => $border_hover ) : array()
206
+ ) );
207
+ }
208
+
209
+ // duplicate options
210
+ $options = array(
211
+ 'yith_wcwl_color_button_style_1' => array(
212
+ 'yith_wcwl_color_ask_an_estimate'
213
+ ),
214
+ 'yith_wcwl_color_button_style_1_hover' => array(
215
+ 'yith_wcwl_color_ask_an_estimate_hover'
216
+ ),
217
+ 'woocommerce_promotion_mail_settings' => array(
218
+ 'woocommerce_yith_wcwl_promotion_mail_settings'
219
+ )
220
+ );
221
+
222
+ foreach( $options as $original_option => $destinations ){
223
+ $option_value = get_option( $option );
224
+
225
+ if( $option_value ){
226
+ foreach( $destinations as $destination ){
227
+ update_option( $destination, $option_value );
228
+ }
229
+ }
230
+ }
231
+
232
+ // button style options
233
+ $use_buttons = get_option( 'yith_wcwl_use_button' );
234
+ $use_theme_style = get_option( 'yith_wcwl_frontend_css' );
235
+
236
+ if( $use_buttons == 'yes' && $use_theme_style == 'no' ){
237
+ $destination_value = 'button_custom';
238
+ }
239
+ elseif( $use_buttons == 'yes' ){
240
+ $destination_value = 'button_default';
241
+ }
242
+ else {
243
+ $destination_value = 'link';
244
+ }
245
+
246
+ update_option( 'yith_wcwl_add_to_wishlist_style', $destination_value );
247
+ update_option( 'yith_wcwl_add_to_cart_style', $destination_value );
248
+ update_option( 'yith_wcwl_ask_an_estimate_style', $destination_value );
249
+
250
+ // rounded corners options
251
+ $rounded_corners = get_option( 'yith_wcwl_rounded_corners' );
252
  $radius_value = 'yes' == $rounded_corners ? 16 : 0;
253
 
254
  update_option( 'yith_wcwl_rounded_corners_radius', $radius_value );
255
  update_option( 'yith_wcwl_add_to_cart_rounded_corners_radius', $radius_value );
256
  update_option( 'yith_wcwl_ask_an_estimate_rounded_corners_radius', $radius_value );
257
+ }
258
+
259
+ /**
260
+ * Add tables for a fresh installation
261
+ *
262
+ * @return void
263
+ * @access private
264
+ * @since 1.0.0
265
+ */
266
+ private function _add_tables() {
267
+ $this->_add_wishlists_table();
268
+ $this->_add_items_table();
269
+ }
270
+
271
+ /**
272
+ * Add the wishlists table to the database.
273
+ *
274
+ * @return void
275
+ * @access private
276
+ * @since 1.0.0
277
+ */
278
+ private function _add_wishlists_table() {
279
+ global $wpdb;
280
+
281
+ if( ! $this->is_installed() || version_compare( get_option( 'yith_wcwl_db_version' ), '3.0.0', '<' ) ){
282
+ $sql = "CREATE TABLE {$this->_table_wishlists} (
283
+ ID BIGINT( 20 ) NOT NULL AUTO_INCREMENT,
284
+ user_id BIGINT( 20 ) NULL DEFAULT NULL,
285
+ session_id VARCHAR( 255 ) DEFAULT NULL,
286
+ wishlist_slug VARCHAR( 200 ) NOT NULL,
287
+ wishlist_name TEXT,
288
+ wishlist_token VARCHAR( 64 ) NOT NULL UNIQUE,
289
+ wishlist_privacy TINYINT( 1 ) NOT NULL DEFAULT 0,
290
+ is_default TINYINT( 1 ) NOT NULL DEFAULT 0,
291
+ dateadded timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
292
+ expiration timestamp NULL DEFAULT NULL,
293
+ PRIMARY KEY ( ID ),
294
+ KEY wishlist_slug ( wishlist_slug )
295
+ ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
296
+
297
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
298
+ dbDelta( $sql );
299
+ }
300
+
301
+ return;
302
+ }
303
+
304
+ /**
305
+ * Add the items table to the database.
306
+ *
307
+ * @return void
308
+ * @access private
309
+ * @since 1.0.0
310
+ */
311
+ private function _add_items_table() {
312
+ global $wpdb;
313
+
314
+ if( ! $this->is_installed() || version_compare( get_option( 'yith_wcwl_db_version' ), '3.0.0', '<' ) ) {
315
+ $sql = "CREATE TABLE {$this->_table_items} (
316
+ ID BIGINT( 20 ) NOT NULL AUTO_INCREMENT,
317
+ prod_id BIGINT( 20 ) NOT NULL,
318
+ quantity INT( 11 ) NOT NULL,
319
+ user_id BIGINT( 20 ) NULL DEFAULT NULL,
320
+ wishlist_id BIGINT( 20 ) NULL,
321
+ position INT( 11 ) DEFAULT 0,
322
+ original_price DECIMAL( 9,3 ) NULL DEFAULT NULL,
323
+ original_currency CHAR( 3 ) NULL DEFAULT NULL,
324
+ dateadded timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
325
+ on_sale tinyint NOT NULL DEFAULT 0,
326
+ PRIMARY KEY ( ID ),
327
+ KEY prod_id ( prod_id )
328
+ ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
329
+
330
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
331
+ dbDelta( $sql );
332
+ }
333
+
334
+ return;
335
+ }
336
+
337
+ /**
338
+ * Add a page "Wishlist".
339
+ *
340
+ * @return void
341
+ * @since 1.0.0
342
+ */
343
+ private function _add_pages() {
344
+ global $wpdb;
345
+
346
+ $option_value = get_option( 'yith-wcwl-page-id' );
347
+
348
+ if ( $option_value > 0 && get_post( $option_value ) ) {
349
+ return;
350
+ }
351
+
352
+ $page_found = $wpdb->get_var( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_name` = 'wishlist' LIMIT 1;" );
353
+
354
+ if ( $page_found ) {
355
+ if ( ! $option_value ) {
356
+ update_option( 'yith-wcwl-page-id', $page_found );
357
+ }
358
+
359
+ return;
360
+ }
361
+
362
+ $page_data = array(
363
+ 'post_status' => 'publish',
364
+ 'post_type' => 'page',
365
+ 'post_author' => 1,
366
+ 'post_name' => esc_sql( _x( 'wishlist', 'page_slug', 'yith-woocommerce-wishlist' ) ),
367
+ 'post_title' => __( 'Wishlist', 'yith-woocommerce-wishlist' ),
368
+ 'post_content' => '[yith_wcwl_wishlist]',
369
+ 'post_parent' => 0,
370
+ 'comment_status' => 'closed'
371
+ );
372
+ $page_id = wp_insert_post( $page_data );
373
+
374
+ update_option( 'yith-wcwl-page-id', $page_id );
375
+ update_option( 'yith_wcwl_wishlist_page_id', $page_id );
376
+ }
377
+ }
378
  }
379
 
380
  /**
includes/class.yith-wcwl-shortcode.php CHANGED
@@ -27,11 +27,16 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
27
  add_shortcode( 'yith_wcwl_wishlist', array( 'YITH_WCWL_Shortcode', 'wishlist' ) );
28
  add_shortcode( 'yith_wcwl_add_to_wishlist', array( 'YITH_WCWL_Shortcode', 'add_to_wishlist' ) );
29
 
30
- // register gutenberg blocks
31
  add_action( 'init', array( 'YITH_WCWL_Shortcode', 'register_gutenberg_blocks' ) );
32
  add_action( 'yith_plugin_fw_gutenberg_before_do_shortcode', array( 'YITH_WCWL_Shortcode', 'fix_for_gutenberg_blocks' ), 10, 1 );
 
 
 
33
  }
34
 
 
 
35
  /**
36
  * Register available gutenberg blocks
37
  *
@@ -143,6 +148,39 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
143
  }
144
  }
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  /**
147
  * Print the wishlist HTML.
148
  *
@@ -204,7 +242,7 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
204
  $additional_params = array(
205
  // wishlist data
206
  'wishlist' => false,
207
- 'is_default' => true,
208
  'is_custom_list' => false,
209
  'wishlist_token' => '',
210
  'wishlist_id' => false,
@@ -224,6 +262,7 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
224
  // user data
225
  'is_user_logged_in' => is_user_logged_in(),
226
  'is_user_owner' => true,
 
227
 
228
  // view data
229
  'no_interactions' => $no_interactions,
@@ -263,7 +302,7 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
263
 
264
  $wishlist = YITH_WCWL_Wishlist_Factory::get_current_wishlist( $atts );
265
 
266
- if( $wishlist ){
267
  // set global wishlist token
268
  $yith_wcwl_wishlist_token = $wishlist->get_token();
269
 
@@ -315,10 +354,10 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
315
  // wishlist data
316
  'wishlist' => $wishlist,
317
  'is_default' => $is_default,
318
- 'is_custom_list' => $is_user_owner && ! $no_interactions,
319
  'wishlist_token' => $wishlist_token,
320
  'wishlist_id' => $wishlist->get_id(),
321
- 'is_private' => $wishlist->get_privacy() == 2,
322
  'ajax_loading' => $ajax_loading,
323
 
324
  //page data
@@ -328,16 +367,18 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
328
 
329
  // user data
330
  'is_user_owner' => $is_user_owner,
 
331
 
332
  // view data
333
- 'show_remove_product' => $show_remove_product && $is_user_owner && ! $no_interactions,
334
- 'repeat_remove_button' => $repeat_remove_button && $is_user_owner && ! $no_interactions,
335
 
336
  // template data
337
  'form_action' => $wishlist->get_url()
338
  ), $additional_params );
339
 
340
  // share options
 
341
  $share_facebook_enabled = get_option( 'yith_wcwl_share_fb' ) == 'yes';
342
  $share_twitter_enabled = get_option( 'yith_wcwl_share_twitter' ) == 'yes';
343
  $share_pinterest_enabled = get_option( 'yith_wcwl_share_pinterest' ) == 'yes';
@@ -345,7 +386,7 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
345
  $share_whatsapp_enabled = get_option( 'yith_wcwl_share_whatsapp' ) == 'yes';
346
  $share_url_enabled = get_option( 'yith_wcwl_share_url' ) == 'yes';
347
 
348
- if( ! $no_interactions && ( $share_facebook_enabled || $share_twitter_enabled || $share_pinterest_enabled || $share_email_enabled || $share_whatsapp_enabled || $share_url_enabled ) ){
349
  $share_title = apply_filters( 'yith_wcwl_socials_share_title', __( 'Share on:', 'yith-woocommerce-wishlist' ) );
350
  $share_link_url = apply_filters('yith_wcwl_shortcode_share_link_url',$wishlist->get_url(),$wishlist);
351
  $share_links_title = apply_filters( 'plugin_text', urlencode( get_option( 'yith_wcwl_socials_title' ) ) );
27
  add_shortcode( 'yith_wcwl_wishlist', array( 'YITH_WCWL_Shortcode', 'wishlist' ) );
28
  add_shortcode( 'yith_wcwl_add_to_wishlist', array( 'YITH_WCWL_Shortcode', 'add_to_wishlist' ) );
29
 
30
+ // register gutenberg blocks
31
  add_action( 'init', array( 'YITH_WCWL_Shortcode', 'register_gutenberg_blocks' ) );
32
  add_action( 'yith_plugin_fw_gutenberg_before_do_shortcode', array( 'YITH_WCWL_Shortcode', 'fix_for_gutenberg_blocks' ), 10, 1 );
33
+
34
+ // register elementor widgets
35
+ add_action( 'init', array( 'YITH_WCWL_Shortcode', 'init_elementor_widgets' ) );
36
  }
37
 
38
+ /* === GUTENBERG BLOCKS === */
39
+
40
  /**
41
  * Register available gutenberg blocks
42
  *
148
  }
149
  }
150
 
151
+ /* === ELEMENTOR WIDGETS === */
152
+
153
+ /**
154
+ * Register custom widgets for Elementor
155
+ *
156
+ * @return void
157
+ */
158
+ public static function init_elementor_widgets() {
159
+ // check if elementor is active
160
+ if( ! defined( 'ELEMENTOR_VERSION' ) ){
161
+ return;
162
+ }
163
+
164
+ // include widgets
165
+ include_once( YITH_WCWL_INC . 'widgets/elementor/class.yith-wcwl-elementor-add-to-wishlist.php' );
166
+ include_once( YITH_WCWL_INC . 'widgets/elementor/class.yith-wcwl-elementor-wishlist.php' );
167
+
168
+ // register widgets
169
+ add_action( 'elementor/widgets/widgets_registered', array( 'YITH_WCWL_Shortcode', 'register_elementor_widgets' ) );
170
+ }
171
+
172
+ /**
173
+ * Register Elementor Widgets
174
+ *
175
+ * @return void
176
+ */
177
+ public static function register_elementor_widgets() {
178
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new YITH_WCWL_Elementor_Add_to_Wishlist() );
179
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new YITH_WCWL_Elementor_Wishlist() );
180
+ }
181
+
182
+ /* === SHORTCODES == */
183
+
184
  /**
185
  * Print the wishlist HTML.
186
  *
242
  $additional_params = array(
243
  // wishlist data
244
  'wishlist' => false,
245
+ 'is_default' => true, // @deprecated since 3.0.7
246
  'is_custom_list' => false,
247
  'wishlist_token' => '',
248
  'wishlist_id' => false,
262
  // user data
263
  'is_user_logged_in' => is_user_logged_in(),
264
  'is_user_owner' => true,
265
+ 'can_user_edit_title' => false,
266
 
267
  // view data
268
  'no_interactions' => $no_interactions,
302
 
303
  $wishlist = YITH_WCWL_Wishlist_Factory::get_current_wishlist( $atts );
304
 
305
+ if( $wishlist && $wishlist->current_user_can( 'view' ) ){
306
  // set global wishlist token
307
  $yith_wcwl_wishlist_token = $wishlist->get_token();
308
 
354
  // wishlist data
355
  'wishlist' => $wishlist,
356
  'is_default' => $is_default,
357
+ 'is_custom_list' => $is_user_owner && ! $no_interactions, // @deprecated since 3.0.7
358
  'wishlist_token' => $wishlist_token,
359
  'wishlist_id' => $wishlist->get_id(),
360
+ 'is_private' => $wishlist->has_privacy( 'private' ),
361
  'ajax_loading' => $ajax_loading,
362
 
363
  //page data
367
 
368
  // user data
369
  'is_user_owner' => $is_user_owner,
370
+ 'can_user_edit_title' => $wishlist->current_user_can( 'update_wishlist' ) && ! $no_interactions,
371
 
372
  // view data
373
+ 'show_remove_product' => $show_remove_product && $wishlist->current_user_can( 'remove_from_wishlist' ) && ! $no_interactions,
374
+ 'repeat_remove_button' => $repeat_remove_button && $wishlist->current_user_can( 'remove_from_wishlist' ) && ! $no_interactions,
375
 
376
  // template data
377
  'form_action' => $wishlist->get_url()
378
  ), $additional_params );
379
 
380
  // share options
381
+ $enable_share = get_option( 'yith_wcwl_enable_share' ) == 'yes' && ! $wishlist->has_privacy( 'private' );
382
  $share_facebook_enabled = get_option( 'yith_wcwl_share_fb' ) == 'yes';
383
  $share_twitter_enabled = get_option( 'yith_wcwl_share_twitter' ) == 'yes';
384
  $share_pinterest_enabled = get_option( 'yith_wcwl_share_pinterest' ) == 'yes';
386
  $share_whatsapp_enabled = get_option( 'yith_wcwl_share_whatsapp' ) == 'yes';
387
  $share_url_enabled = get_option( 'yith_wcwl_share_url' ) == 'yes';
388
 
389
+ if( ! $no_interactions && $enable_share && ( $share_facebook_enabled || $share_twitter_enabled || $share_pinterest_enabled || $share_email_enabled || $share_whatsapp_enabled || $share_url_enabled ) ){
390
  $share_title = apply_filters( 'yith_wcwl_socials_share_title', __( 'Share on:', 'yith-woocommerce-wishlist' ) );
391
  $share_link_url = apply_filters('yith_wcwl_shortcode_share_link_url',$wishlist->get_url(),$wishlist);
392
  $share_links_title = apply_filters( 'plugin_text', urlencode( get_option( 'yith_wcwl_socials_title' ) ) );
includes/class.yith-wcwl-wishlist.php CHANGED
@@ -144,17 +144,13 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist' ) ) {
144
  /**
145
  * Check if current user is owner of this wishlist (works both for authenticated users & guests)
146
  *
147
- * @param $current_user string|int Optional user identfier, in the form of a User ID or session id
148
  * @return bool
149
  */
150
  public function is_current_user_owner( $current_user = false ) {
151
  $user_id = $this->get_user_id();
152
  $session_id = $this->get_session_id();
153
 
154
- if( current_user_can( 'manage_woocommerce' ) ){
155
- return true;
156
- }
157
-
158
  if( $current_user && ( $current_user == $user_id || $current_user == $session_id ) ){
159
  return true;
160
  }
@@ -170,6 +166,47 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist' ) ) {
170
  return false;
171
  }
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  /* === GETTERS === */
174
 
175
  /**
@@ -204,6 +241,35 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist' ) ) {
204
  return apply_filters( 'yith_wcwl_wishlist_formatted_privacy', $formatted_privacy, $privacy, $this, $context );
205
  }
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  /**
208
  * Get owner id
209
  *
144
  /**
145
  * Check if current user is owner of this wishlist (works both for authenticated users & guests)
146
  *
147
+ * @param $current_user string|int|bool Optional user identifier, in the form of a User ID or session id; false for default
148
  * @return bool
149
  */
150
  public function is_current_user_owner( $current_user = false ) {
151
  $user_id = $this->get_user_id();
152
  $session_id = $this->get_session_id();
153
 
 
 
 
 
154
  if( $current_user && ( $current_user == $user_id || $current_user == $session_id ) ){
155
  return true;
156
  }
166
  return false;
167
  }
168
 
169
+ /**
170
+ * Check whether current user can perform a specific action on wishlist
171
+ *
172
+ * Accepted capabilities:
173
+ * * view
174
+ * * update_wishlist
175
+ * * add_to_wishlist
176
+ * * remove_from_wishlist
177
+ * * move_to_another_wishlist
178
+ * * ask_an_estimate
179
+ * * sort_items
180
+ * * update_quantity
181
+ * * download_pdf
182
+ *
183
+ * @param $capability string Capability to check; default "view"
184
+ * @param $current_user string|int|bool Optional user identifier, in the form of a User ID or session id; false for default
185
+ * @return bool
186
+ */
187
+ public function current_user_can( $capability = 'view', $current_user = false ) {
188
+ // admin can do anything by default
189
+ if( is_user_logged_in() && current_user_can( 'manage_woocommerce' ) && apply_filters( 'yith_wcwl_admin_can', true, $capability, $current_user, $this ) ){
190
+ return true;
191
+ }
192
+
193
+ // for other users, perform checks over capability required
194
+ switch( $capability ){
195
+ case 'view';
196
+ $can = $this->is_current_user_owner( $current_user );
197
+
198
+ if( ! $can && $this->has_privacy( array( 'public', 'shared' ) ) ){
199
+ $can = true;
200
+ }
201
+ break;
202
+ default:
203
+ $can = $this->is_current_user_owner( $current_user );
204
+ break;
205
+ }
206
+
207
+ return apply_filters( 'yith_wcwl_current_user_can', $can, $capability, $current_user, $this );
208
+ }
209
+
210
  /* === GETTERS === */
211
 
212
  /**
241
  return apply_filters( 'yith_wcwl_wishlist_formatted_privacy', $formatted_privacy, $privacy, $this, $context );
242
  }
243
 
244
+ /**
245
+ * Checks if current wishlist has a specific privacy value
246
+ * Method will accept both numeric privacy values and privacy labels
247
+ *
248
+ * @param $privacy int|string|array Privacy value (0|1|2) or label (public|shared|private), or array of acceptable values
249
+ * @return bool Whether wishlist matched privacy test
250
+ */
251
+ public function has_privacy ( $privacy ) {
252
+ $wishlist_privacy = $this->get_privacy( 'edit' );
253
+ $has_privacy = false;
254
+
255
+ if( is_array( $privacy ) && ! empty( $privacy ) ){
256
+ foreach( $privacy as $test_value ){
257
+ // return true if wishlist has any of the privacy value submitted
258
+ if( $this->has_privacy( $test_value ) ){
259
+ return true;
260
+ }
261
+ }
262
+ }
263
+ elseif( is_string( $privacy ) ){
264
+ $has_privacy = yith_wcwl_get_privacy_value( $privacy ) == $wishlist_privacy;
265
+ }
266
+ else{
267
+ $has_privacy = $privacy == $wishlist_privacy;
268
+ }
269
+
270
+ return $has_privacy;
271
+ }
272
+
273
  /**
274
  * Get owner id
275
  *
includes/class.yith-wcwl.php CHANGED
@@ -8,780 +8,780 @@
8
  */
9
 
10
  if ( ! defined( 'YITH_WCWL' ) ) {
11
- exit;
12
  } // Exit if accessed directly
13
 
14
  if ( ! class_exists( 'YITH_WCWL' ) ) {
15
- /**
16
- * WooCommerce Wishlist
17
- *
18
- * @since 1.0.0
19
- */
20
- class YITH_WCWL {
21
- /**
22
- * Single instance of the class
23
- *
24
- * @var \YITH_WCWL
25
- * @since 2.0.0
26
- */
27
- protected static $instance;
28
-
29
- /**
30
- * Last operation token
31
- *
32
- * @var string
33
- * @since 2.0.0
34
- */
35
- public $last_operation_token;
36
-
37
- /**
38
- * Query string parameter used to generate Wishlist urls
39
- *
40
- * @var string
41
- * @since 2.1.2
42
- */
43
- public $wishlist_param = 'wishlist-action';
44
-
45
- /**
46
- * Returns single instance of the class
47
- *
48
- * @return \YITH_WCWL
49
- * @since 2.0.0
50
- */
51
- public static function get_instance(){
52
- if( is_null( self::$instance ) ){
53
- self::$instance = new self();
54
- }
55
-
56
- return self::$instance;
57
- }
58
-
59
- /**
60
- * Constructor.
61
- *
62
- * @return \YITH_WCWL
63
- * @since 1.0.0
64
- */
65
- public function __construct() {
66
- // register data stores
67
- add_filter( 'woocommerce_data_stores', array( $this, 'register_data_stores' ) );
68
-
69
- // init frontend class
70
- $this->wcwl_frontend = YITH_WCWL_Frontend();
71
-
72
- // init crons
73
- $this->wcwl_cron = YITH_WCWL_Cron();
74
-
75
- // init session
76
- $this->wcwl_session = YITH_WCWL_Session();
77
-
78
- // init admin handling
79
- if( is_admin() ){
80
- $this->wcwl_admin = YITH_WCWL_Admin();
81
- }
82
-
83
- // load plugin-fw
84
- add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 15 );
85
- add_action( 'plugins_loaded', array( $this, 'privacy_loader' ), 20 );
86
-
87
- // add rewrite rule
88
- add_action( 'init', array( $this, 'add_rewrite_rules' ), 0 );
89
- add_filter( 'query_vars', array( $this, 'add_public_query_var' ) );
90
- }
91
-
92
- /* === PLUGIN FW LOADER === */
93
-
94
- /**
95
- * Loads plugin fw, if not yet created
96
- *
97
- * @return void
98
- * @since 2.0.0
99
- */
100
- public function plugin_fw_loader() {
101
- if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
102
- global $plugin_fw_data;
103
- if( ! empty( $plugin_fw_data ) ){
104
- $plugin_fw_file = array_shift( $plugin_fw_data );
105
- require_once( $plugin_fw_file );
106
- }
107
- }
108
- }
109
-
110
- /* === PRIVACY LOADER === */
111
-
112
- /**
113
- * Loads privacy class
114
- *
115
- * @return void
116
- * @since 2.0.0
117
- */
118
- public function privacy_loader() {
119
- if( class_exists( 'YITH_Privacy_Plugin_Abstract' ) ) {
120
- require_once( YITH_WCWL_INC . 'class.yith-wcwl-privacy.php' );
121
- new YITH_WCWL_Privacy();
122
- }
123
- }
124
-
125
- /* === ITEMS METHODS === */
126
-
127
- /**
128
- * Add a product in the wishlist.
129
- *
130
- * @param $atts array Array of parameters; when not passed, params will be searched in $_REQUEST
131
- * @return void
132
- * @throws Exception When an error occurs with Add to Wishlist operation
133
- * @throws YITH_WCWL_Exception When an error occurs with Add to Wishlist operation
134
- * @since 1.0.0
135
- */
136
- public function add( $atts = array() ) {
137
- $defaults = array(
138
- 'add_to_wishlist' => 0,
139
- 'wishlist_id' => 0,
140
- 'quantity' => 1,
141
- 'user_id' => false,
142
- 'dateadded' => '',
143
- 'wishlist_name' => '',
144
- 'wishlist_visibility' => 0
145
- );
146
-
147
- $atts = empty( $atts ) && ! empty( $this->details ) ? $this->details : $atts;
148
- $atts = ! empty( $atts ) ? $atts : $_REQUEST;
149
- $atts = wp_parse_args( $atts, $defaults );
150
-
151
- // filtering params
152
- $prod_id = apply_filters( 'yith_wcwl_adding_to_wishlist_prod_id', intval( $atts['add_to_wishlist'] ) );
153
- $wishlist_id = apply_filters( 'yith_wcwl_adding_to_wishlist_wishlist_id', $atts['wishlist_id'] );
154
- $quantity = apply_filters( 'yith_wcwl_adding_to_wishlist_quantity', intval( $atts['quantity'] ) );
155
- $user_id = apply_filters( 'yith_wcwl_adding_to_wishlist_user_id', intval( $atts['user_id'] ) );
156
- $dateadded = apply_filters( 'yith_wcwl_adding_to_wishlist_dateadded', $atts['dateadded'] );
157
-
158
- do_action( 'yith_wcwl_adding_to_wishlist', $prod_id, $wishlist_id, $user_id );
159
-
160
- if( ! $this->can_user_add_to_wishlist() ){
161
- throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_user_cannot_add_to_wishlist_message', __( 'The item cannot be added to this wishlist', 'yith-woocommerce-wishlist' ) ), 1 );
162
- }
163
-
164
- if ( $prod_id == false ) {
165
- throw new YITH_WCWL_Exception( __( 'An error occurred while adding the products to the wishlist.', 'yith-woocommerce-wishlist' ), 0 );
166
- }
167
-
168
- $wishlist = 'new' === $wishlist_id ? $this->add_wishlist( $atts ) : YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id, 'edit' );
169
-
170
- if( ! $wishlist instanceof YITH_WCWL_Wishlist ){
171
- throw new YITH_WCWL_Exception( __( 'An error occurred while adding the products to the wishlist.', 'yith-woocommerce-wishlist' ), 0 );
172
- }
173
-
174
- $this->last_operation_token = $wishlist->get_token();
175
-
176
- if( $wishlist->has_product( $prod_id ) ) {
177
- throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_product_already_in_wishlist_message', get_option( 'yith_wcwl_already_in_wishlist_text' ) ), 1 );
178
- }
179
-
180
- $item = new YITH_WCWL_Wishlist_Item();
181
-
182
- $item->set_product_id( $prod_id );
183
- $item->set_quantity( $quantity );
184
-
185
- if( $dateadded ){
186
- $item->set_date_added( $dateadded );
187
- }
188
-
189
- $wishlist->add_item( $item );
190
- $wishlist->save();
191
-
192
- wp_cache_delete( 'wishlist-count-' . $wishlist->get_token(), 'wishlists' );
193
-
194
- if( $user_id = $wishlist->get_user_id() ) {
195
- wp_cache_delete( 'wishlist-user-total-count-' . $user_id, 'wishlists' );
196
- }
197
-
198
- do_action( 'yith_wcwl_added_to_wishlist', $prod_id, $item->get_wishlist_id(), $item->get_user_id() );
199
- }
200
-
201
- /**
202
- * Remove an entry from the wishlist.
203
- *
204
- * @param $atts array Array of parameters; when not passed, parameters will be retrieved from $_REQUEST
205
- *
206
- * @return void
207
- * @throws Exception When something was wrong with removal
208
- * @since 1.0.0
209
- */
210
- public function remove( $atts = array() ) {
211
- $defaults = array(
212
- 'remove_from_wishlist' => 0,
213
- 'wishlist_id' => 0,
214
- 'user_id' => false
215
- );
216
-
217
- $atts = empty( $atts ) && ! empty( $this->details ) ? $this->details : $atts;
218
- $atts = ! empty( $atts ) ? $atts : $_REQUEST;
219
- $atts = wp_parse_args( $atts, $defaults );
220
-
221
- $prod_id = intval( $atts['remove_from_wishlist'] );
222
- $wishlist_id = intval( $atts['wishlist_id'] );
223
- $user_id = intval( $atts['user_id'] );
224
-
225
- do_action( 'yith_wcwl_removing_from_wishlist', $prod_id, $wishlist_id, $user_id );
226
-
227
- if( $prod_id == false ){
228
- throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_unable_to_remove_product_message', __( 'Error. Unable to remove the product from the wishlist.', 'yith-woocommerce-wishlist' ) ), 0 );
229
- }
230
-
231
- $wishlist = YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id );
232
-
233
- if( ! $wishlist instanceof YITH_WCWL_Wishlist ){
234
- throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_unable_to_remove_product_message', __( 'Error. Unable to remove the product from the wishlist.', 'yith-woocommerce-wishlist' ) ), 0 );
235
- }
236
-
237
- $wishlist->remove_product( $prod_id );
238
- $wishlist->save();
239
-
240
- wp_cache_delete( 'wishlist-count-' . $wishlist->get_token(), 'wishlists' );
241
-
242
- if( $user_id = $wishlist->get_user_id() ) {
243
- wp_cache_delete( 'wishlist-user-total-count-' . $user_id );
244
- }
245
-
246
- do_action( 'yith_wcwl_removed_from_wishlist', $prod_id, $wishlist->get_id(), $wishlist->get_user_id() );
247
- }
248
-
249
- /**
250
- * Check if the product exists in the wishlist.
251
- *
252
- * @param int $product_id Product id to check
253
- * @param int|bool $wishlist_id Wishlist where to search (use false to search in default wishlist)
254
- * @return bool
255
- * @since 1.0.0
256
- */
257
- public function is_product_in_wishlist( $product_id, $wishlist_id = false ) {
258
- $wishlist = YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id );
259
-
260
- if( ! $wishlist ){
261
- return false;
262
- }
263
-
264
- return apply_filters( 'yith_wcwl_is_product_in_wishlist', $wishlist->has_product( $product_id ), $product_id, $wishlist_id );
265
- }
266
-
267
- /**
268
- * Retrieve elements of the wishlist for a specific user
269
- *
270
- * @param $args mixed Arguments array; it may contains any of the following:<br/>
271
- * [<br/>
272
- * 'user_id' // Owner of the wishlist; default to current user logged in (if any), or false for cookie wishlist<br/>
273
- * 'product_id' // Product to search in the wishlist<br/>
274
- * 'wishlist_id' // wishlist_id for a specific wishlist, false for default, or all for any wishlist<br/>
275
- * 'wishlist_token' // wishlist token, or false as default<br/>
276
- * 'wishlist_visibility' // all, visible, public, shared, private<br/>
277
- * 'is_default' => // whether searched wishlist should be default one <br/>
278
- * 'id' => false, // only for table select<br/>
279
- * 'limit' => false, // pagination param; number of items per page. 0 to get all items<br/>
280
- * 'offset' => 0 // pagination param; offset for the current set. 0 to start from the first item<br/>
281
- * ]
282
- *
283
- * @return YITH_WCWL_Wishlist_Item[]|bool
284
- * @since 2.0.0
285
- */
286
- public function get_products( $args = array() ) {
287
- return YITH_WCWL_Wishlist_Factory::get_wishlist_items( $args );
288
- }
289
-
290
- /**
291
- * Retrieve the number of products in the wishlist.
292
- *
293
- * @param $wishlist_token string|bool Wishlist token if any; false for default wishlist
294
- *
295
- * @return int
296
- * @since 1.0.0
297
- */
298
- public function count_products( $wishlist_token = false ) {
299
- $wishlist = YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_token );
300
-
301
- if( ! $wishlist ){
302
- return 0;
303
- }
304
-
305
- $count = wp_cache_get( 'wishlist-count-' . $wishlist->get_token(), 'wishlists' );
306
-
307
- if( false === $count ){
308
- $count = $wishlist->count_items();
309
- wp_cache_set( 'wishlist-count-' . $wishlist->get_token(), $count, 'wishlists' );
310
- }
311
-
312
- return $count;
313
- }
314
-
315
- /**
316
- * Count all user items in wishlists
317
- *
318
- * @return int Count of items added all over wishlist from current user
319
- * @since 2.0.12
320
- */
321
- public function count_all_products() {
322
- $args = array(
323
- 'wishlist_id' => 'all'
324
- );
325
-
326
- if( is_user_logged_in() ){
327
- $id = get_current_user_id();
328
- $args['user_id'] = $id;
329
- }
330
- else{
331
- $id = YITH_WCWL_Session()->get_session_id();
332
- $args['session_id'] = $id;
333
- }
334
-
335
- if( false === $count = wp_cache_get( 'wishlist-user-total-count-' . $id, 'wishlists' ) ) {
336
- $count = YITH_WCWL_Wishlist_Factory::get_wishlist_items_count( $args );
337
- wp_cache_set( 'wishlist-user-total-count-' . $id, $count, 'wishlists' );
338
- }
339
-
340
- return $count;
341
- }
342
-
343
- /**
344
- * Count number of times a product was added to users wishlists
345
- *
346
- * @param $product_id int|bool Product id; false will force method to use global product
347
- *
348
- * @return int Number of times the product was added to wishlist
349
- * @since 2.0.13
350
- */
351
- public function count_add_to_wishlist( $product_id = false ) {
352
- global $product;
353
-
354
- $product_id = ! ( $product_id ) ? yit_get_product_id( $product ) : $product_id;
355
-
356
- if( ! $product_id ){
357
- return 0;
358
- }
359
-
360
- $count = YITH_WCWL_Wishlist_Factory::get_times_added_count( $product_id );
361
-
362
- return $count;
363
- }
364
-
365
- /**
366
- * Count product occurrences in users wishlists
367
- *
368
- * @param $product_id int|bool Product id; false will force method to use global product
369
- *
370
- * @return int
371
- * @since 2.0.0
372
- */
373
- public function count_product_occurrences( $product_id = false ) {
374
- global $product;
375
-
376
- $product_id = ! ( $product_id ) ? yit_get_product_id( $product ) : $product_id;
377
-
378
- if( ! $product_id ){
379
- return 0;
380
- }
381
-
382
- $count = YITH_WCWL_Wishlist_Factory::get_wishlist_items_count( array( 'product_id' => $product_id, 'user_id' => false, 'session_id' => false, 'wishlist_id' => 'all' ) );
383
-
384
- return $count;
385
- }
386
-
387
- /**
388
- * Retrieve details of a product in the wishlist.
389
- *
390
- * @param int $product_id
391
- * @param int|bool $wishlist_id
392
- * @return YITH_WCWL_Wishlist_Item|bool
393
- * @since 1.0.0
394
- */
395
- public function get_product_details( $product_id, $wishlist_id = false ) {
396
- $product = $this->get_products(
397
- array(
398
- 'prod_id' => $product_id,
399
- 'wishlist_id' => $wishlist_id
400
- )
401
- );
402
-
403
- if( empty( $product ) ){
404
- return false;
405
- }
406
-
407
- return array_shift( $product );
408
- }
409
-
410
- /* === WISHLISTS METHODS === */
411
-
412
- /**
413
- * Add a new wishlist for the user.
414
- *
415
- * @param $atts array Array of params for wishlist creation
416
- * @return int Id of the wishlist created
417
- * @since 2.0.0
418
- */
419
- public function add_wishlist( $atts = array() ) {
420
- $defaults = array(
421
- 'user_id' => false
422
- );
423
-
424
- $atts = empty( $atts ) && ! empty( $this->details ) ? $this->details : $atts;
425
- $atts = ! empty( $atts ) ? $atts : $_REQUEST;
426
- $atts = wp_parse_args( $atts, $defaults );
427
-
428
- $user_id = ( ! empty( $atts['user_id'] ) ) ? $atts['user_id'] : false;
429
-
430
- return $this->generate_default_wishlist( $user_id );
431
- }
432
-
433
- /**
434
- * Update wishlist with arguments passed as second parameter
435
- *
436
- * @param $wishlist_id int
437
- * @param $args array Array of parameters to use in update process
438
- * @return void
439
- * @since 2.0.0
440
- */
441
- public function update_wishlist( $wishlist_id, $args = array() ) {
442
- return;
443
- }
444
-
445
- /**
446
- * Delete indicated wishlist
447
- *
448
- * @param $wishlist_id int
449
- * @return void
450
- * @since 2.0.0
451
- */
452
- public function remove_wishlist( $wishlist_id ) {
453
- return;
454
- }
455
-
456
- /**
457
- * Retrieve all the wishlist matching specified arguments
458
- *
459
- * @param $args mixed Array of valid arguments<br/>
460
- * [<br/>
461
- * 'id' // Wishlist id to search, if any<br/>
462
- * 'user_id' // User owner<br/>
463
- * 'wishlist_slug' // Slug of the wishlist to search<br/>
464
- * 'wishlist_name' // Name of the wishlist to search<br/>
465
- * 'wishlist_token' // Token of the wishlist to search<br/>
466
- * 'wishlist_visibility' // Wishlist visibility: all, visible, public, shared, private<br/>
467
- * 'user_search' // String to match against first name / last name or email of the wishlist owner<br/>
468
- * 'is_default' // Whether wishlist should be default or not<br/>
469
- * 'orderby' // Column used to sort final result (could be any wishlist lists column)<br/>
470
- * 'order' // Sorting order<br/>
471
- * 'limit' // Pagination param: maximum number of elements in the set. 0 to retrieve all elements<br/>
472
- * 'offset' // Pagination param: offset for the current set. 0 to start from the first item<br/>
473
- * 'show_empty' // Whether to show empty lists os not<br/>
474
- * ]
475
- *
476
- * @return YITH_WCWL_Wishlist[]
477
- * @since 2.0.0
478
- */
479
- public function get_wishlists( $args = array() ){
480
- return YITH_WCWL_Wishlist_Factory::get_wishlists( $args );
481
- }
482
-
483
- /**
484
- * Returns details of a wishlist, searching it by wishlist id
485
- *
486
- * @param $wishlist_id int
487
- * @return YITH_WCWL_Wishlist
488
- * @since 2.0.0
489
- */
490
- public function get_wishlist_detail( $wishlist_id ) {
491
- return YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id );
492
- }
493
-
494
- /**
495
- * Returns details of a wishlist, searching it by wishlist token
496
- *
497
- * @param $wishlist_token string
498
- * @return YITH_WCWL_Wishlist
499
- * @since 2.0.0
500
- */
501
- public function get_wishlist_detail_by_token( $wishlist_token ) {
502
- return YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_token );
503
- }
504
-
505
- /**
506
- * Generate default wishlist for current user or session
507
- *
508
- * @return int Default wishlist id
509
- * @since 2.0.0
510
- */
511
- public function generate_default_wishlist( $id = false ){
512
- $wishlist = YITH_WCWL_Wishlist_Factory::generate_default_wishlist( $id );
513
-
514
- if( $wishlist ){
515
- return $wishlist->get_id();
516
- }
517
-
518
- return false;
519
- }
520
-
521
- /**
522
- * Generate a token to visit wishlist
523
- *
524
- * @return string token
525
- * @since 2.0.0
526
- */
527
- public function generate_wishlist_token(){
528
- return YITH_WCWL_Wishlist_Factory::generate_wishlist_token();
529
- }
530
-
531
- /**
532
- * Returns an array of users that created and populated a public wishlist
533
- *
534
- * @param $args mixed Array of valid arguments<br/>
535
- * [<br/>
536
- * 'search' // String to match against first name / last name / user login or user email of wishlist owner<br/>
537
- * 'limit' // Pagination param: number of items to show in one page. 0 to show all items<br/>
538
- * 'offset' // Pagination param: offset for the current set. 0 to start from the first item<br/>
539
- * ]
540
- * @return array
541
- * @since 2.0.0
542
- */
543
- public function get_users_with_wishlist( $args = array() ){
544
- return YITH_WCWL_Wishlist_Factory::get_wishlist_users( $args );
545
- }
546
-
547
- /**
548
- * Count users that have public wishlists
549
- *
550
- * @param $search string
551
- * @return int
552
- * @since 2.0.0
553
- */
554
- public function count_users_with_wishlists( $search ){
555
- return count( $this->get_users_with_wishlist( array( 'search' => $search ) ) );
556
- }
557
-
558
- /* === GENERAL METHODS === */
559
-
560
- /**
561
- * Checks whether current user can add to the wishlist
562
- *
563
- * @param $user_id int|bool User id to test; false to use current user id
564
- * @return bool Whether current user can add to wishlist
565
- * @since 3.0.0
566
- */
567
- public function can_user_add_to_wishlist( $user_id = false ) {
568
- $user_id = $user_id ? $user_id : get_current_user_id();
569
- $disable_wishlist_for_unauthenticated_users = get_option( 'yith_wcwl_disable_wishlist_for_unauthenticated_users' );
570
- $return = true;
571
-
572
- if( 'yes' == $disable_wishlist_for_unauthenticated_users && ! $user_id ){
573
- $return = false;
574
- }
575
-
576
- return apply_filters( 'yith_wcwl_can_user_add_to_wishlist', $return, $user_id );
577
- }
578
-
579
- /**
580
- * Register custom plugin Data Stores classes
581
- *
582
- * @param $data_stores array Array of registered data stores
583
- * @return array Array of filtered data store
584
- */
585
- public function register_data_stores( $data_stores ) {
586
- $data_stores['wishlist'] = 'YITH_WCWL_Wishlist_Data_Store';
587
- $data_stores['wishlist-item'] = 'YITH_WCWL_Wishlist_Item_Data_Store';
588
-
589
- return $data_stores;
590
- }
591
-
592
- /**
593
- * Add rewrite rules for wishlist
594
- *
595
- * @return void
596
- * @since 2.0.0
597
- */
598
- public function add_rewrite_rules() {
599
- global $wp_query;
600
-
601
- // filter wishlist param
602
- $this->wishlist_param = apply_filters( 'yith_wcwl_wishlist_param', $this->wishlist_param );
603
-
604
- $wishlist_page_id = isset( $_POST['yith_wcwl_wishlist_page_id'] ) ? $_POST['yith_wcwl_wishlist_page_id'] : get_option( 'yith_wcwl_wishlist_page_id' );
605
- $wishlist_page_id = yith_wcwl_object_id( $wishlist_page_id );
606
-
607
- if( empty( $wishlist_page_id ) ){
608
- return;
609
- }
610
-
611
- $wishlist_page = get_post( $wishlist_page_id );
612
- $wishlist_page_slug = $wishlist_page ? $wishlist_page->post_name : false;
613
-
614
- if ( empty( $wishlist_page_slug ) ){
615
- return;
616
- }
617
-
618
- if( defined( 'POLYLANG_VERSION' ) || defined( 'ICL_PLUGIN_PATH' ) ){
619
- return;
620
- }
621
-
622
- $regex_paged = '(([^/]+/)*' . $wishlist_page_slug . ')(/(.*))?/page/([0-9]{1,})/?$';
623
- $regex_simple = '(([^/]+/)*' . $wishlist_page_slug . ')(/(.*))?/?$';
624
-
625
- add_rewrite_rule( $regex_paged, 'index.php?pagename=$matches[1]&' . $this->wishlist_param . '=$matches[4]&paged=$matches[5]', 'top' );
626
- add_rewrite_rule( $regex_simple, 'index.php?pagename=$matches[1]&' . $this->wishlist_param . '=$matches[4]', 'top' );
627
-
628
- $rewrite_rules = get_option( 'rewrite_rules' );
629
-
630
- if( ! is_array( $rewrite_rules ) || ! array_key_exists( $regex_paged, $rewrite_rules ) || ! array_key_exists( $regex_simple, $rewrite_rules ) ){
631
- flush_rewrite_rules();
632
- }
633
- }
634
-
635
- /**
636
- * Adds public query var for wishlist
637
- *
638
- * @param $public_var array
639
- * @return array
640
- * @since 2.0.0
641
- */
642
- public function add_public_query_var( $public_var ) {
643
- $public_var[] = $this->wishlist_param;
644
- $public_var[] = 'wishlist_id';
645
-
646
- return $public_var;
647
- }
648
-
649
- /**
650
- * Build wishlist page URL.
651
- *
652
- * @param $action string
653
- *
654
- * @return string
655
- * @since 1.0.0
656
- */
657
- public function get_wishlist_url( $action = '' ) {
658
- global $sitepress;
659
- $wishlist_page_id = yith_wcwl_object_id( get_option( 'yith_wcwl_wishlist_page_id' ) );
660
- $wishlist_permalink = get_the_permalink( $wishlist_page_id );
661
-
662
- $action_params = explode( '/', $action );
663
- $view = $action_params[0];
664
- $data = isset( $action_params[1] ) ? $action_params[1] : '';
665
-
666
- if( $action == 'view' && empty( $data ) ){
667
- return $wishlist_permalink;
668
- }
669
-
670
- if( get_option( 'permalink_structure' ) && ! defined( 'ICL_PLUGIN_PATH' ) && ! defined( 'POLYLANG_VERSION' ) ) {
671
- $wishlist_permalink = trailingslashit( $wishlist_permalink );
672
- $base_url = trailingslashit( $wishlist_permalink . $action );
673
- }
674
- else{
675
- $base_url = $wishlist_permalink;
676
- $params = array();
677
-
678
- if( ! empty( $data ) ){
679
- $params[ $this->wishlist_param ] = $view;
680
-
681
- if( $view == 'view' ){
682
- $params['wishlist_id'] = $data;
683
- }
684
- elseif( $view == 'user' ){
685
- $params['user_id'] = $data;
686
- }
687
- }
688
- else{
689
- $params[ $this->wishlist_param ] = $view;
690
- }
691
-
692
- $base_url = add_query_arg( $params, $base_url );
693
- }
694
-
695
- if( defined( 'ICL_PLUGIN_PATH' ) && $sitepress->get_current_language() != $sitepress->get_default_language() ){
696
- $base_url = add_query_arg( 'lang', $sitepress->get_current_language(), $base_url );
697
- }
698
-
699
- return apply_filters( 'yith_wcwl_wishlist_page_url', esc_url_raw( $base_url ), $action );
700
- }
701
-
702
- /**
703
- * Retrieve url for the wishlist that was affected by last operation
704
- *
705
- * @return string Url to view last operation wishlist
706
- */
707
- public function get_last_operation_url() {
708
- $action = 'view';
709
-
710
- if( ! empty( $this->last_operation_token ) ){
711
- $action .= "/{$this->last_operation_token}";
712
- }
713
-
714
- return $this->get_wishlist_url( $action );
715
- }
716
-
717
- /**
718
- * Generates Add to Wishlist url, to use when customer do not have js enabled
719
- *
720
- * @param $product_id int Product id to add to wishlist
721
- * @param $args array Any of the following parameters
722
- * [
723
- * 'base_url' => ''
724
- * 'wishlist_id' => 0,
725
- * 'quantity' => 1,
726
- * 'user_id' => false,
727
- * 'dateadded' => '',
728
- * 'wishlist_name' => '',
729
- * 'wishlist_visibility' => 0
730
- * ]
731
- * @return string Add to wishlist url
732
- */
733
- public function get_add_to_wishlist_url( $product_id, $args = array() ) {
734
- $args = array_merge(
735
- array(
736
- 'add_to_wishlist' => $product_id
737
- ),
738
- $args
739
- );
740
-
741
- if( isset( $args['base_url'] ) ){
742
- $base_url = $args['base_url'];
743
- unset( $args['base_url'] );
744
-
745
- $url = add_query_arg( $args, $base_url );
746
- }
747
- else{
748
- $url = add_query_arg( $args );
749
- }
750
 
751
  return apply_filters( 'yith_wcwl_add_to_wishlist_url', esc_url_raw( $url ), $product_id, $args );
752
- }
753
-
754
- /**
755
- * Build the URL used to remove an item from the wishlist.
756
- *
757
- * @param int $item_id
758
- * @return string
759
- * @since 1.0.0
760
- */
761
- public function get_remove_url( $item_id ) {
762
- return esc_url( add_query_arg( 'remove_from_wishlist', $item_id ) );
763
- }
764
-
765
- /**
766
- * Returns available views for wishlist page
767
- *
768
- * @return string[]
769
- * @since 3.0.0
770
- */
771
- public function get_available_views() {
772
- $available_views = apply_filters( 'yith_wcwl_available_wishlist_views', array( 'view', 'user' ) );
773
- return $available_views;
774
- }
775
-
776
- /**
777
- * Checks whether multi-wishlist feature is enabled for current user
778
- *
779
- * @return bool Whether feature is enabled or not
780
- */
781
- public function is_multi_wishlist_enabled() {
782
- return false;
783
- }
784
- }
785
  }
786
 
787
  /**
8
  */
9
 
10
  if ( ! defined( 'YITH_WCWL' ) ) {
11
+ exit;
12
  } // Exit if accessed directly
13
 
14
  if ( ! class_exists( 'YITH_WCWL' ) ) {
15
+ /**
16
+ * WooCommerce Wishlist
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ class YITH_WCWL {
21
+ /**
22
+ * Single instance of the class
23
+ *
24
+ * @var \YITH_WCWL
25
+ * @since 2.0.0
26
+ */
27
+ protected static $instance;
28
+
29
+ /**
30
+ * Last operation token
31
+ *
32
+ * @var string
33
+ * @since 2.0.0
34
+ */
35
+ public $last_operation_token;
36
+
37
+ /**
38
+ * Query string parameter used to generate Wishlist urls
39
+ *
40
+ * @var string
41
+ * @since 2.1.2
42
+ */
43
+ public $wishlist_param = 'wishlist-action';
44
+
45
+ /**
46
+ * Returns single instance of the class
47
+ *
48
+ * @return \YITH_WCWL
49
+ * @since 2.0.0
50
+ */
51
+ public static function get_instance(){
52
+ if( is_null( self::$instance ) ){
53
+ self::$instance = new self();
54
+ }
55
+
56
+ return self::$instance;
57
+ }
58
+
59
+ /**
60
+ * Constructor.
61
+ *
62
+ * @return \YITH_WCWL
63
+ * @since 1.0.0
64
+ */
65
+ public function __construct() {
66
+ // register data stores
67
+ add_filter( 'woocommerce_data_stores', array( $this, 'register_data_stores' ) );
68
+
69
+ // init frontend class
70
+ $this->wcwl_frontend = YITH_WCWL_Frontend();
71
+
72
+ // init crons
73
+ $this->wcwl_cron = YITH_WCWL_Cron();
74
+
75
+ // init session
76
+ $this->wcwl_session = YITH_WCWL_Session();
77
+
78
+ // init admin handling
79
+ if( is_admin() ){
80
+ $this->wcwl_admin = YITH_WCWL_Admin();
81
+ }
82
+
83
+ // load plugin-fw
84
+ add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 15 );
85
+ add_action( 'plugins_loaded', array( $this, 'privacy_loader' ), 20 );
86
+
87
+ // add rewrite rule
88
+ add_action( 'init', array( $this, 'add_rewrite_rules' ), 0 );
89
+ add_filter( 'query_vars', array( $this, 'add_public_query_var' ) );
90
+ }
91
+
92
+ /* === PLUGIN FW LOADER === */
93
+
94
+ /**
95
+ * Loads plugin fw, if not yet created
96
+ *
97
+ * @return void
98
+ * @since 2.0.0
99
+ */
100
+ public function plugin_fw_loader() {
101
+ if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
102
+ global $plugin_fw_data;
103
+ if( ! empty( $plugin_fw_data ) ){
104
+ $plugin_fw_file = array_shift( $plugin_fw_data );
105
+ require_once( $plugin_fw_file );
106
+ }
107
+ }
108
+ }
109
+
110
+ /* === PRIVACY LOADER === */
111
+
112
+ /**
113
+ * Loads privacy class
114
+ *
115
+ * @return void
116
+ * @since 2.0.0
117
+ */
118
+ public function privacy_loader() {
119
+ if( class_exists( 'YITH_Privacy_Plugin_Abstract' ) ) {
120
+ require_once( YITH_WCWL_INC . 'class.yith-wcwl-privacy.php' );
121
+ new YITH_WCWL_Privacy();
122
+ }
123
+ }
124
+
125
+ /* === ITEMS METHODS === */
126
+
127
+ /**
128
+ * Add a product in the wishlist.
129
+ *
130
+ * @param $atts array Array of parameters; when not passed, params will be searched in $_REQUEST
131
+ * @return void
132
+ * @throws Exception When an error occurs with Add to Wishlist operation
133
+ * @throws YITH_WCWL_Exception When an error occurs with Add to Wishlist operation
134
+ * @since 1.0.0
135
+ */
136
+ public function add( $atts = array() ) {
137
+ $defaults = array(
138
+ 'add_to_wishlist' => 0,
139
+ 'wishlist_id' => 0,
140
+ 'quantity' => 1,
141
+ 'user_id' => false,
142
+ 'dateadded' => '',
143
+ 'wishlist_name' => '',
144
+ 'wishlist_visibility' => 0
145
+ );
146
+
147
+ $atts = empty( $atts ) && ! empty( $this->details ) ? $this->details : $atts;
148
+ $atts = ! empty( $atts ) ? $atts : $_REQUEST;
149
+ $atts = wp_parse_args( $atts, $defaults );
150
+
151
+ // filtering params
152
+ $prod_id = apply_filters( 'yith_wcwl_adding_to_wishlist_prod_id', intval( $atts['add_to_wishlist'] ) );
153
+ $wishlist_id = apply_filters( 'yith_wcwl_adding_to_wishlist_wishlist_id', $atts['wishlist_id'] );
154
+ $quantity = apply_filters( 'yith_wcwl_adding_to_wishlist_quantity', intval( $atts['quantity'] ) );
155
+ $user_id = apply_filters( 'yith_wcwl_adding_to_wishlist_user_id', intval( $atts['user_id'] ) );
156
+ $dateadded = apply_filters( 'yith_wcwl_adding_to_wishlist_dateadded', $atts['dateadded'] );
157
+
158
+ do_action( 'yith_wcwl_adding_to_wishlist', $prod_id, $wishlist_id, $user_id );
159
+
160
+ if( ! $this->can_user_add_to_wishlist() ){
161
+ throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_user_cannot_add_to_wishlist_message', __( 'The item cannot be added to this wishlist', 'yith-woocommerce-wishlist' ) ), 1 );
162
+ }
163
+
164
+ if ( $prod_id == false ) {
165
+ throw new YITH_WCWL_Exception( __( 'An error occurred while adding the products to the wishlist.', 'yith-woocommerce-wishlist' ), 0 );
166
+ }
167
+
168
+ $wishlist = 'new' === $wishlist_id ? $this->add_wishlist( $atts ) : YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id, 'edit' );
169
+
170
+ if( ! $wishlist instanceof YITH_WCWL_Wishlist || ! $wishlist->current_user_can( 'add_to_wishlist' ) ){
171
+ throw new YITH_WCWL_Exception( __( 'An error occurred while adding the products to the wishlist.', 'yith-woocommerce-wishlist' ), 0 );
172
+ }
173
+
174
+ $this->last_operation_token = $wishlist->get_token();
175
+
176
+ if( $wishlist->has_product( $prod_id ) ) {
177
+ throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_product_already_in_wishlist_message', get_option( 'yith_wcwl_already_in_wishlist_text' ) ), 1 );
178
+ }
179
+
180
+ $item = new YITH_WCWL_Wishlist_Item();
181
+
182
+ $item->set_product_id( $prod_id );
183
+ $item->set_quantity( $quantity );
184
+
185
+ if( $dateadded ){
186
+ $item->set_date_added( $dateadded );
187
+ }
188
+
189
+ $wishlist->add_item( $item );
190
+ $wishlist->save();
191
+
192
+ wp_cache_delete( 'wishlist-count-' . $wishlist->get_token(), 'wishlists' );
193
+
194
+ if( $user_id = $wishlist->get_user_id() ) {
195
+ wp_cache_delete( 'wishlist-user-total-count-' . $user_id, 'wishlists' );
196
+ }
197
+
198
+ do_action( 'yith_wcwl_added_to_wishlist', $prod_id, $item->get_wishlist_id(), $item->get_user_id() );
199
+ }
200
+
201
+ /**
202
+ * Remove an entry from the wishlist.
203
+ *
204
+ * @param $atts array Array of parameters; when not passed, parameters will be retrieved from $_REQUEST
205
+ *
206
+ * @return void
207
+ * @throws Exception When something was wrong with removal
208
+ * @since 1.0.0
209
+ */
210
+ public function remove( $atts = array() ) {
211
+ $defaults = array(
212
+ 'remove_from_wishlist' => 0,
213
+ 'wishlist_id' => 0,
214
+ 'user_id' => false
215
+ );
216
+
217
+ $atts = empty( $atts ) && ! empty( $this->details ) ? $this->details : $atts;
218
+ $atts = ! empty( $atts ) ? $atts : $_REQUEST;
219
+ $atts = wp_parse_args( $atts, $defaults );
220
+
221
+ $prod_id = intval( $atts['remove_from_wishlist'] );
222
+ $wishlist_id = intval( $atts['wishlist_id'] );
223
+ $user_id = intval( $atts['user_id'] );
224
+
225
+ do_action( 'yith_wcwl_removing_from_wishlist', $prod_id, $wishlist_id, $user_id );
226
+
227
+ if( $prod_id == false ){
228
+ throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_unable_to_remove_product_message', __( 'Error. Unable to remove the product from the wishlist.', 'yith-woocommerce-wishlist' ) ), 0 );
229
+ }
230
+
231
+ $wishlist = YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id );
232
+
233
+ if( ! $wishlist instanceof YITH_WCWL_Wishlist || ! $wishlist->current_user_can( 'remove_from_wishlist' ) ){
234
+ throw new YITH_WCWL_Exception( apply_filters( 'yith_wcwl_unable_to_remove_product_message', __( 'Error. Unable to remove the product from the wishlist.', 'yith-woocommerce-wishlist' ) ), 0 );
235
+ }
236
+
237
+ $wishlist->remove_product( $prod_id );
238
+ $wishlist->save();
239
+
240
+ wp_cache_delete( 'wishlist-count-' . $wishlist->get_token(), 'wishlists' );
241
+
242
+ if( $user_id = $wishlist->get_user_id() ) {
243
+ wp_cache_delete( 'wishlist-user-total-count-' . $user_id );
244
+ }
245
+
246
+ do_action( 'yith_wcwl_removed_from_wishlist', $prod_id, $wishlist->get_id(), $wishlist->get_user_id() );
247
+ }
248
+
249
+ /**
250
+ * Check if the product exists in the wishlist.
251
+ *
252
+ * @param int $product_id Product id to check
253
+ * @param int|bool $wishlist_id Wishlist where to search (use false to search in default wishlist)
254
+ * @return bool
255
+ * @since 1.0.0
256
+ */
257
+ public function is_product_in_wishlist( $product_id, $wishlist_id = false ) {
258
+ $wishlist = YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id );
259
+
260
+ if( ! $wishlist ){
261
+ return false;
262
+ }
263
+
264
+ return apply_filters( 'yith_wcwl_is_product_in_wishlist', $wishlist->has_product( $product_id ), $product_id, $wishlist_id );
265
+ }
266
+
267
+ /**
268
+ * Retrieve elements of the wishlist for a specific user
269
+ *
270
+ * @param $args mixed Arguments array; it may contains any of the following:<br/>
271
+ * [<br/>
272
+ * 'user_id' // Owner of the wishlist; default to current user logged in (if any), or false for cookie wishlist<br/>
273
+ * 'product_id' // Product to search in the wishlist<br/>
274
+ * 'wishlist_id' // wishlist_id for a specific wishlist, false for default, or all for any wishlist<br/>
275
+ * 'wishlist_token' // wishlist token, or false as default<br/>
276
+ * 'wishlist_visibility' // all, visible, public, shared, private<br/>
277
+ * 'is_default' => // whether searched wishlist should be default one <br/>
278
+ * 'id' => false, // only for table select<br/>
279
+ * 'limit' => false, // pagination param; number of items per page. 0 to get all items<br/>
280
+ * 'offset' => 0 // pagination param; offset for the current set. 0 to start from the first item<br/>
281
+ * ]
282
+ *
283
+ * @return YITH_WCWL_Wishlist_Item[]|bool
284
+ * @since 2.0.0
285
+ */
286
+ public function get_products( $args = array() ) {
287
+ return YITH_WCWL_Wishlist_Factory::get_wishlist_items( $args );
288
+ }
289
+
290
+ /**
291
+ * Retrieve the number of products in the wishlist.
292
+ *
293
+ * @param $wishlist_token string|bool Wishlist token if any; false for default wishlist
294
+ *
295
+ * @return int
296
+ * @since 1.0.0
297
+ */
298
+ public function count_products( $wishlist_token = false ) {
299
+ $wishlist = YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_token );
300
+
301
+ if( ! $wishlist ){
302
+ return 0;
303
+ }
304
+
305
+ $count = wp_cache_get( 'wishlist-count-' . $wishlist->get_token(), 'wishlists' );
306
+
307
+ if( false === $count ){
308
+ $count = $wishlist->count_items();
309
+ wp_cache_set( 'wishlist-count-' . $wishlist->get_token(), $count, 'wishlists' );
310
+ }
311
+
312
+ return $count;
313
+ }
314
+
315
+ /**
316
+ * Count all user items in wishlists
317
+ *
318
+ * @return int Count of items added all over wishlist from current user
319
+ * @since 2.0.12
320
+ */
321
+ public function count_all_products() {
322
+ $args = array(
323
+ 'wishlist_id' => 'all'
324
+ );
325
+
326
+ if( is_user_logged_in() ){
327
+ $id = get_current_user_id();
328
+ $args['user_id'] = $id;
329
+ }
330
+ else{
331
+ $id = YITH_WCWL_Session()->get_session_id();
332
+ $args['session_id'] = $id;
333
+ }
334
+
335
+ if( false === $count = wp_cache_get( 'wishlist-user-total-count-' . $id, 'wishlists' ) ) {
336
+ $count = YITH_WCWL_Wishlist_Factory::get_wishlist_items_count( $args );
337
+ wp_cache_set( 'wishlist-user-total-count-' . $id, $count, 'wishlists' );
338
+ }
339
+
340
+ return $count;
341
+ }
342
+
343
+ /**
344
+ * Count number of times a product was added to users wishlists
345
+ *
346
+ * @param $product_id int|bool Product id; false will force method to use global product
347
+ *
348
+ * @return int Number of times the product was added to wishlist
349
+ * @since 2.0.13
350
+ */
351
+ public function count_add_to_wishlist( $product_id = false ) {
352
+ global $product;
353
+
354
+ $product_id = ! ( $product_id ) ? yit_get_product_id( $product ) : $product_id;
355
+
356
+ if( ! $product_id ){
357
+ return 0;
358
+ }
359
+
360
+ $count = YITH_WCWL_Wishlist_Factory::get_times_added_count( $product_id );
361
+
362
+ return $count;
363
+ }
364
+
365
+ /**
366
+ * Count product occurrences in users wishlists
367
+ *
368
+ * @param $product_id int|bool Product id; false will force method to use global product
369
+ *
370
+ * @return int
371
+ * @since 2.0.0
372
+ */
373
+ public function count_product_occurrences( $product_id = false ) {
374
+ global $product;
375
+
376
+ $product_id = ! ( $product_id ) ? yit_get_product_id( $product ) : $product_id;
377
+
378
+ if( ! $product_id ){
379
+ return 0;
380
+ }
381
+
382
+ $count = YITH_WCWL_Wishlist_Factory::get_wishlist_items_count( array( 'product_id' => $product_id, 'user_id' => false, 'session_id' => false, 'wishlist_id' => 'all' ) );
383
+
384
+ return $count;
385
+ }
386
+
387
+ /**
388
+ * Retrieve details of a product in the wishlist.
389
+ *
390
+ * @param int $product_id
391
+ * @param int|bool $wishlist_id
392
+ * @return YITH_WCWL_Wishlist_Item|bool
393
+ * @since 1.0.0
394
+ */
395
+ public function get_product_details( $product_id, $wishlist_id = false ) {
396
+ $product = $this->get_products(
397
+ array(
398
+ 'prod_id' => $product_id,
399
+ 'wishlist_id' => $wishlist_id
400
+ )
401
+ );
402
+
403
+ if( empty( $product ) ){
404
+ return false;
405
+ }
406
+
407
+ return array_shift( $product );
408
+ }
409
+
410
+ /* === WISHLISTS METHODS === */
411
+
412
+ /**
413
+ * Add a new wishlist for the user.
414
+ *
415
+ * @param $atts array Array of params for wishlist creation
416
+ * @return int Id of the wishlist created
417
+ * @since 2.0.0
418
+ */
419
+ public function add_wishlist( $atts = array() ) {
420
+ $defaults = array(
421
+ 'user_id' => false
422
+ );
423
+
424
+ $atts = empty( $atts ) && ! empty( $this->details ) ? $this->details : $atts;
425
+ $atts = ! empty( $atts ) ? $atts : $_REQUEST;
426
+ $atts = wp_parse_args( $atts, $defaults );
427
+
428
+ $user_id = ( ! empty( $atts['user_id'] ) ) ? $atts['user_id'] : false;
429
+
430
+ return $this->generate_default_wishlist( $user_id );
431
+ }
432
+
433
+ /**
434
+ * Update wishlist with arguments passed as second parameter
435
+ *
436
+ * @param $wishlist_id int
437
+ * @param $args array Array of parameters to use in update process
438
+ * @return void
439
+ * @since 2.0.0
440
+ */
441
+ public function update_wishlist( $wishlist_id, $args = array() ) {
442
+ return;
443
+ }
444
+
445
+ /**
446
+ * Delete indicated wishlist
447
+ *
448
+ * @param $wishlist_id int
449
+ * @return void
450
+ * @since 2.0.0
451
+ */
452
+ public function remove_wishlist( $wishlist_id ) {
453
+ return;
454
+ }
455
+
456
+ /**
457
+ * Retrieve all the wishlist matching specified arguments
458
+ *
459
+ * @param $args mixed Array of valid arguments<br/>
460
+ * [<br/>
461
+ * 'id' // Wishlist id to search, if any<br/>
462
+ * 'user_id' // User owner<br/>
463
+ * 'wishlist_slug' // Slug of the wishlist to search<br/>
464
+ * 'wishlist_name' // Name of the wishlist to search<br/>
465
+ * 'wishlist_token' // Token of the wishlist to search<br/>
466
+ * 'wishlist_visibility' // Wishlist visibility: all, visible, public, shared, private<br/>
467
+ * 'user_search' // String to match against first name / last name or email of the wishlist owner<br/>
468
+ * 'is_default' // Whether wishlist should be default or not<br/>
469
+ * 'orderby' // Column used to sort final result (could be any wishlist lists column)<br/>
470
+ * 'order' // Sorting order<br/>
471
+ * 'limit' // Pagination param: maximum number of elements in the set. 0 to retrieve all elements<br/>
472
+ * 'offset' // Pagination param: offset for the current set. 0 to start from the first item<br/>
473
+ * 'show_empty' // Whether to show empty lists os not<br/>
474
+ * ]
475
+ *
476
+ * @return YITH_WCWL_Wishlist[]
477
+ * @since 2.0.0
478
+ */
479
+ public function get_wishlists( $args = array() ){
480
+ return YITH_WCWL_Wishlist_Factory::get_wishlists( $args );
481
+ }
482
+
483
+ /**
484
+ * Returns details of a wishlist, searching it by wishlist id
485
+ *
486
+ * @param $wishlist_id int
487
+ * @return YITH_WCWL_Wishlist
488
+ * @since 2.0.0
489
+ */
490
+ public function get_wishlist_detail( $wishlist_id ) {
491
+ return YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_id );
492
+ }
493
+
494
+ /**
495
+ * Returns details of a wishlist, searching it by wishlist token
496
+ *
497
+ * @param $wishlist_token string
498
+ * @return YITH_WCWL_Wishlist
499
+ * @since 2.0.0
500
+ */
501
+ public function get_wishlist_detail_by_token( $wishlist_token ) {
502
+ return YITH_WCWL_Wishlist_Factory::get_wishlist( $wishlist_token );
503
+ }
504
+
505
+ /**
506
+ * Generate default wishlist for current user or session
507
+ *
508
+ * @return int Default wishlist id
509
+ * @since 2.0.0
510
+ */
511
+ public function generate_default_wishlist( $id = false ){
512
+ $wishlist = YITH_WCWL_Wishlist_Factory::generate_default_wishlist( $id );
513
+
514
+ if( $wishlist ){
515
+ return $wishlist->get_id();
516
+ }
517
+
518
+ return false;
519
+ }
520
+
521
+ /**
522
+ * Generate a token to visit wishlist
523
+ *
524
+ * @return string token
525
+ * @since 2.0.0
526
+ */
527
+ public function generate_wishlist_token(){
528
+ return YITH_WCWL_Wishlist_Factory::generate_wishlist_token();
529
+ }
530
+
531
+ /**
532
+ * Returns an array of users that created and populated a public wishlist
533
+ *
534
+ * @param $args mixed Array of valid arguments<br/>
535
+ * [<br/>
536
+ * 'search' // String to match against first name / last name / user login or user email of wishlist owner<br/>
537
+ * 'limit' // Pagination param: number of items to show in one page. 0 to show all items<br/>
538
+ * 'offset' // Pagination param: offset for the current set. 0 to start from the first item<br/>
539
+ * ]
540
+ * @return array
541
+ * @since 2.0.0
542
+ */
543
+ public function get_users_with_wishlist( $args = array() ){
544
+ return YITH_WCWL_Wishlist_Factory::get_wishlist_users( $args );
545
+ }
546
+
547
+ /**
548
+ * Count users that have public wishlists
549
+ *
550
+ * @param $search string
551
+ * @return int
552
+ * @since 2.0.0
553
+ */
554
+ public function count_users_with_wishlists( $search ){
555
+ return count( $this->get_users_with_wishlist( array( 'search' => $search ) ) );
556
+ }
557
+
558
+ /* === GENERAL METHODS === */
559
+
560
+ /**
561
+ * Checks whether current user can add to the wishlist
562
+ *
563
+ * @param $user_id int|bool User id to test; false to use current user id
564
+ * @return bool Whether current user can add to wishlist
565
+ * @since 3.0.0
566
+ */
567
+ public function can_user_add_to_wishlist( $user_id = false ) {
568
+ $user_id = $user_id ? $user_id : get_current_user_id();
569
+ $disable_wishlist_for_unauthenticated_users = get_option( 'yith_wcwl_disable_wishlist_for_unauthenticated_users' );
570
+ $return = true;
571
+
572
+ if( 'yes' == $disable_wishlist_for_unauthenticated_users && ! $user_id ){
573
+ $return = false;
574
+ }
575
+
576
+ return apply_filters( 'yith_wcwl_can_user_add_to_wishlist', $return, $user_id );
577
+ }
578
+
579
+ /**
580
+ * Register custom plugin Data Stores classes
581
+ *
582
+ * @param $data_stores array Array of registered data stores
583
+ * @return array Array of filtered data store
584
+ */
585
+ public function register_data_stores( $data_stores ) {
586
+ $data_stores['wishlist'] = 'YITH_WCWL_Wishlist_Data_Store';
587
+ $data_stores['wishlist-item'] = 'YITH_WCWL_Wishlist_Item_Data_Store';
588
+
589
+ return $data_stores;
590
+ }
591
+
592
+ /**
593
+ * Add rewrite rules for wishlist
594
+ *
595
+ * @return void
596
+ * @since 2.0.0
597
+ */
598
+ public function add_rewrite_rules() {
599
+ global $wp_query;
600
+
601
+ // filter wishlist param
602
+ $this->wishlist_param = apply_filters( 'yith_wcwl_wishlist_param', $this->wishlist_param );
603
+
604
+ $wishlist_page_id = isset( $_POST['yith_wcwl_wishlist_page_id'] ) ? $_POST['yith_wcwl_wishlist_page_id'] : get_option( 'yith_wcwl_wishlist_page_id' );
605
+ $wishlist_page_id = yith_wcwl_object_id( $wishlist_page_id );
606
+
607
+ if( empty( $wishlist_page_id ) ){
608
+ return;
609
+ }
610
+
611
+ $wishlist_page = get_post( $wishlist_page_id );
612
+ $wishlist_page_slug = $wishlist_page ? $wishlist_page->post_name : false;
613
+
614
+ if ( empty( $wishlist_page_slug ) ){
615
+ return;
616
+ }
617
+
618
+ if( defined( 'POLYLANG_VERSION' ) || defined( 'ICL_PLUGIN_PATH' ) ){
619
+ return;
620
+ }
621
+
622
+ $regex_paged = '(([^/]+/)*' . $wishlist_page_slug . ')(/(.*))?/page/([0-9]{1,})/?$';
623
+ $regex_simple = '(([^/]+/)*' . $wishlist_page_slug . ')(/(.*))?/?$';
624
+
625
+ add_rewrite_rule( $regex_paged, 'index.php?pagename=$matches[1]&' . $this->wishlist_param . '=$matches[4]&paged=$matches[5]', 'top' );
626
+ add_rewrite_rule( $regex_simple, 'index.php?pagename=$matches[1]&' . $this->wishlist_param . '=$matches[4]', 'top' );
627
+
628
+ $rewrite_rules = get_option( 'rewrite_rules' );
629
+
630
+ if( ! is_array( $rewrite_rules ) || ! array_key_exists( $regex_paged, $rewrite_rules ) || ! array_key_exists( $regex_simple, $rewrite_rules ) ){
631
+ flush_rewrite_rules();
632
+ }
633
+ }
634
+
635
+ /**
636
+ * Adds public query var for wishlist
637
+ *
638
+ * @param $public_var array
639
+ * @return array
640
+ * @since 2.0.0
641
+ */
642
+ public function add_public_query_var( $public_var ) {
643
+ $public_var[] = $this->wishlist_param;
644
+ $public_var[] = 'wishlist_id';
645
+
646
+ return $public_var;
647
+ }
648
+
649
+ /**
650
+ * Build wishlist page URL.
651
+ *
652
+ * @param $action string
653
+ *
654
+ * @return string
655
+ * @since 1.0.0
656
+ */
657
+ public function get_wishlist_url( $action = '' ) {
658
+ global $sitepress;
659
+ $wishlist_page_id = yith_wcwl_object_id( get_option( 'yith_wcwl_wishlist_page_id' ) );
660
+ $wishlist_permalink = get_the_permalink( $wishlist_page_id );
661
+
662
+ $action_params = explode( '/', $action );
663
+ $view = $action_params[0];
664
+ $data = isset( $action_params[1] ) ? $action_params[1] : '';
665
+
666
+ if( $action == 'view' && empty( $data ) ){
667
+ return $wishlist_permalink;
668
+ }
669
+
670
+ if( get_option( 'permalink_structure' ) && ! defined( 'ICL_PLUGIN_PATH' ) && ! defined( 'POLYLANG_VERSION' ) ) {
671
+ $wishlist_permalink = trailingslashit( $wishlist_permalink );
672
+ $base_url = trailingslashit( $wishlist_permalink . $action );
673
+ }
674
+ else{
675
+ $base_url = $wishlist_permalink;
676
+ $params = array();
677
+
678
+ if( ! empty( $data ) ){
679
+ $params[ $this->wishlist_param ] = $view;
680
+
681
+ if( $view == 'view' ){
682
+ $params['wishlist_id'] = $data;
683
+ }
684
+ elseif( $view == 'user' ){
685
+ $params['user_id'] = $data;
686
+ }
687
+ }
688
+ else{
689
+ $params[ $this->wishlist_param ] = $view;
690
+ }
691
+
692
+ $base_url = add_query_arg( $params, $base_url );
693
+ }
694
+
695
+ if( defined( 'ICL_PLUGIN_PATH' ) && $sitepress->get_current_language() != $sitepress->get_default_language() ){
696
+ $base_url = add_query_arg( 'lang', $sitepress->get_current_language(), $base_url );
697
+ }
698
+
699
+ return apply_filters( 'yith_wcwl_wishlist_page_url', esc_url_raw( $base_url ), $action );
700
+ }
701
+
702
+ /**
703
+ * Retrieve url for the wishlist that was affected by last operation
704
+ *
705
+ * @return string Url to view last operation wishlist
706
+ */
707
+ public function get_last_operation_url() {
708
+ $action = 'view';
709
+
710
+ if( ! empty( $this->last_operation_token ) ){
711
+ $action .= "/{$this->last_operation_token}";
712
+ }
713
+
714
+ return $this->get_wishlist_url( $action );
715
+ }
716
+
717
+ /**
718
+ * Generates Add to Wishlist url, to use when customer do not have js enabled
719
+ *
720
+ * @param $product_id int Product id to add to wishlist
721
+ * @param $args array Any of the following parameters
722
+ * [
723
+ * 'base_url' => ''
724
+ * 'wishlist_id' => 0,
725
+ * 'quantity' => 1,
726
+ * 'user_id' => false,
727
+ * 'dateadded' => '',
728
+ * 'wishlist_name' => '',
729
+ * 'wishlist_visibility' => 0
730
+ * ]
731
+ * @return string Add to wishlist url
732
+ */
733
+ public function get_add_to_wishlist_url( $product_id, $args = array() ) {
734
+ $args = array_merge(
735
+ array(
736
+ 'add_to_wishlist' => $product_id
737
+ ),
738
+ $args
739
+ );
740
+
741
+ if( isset( $args['base_url'] ) ){
742
+ $base_url = $args['base_url'];
743
+ unset( $args['base_url'] );
744
+
745
+ $url = add_query_arg( $args, $base_url );
746
+ }
747
+ else{
748
+ $url = add_query_arg( $args );
749
+ }
750
 
751
  return apply_filters( 'yith_wcwl_add_to_wishlist_url', esc_url_raw( $url ), $product_id, $args );
752
+ }
753
+
754
+ /**
755
+ * Build the URL used to remove an item from the wishlist.
756
+ *
757
+ * @param int $item_id
758
+ * @return string
759
+ * @since 1.0.0
760
+ */
761
+ public function get_remove_url( $item_id ) {
762
+ return esc_url( add_query_arg( 'remove_from_wishlist', $item_id ) );
763
+ }
764
+
765
+ /**
766
+ * Returns available views for wishlist page
767
+ *
768
+ * @return string[]
769
+ * @since 3.0.0
770
+ */
771
+ public function get_available_views() {
772
+ $available_views = apply_filters( 'yith_wcwl_available_wishlist_views', array( 'view', 'user' ) );
773
+ return $available_views;
774
+ }
775
+
776
+ /**
777
+ * Checks whether multi-wishlist feature is enabled for current user
778
+ *
779
+ * @return bool Whether feature is enabled or not
780
+ */
781
+ public function is_multi_wishlist_enabled() {
782
+ return false;
783
+ }
784
+ }
785
  }
786
 
787
  /**
includes/data-stores/class.yith-wcwl-wishlist-data-store.php CHANGED
@@ -378,21 +378,9 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist_Data_Store' ) ) {
378
  $sql_args[] = 0;
379
  $sql_args[] = 1;
380
  break;
381
- case 'public':
382
- $sql .= " AND l.`wishlist_privacy` = %d";
383
- $sql_args[] = 0;
384
- break;
385
- case 'shared':
386
- $sql .= " AND l.`wishlist_privacy` = %d";
387
- $sql_args[] = 1;
388
- break;
389
- case 'private':
390
- $sql .= " AND l.`wishlist_privacy` = %d";
391
- $sql_args[] = 2;
392
- break;
393
  default:
394
  $sql .= " AND l.`wishlist_privacy` = %d";
395
- $sql_args[] = 0;
396
  break;
397
  }
398
  }
@@ -578,7 +566,8 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist_Data_Store' ) ) {
578
 
579
  // remove hidden products from result
580
  $hidden_products = yith_wcwl_get_hidden_products();
581
- if( ! empty( $hidden_products ) ){
 
582
  $query .= " AND prod_id NOT IN ( " . implode( ', ', array_filter( $hidden_products, 'esc_sql' ) ) . " )";
583
  }
584
 
@@ -592,6 +581,26 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist_Data_Store' ) ) {
592
  'publish'
593
  ) ) );
594
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  foreach ( $items as $item ) {
596
  wp_cache_set( 'item-' . $item->ID, $item, 'wishlist-items' );
597
  }
378
  $sql_args[] = 0;
379
  $sql_args[] = 1;
380
  break;
 
 
 
 
 
 
 
 
 
 
 
 
381
  default:
382
  $sql .= " AND l.`wishlist_privacy` = %d";
383
+ $sql_args[] = yith_wcwl_get_privacy_value( $wishlist_visibility );
384
  break;
385
  }
386
  }
566
 
567
  // remove hidden products from result
568
  $hidden_products = yith_wcwl_get_hidden_products();
569
+
570
+ if( ! empty( $hidden_products ) && apply_filters( 'yith_wcwl_remove_hidden_products_via_query', true ) ){
571
  $query .= " AND prod_id NOT IN ( " . implode( ', ', array_filter( $hidden_products, 'esc_sql' ) ) . " )";
572
  }
573
 
581
  'publish'
582
  ) ) );
583
 
584
+ /**
585
+ * This filter was added to allow developer remove hidden products using a foreach loop, instead of the query
586
+ * It is required when the store contains a huge number of hidden products, and the resulting query would fail
587
+ * to be submitted to DBMS because of its size
588
+ *
589
+ * This code requires reasonable amount of products in the wishlist
590
+ * A great number of products retrieved from the main query could easily degrade performance of the overall system
591
+ *
592
+ * @since 3.0.7
593
+ */
594
+ if( ! empty( $hidden_products ) && ! empty( $items ) && ! apply_filters( 'yith_wcwl_remove_hidden_products_via_query', true ) ){
595
+ foreach( $items as $item_id => $item ){
596
+ if( ! in_array( $item->prod_id, $hidden_products ) ){
597
+ continue;
598
+ }
599
+
600
+ unset( $items[ $item_id ] );
601
+ }
602
+ }
603
+
604
  foreach ( $items as $item ) {
605
  wp_cache_set( 'item-' . $item->ID, $item, 'wishlist-items' );
606
  }
includes/data-stores/class.yith-wcwl-wishlist-item-data-store.php CHANGED
@@ -233,14 +233,18 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist_Item_Data_Store' ) ) {
233
  $args = wp_parse_args( $args, $default );
234
  extract( $args );
235
 
236
- $hidden_products = yith_wcwl_get_hidden_products();
237
-
238
- $sql = "SELECT SQL_CALC_FOUND_ROWS i.`ID`
239
  FROM `{$wpdb->yith_wcwl_items}` AS i
240
  LEFT JOIN {$wpdb->yith_wcwl_wishlists} AS l ON l.`ID` = i.`wishlist_id`
241
  INNER JOIN {$wpdb->posts} AS p ON p.ID = i.prod_id
242
  WHERE 1 AND p.post_type IN ( %s, %s ) AND p.post_status = %s";
243
- $sql .= $hidden_products ? " AND p.ID NOT IN ( " . implode( ', ', array_filter( $hidden_products, 'esc_sql' ) ) . " )" : "";
 
 
 
 
 
 
244
 
245
  $sql_args = array(
246
  'product',
@@ -341,10 +345,30 @@ if ( ! class_exists( 'YITH_WCWL_Wishlist_Item_Data_Store' ) ) {
341
  $sql_args[] = $limit;
342
  }
343
 
344
- $items = $wpdb->get_col( $wpdb->prepare( $sql, $sql_args ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
 
346
  if( ! empty( $items ) ){
347
- $items = array_map( array( 'YITH_WCWL_Wishlist_Factory', 'get_wishlist_item' ), $items );
348
  } else {
349
  $items = array();
350
  }
233
  $args = wp_parse_args( $args, $default );
234
  extract( $args );
235
 
236
+ $sql = "SELECT SQL_CALC_FOUND_ROWS i.*
 
 
237
  FROM `{$wpdb->yith_wcwl_items}` AS i
238
  LEFT JOIN {$wpdb->yith_wcwl_wishlists} AS l ON l.`ID` = i.`wishlist_id`
239
  INNER JOIN {$wpdb->posts} AS p ON p.ID = i.prod_id
240
  WHERE 1 AND p.post_type IN ( %s, %s ) AND p.post_status = %s";
241
+
242
+ // remove hidden products from result
243
+ $hidden_products = yith_wcwl_get_hidden_products();
244
+
245
+ if( ! empty( $hidden_products ) && apply_filters( 'yith_wcwl_remove_hidden_products_via_query', true ) ) {
246
+ $sql .= " AND p.ID NOT IN ( " . implode( ', ', array_filter( $hidden_products, 'esc_sql' ) ) . " )";
247
+ }
248
 
249
  $sql_args = array(
250
  'product',
345
  $sql_args[] = $limit;
346
  }
347
 
348
+ $items = $wpdb->get_results( $wpdb->prepare( $sql, $sql_args ) );
349
+
350
+ /**
351
+ * This filter was added to allow developer remove hidden products using a foreach loop, instead of the query
352
+ * It is required when the store contains a huge number of hidden products, and the resulting query would fail
353
+ * to be submitted to DBMS because of its size
354
+ *
355
+ * This code requires reasonable amount of products in the wishlist
356
+ * A great number of products retrieved from the main query could easily degrade performance of the overall system
357
+ *
358
+ * @since 3.0.7
359
+ */
360
+ if( ! empty( $hidden_products ) && ! empty( $items ) && ! apply_filters( 'yith_wcwl_remove_hidden_products_via_query', true ) ){
361
+ foreach( $items as $item_id => $item ){
362
+ if( ! in_array( $item->prod_id, $hidden_products ) ){
363
+ continue;
364
+ }
365
+
366
+ unset( $items[ $item_id ] );
367
+ }
368
+ }
369
 
370
  if( ! empty( $items ) ){
371
+ $items = array_map( array( 'YITH_WCWL_Wishlist_Factory', 'get_wishlist_item' ), array_combine( wp_list_pluck( $items, 'prod_id' ), $items ) );
372
  } else {
373
  $items = array();
374
  }
includes/functions.yith-wcwl.php CHANGED
@@ -12,95 +12,95 @@ if ( ! defined( 'YITH_WCWL' ) ) {
12
  } // Exit if accessed directly
13
 
14
  if( !function_exists( 'yith_wcwl_is_wishlist' ) ){
15
- /**
16
- * Check if we're printing wishlist shortcode
17
- *
18
- * @return bool
19
- * @since 2.0.0
20
- */
21
- function yith_wcwl_is_wishlist(){
22
- global $yith_wcwl_is_wishlist;
23
-
24
- return $yith_wcwl_is_wishlist;
25
- }
26
  }
27
 
28
  if( !function_exists( 'yith_wcwl_is_wishlist_page' ) ){
29
- /**
30
- * Check if current page is wishlist
31
- *
32
- * @return bool
33
- * @since 2.0.13
34
- */
35
- function yith_wcwl_is_wishlist_page(){
36
- $wishlist_page_id = yith_wcwl_object_id( get_option( 'yith_wcwl_wishlist_page_id' ) );
37
-
38
- if( ! $wishlist_page_id ){
39
- return false;
40
- }
41
-
42
- return apply_filters( 'yith_wcwl_is_wishlist_page', is_page( $wishlist_page_id ) );
43
- }
44
  }
45
 
46
  if( !function_exists( 'yith_wcwl_locate_template' ) ) {
47
- /**
48
- * Locate the templates and return the path of the file found
49
- *
50
- * @param string $path
51
- * @param array $var
52
- * @return string
53
- * @since 1.0.0
54
- */
55
- function yith_wcwl_locate_template( $path, $var = NULL ){
56
- $woocommerce_base = WC()->template_path();
57
-
58
- $template_woocommerce_path = $woocommerce_base . $path;
59
- $template_path = '/' . $path;
60
- $plugin_path = YITH_WCWL_DIR . 'templates/' . $path;
61
-
62
- $located = locate_template( array(
63
- $template_woocommerce_path, // Search in <theme>/woocommerce/
64
- $template_path, // Search in <theme>/
65
- ) );
66
-
67
- if( ! $located && file_exists( $plugin_path ) ){
68
- return apply_filters( 'yith_wcwl_locate_template', $plugin_path, $path );
69
- }
70
-
71
- return apply_filters( 'yith_wcwl_locate_template', $located, $path );
72
- }
73
  }
74
 
75
  if( !function_exists( 'yith_wcwl_get_template' ) ) {
76
- /**
77
- * Retrieve a template file.
78
- *
79
- * @param string $path
80
- * @param mixed $var
81
- * @param bool $return
82
- * @return string|void
83
- * @since 1.0.0
84
- */
85
- function yith_wcwl_get_template( $path, $var = null, $return = false ) {
86
- $located = yith_wcwl_locate_template( $path, $var );
87
-
88
- if ( $var && is_array( $var ) ) {
89
- $atts = $var;
90
- extract( $var );
91
- }
92
-
93
- if( $return ) {
94
- ob_start();
95
- }
96
-
97
- // include file located
98
- include( $located );
99
-
100
- if( $return ) {
101
- return ob_get_clean();
102
- }
103
- }
104
  }
105
 
106
  if( !function_exists( 'yith_wcwl_get_template_part' ) ) {
@@ -145,43 +145,43 @@ if( !function_exists( 'yith_wcwl_get_template_part' ) ) {
145
  }
146
 
147
  if( !function_exists( 'yith_wcwl_count_products' ) ) {
148
- /**
149
- * Retrieve the number of products in the wishlist.
150
- *
151
- * @param $wishlist_token string|bool Optional wishlist token
152
- *
153
- * @return int
154
- * @since 1.0.0
155
- */
156
- function yith_wcwl_count_products( $wishlist_token = false ) {
157
- return YITH_WCWL()->count_products( $wishlist_token );
158
- }
159
  }
160
 
161
  if( !function_exists( 'yith_wcwl_count_all_products' ) ) {
162
- /**
163
- * Retrieve the number of products in all the wishlists.
164
- *
165
- * @return int
166
- * @since 2.0.13
167
- */
168
- function yith_wcwl_count_all_products() {
169
- return YITH_WCWL()->count_all_products();
170
- }
171
  }
172
 
173
  if( !function_exists( 'yith_wcwl_count_add_to_wishlist' ) ){
174
- /**
175
- * Count number of times a product was added to users wishlists
176
- *
177
- * @param $product_id int|bool Product id
178
- *
179
- * @return int Number of times the product was added to wishlists
180
- * @since 2.0.13
181
- */
182
- function yith_wcwl_count_add_to_wishlist( $product_id = false ){
183
- return YITH_WCWL()->count_add_to_wishlist( $product_id );
184
- }
185
  }
186
 
187
  if( !function_exists( 'yith_wcwl_get_count_text' ) ){
@@ -220,35 +220,35 @@ if( !function_exists( 'yith_wcwl_get_count_text' ) ){
220
  }
221
 
222
  if( !function_exists( 'yith_frontend_css_color_picker' ) ) {
223
- /**
224
- * Output a colour picker input box.
225
- *
226
- * This function is not of the plugin YITH WCWL. It is from WooCommerce.
227
- * We redeclare it only because it is needed in the tab "Styles" where it is not available.
228
- * The original function name is woocommerce_frontend_css_colorpicker and it is declared in
229
- * wp-content/plugins/woocommerce/admin/settings/settings-frontend-styles.php
230
- *
231
- * @access public
232
- * @deprecated
233
- * @param mixed $name
234
- * @param mixed $id
235
- * @param mixed $value
236
- * @param string $desc (default: '')
237
- * @return void
238
- */
239
- function yith_frontend_css_color_picker( $name, $id, $value, $desc = '' ) {
240
- _deprecated_function( 'yith_frontend_css_color_picker', '3.0.0' );
241
-
242
- $value = ! empty( $value ) ? $value : '#ffffff';
243
-
244
- echo '<div class="color_box">
245
- <table><tr><td>
246
- <strong>' . $name . '</strong>
247
- <input name="' . esc_attr( $id ). '" id="' . $id . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick colorpickpreview" style="background-color: ' . $value . '" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
248
- </td></tr></table>
249
- </div>';
250
-
251
- }
252
  }
253
 
254
  if( !function_exists( 'yith_wcwl_get_cookie_expiration' ) ){
@@ -258,125 +258,125 @@ if( !function_exists( 'yith_wcwl_get_cookie_expiration' ) ){
258
  }
259
 
260
  if( !function_exists( 'yith_setcookie' ) ) {
261
- /**
262
- * Create a cookie.
263
- *
264
- * @param string $name
265
- * @param mixed $value
266
- * @param int $time
267
- * @param bool $secure
268
- * @param bool $httponly
269
- * @return bool
270
- * @since 1.0.0
271
- */
272
- function yith_setcookie( $name, $value = array(), $time = null, $secure = false, $httponly = false ) {
273
- if( ! apply_filters( 'yith_wcwl_set_cookie', true ) || empty( $name ) ){
274
- return false;
275
- }
276
-
277
- $time = $time != null ? $time : time() + yith_wcwl_get_cookie_expiration();
278
-
279
- $value = json_encode( stripslashes_deep( $value ) );
280
- $expiration = apply_filters( 'yith_wcwl_cookie_expiration_time', $time ); // Default 30 days
281
-
282
- $_COOKIE[ $name ] = $value;
283
- wc_setcookie( $name, $value, $expiration, $secure, $httponly );
284
-
285
- return true;
286
- }
287
  }
288
 
289
  if( !function_exists( 'yith_getcookie' ) ) {
290
- /**
291
- * Retrieve the value of a cookie.
292
- *
293
- * @param string $name
294
- * @return mixed
295
- * @since 1.0.0
296
- */
297
- function yith_getcookie( $name ) {
298
- if( isset( $_COOKIE[$name] ) ) {
299
- return json_decode( stripslashes( $_COOKIE[$name] ), true );
300
- }
301
-
302
- return array();
303
- }
304
  }
305
 
306
  if( !function_exists ( 'yith_destroycookie' ) ) {
307
- /**
308
- * Destroy a cookie.
309
- *
310
- * @param string $name
311
- * @return void
312
- * @since 1.0.0
313
- */
314
- function yith_destroycookie( $name ) {
315
- yith_setcookie( $name, array(), time() - 3600 );
316
- }
317
- }
318
 
319
- if( !function_exists( 'yith_wcwl_object_id' ) ){
320
- /**
321
- * Retrieve translated page id, if wpml is installed
322
- *
323
- * @param $id int Original page id
324
- * @return int Translation id
325
- * @since 1.0.0
326
- */
327
- function yith_wcwl_object_id( $id ){
328
- if( function_exists( 'wpml_object_id_filter' ) ){
329
- return wpml_object_id_filter( $id, 'page', true );
330
- }
331
- elseif( function_exists( 'icl_object_id' ) ){
332
- return icl_object_id( $id, 'page', true );
333
- }
334
- else{
335
- return $id;
336
- }
337
- }
338
  }
339
 
340
  if( !function_exists( 'yith_wcwl_get_hidden_products' ) ){
341
- /**
342
- * Retrieves a list of hidden products, whatever WC version is running
343
- *
344
- * WC switched from meta _visibility to product_visibility taxonomy since version 3.0.0,
345
- * forcing a split handling (Thank you, WC!)
346
- *
347
- * @return array List of hidden product ids
348
- * @since 2.1.1
349
- */
350
- function yith_wcwl_get_hidden_products(){
351
- if( version_compare( WC()->version, '3.0.0', '<' ) ){
352
- $hidden_products = get_posts( array(
353
- 'post_type' => 'product',
354
- 'post_status' => 'publish',
355
- 'posts_per_page' => -1,
356
- 'fields' => 'ids',
357
- 'meta_query' => array(
358
- array(
359
- 'key' => '_visibility',
360
- 'value' => 'visible'
361
- )
362
- )
363
- ) );
364
- }
365
- else{
366
- $hidden_products = wc_get_products( array(
367
- 'limit' => -1,
368
- 'status' => 'publish',
369
- 'return' => 'ids',
370
- 'visibility' => 'hidden'
371
- ) );
372
- }
373
-
374
- /**
375
- * array_filter was added to prevent errors when previous query returns for some reason just 0 index
376
- * @since 2.2.6
377
- */
378
- return apply_filters( 'yith_wcwl_hidden_products', array_filter( $hidden_products ) );
379
- }
380
  }
381
 
382
  if( !function_exists( 'yith_wcwl_get_wishlist' ) ){
@@ -542,8 +542,8 @@ if( !function_exists( 'yith_wcwl_get_privacy_label' ) ){
542
 
543
  if( $extended ){
544
  $privacy_text = '<b>' . $privacy_text . '</b> - ';
545
- $privacy_text .= __( 'Anyone can search for and see this list', 'yith-woocommerce-wishlist' );
546
- }
547
 
548
  break;
549
  }
@@ -552,6 +552,32 @@ if( !function_exists( 'yith_wcwl_get_privacy_label' ) ){
552
  }
553
  }
554
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  if( !function_exists( 'yith_wcwl_get_current_url' ) ){
556
  /**
557
  * Retrieves current url
12
  } // Exit if accessed directly
13
 
14
  if( !function_exists( 'yith_wcwl_is_wishlist' ) ){
15
+ /**
16
+ * Check if we're printing wishlist shortcode
17
+ *
18
+ * @return bool
19
+ * @since 2.0.0
20
+ */
21
+ function yith_wcwl_is_wishlist(){
22
+ global $yith_wcwl_is_wishlist;
23
+
24
+ return $yith_wcwl_is_wishlist;
25
+ }
26
  }
27
 
28
  if( !function_exists( 'yith_wcwl_is_wishlist_page' ) ){
29
+ /**
30
+ * Check if current page is wishlist
31
+ *
32
+ * @return bool
33
+ * @since 2.0.13
34
+ */
35
+ function yith_wcwl_is_wishlist_page(){
36
+ $wishlist_page_id = yith_wcwl_object_id( get_option( 'yith_wcwl_wishlist_page_id' ) );
37
+
38
+ if( ! $wishlist_page_id ){
39
+ return false;
40
+ }
41
+
42
+ return apply_filters( 'yith_wcwl_is_wishlist_page', is_page( $wishlist_page_id ) );
43
+ }
44
  }
45
 
46
  if( !function_exists( 'yith_wcwl_locate_template' ) ) {
47
+ /**
48
+ * Locate the templates and return the path of the file found
49
+ *
50
+ * @param string $path
51
+ * @param array $var
52
+ * @return string
53
+ * @since 1.0.0
54
+ */
55
+ function yith_wcwl_locate_template( $path, $var = NULL ){
56
+ $woocommerce_base = WC()->template_path();
57
+
58
+ $template_woocommerce_path = $woocommerce_base . $path;
59
+ $template_path = '/' . $path;
60
+ $plugin_path = YITH_WCWL_DIR . 'templates/' . $path;
61
+
62
+ $located = locate_template( array(
63
+ $template_woocommerce_path, // Search in <theme>/woocommerce/
64
+ $template_path, // Search in <theme>/
65
+ ) );
66
+
67
+ if( ! $located && file_exists( $plugin_path ) ){
68
+ return apply_filters( 'yith_wcwl_locate_template', $plugin_path, $path );
69
+ }
70
+
71
+ return apply_filters( 'yith_wcwl_locate_template', $located, $path );
72
+ }
73
  }
74
 
75
  if( !function_exists( 'yith_wcwl_get_template' ) ) {
76
+ /**
77
+ * Retrieve a template file.
78
+ *
79
+ * @param string $path
80
+ * @param mixed $var
81
+ * @param bool $return
82
+ * @return string|void
83
+ * @since 1.0.0
84
+ */
85
+ function yith_wcwl_get_template( $path, $var = null, $return = false ) {
86
+ $located = yith_wcwl_locate_template( $path, $var );
87
+
88
+ if ( $var && is_array( $var ) ) {
89
+ $atts = $var;
90
+ extract( $var );
91
+ }
92
+
93
+ if( $return ) {
94
+ ob_start();
95
+ }
96
+
97
+ // include file located
98
+ include( $located );
99
+
100
+ if( $return ) {
101
+ return ob_get_clean();
102
+ }
103
+ }
104
  }
105
 
106
  if( !function_exists( 'yith_wcwl_get_template_part' ) ) {
145
  }
146
 
147
  if( !function_exists( 'yith_wcwl_count_products' ) ) {
148
+ /**
149
+ * Retrieve the number of products in the wishlist.
150
+ *
151
+ * @param $wishlist_token string|bool Optional wishlist token
152
+ *
153
+ * @return int
154
+ * @since 1.0.0
155
+ */
156
+ function yith_wcwl_count_products( $wishlist_token = false ) {
157
+ return YITH_WCWL()->count_products( $wishlist_token );
158
+ }
159
  }
160
 
161
  if( !function_exists( 'yith_wcwl_count_all_products' ) ) {
162
+ /**
163
+ * Retrieve the number of products in all the wishlists.
164
+ *
165
+ * @return int
166
+ * @since 2.0.13
167
+ */
168
+ function yith_wcwl_count_all_products() {
169
+ return YITH_WCWL()->count_all_products();
170
+ }
171
  }
172
 
173
  if( !function_exists( 'yith_wcwl_count_add_to_wishlist' ) ){
174
+ /**
175
+ * Count number of times a product was added to users wishlists
176
+ *
177
+ * @param $product_id int|bool Product id
178
+ *
179
+ * @return int Number of times the product was added to wishlists
180
+ * @since 2.0.13
181
+ */
182
+ function yith_wcwl_count_add_to_wishlist( $product_id = false ){
183
+ return YITH_WCWL()->count_add_to_wishlist( $product_id );
184
+ }
185
  }
186
 
187
  if( !function_exists( 'yith_wcwl_get_count_text' ) ){
220
  }
221
 
222
  if( !function_exists( 'yith_frontend_css_color_picker' ) ) {
223
+ /**
224
+ * Output a colour picker input box.
225
+ *
226
+ * This function is not of the plugin YITH WCWL. It is from WooCommerce.
227
+ * We redeclare it only because it is needed in the tab "Styles" where it is not available.
228
+ * The original function name is woocommerce_frontend_css_colorpicker and it is declared in
229
+ * wp-content/plugins/woocommerce/admin/settings/settings-frontend-styles.php
230
+ *
231
+ * @access public
232
+ * @deprecated
233
+ * @param mixed $name
234
+ * @param mixed $id
235
+ * @param mixed $value
236
+ * @param string $desc (default: '')
237
+ * @return void
238
+ */
239
+ function yith_frontend_css_color_picker( $name, $id, $value, $desc = '' ) {
240
+ _deprecated_function( 'yith_frontend_css_color_picker', '3.0.0' );
241
+
242
+ $value = ! empty( $value ) ? $value : '#ffffff';
243
+
244
+ echo '<div class="color_box">
245
+ <table><tr><td>
246
+ <strong>' . $name . '</strong>
247
+ <input name="' . esc_attr( $id ). '" id="' . $id . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick colorpickpreview" style="background-color: ' . $value . '" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div>
248
+ </td></tr></table>
249
+ </div>';
250
+
251
+ }
252
  }
253
 
254
  if( !function_exists( 'yith_wcwl_get_cookie_expiration' ) ){
258
  }
259
 
260
  if( !function_exists( 'yith_setcookie' ) ) {
261
+ /**
262
+ * Create a cookie.
263
+ *
264
+ * @param string $name
265
+ * @param mixed $value
266
+ * @param int $time
267
+ * @param bool $secure
268
+ * @param bool $httponly
269
+ * @return bool
270
+ * @since 1.0.0
271
+ */
272
+ function yith_setcookie( $name, $value = array(), $time = null, $secure = false, $httponly = false ) {
273
+ if( ! apply_filters( 'yith_wcwl_set_cookie', true ) || empty( $name ) ){
274
+ return false;
275
+ }
276
+
277
+ $time = $time != null ? $time : time() + yith_wcwl_get_cookie_expiration();
278
+
279
+ $value = json_encode( stripslashes_deep( $value ) );
280
+ $expiration = apply_filters( 'yith_wcwl_cookie_expiration_time', $time ); // Default 30 days
281
+
282
+ $_COOKIE[ $name ] = $value;
283
+ wc_setcookie( $name, $value, $expiration, $secure, $httponly );
284
+
285
+ return true;
286
+ }
287
  }
288
 
289
  if( !function_exists( 'yith_getcookie' ) ) {
290
+ /**
291
+ * Retrieve the value of a cookie.
292
+ *
293
+ * @param string $name
294
+ * @return mixed
295
+ * @since 1.0.0
296
+ */
297
+ function yith_getcookie( $name ) {
298
+ if( isset( $_COOKIE[$name] ) ) {
299
+ return json_decode( stripslashes( $_COOKIE[$name] ), true );
300
+ }
301
+
302
+ return array();
303
+ }
304
  }
305
 
306
  if( !function_exists ( 'yith_destroycookie' ) ) {
307
+ /**
308
+ * Destroy a cookie.
309
+ *
310
+ * @param string $name
311
+ * @return void
312
+ * @since 1.0.0
313
+ */
314
+ function yith_destroycookie( $name ) {
315
+ yith_setcookie( $name, array(), time() - 3600 );
316
+ }
317
+ }
318
 
319
+ if( !function_exists( 'yith_wcwl_object_id' ) ){
320
+ /**
321
+ * Retrieve translated page id, if wpml is installed
322
+ *
323
+ * @param $id int Original page id
324
+ * @return int Translation id
325
+ * @since 1.0.0
326
+ */
327
+ function yith_wcwl_object_id( $id ){
328
+ if( function_exists( 'wpml_object_id_filter' ) ){
329
+ return wpml_object_id_filter( $id, 'page', true );
330
+ }
331
+ elseif( function_exists( 'icl_object_id' ) ){
332
+ return icl_object_id( $id, 'page', true );
333
+ }
334
+ else{
335
+ return $id;
336
+ }
337
+ }
338
  }
339
 
340
  if( !function_exists( 'yith_wcwl_get_hidden_products' ) ){
341
+ /**
342
+ * Retrieves a list of hidden products, whatever WC version is running
343
+ *
344
+ * WC switched from meta _visibility to product_visibility taxonomy since version 3.0.0,
345
+ * forcing a split handling (Thank you, WC!)
346
+ *
347
+ * @return array List of hidden product ids
348
+ * @since 2.1.1
349
+ */
350
+ function yith_wcwl_get_hidden_products(){
351
+ if( version_compare( WC()->version, '3.0.0', '<' ) ){
352
+ $hidden_products = get_posts( array(
353
+ 'post_type' => 'product',
354
+ 'post_status' => 'publish',
355
+ 'posts_per_page' => -1,
356
+ 'fields' => 'ids',
357
+ 'meta_query' => array(
358
+ array(
359
+ 'key' => '_visibility',
360
+ 'value' => 'visible'
361
+ )
362
+ )
363
+ ) );
364
+ }
365
+ else{
366
+ $hidden_products = wc_get_products( array(
367
+ 'limit' => -1,
368
+ 'status' => 'publish',
369
+ 'return' => 'ids',
370
+ 'visibility' => 'hidden'
371
+ ) );
372
+ }
373
+
374
+ /**
375
+ * array_filter was added to prevent errors when previous query returns for some reason just 0 index
376
+ * @since 2.2.6
377
+ */
378
+ return apply_filters( 'yith_wcwl_hidden_products', array_filter( $hidden_products ) );
379
+ }
380
  }
381
 
382
  if( !function_exists( 'yith_wcwl_get_wishlist' ) ){
542
 
543
  if( $extended ){
544
  $privacy_text = '<b>' . $privacy_text . '</b> - ';
545
+ $privacy_text .= __( 'Anyone can search for and see this list', 'yith-woocommerce-wishlist' );
546
+ }
547
 
548
  break;
549
  }
552
  }
553
  }
554
 
555
+ if( !function_exists( 'yith_wcwl_get_privacy_value' ) ){
556
+ /**
557
+ * Returns privacy numeric value
558
+ *
559
+ * @param $privacy_label string Privacy label
560
+ * @return int Privacy value
561
+ * @since 3.0.0
562
+ */
563
+ function yith_wcwl_get_privacy_value( $privacy_label ) {
564
+
565
+ switch ( $privacy_label ) {
566
+ case 'shared':
567
+ $privacy_value = 1;
568
+ break;
569
+ case 'private':
570
+ $privacy_value = 2;
571
+ break;
572
+ default:
573
+ $privacy_value = 0;
574
+ break;
575
+ }
576
+
577
+ return $privacy_value;
578
+ }
579
+ }
580
+
581
  if( !function_exists( 'yith_wcwl_get_current_url' ) ){
582
  /**
583
  * Retrieves current url
includes/widgets/elementor/class.yith-wcwl-elementor-add-to-wishlist.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add to Wishlist widget for Elementor
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Wishlist
7
+ * @version 3.0.7
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCWL' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if( ! class_exists( 'YITH_WCWL_Elementor_Add_to_Wishlist' ) ) {
15
+ class YITH_WCWL_Elementor_Add_to_Wishlist extends \Elementor\Widget_Base {
16
+
17
+ /**
18
+ * Get widget name.
19
+ *
20
+ * Retrieve YITH_WCWL_Elementor_Add_to_Wishlist widget name.
21
+ *
22
+ * @return string Widget name.
23
+ * @since 1.0.0
24
+ * @access public
25
+ */
26
+ public function get_name() {
27
+ return 'yith_wcwl_add_to_wishlist';
28
+ }
29
+
30
+ /**
31
+ * Get widget title.
32
+ *
33
+ * Retrieve YITH_WCWL_Elementor_Add_to_Wishlist widget title.
34
+ *
35
+ * @return string Widget title.
36
+ * @since 1.0.0
37
+ * @access public
38
+ */
39
+ public function get_title() {
40
+ return _x( 'YITH Wishlist Add button', 'Elementor widget name', 'yith-woocommerce-wishlist' );
41
+ }
42
+
43
+ /**
44
+ * Get widget icon.
45
+ *
46
+ * Retrieve YITH_WCWL_Elementor_Add_to_Wishlist widget icon.
47
+ *
48
+ * @return string Widget icon.
49
+ * @since 1.0.0
50
+ * @access public
51
+ */
52
+ public function get_icon() {
53
+ return 'eicon-button';
54
+ }
55
+
56
+ /**
57
+ * Get widget categories.
58
+ *
59
+ * Retrieve the list of categories the YITH_WCWL_Elementor_Add_to_Wishlist widget belongs to.
60
+ *
61
+ * @return array Widget categories.
62
+ * @since 1.0.0
63
+ * @access public
64
+ *
65
+ */
66
+ public function get_categories() {
67
+ return [ 'general', 'yith' ];
68
+ }
69
+
70
+ /**
71
+ * Register YITH_WCWL_Elementor_Add_to_Wishlist widget controls.
72
+ *
73
+ * Adds different input fields to allow the user to change and customize the widget settings.
74
+ *
75
+ * @since 1.0.0
76
+ * @access protected
77
+ */
78
+ protected function _register_controls() {
79
+
80
+ $this->start_controls_section(
81
+ 'product_section',
82
+ [
83
+ 'label' => _x( 'Product', 'Elementor section title', 'yith-woocommerce-wishlist' ),
84
+ 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
85
+ ]
86
+ );
87
+
88
+ $this->add_control(
89
+ 'product_id',
90
+ [
91
+ 'label' => _x( 'Product ID', 'Elementor control label', 'yith-woocommerce-wishlist' ),
92
+ 'type' => \Elementor\Controls_Manager::NUMBER,
93
+ 'input_type' => 'text',
94
+ 'placeholder' => '123',
95
+ ]
96
+ );
97
+
98
+ $this->end_controls_section();
99
+
100
+ $this->start_controls_section(
101
+ 'labels_section',
102
+ [
103
+ 'label' => _x( 'Labels', 'Elementor section title', 'yith-woocommerce-wishlist' ),
104
+ 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
105
+ ]
106
+ );
107
+
108
+ $this->add_control(
109
+ 'label',
110
+ [
111
+ 'label' => _x( 'Button label', 'Elementor control label', 'yith-woocommerce-wishlist' ),
112
+ 'type' => \Elementor\Controls_Manager::TEXT,
113
+ 'input_type' => 'text',
114
+ 'placeholder' => __( 'Add to wishlist', 'yith-woocommerce-wishlist' ),
115
+ ]
116
+ );
117
+
118
+ $this->add_control(
119
+ 'browse_wishlist_text',
120
+ [
121
+ 'label' => _x( '"Browse wishlist" label', 'Elementor control label', 'yith-woocommerce-wishlist' ),
122
+ 'type' => \Elementor\Controls_Manager::TEXT,
123
+ 'input_type' => 'text',
124
+ 'placeholder' => __( 'Browse wishlist', 'yith-woocommerce-wishlist' ),
125
+ ]
126
+ );
127
+
128
+ $this->add_control(
129
+ 'already_in_wishslist_text',
130
+ [
131
+ 'label' => _x( '"Product already in wishlist" label', 'Elementor control label', 'yith-woocommerce-wishlist' ),
132
+ 'type' => \Elementor\Controls_Manager::TEXT,
133
+ 'input_type' => 'text',
134
+ 'placeholder' => __( 'Product already in wishlist', 'yith-woocommerce-wishlist' ),
135
+ ]
136
+ );
137
+
138
+ $this->add_control(
139
+ 'product_added_text',
140
+ [
141
+ 'label' => _x( '"Product added to wishlist" label', 'Elementor control label', 'yith-woocommerce-wishlist' ),
142
+ 'type' => \Elementor\Controls_Manager::TEXT,
143
+ 'input_type' => 'text',
144
+ 'placeholder' => __( 'Product added to wishlist', 'yith-woocommerce-wishlist' ),
145
+ ]
146
+ );
147
+
148
+ $this->end_controls_section();
149
+
150
+ $this->start_controls_section(
151
+ 'advanced_section',
152
+ [
153
+ 'label' => _x( 'Advanced', 'Elementor section title', 'yith-woocommerce-wishlist' ),
154
+ 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
155
+ ]
156
+ );
157
+
158
+ $this->add_control(
159
+ 'wishlist_url',
160
+ [
161
+ 'label' => _x( 'URL of the wishlist page', 'Elementor control label', 'yith-woocommerce-wishlist' ),
162
+ 'type' => \Elementor\Controls_Manager::TEXT,
163
+ 'input_type' => 'url',
164
+ 'placeholder' => '',
165
+ ]
166
+ );
167
+
168
+ $this->add_control(
169
+ 'icon',
170
+ [
171
+ 'label' => _x( 'Icon for the button', 'Elementor control label', 'yith-woocommerce-wishlist' ),
172
+ 'type' => \Elementor\Controls_Manager::TEXT,
173
+ 'input_type' => 'text',
174
+ 'placeholder' => '',
175
+ ]
176
+ );
177
+
178
+ $this->add_control(
179
+ 'link_classes',
180
+ [
181
+ 'label' => _x( 'Additional CSS classes for the button', 'Elementor control label', 'yith-woocommerce-wishlist' ),
182
+ 'type' => \Elementor\Controls_Manager::TEXT,
183
+ 'input_type' => 'text',
184
+ 'placeholder' => '',
185
+ ]
186
+ );
187
+
188
+ $this->end_controls_section();
189
+
190
+ }
191
+
192
+ /**
193
+ * Render YITH_WCWL_Elementor_Add_to_Wishlist widget output on the frontend.
194
+ *
195
+ * @since 1.0.0
196
+ * @access protected
197
+ */
198
+ protected function render() {
199
+
200
+ $attribute_string = '';
201
+ $settings = $this->get_settings_for_display();
202
+
203
+ foreach ( $settings as $key => $value ) {
204
+ if ( empty( $value ) || ! is_scalar( $value ) ) {
205
+ continue;
206
+ }
207
+ $attribute_string .= " {$key}=\"{$value}\"";
208
+ }
209
+
210
+ echo do_shortcode( "[yith_wcwl_add_to_wishlist {$attribute_string}]" );
211
+ }
212
+
213
+ }
214
+ }
includes/widgets/elementor/class.yith-wcwl-elementor-wishlist.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Wishlist widget for Elementor
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Wishlist
7
+ * @version 3.0.7
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCWL' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if( ! class_exists( 'YITH_WCWL_Elementor_Wishlist' ) ) {
15
+ class YITH_WCWL_Elementor_Wishlist extends \Elementor\Widget_Base {
16
+
17
+ /**
18
+ * Get widget name.
19
+ *
20
+ * Retrieve YITH_WCWL_Elementor_Wishlist widget name.
21
+ *
22
+ * @return string Widget name.
23
+ * @since 1.0.0
24
+ * @access public
25
+ */
26
+ public function get_name() {
27
+ return 'yith_wcwl_wishlist';
28
+ }
29
+
30
+ /**
31
+ * Get widget title.
32
+ *
33
+ * Retrieve YITH_WCWL_Elementor_Wishlist widget title.
34
+ *
35
+ * @return string Widget title.
36
+ * @since 1.0.0
37
+ * @access public
38
+ */
39
+ public function get_title() {
40
+ return _x( 'YITH Wishlist', 'Elementor widget name', 'yith-woocommerce-wishlist' );
41
+ }
42
+
43
+ /**
44
+ * Get widget icon.
45
+ *
46
+ * Retrieve YITH_WCWL_Elementor_Wishlist widget icon.
47
+ *
48
+ * @return string Widget icon.
49
+ * @since 1.0.0
50
+ * @access public
51
+ */
52
+ public function get_icon() {
53
+ return 'eicon-table';
54
+ }
55
+
56
+ /**
57
+ * Get widget categories.
58
+ *
59
+ * Retrieve the list of categories the YITH_WCWL_Elementor_Wishlist widget belongs to.
60
+ *
61
+ * @return array Widget categories.
62
+ * @since 1.0.0
63
+ * @access public
64
+ */
65
+ public function get_categories() {
66
+ return [ 'general', 'yith' ];
67
+ }
68
+
69
+ /**
70
+ * Register YITH_WCWL_Elementor_Wishlist widget controls.
71
+ *
72
+ * Adds different input fields to allow the user to change and customize the widget settings.
73
+ *
74
+ * @since 1.0.0
75
+ * @access protected
76
+ */
77
+ protected function _register_controls() {
78
+
79
+ $this->start_controls_section(
80
+ 'product_section',
81
+ [
82
+ 'label' => _x( 'Wishlist', 'Elementor section title', 'yith-woocommerce-wishlist' ),
83
+ 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
84
+ ]
85
+ );
86
+
87
+ $this->add_control(
88
+ 'wishlist_id',
89
+ [
90
+ 'label' => _x( 'Wishlist ID', 'Elementor control label', 'yith-woocommerce-wishlist' ),
91
+ 'type' => \Elementor\Controls_Manager::TEXT,
92
+ 'input_type' => 'text',
93
+ 'placeholder' => 'K6EOWXB888ZD',
94
+ ]
95
+ );
96
+
97
+ $this->end_controls_section();
98
+
99
+ $this->start_controls_section(
100
+ 'labels_section',
101
+ [
102
+ 'label' => _x( 'Pagination', 'Elementor section title', 'yith-woocommerce-wishlist' ),
103
+ 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
104
+ ]
105
+ );
106
+
107
+ $this->add_control(
108
+ 'pagination',
109
+ [
110
+ 'label' => _x( 'Paginate items', 'Elementor control label', 'yith-woocommerce-wishlist' ),
111
+ 'type' => \Elementor\Controls_Manager::SELECT,
112
+ 'options' => [
113
+ 'yes' => __( 'Paginate', 'yith-woocommerce-wishlist' ),
114
+ 'no' => __( 'Do not paginate', 'yith-woocommerce-wishlist' ),
115
+ ],
116
+ 'default' => 'no',
117
+ ]
118
+ );
119
+
120
+ $this->add_control(
121
+ 'per_page',
122
+ [
123
+ 'label' => _x( 'Items per page', 'yith-woocommerce-wishlist' ),
124
+ 'type' => \Elementor\Controls_Manager::NUMBER,
125
+ 'input_type' => 'number',
126
+ 'placeholder' => 5,
127
+ ]
128
+ );
129
+
130
+ $this->end_controls_section();
131
+
132
+ }
133
+
134
+ /**
135
+ * Render YITH_WCWL_Elementor_Wishlist widget output on the frontend.
136
+ *
137
+ * @since 1.0.0
138
+ * @access protected
139
+ */
140
+ protected function render() {
141
+
142
+ $attribute_string = '';
143
+ $settings = $this->get_settings_for_display();
144
+
145
+ foreach ( $settings as $key => $value ) {
146
+ if ( empty( $value ) || ! is_scalar( $value ) ) {
147
+ continue;
148
+ }
149
+ $attribute_string .= " {$key}=\"{$value}\"";
150
+ }
151
+
152
+ echo do_shortcode( "[yith_wcwl_wishlist {$attribute_string}]" );
153
+ }
154
+
155
+ }
156
+ }
init.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: YITH WooCommerce Wishlist
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-wishlist/
5
  * Description: <code><strong>YITH WooCommerce Wishlist</strong></code> gives your users the possibility to create, fill, manage and share their wishlists allowing you to analyze their interests and needs to improve your marketing strategies. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce on <strong>YITH</strong></a>
6
- * Version: 3.0.6
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-wishlist
10
  * Domain Path: /languages/
11
  * WC requires at least: 2.5.0
12
- * WC tested up to: 3.9.0
13
  *
14
  * @author YITHEMES
15
  * @package YITH WooCommerce Wishlist
@@ -33,32 +33,32 @@
33
  */
34
 
35
  if ( ! defined( 'ABSPATH' ) ) {
36
- exit;
37
  } // Exit if accessed directly
38
 
39
  if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
40
- require_once 'plugin-fw/yit-plugin-registration-hook.php';
41
  }
42
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
43
 
44
  if ( ! defined( 'YITH_WCWL' ) ) {
45
- define( 'YITH_WCWL', true );
46
  }
47
 
48
  if ( ! defined( 'YITH_WCWL_URL' ) ) {
49
- define( 'YITH_WCWL_URL', plugin_dir_url( __FILE__ ) );
50
  }
51
 
52
  if ( ! defined( 'YITH_WCWL_DIR' ) ) {
53
- define( 'YITH_WCWL_DIR', plugin_dir_path( __FILE__ ) );
54
  }
55
 
56
  if ( ! defined( 'YITH_WCWL_INC' ) ) {
57
- define( 'YITH_WCWL_INC', YITH_WCWL_DIR . 'includes/' );
58
  }
59
 
60
  if ( ! defined( 'YITH_WCWL_INIT' ) ) {
61
- define( 'YITH_WCWL_INIT', plugin_basename( __FILE__ ) );
62
  }
63
 
64
  if ( ! defined( 'YITH_WCWL_FREE_INIT' ) ) {
@@ -71,14 +71,14 @@ if ( ! defined( 'YITH_WCWL_SLUG' ) ) {
71
 
72
  /* Plugin Framework Version Check */
73
  if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WCWL_DIR . 'plugin-fw/init.php' ) ) {
74
- require_once( YITH_WCWL_DIR . 'plugin-fw/init.php' );
75
  }
76
  yit_maybe_plugin_fw_loader( YITH_WCWL_DIR );
77
 
78
  if( ! function_exists( 'yith_wishlist_constructor' ) ) {
79
- function yith_wishlist_constructor() {
80
 
81
- load_plugin_textdomain( 'yith-woocommerce-wishlist', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
82
 
83
  // Load required classes and functions
84
  require_once( YITH_WCWL_INC . 'data-stores/class.yith-wcwl-wishlist-data-store.php' );
3
  * Plugin Name: YITH WooCommerce Wishlist
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-wishlist/
5
  * Description: <code><strong>YITH WooCommerce Wishlist</strong></code> gives your users the possibility to create, fill, manage and share their wishlists allowing you to analyze their interests and needs to improve your marketing strategies. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce on <strong>YITH</strong></a>
6
+ * Version: 3.0.7
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-wishlist
10
  * Domain Path: /languages/
11
  * WC requires at least: 2.5.0
12
+ * WC tested up to: 4.0.0
13
  *
14
  * @author YITHEMES
15
  * @package YITH WooCommerce Wishlist
33
  */
34
 
35
  if ( ! defined( 'ABSPATH' ) ) {
36
+ exit;
37
  } // Exit if accessed directly
38
 
39
  if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
40
+ require_once 'plugin-fw/yit-plugin-registration-hook.php';
41
  }
42
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
43
 
44
  if ( ! defined( 'YITH_WCWL' ) ) {
45
+ define( 'YITH_WCWL', true );
46
  }
47
 
48
  if ( ! defined( 'YITH_WCWL_URL' ) ) {
49
+ define( 'YITH_WCWL_URL', plugin_dir_url( __FILE__ ) );
50
  }
51
 
52
  if ( ! defined( 'YITH_WCWL_DIR' ) ) {
53
+ define( 'YITH_WCWL_DIR', plugin_dir_path( __FILE__ ) );
54
  }
55
 
56
  if ( ! defined( 'YITH_WCWL_INC' ) ) {
57
+ define( 'YITH_WCWL_INC', YITH_WCWL_DIR . 'includes/' );
58
  }
59
 
60
  if ( ! defined( 'YITH_WCWL_INIT' ) ) {
61
+ define( 'YITH_WCWL_INIT', plugin_basename( __FILE__ ) );
62
  }
63
 
64
  if ( ! defined( 'YITH_WCWL_FREE_INIT' ) ) {
71
 
72
  /* Plugin Framework Version Check */
73
  if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WCWL_DIR . 'plugin-fw/init.php' ) ) {
74
+ require_once( YITH_WCWL_DIR . 'plugin-fw/init.php' );
75
  }
76
  yit_maybe_plugin_fw_loader( YITH_WCWL_DIR );
77
 
78
  if( ! function_exists( 'yith_wishlist_constructor' ) ) {
79
+ function yith_wishlist_constructor() {
80
 
81
+ load_plugin_textdomain( 'yith-woocommerce-wishlist', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
82
 
83
  // Load required classes and functions
84
  require_once( YITH_WCWL_INC . 'data-stores/class.yith-wcwl-wishlist-data-store.php' );
plugin-fw/assets/js/yit-plugin-panel.js CHANGED
@@ -157,4 +157,13 @@ jQuery( function ( $ ) {
157
  // prevents the WC message for changes when leaving the panel page
158
  $( '.yith-plugin-fw-panel .woo-nav-tab-wrapper' ).removeClass( 'woo-nav-tab-wrapper' ).addClass( 'yith-nav-tab-wrapper' );
159
 
 
 
 
 
 
 
 
 
 
160
  } );
157
  // prevents the WC message for changes when leaving the panel page
158
  $( '.yith-plugin-fw-panel .woo-nav-tab-wrapper' ).removeClass( 'woo-nav-tab-wrapper' ).addClass( 'yith-nav-tab-wrapper' );
159
 
160
+ var wrap = $( '.wrap.yith-plugin-ui' ).first(),
161
+ notices = $( 'div.updated, div.error, div.notice' );
162
+
163
+ // prevent moving notices into the wrapper
164
+ notices.addClass( 'inline' );
165
+ if ( wrap.length ) {
166
+ wrap.prepend( notices );
167
+ }
168
+
169
  } );
plugin-fw/assets/js/yit-plugin-panel.min.js CHANGED
@@ -1 +1,8 @@
1
- jQuery(function(f){function s(a,e,t,i){var n=!0;if("string"==typeof e){":radio"==e.substr(0,6)&&(e+=":checked");var s=f(e).val();if("checkbox"==f(e).attr("type"))s=f(e).is(":checked")?"yes":"no";t=t.split(",");for(var r=0;r<t.length;r++){if(s==t[r]){n=!0;break}n=!1}}var o=f(a),d=f(a+"-container").closest("tr");d.length<1&&(d=o.closest(".yith-plugin-fw-panel-wc-row"));var c,l=i.split("-");for(c in l){var h=l[c];if(n)switch(h){case"disable":d.removeClass("yith-disabled"),o.attr("disabled",!1);break;case"hideme":o.show();break;default:d.show(),d.fadeTo("slow",1).addClass("fade-in")}else switch(h){case"disable":d.addClass("yith-disabled"),o.attr("disabled",!0);break;case"hideme":o.hide();break;default:d.hasClass("fade-in")?d.fadeTo("slow",0,function(){f(this).hide().removeClass("fade-in")}):(d.hide(),d.css({opacity:"0"}))}}}f("[data-dep-target]").each(function(){var a=f(this),e="#"+a.data("dep-target"),t="#"+a.data("dep-id"),i=a.data("dep-value"),n=a.data("dep-type");s(e,t,i.toString(),n),f(t).on("change",function(){s(e,t,i.toString(),n)}).change()}),f(".rm_connectedlist").each(function(){var i=f(this).find("ul"),n=f(this).find(":hidden");i.sortable({connectWith:i,update:function(a,e){var t={};i.each(function(){var a={};f(this).children().each(function(){a[f(this).data("option")]=f(this).text()}),t[f(this).data("list")]=a}),n.val(JSON.stringify(t).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()}),f(document).ready(function(){f(".google-analytic-generate").click(function(){var a=f("#"+f(this).data("textarea")).data("codemirrorInstance"),e="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";e+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n",e+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",e+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n",e+="ga('create', '"+f("#"+f(this).data("input")).val()+"', '"+f(this).data("basename")+"');\n",e+="ga('send', 'pageview');\n",a.replaceRange(e,a.getCursor("start"),a.getCursor("end"))})}),f(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper")});
 
 
 
 
 
 
 
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,c){a instanceof String&&(a=String(a));for(var d=a.length,b=0;b<d;b++){var f=a[b];if(e.call(c,f,b,a))return{i:b,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,c){a!=Array.prototype&&a!=Object.prototype&&(a[e]=c.value)};
2
+ $jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,c,d){if(e){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var b=a[d];b in c||(c[b]={});c=c[b]}a=a[a.length-1];d=c[a];e=e(d);e!=d&&null!=e&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:e})}};
3
+ $jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
4
+ jQuery(function(a){function e(b,f,g,c){var e=!0;if("string"==typeof f){":radio"==f.substr(0,6)&&(f+=":checked");var d=a(f).val();"checkbox"==a(f).attr("type")&&(d=a(f).is(":checked")?"yes":"no");g=g.split(",");for(f=0;f<g.length;f++)if(d!=g[f])e=!1;else{e=!0;break}}g=a(b);b=a(b+"-container").closest("tr");1>b.length&&(b=g.closest(".yith-plugin-fw-panel-wc-row"));c=c.split("-");for(var h in c)if(d=c[h],e)switch(d){case "disable":b.removeClass("yith-disabled");g.attr("disabled",!1);break;case "hideme":g.show();
5
+ break;default:b.show(),b.fadeTo("slow",1).addClass("fade-in")}else switch(d){case "disable":b.addClass("yith-disabled");g.attr("disabled",!0);break;case "hideme":g.hide();break;default:b.hasClass("fade-in")?b.fadeTo("slow",0,function(){a(this).hide().removeClass("fade-in")}):(b.hide(),b.css({opacity:"0"}))}}a("[data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),d="#"+b.data("dep-id"),h=b.data("dep-value"),k=b.data("dep-type");e(c,d,h.toString(),k);a(d).on("change",function(){e(c,
6
+ d,h.toString(),k)}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),
7
+ c=a("#"+a(this).data("input")).val(),d=a(this).data("basename");b.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n"+("ga('create', '"+c+"', '"+d+"');\n")+"ga('send', 'pageview');\n",b.getCursor("start"),b.getCursor("end"))})});
8
+ a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper");var c=a(".wrap.yith-plugin-ui").first(),d=a("div.updated, div.error, div.notice");d.addClass("inline");c.length&&c.prepend(d)});
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.4.10
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.4.10
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.4.13
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.4.13
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/languages/yith-plugin-fw-el.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-el.po CHANGED
@@ -5,7 +5,7 @@ msgstr ""
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
  "POT-Creation-Date: 2020-01-10 13:40+0100\n"
8
- "PO-Revision-Date: 2020-01-31 16:11+0000\n"
9
  "Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -340,31 +340,32 @@ msgstr "Το προστιθέμενο αρχείο δεν είναι έγκυρ
340
 
341
  #: lib/yit-plugin-panel.php:784
342
  msgid "Sorry, import is disabled."
343
- msgstr ""
344
 
345
  #: lib/yit-plugin-panel.php:785
346
  msgid "Sorting successful."
347
- msgstr ""
348
 
349
  #: lib/yit-plugin-panel.php:1233
350
  msgid "We need your support"
351
- msgstr ""
352
 
353
  #: lib/yit-plugin-panel.php:1234
354
  msgid "to keep updating and improving the plugin. Please,"
355
  msgstr ""
 
356
 
357
  #: lib/yit-plugin-panel.php:1236
358
  msgid "help us by leaving a five-star rating"
359
- msgstr ""
360
 
361
  #: lib/yit-plugin-panel.php:1237
362
  msgid ":) Thanks!"
363
- msgstr ""
364
 
365
  #: lib/yit-pointers.php:70
366
  msgid "Plugins Activated"
367
- msgstr ""
368
 
369
  #: lib/yit-pointers.php:71
370
  msgid ""
@@ -372,18 +373,22 @@ msgid ""
372
  " Plugin customization settings will be "
373
  "available as a new entry in YITH Plugins menu."
374
  msgstr ""
 
 
 
 
375
 
376
  #: lib/yit-pointers.php:73 lib/yit-pointers.php:89
377
  msgid "Discover all our plugins available on:"
378
- msgstr ""
379
 
380
  #: lib/yit-pointers.php:74 lib/yit-pointers.php:90
381
  msgid "and"
382
- msgstr ""
383
 
384
  #: lib/yit-pointers.php:84
385
  msgid "Plugins Upgraded"
386
- msgstr ""
387
 
388
  #: lib/yit-pointers.php:85
389
  msgid ""
@@ -397,112 +402,123 @@ msgid ""
397
  " will be moved from previous location to "
398
  "YITH Plugins tab."
399
  msgstr ""
 
 
 
 
 
 
 
 
 
400
 
401
  #: lib/yith-dashboard.php:40
402
  msgid "YITH Latest Updates"
403
- msgstr ""
404
 
405
  #: lib/yith-dashboard.php:41
406
  msgid "Latest news from YITH Blog"
407
- msgstr ""
408
 
409
  #: lib/yith-dashboard.php:65
410
  msgid "RSS Error:"
411
- msgstr ""
412
 
413
  #: lib/yith-dashboard.php:71
414
  msgid ""
415
  "An error has occurred, which probably means the feed is down. Try again "
416
  "later."
417
  msgstr ""
 
 
418
 
419
  #: lib/yith-dashboard.php:99
420
  msgctxt "Plugin FW"
421
  msgid "View Changelog"
422
- msgstr ""
423
 
424
  #: lib/yith-dashboard.php:100
425
  msgctxt "Plugin FW"
426
  msgid "Latest update released on"
427
- msgstr ""
428
 
429
  #: lib/yith-dashboard.php:143
430
  msgctxt "Button label"
431
  msgid "Close"
432
- msgstr ""
433
 
434
  #: lib/yith-gutenberg.php:134
435
  msgctxt "[gutenberg]: Category Name"
436
  msgid "YITH"
437
- msgstr ""
438
 
439
  #: lib/yith-system-status.php:97 lib/yith-system-status.php:98
440
  msgid "System Status"
441
- msgstr ""
442
 
443
  #: lib/yith-system-status.php:104
444
  msgid "WordPress Version"
445
- msgstr ""
446
 
447
  #: lib/yith-system-status.php:105
448
  msgid "WooCommerce Version"
449
- msgstr ""
450
 
451
  #: lib/yith-system-status.php:106
452
  msgid "Available Memory"
453
- msgstr ""
454
 
455
  #: lib/yith-system-status.php:107
456
  msgid "PHP Version"
457
- msgstr ""
458
 
459
  #: lib/yith-system-status.php:108
460
  msgid "TLS Version"
461
- msgstr ""
462
 
463
  #: lib/yith-system-status.php:109
464
  msgid "WordPress Cron"
465
- msgstr ""
466
 
467
  #: lib/yith-system-status.php:110
468
  msgid "SimpleXML"
469
- msgstr ""
470
 
471
  #: lib/yith-system-status.php:111
472
  msgid "MultiByte String"
473
- msgstr ""
474
 
475
  #: lib/yith-system-status.php:112
476
  msgid "ImageMagick Version"
477
- msgstr ""
478
 
479
  #: lib/yith-system-status.php:113
480
  msgid "GD Library"
481
- msgstr ""
482
 
483
  #: lib/yith-system-status.php:114
484
  msgid "Iconv Module"
485
- msgstr ""
486
 
487
  #: lib/yith-system-status.php:115
488
  msgid "OPCache Save Comments"
489
- msgstr ""
490
 
491
  #: lib/yith-system-status.php:116
492
  msgid "URL FOpen"
493
- msgstr ""
494
 
495
  #: lib/yith-system-status.php:173
496
  msgid "YITH Plugins"
497
- msgstr ""
498
 
499
  #: lib/yith-system-status.php:174
500
  msgid "WooCommerce"
501
- msgstr ""
502
 
503
  #: lib/yith-system-status.php:291
504
  msgid "Warning!"
505
- msgstr ""
506
 
507
  #: lib/yith-system-status.php:292
508
  #, php-format
@@ -510,183 +526,185 @@ msgid ""
510
  "The system check has detected some compatibility issues on your "
511
  "installation. %sClick here%s to know more"
512
  msgstr ""
 
 
513
 
514
  #: templates/fields/ajax-customers.php:57
515
  msgid "Search Customers"
516
- msgstr ""
517
 
518
  #: templates/fields/ajax-customers.php:83
519
  #: templates/fields/ajax-customers.php:93
520
  #, php-format
521
  msgid "%1$s (#%2$s &ndash; %3$s)"
522
- msgstr ""
523
 
524
  #: templates/fields/ajax-posts.php:57
525
  msgid "Search Posts"
526
- msgstr ""
527
 
528
  #: templates/fields/ajax-products.php:16
529
  msgid "Search Product"
530
- msgstr ""
531
 
532
  #: templates/fields/customtabs.php:28
533
  msgid "Close all"
534
- msgstr ""
535
 
536
  #: templates/fields/customtabs.php:28
537
  msgid "Expand all"
538
- msgstr ""
539
 
540
  #: templates/fields/customtabs.php:37 templates/fields/customtabs.php:81
541
  msgid "Remove"
542
- msgstr ""
543
 
544
  #: templates/fields/customtabs.php:52 templates/fields/customtabs.php:94
545
  msgid "Value"
546
- msgstr ""
547
 
548
  #: templates/fields/customtabs.php:53 templates/fields/customtabs.php:95
549
  msgid "Content of the tab. (HTML is supported)"
550
- msgstr ""
551
 
552
  #: templates/fields/customtabs.php:65
553
  msgid "Add custom product tab"
554
- msgstr ""
555
 
556
  #: templates/fields/customtabs.php:106
557
  msgid "Do you want to remove the custom tab?"
558
- msgstr ""
559
 
560
  #: templates/fields/date-format.php:50
561
  msgid "Custom:"
562
- msgstr ""
563
 
564
  #: templates/fields/icons.php:58
565
  msgid "Set Default"
566
- msgstr ""
567
 
568
  #: templates/fields/image-gallery.php:34 templates/fields/image-gallery.php:39
569
  msgid "Delete image"
570
- msgstr ""
571
 
572
  #: templates/fields/image-gallery.php:39
573
  msgid "Add Images to Gallery"
574
- msgstr ""
575
 
576
  #: templates/fields/image-gallery.php:39
577
  msgid "Add to gallery"
578
- msgstr ""
579
 
580
  #: templates/fields/image-gallery.php:39
581
  msgid "Add images"
582
- msgstr ""
583
 
584
  #: templates/fields/image-gallery.php:39
585
  msgid "Delete"
586
- msgstr ""
587
 
588
  #: templates/fields/onoff.php:24
589
  msgctxt "ON/OFF button: use MAX 3 characters!"
590
  msgid "ON"
591
- msgstr ""
592
 
593
  #: templates/fields/onoff.php:25
594
  msgctxt "ON/OFF button: use MAX 3 characters!"
595
  msgid "OFF"
596
- msgstr ""
597
 
598
  #: templates/fields/select-buttons.php:21
599
  msgid "Add All"
600
- msgstr ""
601
 
602
  #: templates/fields/select-buttons.php:34
603
  msgid "Remove All"
604
- msgstr ""
605
 
606
  #: templates/fields/sidebars.php:22
607
  msgid "Left sidebar"
608
- msgstr ""
609
 
610
  #: templates/fields/sidebars.php:25
611
  msgid "Right sidebar"
612
- msgstr ""
613
 
614
  #: templates/fields/sidebars.php:28 templates/fields/sidebars.php:31
615
  msgid "No sidebar"
616
- msgstr ""
617
 
618
  #: templates/fields/sidebars.php:39
619
  msgid "Left Sidebar"
620
- msgstr ""
621
 
622
  #: templates/fields/sidebars.php:41 templates/fields/sidebars.php:54
623
  msgid "Choose a sidebar"
624
- msgstr ""
625
 
626
  #: templates/fields/sidebars.php:52
627
  msgid "Right Sidebar"
628
- msgstr ""
629
 
630
  #: templates/fields/upload.php:27 templates/metaboxes/types/icon-list.php:70
631
  #: templates/panel/woocommerce/woocommerce-upload.php:40
632
  msgid "Upload"
633
- msgstr ""
634
 
635
  #: templates/fields/upload.php:29
636
  msgid "Reset"
637
- msgstr ""
638
 
639
  #: templates/metaboxes/types/icon-list.php:76
640
  msgid "Image preview"
641
- msgstr ""
642
 
643
  #: templates/metaboxes/types/icon-list.php:90
644
  #, php-format
645
  msgid "(Default: %s <img src=\"%s\"/>)"
646
- msgstr ""
647
 
648
  #: templates/metaboxes/types/icon-list.php:92
649
  #, php-format
650
  msgid "(Default: <i %s></i> )"
651
- msgstr ""
652
 
653
  #: templates/panel/woocommerce/woocommerce-form.php:20
654
  msgid "Reset Defaults"
655
- msgstr ""
656
 
657
  #: templates/sysinfo/system-information-panel.php:30
658
  msgid "YITH System Information"
659
- msgstr ""
660
 
661
  #: templates/sysinfo/system-information-panel.php:38
662
  msgid "Site URL"
663
- msgstr ""
664
 
665
  #: templates/sysinfo/system-information-panel.php:46
666
  msgid "Output IP Address"
667
- msgstr ""
668
 
669
  #: templates/sysinfo/system-information-panel.php:76
670
  msgid "Enabled"
671
- msgstr ""
672
 
673
  #: templates/sysinfo/system-information-panel.php:76
674
  msgid "Disabled"
675
- msgstr ""
676
 
677
  #: templates/sysinfo/system-information-panel.php:82
678
  msgid "N/A"
679
- msgstr ""
680
 
681
  #: templates/sysinfo/system-information-panel.php:96
682
  #, php-format
683
  msgid "%s needs %s enabled"
684
- msgstr ""
685
 
686
  #: templates/sysinfo/system-information-panel.php:98
687
  #, php-format
688
  msgid "%s needs at least %s of available memory"
689
- msgstr ""
690
 
691
  #: templates/sysinfo/system-information-panel.php:100
692
  #: templates/sysinfo/system-information-panel.php:149
@@ -695,6 +713,8 @@ msgid ""
695
  "For optimal functioning of our plugins, we suggest setting at least %s of "
696
  "available memory"
697
  msgstr ""
 
 
698
 
699
  #: templates/sysinfo/system-information-panel.php:102
700
  #: templates/sysinfo/system-information-panel.php:137
@@ -703,80 +723,89 @@ msgstr ""
703
  msgid ""
704
  "Read more %s here%s or contact your hosting company in order to increase it."
705
  msgstr ""
 
 
706
 
707
  #: templates/sysinfo/system-information-panel.php:105
708
  #, php-format
709
  msgid "%s needs at least %s version"
710
- msgstr ""
711
 
712
  #: templates/sysinfo/system-information-panel.php:116
713
  msgid ""
714
  "Update it to the latest version in order to benefit of all new features and "
715
  "security updates."
716
  msgstr ""
 
 
717
 
718
  #: templates/sysinfo/system-information-panel.php:122
719
  msgid "Contact your hosting company in order to update it."
720
- msgstr ""
721
 
722
  #: templates/sysinfo/system-information-panel.php:126
723
  #, php-format
724
  msgid "Remove %s from %s file"
725
- msgstr ""
726
 
727
  #: templates/sysinfo/system-information-panel.php:134
728
  msgid "Contact your hosting company in order to enable it."
729
- msgstr ""
730
 
731
  #: templates/sysinfo/system-information-panel.php:157
732
  msgid ""
733
  "We cannot determine which <b>TLS</b> version is installed because <b>cURL</"
734
  "b> module is disabled. Ask your hosting company to enable it."
735
  msgstr ""
 
 
 
736
 
737
  #: templates/sysinfo/system-information-panel.php:160
738
  msgid ""
739
  "<b>ImageMagick</b> module is not installed. Ask your hosting company to "
740
  "install it."
741
  msgstr ""
 
 
742
 
743
  #: templates/sysinfo/system-information-panel.php:172
744
  msgid "Show full PHPInfo"
745
- msgstr ""
746
 
747
  #: templates/sysinfo/system-information-panel.php:176
748
  msgid "Back to System panel"
749
- msgstr ""
750
 
751
  #: templates/sysinfo/system-information-panel.php:193
752
  msgid "Back to top"
753
- msgstr ""
754
 
755
  #: yit-plugin.php:83
756
  msgctxt "Plugin Row Meta"
757
  msgid "Live Demo"
758
- msgstr ""
759
 
760
  #: yit-plugin.php:88
761
  msgctxt "Plugin Row Meta"
762
  msgid "Documentation"
763
- msgstr ""
764
 
765
  #: yit-plugin.php:93
766
  msgctxt "Plugin Row Meta"
767
  msgid "Support"
768
- msgstr ""
769
 
770
  #: yit-plugin.php:98
771
  msgctxt "Plugin Row Meta"
772
  msgid "Premium version"
773
- msgstr ""
774
 
775
  #: yit-plugin.php:190
776
  msgctxt "Action links"
777
  msgid "Settings"
778
- msgstr ""
779
 
780
  #: yit-plugin.php:194
781
  msgid "License"
782
- msgstr ""
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
  "POT-Creation-Date: 2020-01-10 13:40+0100\n"
8
+ "PO-Revision-Date: 2020-03-02 13:49+0000\n"
9
  "Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
340
 
341
  #: lib/yit-plugin-panel.php:784
342
  msgid "Sorry, import is disabled."
343
+ msgstr "Συγνώμη, η εισαγωγή είναι απενεργοποιημένη."
344
 
345
  #: lib/yit-plugin-panel.php:785
346
  msgid "Sorting successful."
347
+ msgstr "Διαλογή επιτυχής."
348
 
349
  #: lib/yit-plugin-panel.php:1233
350
  msgid "We need your support"
351
+ msgstr "Χρειαζόμαστε την υποστήριξή σας"
352
 
353
  #: lib/yit-plugin-panel.php:1234
354
  msgid "to keep updating and improving the plugin. Please,"
355
  msgstr ""
356
+ "για να διατηρήσετε την ενημέρωση και τη βελτίωση του πρόσθετου. Παρακαλώ"
357
 
358
  #: lib/yit-plugin-panel.php:1236
359
  msgid "help us by leaving a five-star rating"
360
+ msgstr "Βοηθήστε μας αφήνοντας μια βαθμολογία πέντε αστέρων"
361
 
362
  #: lib/yit-plugin-panel.php:1237
363
  msgid ":) Thanks!"
364
+ msgstr ":) Ευχαριστώ!"
365
 
366
  #: lib/yit-pointers.php:70
367
  msgid "Plugins Activated"
368
+ msgstr "Ενεργοποιημένα Πρόσθετα"
369
 
370
  #: lib/yit-pointers.php:71
371
  msgid ""
373
  " Plugin customization settings will be "
374
  "available as a new entry in YITH Plugins menu."
375
  msgstr ""
376
+ "Πλέον μπορείτε να βρείτε όλες τις επιλογές του προσθέτου μέσω του μενού YITH "
377
+ "Plugins.\n"
378
+ " Οι ρυθμίσεις προσαρμογής του προσθέτου "
379
+ "θα είναι διαθέσιμες ως νέα εγγραφή στο μενού YITH Plugins."
380
 
381
  #: lib/yit-pointers.php:73 lib/yit-pointers.php:89
382
  msgid "Discover all our plugins available on:"
383
+ msgstr "Ανακαλύψτε όλα τα διαθέσιμά μας πρόσθετα στο:"
384
 
385
  #: lib/yit-pointers.php:74 lib/yit-pointers.php:90
386
  msgid "and"
387
+ msgstr "Και"
388
 
389
  #: lib/yit-pointers.php:84
390
  msgid "Plugins Upgraded"
391
+ msgstr "Αναβαθμισμένα Πρόσθετα"
392
 
393
  #: lib/yit-pointers.php:85
394
  msgid ""
402
  " will be moved from previous location to "
403
  "YITH Plugins tab."
404
  msgstr ""
405
+ "Πλέον μπορείτε να βρείτε όλες τις επιλογές του προσθέτου μέσω του μενού YITH "
406
+ "Plugins.\n"
407
+ " Κάθε φορά που προστίθεται ένα από τα "
408
+ "πρόσθετά μας, μια νέα εγγραφή θα προστίθεται στο μενού.\n"
409
+ " Για παράδειγμα, μετά την αναβάθμιση, οι "
410
+ "επιλογές των προσθέτων (όπως YITH WooCommerce Wishlist, YITH WooCommerce "
411
+ "Ajax Search, etc.)\n"
412
+ " θα μεταφέρονται από την προηγούμενη "
413
+ "τοποθεσία στην καρτέλα YITH Plugins."
414
 
415
  #: lib/yith-dashboard.php:40
416
  msgid "YITH Latest Updates"
417
+ msgstr "Τελευταίες Αναβαθμίσεις YITH"
418
 
419
  #: lib/yith-dashboard.php:41
420
  msgid "Latest news from YITH Blog"
421
+ msgstr "Τελευταία νέα από YITH Blog"
422
 
423
  #: lib/yith-dashboard.php:65
424
  msgid "RSS Error:"
425
+ msgstr "Σφάλμα RSS:"
426
 
427
  #: lib/yith-dashboard.php:71
428
  msgid ""
429
  "An error has occurred, which probably means the feed is down. Try again "
430
  "later."
431
  msgstr ""
432
+ "Παρουσιάστηκε σφάλμα, που πιθανότατα σημαίνει ότι έπεσε το τροφοδοτικό. "
433
+ "Προσπαθήστε ξανά αργότερα."
434
 
435
  #: lib/yith-dashboard.php:99
436
  msgctxt "Plugin FW"
437
  msgid "View Changelog"
438
+ msgstr "Προβολή Αρχείου Καταγραφής"
439
 
440
  #: lib/yith-dashboard.php:100
441
  msgctxt "Plugin FW"
442
  msgid "Latest update released on"
443
+ msgstr "Τελευταία αναβάθμιση κυκλοφόρησε στις"
444
 
445
  #: lib/yith-dashboard.php:143
446
  msgctxt "Button label"
447
  msgid "Close"
448
+ msgstr "Απενεργοποίηση"
449
 
450
  #: lib/yith-gutenberg.php:134
451
  msgctxt "[gutenberg]: Category Name"
452
  msgid "YITH"
453
+ msgstr "YITH"
454
 
455
  #: lib/yith-system-status.php:97 lib/yith-system-status.php:98
456
  msgid "System Status"
457
+ msgstr "Κατάσταση Συστήματος"
458
 
459
  #: lib/yith-system-status.php:104
460
  msgid "WordPress Version"
461
+ msgstr "Έκδοση WordPress"
462
 
463
  #: lib/yith-system-status.php:105
464
  msgid "WooCommerce Version"
465
+ msgstr "Έκδοση WooCommerce"
466
 
467
  #: lib/yith-system-status.php:106
468
  msgid "Available Memory"
469
+ msgstr "Διαθέσιμη Μνήμη"
470
 
471
  #: lib/yith-system-status.php:107
472
  msgid "PHP Version"
473
+ msgstr "Έκδοση PHP"
474
 
475
  #: lib/yith-system-status.php:108
476
  msgid "TLS Version"
477
+ msgstr "Έκδοση TLS"
478
 
479
  #: lib/yith-system-status.php:109
480
  msgid "WordPress Cron"
481
+ msgstr "WordPress Cron"
482
 
483
  #: lib/yith-system-status.php:110
484
  msgid "SimpleXML"
485
+ msgstr "SimpleXML"
486
 
487
  #: lib/yith-system-status.php:111
488
  msgid "MultiByte String"
489
+ msgstr "MultiByte String"
490
 
491
  #: lib/yith-system-status.php:112
492
  msgid "ImageMagick Version"
493
+ msgstr "Έκδοση ImageMagick"
494
 
495
  #: lib/yith-system-status.php:113
496
  msgid "GD Library"
497
+ msgstr "Βιβλιοθήκη GD"
498
 
499
  #: lib/yith-system-status.php:114
500
  msgid "Iconv Module"
501
+ msgstr "Άρθρωμα Iconv"
502
 
503
  #: lib/yith-system-status.php:115
504
  msgid "OPCache Save Comments"
505
+ msgstr "OPCache Save Comments"
506
 
507
  #: lib/yith-system-status.php:116
508
  msgid "URL FOpen"
509
+ msgstr "URL FOpen"
510
 
511
  #: lib/yith-system-status.php:173
512
  msgid "YITH Plugins"
513
+ msgstr "Πρόσθετα YITH"
514
 
515
  #: lib/yith-system-status.php:174
516
  msgid "WooCommerce"
517
+ msgstr "WooCommerce"
518
 
519
  #: lib/yith-system-status.php:291
520
  msgid "Warning!"
521
+ msgstr "Προσοχή!"
522
 
523
  #: lib/yith-system-status.php:292
524
  #, php-format
526
  "The system check has detected some compatibility issues on your "
527
  "installation. %sClick here%s to know more"
528
  msgstr ""
529
+ "Ο έλεγχος συστήματος έχει εντοπίσει κάποια προβλήματα συμβατότητας στην "
530
+ "εγκατάστασή σας. %sΚάντε κλικ εδώ%s για να μάθετε περισσότερα"
531
 
532
  #: templates/fields/ajax-customers.php:57
533
  msgid "Search Customers"
534
+ msgstr "Αναζήτηση Πελατών"
535
 
536
  #: templates/fields/ajax-customers.php:83
537
  #: templates/fields/ajax-customers.php:93
538
  #, php-format
539
  msgid "%1$s (#%2$s &ndash; %3$s)"
540
+ msgstr "%1$s (#%2$s &ndash; %3$s)"
541
 
542
  #: templates/fields/ajax-posts.php:57
543
  msgid "Search Posts"
544
+ msgstr "Αναζήτηση Άρθρου"
545
 
546
  #: templates/fields/ajax-products.php:16
547
  msgid "Search Product"
548
+ msgstr "Αναζήτηση Προϊόντος"
549
 
550
  #: templates/fields/customtabs.php:28
551
  msgid "Close all"
552
+ msgstr "Απενεργοποίηση όλων"
553
 
554
  #: templates/fields/customtabs.php:28
555
  msgid "Expand all"
556
+ msgstr "Ανάπτυξη όλων"
557
 
558
  #: templates/fields/customtabs.php:37 templates/fields/customtabs.php:81
559
  msgid "Remove"
560
+ msgstr "Αφαίρεση"
561
 
562
  #: templates/fields/customtabs.php:52 templates/fields/customtabs.php:94
563
  msgid "Value"
564
+ msgstr "Τιμή"
565
 
566
  #: templates/fields/customtabs.php:53 templates/fields/customtabs.php:95
567
  msgid "Content of the tab. (HTML is supported)"
568
+ msgstr "Περιεχόμενο καρτέλας. (Υποστηρίζεται HTML)"
569
 
570
  #: templates/fields/customtabs.php:65
571
  msgid "Add custom product tab"
572
+ msgstr "Προσθέστε καρτέλα προσαρμοσμένου προϊόντος"
573
 
574
  #: templates/fields/customtabs.php:106
575
  msgid "Do you want to remove the custom tab?"
576
+ msgstr "Θέλετε να αφαιρέσετε την προσαρμοσμένη καρτέλα;"
577
 
578
  #: templates/fields/date-format.php:50
579
  msgid "Custom:"
580
+ msgstr "Προσαρμογή:"
581
 
582
  #: templates/fields/icons.php:58
583
  msgid "Set Default"
584
+ msgstr "Ορίστε Προεπιλεγμένο"
585
 
586
  #: templates/fields/image-gallery.php:34 templates/fields/image-gallery.php:39
587
  msgid "Delete image"
588
+ msgstr "Διαγραφή εικόνας"
589
 
590
  #: templates/fields/image-gallery.php:39
591
  msgid "Add Images to Gallery"
592
+ msgstr "Προσθέστε Εικόνες στη Συλλογή"
593
 
594
  #: templates/fields/image-gallery.php:39
595
  msgid "Add to gallery"
596
+ msgstr "Προσθέστε στη συλλογή"
597
 
598
  #: templates/fields/image-gallery.php:39
599
  msgid "Add images"
600
+ msgstr "Προσθέστε εικόνες"
601
 
602
  #: templates/fields/image-gallery.php:39
603
  msgid "Delete"
604
+ msgstr "Διαγραφή"
605
 
606
  #: templates/fields/onoff.php:24
607
  msgctxt "ON/OFF button: use MAX 3 characters!"
608
  msgid "ON"
609
+ msgstr "ΕΝΕΡΓΟΠΟΙΗΣΗ"
610
 
611
  #: templates/fields/onoff.php:25
612
  msgctxt "ON/OFF button: use MAX 3 characters!"
613
  msgid "OFF"
614
+ msgstr "ΑΠΕΝΕΡΓΟΠΟΙΗΣΗ"
615
 
616
  #: templates/fields/select-buttons.php:21
617
  msgid "Add All"
618
+ msgstr "Προσθήκη Όλων"
619
 
620
  #: templates/fields/select-buttons.php:34
621
  msgid "Remove All"
622
+ msgstr "Αφαίρεση Όλων"
623
 
624
  #: templates/fields/sidebars.php:22
625
  msgid "Left sidebar"
626
+ msgstr "Αριστερή πλευρική στήλη"
627
 
628
  #: templates/fields/sidebars.php:25
629
  msgid "Right sidebar"
630
+ msgstr "Δεξιά πλευρική στήλη"
631
 
632
  #: templates/fields/sidebars.php:28 templates/fields/sidebars.php:31
633
  msgid "No sidebar"
634
+ msgstr "Χωρίς πλευρική στήλη"
635
 
636
  #: templates/fields/sidebars.php:39
637
  msgid "Left Sidebar"
638
+ msgstr "Αριστερή Πλευρική Στήλη"
639
 
640
  #: templates/fields/sidebars.php:41 templates/fields/sidebars.php:54
641
  msgid "Choose a sidebar"
642
+ msgstr "Επιλέξτε πλευρική στήλη"
643
 
644
  #: templates/fields/sidebars.php:52
645
  msgid "Right Sidebar"
646
+ msgstr "Δεξιά Πλευρική Στήλη"
647
 
648
  #: templates/fields/upload.php:27 templates/metaboxes/types/icon-list.php:70
649
  #: templates/panel/woocommerce/woocommerce-upload.php:40
650
  msgid "Upload"
651
+ msgstr "Ανέβασμα"
652
 
653
  #: templates/fields/upload.php:29
654
  msgid "Reset"
655
+ msgstr "Επαναφορά"
656
 
657
  #: templates/metaboxes/types/icon-list.php:76
658
  msgid "Image preview"
659
+ msgstr "Προεπισκόπηση εικόνας"
660
 
661
  #: templates/metaboxes/types/icon-list.php:90
662
  #, php-format
663
  msgid "(Default: %s <img src=\"%s\"/>)"
664
+ msgstr "(Default: %s <img src=“%s”/>)"
665
 
666
  #: templates/metaboxes/types/icon-list.php:92
667
  #, php-format
668
  msgid "(Default: <i %s></i> )"
669
+ msgstr "(Default: <i %s></i> )"
670
 
671
  #: templates/panel/woocommerce/woocommerce-form.php:20
672
  msgid "Reset Defaults"
673
+ msgstr "Επαναφορά Προεπιλεγμένων"
674
 
675
  #: templates/sysinfo/system-information-panel.php:30
676
  msgid "YITH System Information"
677
+ msgstr "Σύστημα Πληροφοριών YITH"
678
 
679
  #: templates/sysinfo/system-information-panel.php:38
680
  msgid "Site URL"
681
+ msgstr "URL Ιστοσελίδας"
682
 
683
  #: templates/sysinfo/system-information-panel.php:46
684
  msgid "Output IP Address"
685
+ msgstr "Διεύθυνση IP Παραγωγής"
686
 
687
  #: templates/sysinfo/system-information-panel.php:76
688
  msgid "Enabled"
689
+ msgstr "Ενεργοποιημένο"
690
 
691
  #: templates/sysinfo/system-information-panel.php:76
692
  msgid "Disabled"
693
+ msgstr "Απενεργοποιημένο"
694
 
695
  #: templates/sysinfo/system-information-panel.php:82
696
  msgid "N/A"
697
+ msgstr "N/A"
698
 
699
  #: templates/sysinfo/system-information-panel.php:96
700
  #, php-format
701
  msgid "%s needs %s enabled"
702
+ msgstr "%s χρειάζεται %s ενεργοποιημένο"
703
 
704
  #: templates/sysinfo/system-information-panel.php:98
705
  #, php-format
706
  msgid "%s needs at least %s of available memory"
707
+ msgstr "%s χρειάζεται τουλάχιστον %s διαθέσιμης μνήμης"
708
 
709
  #: templates/sysinfo/system-information-panel.php:100
710
  #: templates/sysinfo/system-information-panel.php:149
713
  "For optimal functioning of our plugins, we suggest setting at least %s of "
714
  "available memory"
715
  msgstr ""
716
+ "Για την βέλτιστη λειτουργικότητα των προσθέτων μας, προτείνουμε να ορίσετε "
717
+ "τουλάχιστον %s διαθέσιμης μνήμης"
718
 
719
  #: templates/sysinfo/system-information-panel.php:102
720
  #: templates/sysinfo/system-information-panel.php:137
723
  msgid ""
724
  "Read more %s here%s or contact your hosting company in order to increase it."
725
  msgstr ""
726
+ "Μάθετε περισσότερα %s εδώ%s ή επικοινωνήστε με την εταιρεία hosting σας για "
727
+ "να το βελτιώσετε."
728
 
729
  #: templates/sysinfo/system-information-panel.php:105
730
  #, php-format
731
  msgid "%s needs at least %s version"
732
+ msgstr "%s χρειάζεται τουλάχιστον %s έκδοση"
733
 
734
  #: templates/sysinfo/system-information-panel.php:116
735
  msgid ""
736
  "Update it to the latest version in order to benefit of all new features and "
737
  "security updates."
738
  msgstr ""
739
+ "Κάντε αναβάθμιση της τελευταίας έκδοσης για να επωφεληθείτε από τα νέα "
740
+ "χαρακτηριστικά και τις αναβαθμίσεις προστασίας."
741
 
742
  #: templates/sysinfo/system-information-panel.php:122
743
  msgid "Contact your hosting company in order to update it."
744
+ msgstr "Επικοινωνήστε με την εταιρεία hosting σας για να αναβαθμίσετε."
745
 
746
  #: templates/sysinfo/system-information-panel.php:126
747
  #, php-format
748
  msgid "Remove %s from %s file"
749
+ msgstr "Αφαίρεση %s από αρχείο %s"
750
 
751
  #: templates/sysinfo/system-information-panel.php:134
752
  msgid "Contact your hosting company in order to enable it."
753
+ msgstr "Επικοινωνήστε με την εταιρεία hosting σας για να ενεργοποιήσετε."
754
 
755
  #: templates/sysinfo/system-information-panel.php:157
756
  msgid ""
757
  "We cannot determine which <b>TLS</b> version is installed because <b>cURL</"
758
  "b> module is disabled. Ask your hosting company to enable it."
759
  msgstr ""
760
+ "Δεν μπορούμε να καθορίσουμε ποια έκδοση <b>TLS</b> έχει εγκατασταθεί γιατί "
761
+ "το άρθρωμα <b>cURL</b> είναι απενεργοποιημένο. Ζητήστε από την εταιρεία "
762
+ "hosting σας να το ενεργοποιήσει."
763
 
764
  #: templates/sysinfo/system-information-panel.php:160
765
  msgid ""
766
  "<b>ImageMagick</b> module is not installed. Ask your hosting company to "
767
  "install it."
768
  msgstr ""
769
+ "Το άρθρωμα <b>ImageMagick</b> δεν έχει εγκατασταθεί. Ζητήστε από την "
770
+ "εταιρεία hosting σας να το εγκαταστήσει."
771
 
772
  #: templates/sysinfo/system-information-panel.php:172
773
  msgid "Show full PHPInfo"
774
+ msgstr "Πλήρης εμφάνιση PHPInfo"
775
 
776
  #: templates/sysinfo/system-information-panel.php:176
777
  msgid "Back to System panel"
778
+ msgstr "Πίσω στο πάνελ Συστήματος"
779
 
780
  #: templates/sysinfo/system-information-panel.php:193
781
  msgid "Back to top"
782
+ msgstr "Πίσω στην κορυφή"
783
 
784
  #: yit-plugin.php:83
785
  msgctxt "Plugin Row Meta"
786
  msgid "Live Demo"
787
+ msgstr "Live Demo"
788
 
789
  #: yit-plugin.php:88
790
  msgctxt "Plugin Row Meta"
791
  msgid "Documentation"
792
+ msgstr "Εγχειρίδιο χρήσης"
793
 
794
  #: yit-plugin.php:93
795
  msgctxt "Plugin Row Meta"
796
  msgid "Support"
797
+ msgstr "Υποστήριξη"
798
 
799
  #: yit-plugin.php:98
800
  msgctxt "Plugin Row Meta"
801
  msgid "Premium version"
802
+ msgstr "Premium έκδοση"
803
 
804
  #: yit-plugin.php:190
805
  msgctxt "Action links"
806
  msgid "Settings"
807
+ msgstr "Ρυθμίσεις"
808
 
809
  #: yit-plugin.php:194
810
  msgid "License"
811
+ msgstr "Άδεια χρήσης προϊόντος"
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -340,14 +340,13 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
340
  $yit_options = $this->get_main_array_options();
341
  $option_key = $this->get_current_option_key();
342
  foreach ( $yit_options[ $option_key ] as $id => $option ) {
343
- if( isset( $option['yith-type'] ) && $option['yith-type'] == 'multi-colorpicker' && ! empty( $option['colorpickers'] ) ) {
344
  $default = [];
345
- foreach( $option['colorpickers'] as $colorpicker ) {
346
- $default[ $colorpicker['id'] ] = isset( $colorpicker['default'] ) ? $colorpicker['default'] : '';
347
  }
348
  update_option( $option[ 'id' ], $default );
349
- }
350
- elseif ( isset( $option[ 'default' ] ) ) {
351
  update_option( $option[ 'id' ], $option[ 'default' ] );
352
  }
353
  }
@@ -372,8 +371,11 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
372
  wp_enqueue_style( 'wp-jquery-ui-dialog' );
373
  }
374
 
 
 
 
375
  // enqueue styles only in the current panel page
376
- if ( 'admin.php' === $pagenow && strpos( get_current_screen()->id, $this->settings[ 'page' ] ) !== false ) {
377
  $woocommerce_version = function_exists( 'WC' ) ? WC()->version : $woocommerce->version;
378
  $woocommerce_settings_deps = array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris' );
379
 
@@ -396,17 +398,16 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
396
  wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
397
  'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
398
  ) );
399
-
400
  wp_enqueue_script( 'yith-plugin-fw-fields' );
401
  }
402
 
403
- if ( 'admin.php' === $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) {
404
  wp_enqueue_media();
405
  wp_enqueue_style( 'yit-plugin-style' );
406
  wp_enqueue_script( 'yit-plugin-panel' );
407
  }
408
 
409
- if ( 'admin.php' === $pagenow && strpos( get_current_screen()->id, 'yith_upgrade_premium_version' ) !== false ) {
410
  wp_enqueue_style( 'yit-upgrade-to-pro' );
411
  wp_enqueue_script( 'colorbox' );
412
  }
@@ -470,7 +471,10 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
470
  public static function admin_body_class( $admin_body_classes ) {
471
  global $pagenow;
472
 
473
- if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) )
 
 
 
474
  $admin_body_classes = substr_count( $admin_body_classes, self::$body_class ) == 0 ? $admin_body_classes . self::$body_class : $admin_body_classes;
475
 
476
  return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
@@ -549,11 +553,11 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
549
 
550
  if ( $value && isset( $option[ 'elements' ] ) && !empty( $option[ 'elements' ] ) ) {
551
 
552
- $value = maybe_unserialize( $value );
553
 
554
- if( isset( $value['box_id'] ) ){
555
- unset( $value['box_id'] );
556
- }
557
 
558
  foreach ( $value as $index => $single_toggle ) {
559
 
@@ -567,7 +571,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
567
  }
568
 
569
  foreach ( $option[ 'elements' ] as $element ) {
570
- $element_value = isset( $value[ $index ][ $element[ 'id' ] ] ) ? $value[ $index ][ $element[ 'id' ] ] : false;
571
  $value[ $index ][ $element[ 'id' ] ] = self::sanitize_option( $element_value, $element, $element_value );
572
  }
573
  }
@@ -627,11 +631,11 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
627
  */
628
  public function save_toggle_element_options() {
629
 
630
- check_ajax_referer( 'save-toggle-element', 'security' );
631
 
632
- if( ! current_user_can( $this->settings['capability'] ) ){
633
- wp_die( -1 );
634
- }
635
 
636
  $posted = $_POST;
637
  $tabs = $this->get_available_tabs();
@@ -640,7 +644,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
640
  $option_id = isset( $_REQUEST[ 'toggle_id' ] ) ? $_REQUEST[ 'toggle_id' ] : '';
641
  $updated = false;
642
 
643
- if ( ! empty( $yit_options[ $current_tab ] ) && ! empty( $option_id ) ) {
644
 
645
  $tab_options = $yit_options[ $current_tab ];
646
  foreach ( $tab_options as $key => $item ) {
340
  $yit_options = $this->get_main_array_options();
341
  $option_key = $this->get_current_option_key();
342
  foreach ( $yit_options[ $option_key ] as $id => $option ) {
343
+ if ( isset( $option[ 'yith-type' ] ) && $option[ 'yith-type' ] == 'multi-colorpicker' && !empty( $option[ 'colorpickers' ] ) ) {
344
  $default = [];
345
+ foreach ( $option[ 'colorpickers' ] as $colorpicker ) {
346
+ $default[ $colorpicker[ 'id' ] ] = isset( $colorpicker[ 'default' ] ) ? $colorpicker[ 'default' ] : '';
347
  }
348
  update_option( $option[ 'id' ], $default );
349
+ } elseif ( isset( $option[ 'default' ] ) ) {
 
350
  update_option( $option[ 'id' ], $option[ 'default' ] );
351
  }
352
  }
371
  wp_enqueue_style( 'wp-jquery-ui-dialog' );
372
  }
373
 
374
+ $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
375
+ $assets_screen_ids = (array) apply_filters( 'yith_plugin_fw_wc_panel_screen_ids_for_assets', array() );
376
+
377
  // enqueue styles only in the current panel page
378
+ if ( $screen && ( 'admin.php' === $pagenow && strpos( $screen->id, $this->settings[ 'page' ] ) !== false ) || in_array( $screen->id, $assets_screen_ids ) ) {
379
  $woocommerce_version = function_exists( 'WC' ) ? WC()->version : $woocommerce->version;
380
  $woocommerce_settings_deps = array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris' );
381
 
398
  wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
399
  'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
400
  ) );
 
401
  wp_enqueue_script( 'yith-plugin-fw-fields' );
402
  }
403
 
404
+ if ( $screen && ( 'admin.php' === $pagenow && yith_plugin_fw_is_panel() ) || in_array( $screen->id, $assets_screen_ids ) ) {
405
  wp_enqueue_media();
406
  wp_enqueue_style( 'yit-plugin-style' );
407
  wp_enqueue_script( 'yit-plugin-panel' );
408
  }
409
 
410
+ if ( $screen && 'admin.php' === $pagenow && strpos( $screen->id, 'yith_upgrade_premium_version' ) !== false ) {
411
  wp_enqueue_style( 'yit-upgrade-to-pro' );
412
  wp_enqueue_script( 'colorbox' );
413
  }
471
  public static function admin_body_class( $admin_body_classes ) {
472
  global $pagenow;
473
 
474
+ $assets_screen_ids = (array) apply_filters( 'yith_plugin_fw_wc_panel_screen_ids_for_assets', array() );
475
+
476
+
477
+ if ( ( 'admin.php' == $pagenow && ( strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false || in_array( get_current_screen()->id, $assets_screen_ids ) ) ) )
478
  $admin_body_classes = substr_count( $admin_body_classes, self::$body_class ) == 0 ? $admin_body_classes . self::$body_class : $admin_body_classes;
479
 
480
  return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
553
 
554
  if ( $value && isset( $option[ 'elements' ] ) && !empty( $option[ 'elements' ] ) ) {
555
 
556
+ $value = maybe_unserialize( $value );
557
 
558
+ if ( isset( $value[ 'box_id' ] ) ) {
559
+ unset( $value[ 'box_id' ] );
560
+ }
561
 
562
  foreach ( $value as $index => $single_toggle ) {
563
 
571
  }
572
 
573
  foreach ( $option[ 'elements' ] as $element ) {
574
+ $element_value = isset( $value[ $index ][ $element[ 'id' ] ] ) ? $value[ $index ][ $element[ 'id' ] ] : false;
575
  $value[ $index ][ $element[ 'id' ] ] = self::sanitize_option( $element_value, $element, $element_value );
576
  }
577
  }
631
  */
632
  public function save_toggle_element_options() {
633
 
634
+ check_ajax_referer( 'save-toggle-element', 'security' );
635
 
636
+ if ( !current_user_can( $this->settings[ 'capability' ] ) ) {
637
+ wp_die( -1 );
638
+ }
639
 
640
  $posted = $_POST;
641
  $tabs = $this->get_available_tabs();
644
  $option_id = isset( $_REQUEST[ 'toggle_id' ] ) ? $_REQUEST[ 'toggle_id' ] : '';
645
  $updated = false;
646
 
647
+ if ( !empty( $yit_options[ $current_tab ] ) && !empty( $option_id ) ) {
648
 
649
  $tab_options = $yit_options[ $current_tab ];
650
  foreach ( $tab_options as $key => $item ) {
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -132,7 +132,8 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
132
  global $pagenow, $post_type, $taxonomy;
133
  $tabs = false;
134
 
135
- if ( in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) ) {
 
136
  $tabs = $this->get_post_type_tabs( $post_type );
137
  } else if ( in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) ) {
138
  $tabs = $this->get_taxonomy_tabs( $taxonomy );
@@ -948,9 +949,9 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
948
  */
949
  function get_tab_title() {
950
  $yit_options = $this->get_main_array_options();
951
- $current_tab = $this->get_current_tab();
952
 
953
- foreach ( $yit_options[ $current_tab ] as $sections => $data ) {
954
  foreach ( $data as $option ) {
955
  if ( isset( $option[ 'type' ] ) && $option[ 'type' ] == 'title' ) {
956
  return $option[ 'name' ];
@@ -971,9 +972,9 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
971
  */
972
  function get_section_title( $section ) {
973
  $yit_options = $this->get_main_array_options();
974
- $current_tab = $this->get_current_tab();
975
 
976
- foreach ( $yit_options[ $current_tab ][ $section ] as $option ) {
977
  if ( isset( $option[ 'type' ] ) && $option[ 'type' ] == 'section' ) {
978
  return $option[ 'name' ];
979
  }
@@ -992,9 +993,9 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
992
  */
993
  function get_section_description( $section ) {
994
  $yit_options = $this->get_main_array_options();
995
- $current_tab = $this->get_current_tab();
996
 
997
- foreach ( $yit_options[ $current_tab ][ $section ] as $option ) {
998
  if ( isset( $option[ 'type' ] ) && $option[ 'type' ] == 'section' && isset( $option[ 'desc' ] ) ) {
999
  return '<p>' . $option[ 'desc' ] . '</p>';
1000
  }
132
  global $pagenow, $post_type, $taxonomy;
133
  $tabs = false;
134
 
135
+ if ( in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true )
136
+ && !in_array( $post_type, array( 'product', 'page', 'post' ) ) ) {
137
  $tabs = $this->get_post_type_tabs( $post_type );
138
  } else if ( in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) ) {
139
  $tabs = $this->get_taxonomy_tabs( $taxonomy );
949
  */
950
  function get_tab_title() {
951
  $yit_options = $this->get_main_array_options();
952
+ $option_key = $this->get_current_option_key();
953
 
954
+ foreach ( $yit_options[ $option_key ] as $sections => $data ) {
955
  foreach ( $data as $option ) {
956
  if ( isset( $option[ 'type' ] ) && $option[ 'type' ] == 'title' ) {
957
  return $option[ 'name' ];
972
  */
973
  function get_section_title( $section ) {
974
  $yit_options = $this->get_main_array_options();
975
+ $option_key = $this->get_current_option_key();
976
 
977
+ foreach ( $yit_options[ $option_key ][ $section ] as $option ) {
978
  if ( isset( $option[ 'type' ] ) && $option[ 'type' ] == 'section' ) {
979
  return $option[ 'name' ];
980
  }
993
  */
994
  function get_section_description( $section ) {
995
  $yit_options = $this->get_main_array_options();
996
+ $option_key = $this->get_current_option_key();
997
 
998
+ foreach ( $yit_options[ $option_key ][ $section ] as $option ) {
999
  if ( isset( $option[ 'type' ] ) && $option[ 'type' ] == 'section' && isset( $option[ 'desc' ] ) ) {
1000
  return '<p>' . $option[ 'desc' ] . '</p>';
1001
  }
plugin-fw/lib/yith-system-status.php CHANGED
@@ -19,17 +19,12 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
19
  * Setting Page to Manage Plugins
20
  *
21
  * @class YITH_System_Status
22
- * @package YITH
23
  * @since 1.0
24
  * @author Alberto Ruggiero
 
25
  */
26
  class YITH_System_Status {
27
 
28
- /**
29
- * @var array The settings require to add the submenu page "System Status"
30
- */
31
- protected $_settings = array();
32
-
33
  /**
34
  * @var string the page slug
35
  */
@@ -48,16 +43,16 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
48
  /**
49
  * Single instance of the class
50
  *
51
- * @var \YITH_System_Status
52
  * @since 1.0.0
 
53
  */
54
  protected static $_instance = null;
55
 
56
  /**
57
  * Main plugin Instance
58
  *
59
- * @since 1.0.0
60
  * @return YITH_System_Status
 
61
  * @author Alberto Ruggiero
62
  */
63
  public static function instance() {
@@ -71,8 +66,8 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
71
  /**
72
  * Constructor
73
  *
74
- * @since 1.0.0
75
  * @return void
 
76
  * @author Alberto Ruggiero
77
  */
78
  public function __construct() {
@@ -89,16 +84,22 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
89
  return;
90
  }
91
 
92
- $system_info = get_option( 'yith_system_info' );
93
- $error_notice = ( $system_info['errors'] === true ? ' <span class="yith-system-info-menu update-plugins">!</span>' : '' );
 
 
 
94
 
95
- $this->_settings = array(
96
- 'parent_page' => 'yith_plugin_panel',
97
- 'page_title' => __( 'System Status', 'yith-plugin-fw' ),
98
- 'menu_title' => __( 'System Status', 'yith-plugin-fw' ) . $error_notice,
99
- 'capability' => 'manage_options',
100
- 'page' => $this->_page,
101
- );
 
 
 
102
 
103
  $this->_requirement_labels = array(
104
  'min_wp_version' => __( 'WordPress Version', 'yith-plugin-fw' ),
@@ -116,28 +117,33 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
116
  'url_fopen_enabled' => __( 'URL FOpen', 'yith-plugin-fw' ),
117
  );
118
 
119
- add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
120
- add_action( 'admin_init', array( $this, 'check_system_status' ) );
121
- add_action( 'admin_notices', array( $this, 'activate_system_notice' ), 15 );
122
- add_action( 'admin_enqueue_scripts', array( $this, 'dismissable_notice' ), 20 );
123
-
124
-
125
  }
126
 
127
  /**
128
  * Add "System Information" submenu page under YITH Plugins
129
  *
130
- * @since 1.0.0
131
  * @return void
 
132
  * @author Alberto Ruggiero
133
  */
134
  public function add_submenu_page() {
 
 
 
 
 
 
 
 
 
 
 
135
  add_submenu_page(
136
- $this->_settings['parent_page'],
137
- $this->_settings['page_title'],
138
- $this->_settings['menu_title'],
139
- $this->_settings['capability'],
140
- $this->_settings['page'],
141
  array( $this, 'show_information_panel' )
142
  );
143
  }
@@ -145,8 +151,8 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
145
  /**
146
  * Add "System Information" page template under YITH Plugins
147
  *
148
- * @since 1.0.0
149
  * @return void
 
150
  * @author Alberto Ruggiero
151
  */
152
  public function show_information_panel() {
@@ -161,8 +167,8 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
161
  /**
162
  * Perform system status check
163
  *
164
- * @since 1.0.0
165
  * @return void
 
166
  * @author Alberto Ruggiero
167
  */
168
  public function check_system_status() {
@@ -231,12 +237,12 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
231
  /**
232
  * Handle plugin requirements
233
  *
234
- * @since 1.0.0
235
- *
236
  * @param $plugin_name string
237
  * @param $requirements array
238
  *
239
  * @return void
 
 
240
  * @author Alberto Ruggiero
241
  */
242
  public function add_requirements( $plugin_name, $requirements ) {
@@ -255,8 +261,8 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
255
  /**
256
  * Manages notice dismissing
257
  *
258
- * @since 1.0.0
259
  * @return void
 
260
  * @author Alberto Ruggiero
261
  */
262
  public function dismissable_notice() {
@@ -268,8 +274,8 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
268
  /**
269
  * Show system notice
270
  *
271
- * @since 1.0.0
272
  * @return void
 
273
  * @author Alberto Ruggiero
274
  */
275
  public function activate_system_notice() {
@@ -300,8 +306,8 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
300
  /**
301
  * Get system information
302
  *
303
- * @since 1.0.0
304
  * @return array
 
305
  * @author Alberto Ruggiero
306
  */
307
  public function get_system_info() {
@@ -357,11 +363,11 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
357
  /**
358
  * Convert site into number
359
  *
360
- * @since 1.0.0
361
- *
362
  * @param $memory_size string
363
  *
364
  * @return integer
 
 
365
  * @author Alberto Ruggiero
366
  */
367
  public function memory_size_to_num( $memory_size ) {
19
  * Setting Page to Manage Plugins
20
  *
21
  * @class YITH_System_Status
 
22
  * @since 1.0
23
  * @author Alberto Ruggiero
24
+ * @package YITH
25
  */
26
  class YITH_System_Status {
27
 
 
 
 
 
 
28
  /**
29
  * @var string the page slug
30
  */
43
  /**
44
  * Single instance of the class
45
  *
 
46
  * @since 1.0.0
47
+ * @var \YITH_System_Status
48
  */
49
  protected static $_instance = null;
50
 
51
  /**
52
  * Main plugin Instance
53
  *
 
54
  * @return YITH_System_Status
55
+ * @since 1.0.0
56
  * @author Alberto Ruggiero
57
  */
58
  public static function instance() {
66
  /**
67
  * Constructor
68
  *
 
69
  * @return void
70
+ * @since 1.0.0
71
  * @author Alberto Ruggiero
72
  */
73
  public function __construct() {
84
  return;
85
  }
86
 
87
+ add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
88
+ add_action( 'admin_init', array( $this, 'check_system_status' ) );
89
+ add_action( 'admin_notices', array( $this, 'activate_system_notice' ), 15 );
90
+ add_action( 'admin_enqueue_scripts', array( $this, 'dismissable_notice' ), 20 );
91
+ add_action( 'init', array( $this, 'set_requirements_labels' ) );
92
 
93
+ }
94
+
95
+ /**
96
+ * Set requirements labels
97
+ *
98
+ * @return void
99
+ * @since 1.0.0
100
+ * @author Alberto Ruggiero
101
+ */
102
+ public function set_requirements_labels() {
103
 
104
  $this->_requirement_labels = array(
105
  'min_wp_version' => __( 'WordPress Version', 'yith-plugin-fw' ),
117
  'url_fopen_enabled' => __( 'URL FOpen', 'yith-plugin-fw' ),
118
  );
119
 
 
 
 
 
 
 
120
  }
121
 
122
  /**
123
  * Add "System Information" submenu page under YITH Plugins
124
  *
 
125
  * @return void
126
+ * @since 1.0.0
127
  * @author Alberto Ruggiero
128
  */
129
  public function add_submenu_page() {
130
+
131
+ $system_info = get_option( 'yith_system_info' );
132
+ $error_notice = ( $system_info['errors'] === true ? ' <span class="yith-system-info-menu update-plugins">!</span>' : '' );
133
+ $settings = array(
134
+ 'parent_page' => 'yith_plugin_panel',
135
+ 'page_title' => __( 'System Status', 'yith-plugin-fw' ),
136
+ 'menu_title' => __( 'System Status', 'yith-plugin-fw' ) . $error_notice,
137
+ 'capability' => 'manage_options',
138
+ 'page' => $this->_page,
139
+ );
140
+
141
  add_submenu_page(
142
+ $settings['parent_page'],
143
+ $settings['page_title'],
144
+ $settings['menu_title'],
145
+ $settings['capability'],
146
+ $settings['page'],
147
  array( $this, 'show_information_panel' )
148
  );
149
  }
151
  /**
152
  * Add "System Information" page template under YITH Plugins
153
  *
 
154
  * @return void
155
+ * @since 1.0.0
156
  * @author Alberto Ruggiero
157
  */
158
  public function show_information_panel() {
167
  /**
168
  * Perform system status check
169
  *
 
170
  * @return void
171
+ * @since 1.0.0
172
  * @author Alberto Ruggiero
173
  */
174
  public function check_system_status() {
237
  /**
238
  * Handle plugin requirements
239
  *
 
 
240
  * @param $plugin_name string
241
  * @param $requirements array
242
  *
243
  * @return void
244
+ * @since 1.0.0
245
+ *
246
  * @author Alberto Ruggiero
247
  */
248
  public function add_requirements( $plugin_name, $requirements ) {
261
  /**
262
  * Manages notice dismissing
263
  *
 
264
  * @return void
265
+ * @since 1.0.0
266
  * @author Alberto Ruggiero
267
  */
268
  public function dismissable_notice() {
274
  /**
275
  * Show system notice
276
  *
 
277
  * @return void
278
+ * @since 1.0.0
279
  * @author Alberto Ruggiero
280
  */
281
  public function activate_system_notice() {
306
  /**
307
  * Get system information
308
  *
 
309
  * @return array
310
+ * @since 1.0.0
311
  * @author Alberto Ruggiero
312
  */
313
  public function get_system_info() {
363
  /**
364
  * Convert site into number
365
  *
 
 
366
  * @param $memory_size string
367
  *
368
  * @return integer
369
+ * @since 1.0.0
370
+ *
371
  * @author Alberto Ruggiero
372
  */
373
  public function memory_size_to_num( $memory_size ) {
plugin-fw/templates/panel/panel-field-container.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
  * This file belongs to the YIT Plugin Framework.
4
- *
5
  * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
  * that is bundled with this package in the file LICENSE.txt.
7
  * It is also available through the world-wide-web at this URL:
@@ -34,8 +33,11 @@ if ( !empty( $custom_attributes ) )
34
  <div class="option">
35
  <?php yith_plugin_fw_get_field( $field, true, false ); ?>
36
  </div>
37
- <span class="description"><?php echo $option[ 'desc' ] ?></span>
38
 
 
 
 
 
39
  <div class="clear"></div>
40
  </div>
41
 
1
  <?php
2
  /**
3
  * This file belongs to the YIT Plugin Framework.
 
4
  * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
  * that is bundled with this package in the file LICENSE.txt.
6
  * It is also available through the world-wide-web at this URL:
33
  <div class="option">
34
  <?php yith_plugin_fw_get_field( $field, true, false ); ?>
35
  </div>
 
36
 
37
+ <?php if ( !empty( $option[ 'desc' ] ) ): ?>
38
+ <span class="description"><?php echo $option[ 'desc' ] ?></span>
39
+ <?php endif; ?>
40
+
41
  <div class="clear"></div>
42
  </div>
43
 
templates/add-to-wishlist-added.php CHANGED
@@ -37,11 +37,11 @@ global $product;
37
  <!-- ADDED TO WISHLIST MESSAGE -->
38
  <div class="yith-wcwl-wishlistaddedbrowse">
39
  <span class="feedback">
40
- <?php echo $icon ?>
41
- <?php echo $product_added_text ?>
42
- </span>
43
  <a href="<?php echo esc_url( $wishlist_url )?>" rel="nofollow" data-title="<?php echo esc_attr( $browse_wishlist_text ) ?>">
44
- <?php echo ( ! $is_single && 'before_image' == $loop_position ) ? $icon : false ?>
45
- <?php echo apply_filters( 'yith-wcwl-browse-wishlist-label', $browse_wishlist_text, $product_id, $icon ) ?>
46
  </a>
47
  </div>
37
  <!-- ADDED TO WISHLIST MESSAGE -->
38
  <div class="yith-wcwl-wishlistaddedbrowse">
39
  <span class="feedback">
40
+ <?php echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
41
+ <?php echo esc_html( $product_added_text ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
42
+ </span>
43
  <a href="<?php echo esc_url( $wishlist_url )?>" rel="nofollow" data-title="<?php echo esc_attr( $browse_wishlist_text ) ?>">
44
+ <?php echo ( ! $is_single && 'before_image' == $loop_position ) ? $icon : false; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
45
+ <?php echo esc_html( apply_filters( 'yith-wcwl-browse-wishlist-label', $browse_wishlist_text, $product_id, $icon ) ); ?>
46
  </a>
47
  </div>
templates/add-to-wishlist-browse.php CHANGED
@@ -10,21 +10,21 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $wishlist_url string Url to wishlist page
14
- * @var $exists bool Whether current product is already in wishlist
15
- * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
16
- * @var $product_id int Current product id
17
- * @var $product_type string Current product type
18
- * @var $label string Button label
19
- * @var $browse_wishlist_text string Browse wishlist text
20
  * @var $already_in_wishslist_text string Already in wishlist text
21
- * @var $product_added_text string Product added text
22
- * @var $icon string Icon for Add to Wishlist button
23
- * @var $link_classes string Classed for Add to Wishlist button
24
- * @var $available_multi_wishlist bool Whether add to wishlist is available or not
25
- * @var $disable_wishlist bool Whether wishlist is disabled or not
26
- * @var $template_part string Template part
27
- * @var $loop_position string Loop position
28
  */
29
 
30
  if ( ! defined( 'YITH_WCWL' ) ) {
@@ -37,11 +37,11 @@ global $product;
37
  <!-- BROWSE WISHLIST MESSAGE -->
38
  <div class="yith-wcwl-wishlistexistsbrowse">
39
  <span class="feedback">
40
- <?php echo $icon ?>
41
- <?php echo $already_in_wishslist_text ?>
42
- </span>
43
- <a href="<?php echo esc_url( $wishlist_url ) ?>" rel="nofollow" data-title="<?php echo esc_attr( $browse_wishlist_text ) ?>">
44
- <?php echo ( ! $is_single && 'before_image' == $loop_position ) ? $icon : false ?>
45
- <?php echo apply_filters( 'yith-wcwl-browse-wishlist-label', $browse_wishlist_text, $product_id, $icon ) ?>
46
  </a>
47
  </div>
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $wishlist_url string Url to wishlist page
14
+ * @var $exists bool Whether current product is already in wishlist
15
+ * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
16
+ * @var $product_id int Current product id
17
+ * @var $product_type string Current product type
18
+ * @var $label string Button label
19
+ * @var $browse_wishlist_text string Browse wishlist text
20
  * @var $already_in_wishslist_text string Already in wishlist text
21
+ * @var $product_added_text string Product added text
22
+ * @var $icon string Icon for Add to Wishlist button
23
+ * @var $link_classes string Classed for Add to Wishlist button
24
+ * @var $available_multi_wishlist bool Whether add to wishlist is available or not
25
+ * @var $disable_wishlist bool Whether wishlist is disabled or not
26
+ * @var $template_part string Template part
27
+ * @var $loop_position string Loop position
28
  */
29
 
30
  if ( ! defined( 'YITH_WCWL' ) ) {
37
  <!-- BROWSE WISHLIST MESSAGE -->
38
  <div class="yith-wcwl-wishlistexistsbrowse">
39
  <span class="feedback">
40
+ <?php echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
41
+ <?php echo esc_html( $already_in_wishslist_text ); ?>
42
+ </span>
43
+ <a href="<?php echo esc_url( $wishlist_url ); ?>" rel="nofollow" data-title="<?php echo esc_attr( $browse_wishlist_text ); ?>">
44
+ <?php echo ( ! $is_single && 'before_image' == $loop_position ) ? $icon : false; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
45
+ <?php echo esc_html( apply_filters( 'yith-wcwl-browse-wishlist-label', $browse_wishlist_text, $product_id, $icon ) ); ?>
46
  </a>
47
  </div>
templates/add-to-wishlist-button.php CHANGED
@@ -11,35 +11,35 @@
11
  * Template variables:
12
  *
13
  * @var $base_url string Current page url
14
- * @var $wishlist_url string Url to wishlist page
15
- * @var $exists bool Whether current product is already in wishlist
16
- * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
17
- * @var $show_count bool Whether to show count of times item was added to wishlist
18
- * @var $product_id int Current product id
19
- * @var $parent_product_id int Parent for current product
20
- * @var $product_type string Current product type
21
- * @var $label string Button label
22
- * @var $browse_wishlist_text string Browse wishlist text
23
  * @var $already_in_wishslist_text string Already in wishlist text
24
- * @var $product_added_text string Product added text
25
- * @var $icon string Icon for Add to Wishlist button
26
- * @var $link_classes string Classed for Add to Wishlist button
27
- * @var $available_multi_wishlist bool Whether add to wishlist is available or not
28
- * @var $disable_wishlist bool Whether wishlist is disabled or not
29
- * @var $template_part string Template part
30
- * @var $container_classes string Container classes
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
34
- exit;
35
  } // Exit if accessed directly
36
 
37
  global $product;
38
  ?>
39
 
40
  <div class="yith-wcwl-add-button">
41
- <a href="<?php echo esc_url( add_query_arg( 'add_to_wishlist', $product_id, $base_url ) )?>" rel="nofollow" data-product-id="<?php echo $product_id ?>" data-product-type="<?php echo $product_type?>" data-original-product-id="<?php echo $parent_product_id ?>" class="<?php echo $link_classes ?>" data-title="<?php echo esc_attr( apply_filters( 'yith_wcwl_add_to_wishlist_title', $label ) ) ?>">
42
- <?php echo $icon ?>
43
- <span><?php echo $label ?></span>
44
- </a>
45
  </div>
11
  * Template variables:
12
  *
13
  * @var $base_url string Current page url
14
+ * @var $wishlist_url string Url to wishlist page
15
+ * @var $exists bool Whether current product is already in wishlist
16
+ * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
17
+ * @var $show_count bool Whether to show count of times item was added to wishlist
18
+ * @var $product_id int Current product id
19
+ * @var $parent_product_id int Parent for current product
20
+ * @var $product_type string Current product type
21
+ * @var $label string Button label
22
+ * @var $browse_wishlist_text string Browse wishlist text
23
  * @var $already_in_wishslist_text string Already in wishlist text
24
+ * @var $product_added_text string Product added text
25
+ * @var $icon string Icon for Add to Wishlist button
26
+ * @var $link_classes string Classed for Add to Wishlist button
27
+ * @var $available_multi_wishlist bool Whether add to wishlist is available or not
28
+ * @var $disable_wishlist bool Whether wishlist is disabled or not
29
+ * @var $template_part string Template part
30
+ * @var $container_classes string Container classes
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
34
+ exit;
35
  } // Exit if accessed directly
36
 
37
  global $product;
38
  ?>
39
 
40
  <div class="yith-wcwl-add-button">
41
+ <a href="<?php echo esc_url( add_query_arg( 'add_to_wishlist', $product_id, $base_url ) ); ?>" rel="nofollow" data-product-id="<?php echo esc_attr( $product_id ) ?>" data-product-type="<?php echo $product_type?>" data-original-product-id="<?php echo $parent_product_id ?>" class="<?php echo esc_attr( $link_classes ); ?>" data-title="<?php echo esc_attr( apply_filters( 'yith_wcwl_add_to_wishlist_title', $label ) ); ?>">
42
+ <?php echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
43
+ <span><?php echo esc_html( $label ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
44
+ </a>
45
  </div>
templates/add-to-wishlist-remove.php CHANGED
@@ -10,26 +10,26 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $base_url string Current page url
14
- * @var $wishlist_url string Url to wishlist page
15
- * @var $exists bool Whether current product is already in wishlist
16
- * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
17
- * @var $show_count bool Whether to show count of times item was added to wishlist
18
- * @var $show_view bool Whether to show view button or not
19
- * @var $product_id int Current product id
20
- * @var $product_type string Current product type
21
- * @var $label string Button label
22
- * @var $browse_wishlist_text string Browse wishlist text
23
  * @var $already_in_wishslist_text string Already in wishlist text
24
- * @var $product_added_text string Product added text
25
- * @var $icon string Icon for Add to Wishlist button
26
- * @var $link_classes string Classed for Add to Wishlist button
27
- * @var $available_multi_wishlist bool Whether add to wishlist is available or not
28
- * @var $disable_wishlist bool Whether wishlist is disabled or not
29
- * @var $template_part string Template part
30
- * @var $container_classes string Container classes
31
- * @var $found_in_list YITH_WCWL_Wishlist Wishlist
32
- * @var $found_item YITH_WCWL_Wishlist_Item Wishlist item
33
  */
34
 
35
  if ( ! defined( 'YITH_WCWL' ) ) {
@@ -40,13 +40,13 @@ global $product;
40
  ?>
41
 
42
  <div class="yith-wcwl-add-button">
43
- <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $product_id, $base_url ) )?>" rel="nofollow" data-item-id="<?php echo esc_attr( $found_item->get_id() ) ?>" data-product-id="<?php echo esc_attr( $product_id ) ?>" class="delete_item <?php echo $link_classes ?>" data-title="<?php echo esc_attr( apply_filters( 'yith_wcwl_add_to_wishlist_title', $label ) ) ?>">
44
- <?php echo $icon ?>
45
- <?php echo $label ?>
46
  </a>
47
 
48
- <?php if( $show_view ): ?>
49
- <span class="separator"><?php _e( 'or', 'yith-woocommerce-wishlist' )?></span>
50
- <a href="<?php echo esc_url( $found_in_list->get_url() ) ?>" class="view-wishlist"><?php echo apply_filters( 'yith_wcwl_view_wishlist_label', __( 'View &rsaquo;', 'yith-woocommerce-wishlist' ) ) ?></a>
51
- <?php endif; ?>
52
  </div>
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $base_url string Current page url
14
+ * @var $wishlist_url string Url to wishlist page
15
+ * @var $exists bool Whether current product is already in wishlist
16
+ * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
17
+ * @var $show_count bool Whether to show count of times item was added to wishlist
18
+ * @var $show_view bool Whether to show view button or not
19
+ * @var $product_id int Current product id
20
+ * @var $product_type string Current product type
21
+ * @var $label string Button label
22
+ * @var $browse_wishlist_text string Browse wishlist text
23
  * @var $already_in_wishslist_text string Already in wishlist text
24
+ * @var $product_added_text string Product added text
25
+ * @var $icon string Icon for Add to Wishlist button
26
+ * @var $link_classes string Classed for Add to Wishlist button
27
+ * @var $available_multi_wishlist bool Whether add to wishlist is available or not
28
+ * @var $disable_wishlist bool Whether wishlist is disabled or not
29
+ * @var $template_part string Template part
30
+ * @var $container_classes string Container classes
31
+ * @var $found_in_list YITH_WCWL_Wishlist Wishlist
32
+ * @var $found_item YITH_WCWL_Wishlist_Item Wishlist item
33
  */
34
 
35
  if ( ! defined( 'YITH_WCWL' ) ) {
40
  ?>
41
 
42
  <div class="yith-wcwl-add-button">
43
+ <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $product_id, $base_url ) ); ?>" rel="nofollow" data-item-id="<?php echo esc_attr( $found_item->get_id() ); ?>" data-product-id="<?php echo esc_attr( $product_id ); ?>" class="delete_item <?php echo esc_attr( $link_classes ); ?>" data-title="<?php echo esc_attr( apply_filters( 'yith_wcwl_add_to_wishlist_title', $label ) ); ?>">
44
+ <?php echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
45
+ <?php echo esc_html( $label ); ?>
46
  </a>
47
 
48
+ <?php if( $show_view ): ?>
49
+ <span class="separator"><?php esc_html_e( 'or', 'yith-woocommerce-wishlist' ); ?></span>
50
+ <a href="<?php echo esc_url( $found_in_list->get_url() ); ?>" class="view-wishlist"><?php echo esc_html( apply_filters( 'yith_wcwl_view_wishlist_label', __( 'View &rsaquo;', 'yith-woocommerce-wishlist' ) ) ); ?></a>
51
+ <?php endif; ?>
52
  </div>
templates/add-to-wishlist.php CHANGED
@@ -10,24 +10,24 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $wishlist_url string Url to wishlist page
14
- * @var $exists bool Whether current product is already in wishlist
15
- * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
16
- * @var $show_count bool Whether to show count of times item was added to wishlist
17
- * @var $product_id int Current product id
18
- * @var $product_type string Current product type
19
- * @var $label string Button label
20
- * @var $browse_wishlist_text string Browse wishlist text
21
  * @var $already_in_wishslist_text string Already in wishlist text
22
- * @var $product_added_text string Product added text
23
- * @var $icon string Icon for Add to Wishlist button
24
- * @var $link_classes string Classed for Add to Wishlist button
25
- * @var $available_multi_wishlist bool Whether add to wishlist is available or not
26
- * @var $disable_wishlist bool Whether wishlist is disabled or not
27
- * @var $template_part string Template part
28
- * @var $container_classes string Container classes
29
- * @var $fragment_options array Array of data to send through ajax calls
30
- * @var $ajax_loading bool Whether ajax loading is enabled or not
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
@@ -37,27 +37,27 @@ if ( ! defined( 'YITH_WCWL' ) ) {
37
  global $product;
38
  ?>
39
 
40
- <div class="yith-wcwl-add-to-wishlist add-to-wishlist-<?php echo $product_id ?> <?php echo $container_classes ?> wishlist-fragment on-first-load" data-fragment-ref="<?php echo $product_id ?>" data-fragment-options="<?php echo esc_attr( json_encode( $fragment_options ) )?>">
41
- <?php if( ! $ajax_loading ): ?>
42
- <?php if( ! ( $disable_wishlist && ! is_user_logged_in() ) ): ?>
43
 
44
- <!-- ADD TO WISHLIST -->
45
- <?php yith_wcwl_get_template( 'add-to-wishlist-' . $template_part . '.php', $var ); ?>
46
 
47
- <!-- COUNT TEXT -->
48
- <?php
49
- if( $show_count ):
50
- echo yith_wcwl_get_count_text( $product_id );
51
- endif;
52
- ?>
53
 
54
- <?php else: ?>
55
 
56
- <a href="<?php echo esc_url( add_query_arg( array( 'wishlist_notice' => 'true', 'add_to_wishlist' => $product_id ), get_permalink( wc_get_page_id( 'myaccount' ) ) ) )?>" rel="nofollow" class="disabled_item <?php echo str_replace( array( 'add_to_wishlist', 'single_add_to_wishlist' ), '', $link_classes ) ?>" >
57
- <?php echo $icon ?>
58
- <?php echo $label ?>
59
- </a>
60
 
61
- <?php endif; ?>
62
  <?php endif; ?>
63
  </div>
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $wishlist_url string Url to wishlist page
14
+ * @var $exists bool Whether current product is already in wishlist
15
+ * @var $show_exists bool Whether to show already in wishlist link on multi wishlist
16
+ * @var $show_count bool Whether to show count of times item was added to wishlist
17
+ * @var $product_id int Current product id
18
+ * @var $product_type string Current product type
19
+ * @var $label string Button label
20
+ * @var $browse_wishlist_text string Browse wishlist text
21
  * @var $already_in_wishslist_text string Already in wishlist text
22
+ * @var $product_added_text string Product added text
23
+ * @var $icon string Icon for Add to Wishlist button
24
+ * @var $link_classes string Classed for Add to Wishlist button
25
+ * @var $available_multi_wishlist bool Whether add to wishlist is available or not
26
+ * @var $disable_wishlist bool Whether wishlist is disabled or not
27
+ * @var $template_part string Template part
28
+ * @var $container_classes string Container classes
29
+ * @var $fragment_options array Array of data to send through ajax calls
30
+ * @var $ajax_loading bool Whether ajax loading is enabled or not
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
37
  global $product;
38
  ?>
39
 
40
+ <div class="yith-wcwl-add-to-wishlist add-to-wishlist-<?php echo esc_attr( $product_id ); ?> <?php echo esc_attr( $container_classes ); ?> wishlist-fragment on-first-load" data-fragment-ref="<?php echo esc_attr( $product_id ); ?>" data-fragment-options="<?php echo esc_attr( json_encode( $fragment_options ) ); ?>">
41
+ <?php if( ! $ajax_loading ): ?>
42
+ <?php if( ! ( $disable_wishlist && ! is_user_logged_in() ) ): ?>
43
 
44
+ <!-- ADD TO WISHLIST -->
45
+ <?php yith_wcwl_get_template( 'add-to-wishlist-' . $template_part . '.php', $var ); ?>
46
 
47
+ <!-- COUNT TEXT -->
48
+ <?php
49
+ if( $show_count ):
50
+ echo yith_wcwl_get_count_text( $product_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
51
+ endif;
52
+ ?>
53
 
54
+ <?php else: ?>
55
 
56
+ <a href="<?php echo esc_url( add_query_arg( array( 'wishlist_notice' => 'true', 'add_to_wishlist' => $product_id ), get_permalink( wc_get_page_id( 'myaccount' ) ) ) )?>" rel="nofollow" class="disabled_item <?php echo str_replace( array( 'add_to_wishlist', 'single_add_to_wishlist' ), '', $link_classes ) ?>" >
57
+ <?php echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
58
+ <?php echo esc_html( $label ); ?>
59
+ </a>
60
 
61
+ <?php endif; ?>
62
  <?php endif; ?>
63
  </div>
templates/share.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Share template
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
@@ -10,87 +10,87 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $share_title string Title for share section
14
- * @var $share_facebook_enabled bool Whether to enable FB sharing button
15
- * @var $share_twitter_enabled bool Whether to enable Twitter sharing button
16
  * @var $share_pinterest_enabled bool Whether to enable Pintereset sharing button
17
- * @var $share_email_enabled bool Whether to enable Email sharing button
18
- * @var $share_whatsapp_enabled bool Whether to enable WhatsApp sharing button (mobile online)
19
- * @var $share_url_enabled bool Whether to enable share via url
20
- * @var $share_link_title string Title to use for post (where applicable)
21
- * @var $share_link_url string Url to share
22
- * @var $share_summary string Summary to use for sharing on social media
23
- * @var $share_image_url string Image to use for sharing on social media
24
- * @var $share_twitter_summary string Summary to use for sharing on Twitter
25
- * @var $share_facebook_icon string Icon for facebook sharing button
26
- * @var $share_twitter_icon string Icon for twitter sharing button
27
- * @var $share_pinterest_icon string Icon for pinterest sharing button
28
- * @var $share_email_icon string Icon for email sharing button
29
- * @var $share_whatsapp_icon string Icon for whatsapp sharing button
30
- * @var $share_whatsapp_url string Sharing url on whatsapp
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
34
- exit;
35
  } // Exit if accessed directly
36
  ?>
37
 
38
- <?php do_action( 'yith_wcwl_before_wishlist_share', $wishlist); ?>
39
 
40
  <div class="yith-wcwl-share">
41
- <h4 class="yith-wcwl-share-title"><?php echo $share_title ?></h4>
42
- <ul>
43
- <?php if( $share_facebook_enabled ): ?>
44
- <li class="share-button">
45
- <a target="_blank" class="facebook" href="https://www.facebook.com/sharer.php?u=<?php echo urlencode($share_link_url)?>&p[title]=<?php echo $share_link_title ?>" title="<?php _e( 'Facebook', 'yith-woocommerce-wishlist' ) ?>">
46
- <?php echo $share_facebook_icon ? $share_facebook_icon : __( 'Facebook', 'yith-woocommerce-wishlist' ) ?>
47
- </a>
48
- </li>
49
- <?php endif; ?>
50
 
51
- <?php if( $share_twitter_enabled ): ?>
52
- <li class="share-button">
53
- <a target="_blank" class="twitter" href="https://twitter.com/share?url=<?php echo urlencode( $share_link_url ) ?>&amp;text=<?php echo $share_twitter_summary ?>" title="<?php _e( 'Twitter', 'yith-woocommerce-wishlist' ) ?>">
54
- <?php echo $share_twitter_icon ? $share_twitter_icon : __( 'Twitter', 'yith-woocommerce-wishlist' ) ?>
55
- </a>
56
- </li>
57
- <?php endif; ?>
58
 
59
- <?php if( $share_pinterest_enabled ): ?>
60
- <li class="share-button">
61
- <a target="_blank" class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode( $share_link_url ) ?>&amp;description=<?php echo $share_summary ?>&amp;media=<?php echo $share_image_url ?>" title="<?php _e( 'Pinterest', 'yith-woocommerce-wishlist' ) ?>" onclick="window.open(this.href); return false;">
62
- <?php echo $share_pinterest_icon ? $share_pinterest_icon : __( 'Pinterest', 'yith-woocommerce-wishlist' ) ?>
63
- </a>
64
- </li>
65
- <?php endif; ?>
66
 
67
- <?php if( $share_email_enabled ): ?>
68
- <li class="share-button">
69
- <a class="email" href="mailto:?subject=<?php echo urlencode( apply_filters( 'yith_wcwl_email_share_subject', $share_link_title ) )?>&amp;body=<?php echo apply_filters( 'yith_wcwl_email_share_body', urlencode( $share_link_url ) ) ?>&amp;title=<?php echo $share_link_title ?>" title="<?php _e( 'Email', 'yith-woocommerce-wishlist' ) ?>">
70
- <?php echo $share_email_icon ? $share_email_icon : __( 'Email', 'yith-woocommerce-wishlist' ) ?>
71
- </a>
72
- </li>
73
- <?php endif; ?>
74
 
75
- <?php if( $share_whatsapp_enabled ):
76
- ?>
77
- <li class="share-button">
78
- <a class="whatsapp" href="<?php echo $share_whatsapp_url ?>" data-action="share/whatsapp/share" target="_blank" title="<?php _e( 'WhatsApp', 'yith-woocommerce-wishlist' ) ?>">
79
- <?php echo $share_whatsapp_icon ? $share_whatsapp_icon : __( 'Whatsapp', 'yith-woocommerce-wishlist' ) ?>
80
- </a>
81
- </li>
82
- <?php endif;
83
- ?>
84
- </ul>
85
 
86
- <?php if( $share_url_enabled ): ?>
87
- <div class="yith-wcwl-after-share-section">
88
- <input class="copy-target" readonly="readonly" type="url" name="yith_wcwl_share_url" id="yith_wcwl_share_url" value="<?php echo $share_link_url ?>"/>
89
- <?php echo ( ! empty( $share_link_url ) ) ? sprintf( '<small>%s <span class="copy-trigger">%s</span> %s</small>', __( '(Now', 'yith-woocommerce-wishlist' ), __( 'copy', 'yith-woocommerce-wishlist' ), __( 'this wishlist link and share it anywhere)', 'yith-woocommerce-wishlist' ) ) : '' ?>
90
- </div>
91
- <?php endif; ?>
92
 
93
- <?php do_action( 'yith_wcwl_after_share_buttons', $share_link_url, $share_title, $share_link_title ) ?>
94
  </div>
95
 
96
  <?php do_action( 'yith_wcwl_after_wishlist_share', $wishlist ); ?>
2
  /**
3
  * Share template
4
  *
5
+ * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $share_title string Title for share section
14
+ * @var $share_facebook_enabled bool Whether to enable FB sharing button
15
+ * @var $share_twitter_enabled bool Whether to enable Twitter sharing button
16
  * @var $share_pinterest_enabled bool Whether to enable Pintereset sharing button
17
+ * @var $share_email_enabled bool Whether to enable Email sharing button
18
+ * @var $share_whatsapp_enabled bool Whether to enable WhatsApp sharing button (mobile online)
19
+ * @var $share_url_enabled bool Whether to enable share via url
20
+ * @var $share_link_title string Title to use for post (where applicable)
21
+ * @var $share_link_url string Url to share
22
+ * @var $share_summary string Summary to use for sharing on social media
23
+ * @var $share_image_url string Image to use for sharing on social media
24
+ * @var $share_twitter_summary string Summary to use for sharing on Twitter
25
+ * @var $share_facebook_icon string Icon for facebook sharing button
26
+ * @var $share_twitter_icon string Icon for twitter sharing button
27
+ * @var $share_pinterest_icon string Icon for pinterest sharing button
28
+ * @var $share_email_icon string Icon for email sharing button
29
+ * @var $share_whatsapp_icon string Icon for whatsapp sharing button
30
+ * @var $share_whatsapp_url string Sharing url on whatsapp
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
34
+ exit;
35
  } // Exit if accessed directly
36
  ?>
37
 
38
+ <?php do_action( 'yith_wcwl_before_wishlist_share', $wishlist ); ?>
39
 
40
  <div class="yith-wcwl-share">
41
+ <h4 class="yith-wcwl-share-title"><?php echo esc_html( $share_title ); ?></h4>
42
+ <ul>
43
+ <?php if ( $share_facebook_enabled ): ?>
44
+ <li class="share-button">
45
+ <a target="_blank" class="facebook" href="https://www.facebook.com/sharer.php?u=<?php echo urlencode( $share_link_url ); ?>&p[title]=<?php echo esc_attr( $share_link_title ); ?>" title="<?php esc_html_e( 'Facebook', 'yith-woocommerce-wishlist' ); ?>">
46
+ <?php echo $share_facebook_icon ? $share_facebook_icon : esc_html__( 'Facebook', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
47
+ </a>
48
+ </li>
49
+ <?php endif; ?>
50
 
51
+ <?php if ( $share_twitter_enabled ): ?>
52
+ <li class="share-button">
53
+ <a target="_blank" class="twitter" href="https://twitter.com/share?url=<?php echo urlencode( $share_link_url ); ?>&amp;text=<?php echo esc_attr( $share_twitter_summary ); ?>" title="<?php esc_html_e( 'Twitter', 'yith-woocommerce-wishlist' ); ?>">
54
+ <?php echo $share_twitter_icon ? $share_twitter_icon : esc_html__( 'Twitter', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
55
+ </a>
56
+ </li>
57
+ <?php endif; ?>
58
 
59
+ <?php if ( $share_pinterest_enabled ): ?>
60
+ <li class="share-button">
61
+ <a target="_blank" class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode( $share_link_url ); ?>&amp;description=<?php echo esc_attr( $share_summary ); ?>&amp;media=<?php echo esc_attr( $share_image_url ); ?>" title="<?php esc_html_e( 'Pinterest', 'yith-woocommerce-wishlist' ); ?>" onclick="window.open(this.href); return false;">
62
+ <?php echo $share_pinterest_icon ? $share_pinterest_icon : esc_html__( 'Pinterest', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
63
+ </a>
64
+ </li>
65
+ <?php endif; ?>
66
 
67
+ <?php if ( $share_email_enabled ): ?>
68
+ <li class="share-button">
69
+ <a class="email" href="mailto:?subject=<?php echo urlencode( apply_filters( 'yith_wcwl_email_share_subject', $share_link_title ) ); ?>&amp;body=<?php echo esc_attr( apply_filters( 'yith_wcwl_email_share_body', urlencode( $share_link_url ) ) ); ?>&amp;title=<?php echo esc_attr( $share_link_title ); ?>" title="<?php esc_html_e( 'Email', 'yith-woocommerce-wishlist' ); ?>">
70
+ <?php echo $share_email_icon ? $share_email_icon : __( 'Email', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
71
+ </a>
72
+ </li>
73
+ <?php endif; ?>
74
 
75
+ <?php if ( $share_whatsapp_enabled ):
76
+ ?>
77
+ <li class="share-button">
78
+ <a class="whatsapp" href="<?php echo esc_attr( $share_whatsapp_url ); ?>" data-action="share/whatsapp/share" target="_blank" title="<?php esc_html_e( 'WhatsApp', 'yith-woocommerce-wishlist' ); ?>">
79
+ <?php echo $share_whatsapp_icon ? $share_whatsapp_icon : esc_html__( 'Whatsapp', 'yith-woocommerce-wishlist' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
80
+ </a>
81
+ </li>
82
+ <?php endif;
83
+ ?>
84
+ </ul>
85
 
86
+ <?php if ( $share_url_enabled ): ?>
87
+ <div class="yith-wcwl-after-share-section">
88
+ <input class="copy-target" readonly="readonly" type="url" name="yith_wcwl_share_url" id="yith_wcwl_share_url" value="<?php echo esc_attr( $share_link_url ); ?>"/>
89
+ <?php echo ( ! empty( $share_link_url ) ) ? sprintf( '<small>%s <span class="copy-trigger">%s</span> %s</small>', esc_html__( '(Now', 'yith-woocommerce-wishlist' ), esc_html__( 'copy', 'yith-woocommerce-wishlist' ), esc_html__( 'this wishlist link and share it anywhere)', 'yith-woocommerce-wishlist' ) ) : ''; ?>
90
+ </div>
91
+ <?php endif; ?>
92
 
93
+ <?php do_action( 'yith_wcwl_after_share_buttons', $share_link_url, $share_title, $share_link_title ); ?>
94
  </div>
95
 
96
  <?php do_action( 'yith_wcwl_after_wishlist_share', $wishlist ); ?>
templates/wishlist-view-footer-mobile.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Wishlist footer
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
@@ -10,111 +10,111 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $wishlist \YITH_WCWL_Wishlist
14
- * @var $wishlist_token string Current wishlist token
15
- * @var $show_cb bool Whether to show checkbox column
16
- * @var $show_update bool Whether to show update button or not
17
- * @var $is_user_owner bool Whether current user is wishlist owner
18
- * @var $is_private bool Whether current wishlist is private
19
- * @var $share_enabled bool Whether share buttons should appear
20
- * @var $share_atts array Array of options; shows which share links should be shown
21
- * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
22
- * @var $ask_estimate_url string Ask an estimate destination url
23
- * @var $ask_an_estimate_icon string Ask an estimate button icon
24
- * @var $ask_an_estimate_classes string Classes to use for Ask for an estimate button
25
- * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
26
- * @var $enable_add_all_to_cart bool Whether to show "Add all to Cart" button
27
- * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
28
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
29
- * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
30
- * @var $users_wishlists array Array of current user wishlists
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
34
  exit;
35
  } // Exit if accessed directly
36
  ?>
37
- <div class="yith_wcwl_wishlist_footer">
38
- <?php if ( $count && $show_cb ) : ?>
39
- <!-- Bulk actions form -->
40
- <div class="yith_wcwl_wishlist_bulk_action">
41
- <label for="bulk_actions"><?php echo apply_filters( 'yith_wcwl_wishlist_bulk_actions_label', __( 'Apply this action to all the selected items:', 'yith-woocommerce-wishlist' ) ) ?></label>
42
- <select name="bulk_actions" id="bulk_actions">
43
- <option value="add_to_cart"><?php _e( 'Add to cart', 'yith-woocommerce-wishlist' ) ?></option>
44
-
45
- <?php if ( $is_user_owner ): ?>
46
- <option value="delete"><?php _e( 'Remove from wishlist', 'yith-woocommerce-wishlist' ) ?></option>
47
-
48
- <?php if( $available_multi_wishlist && count( $users_wishlists ) > 1 ): ?>
49
- <?php
50
- foreach( $users_wishlists as $wl ):
51
- /**
52
- * @var $wl \YITH_WCWL_Wishlist
53
- */
54
- if( $wl->get_token() == $wishlist_token ){
55
- continue;
56
- }
57
- ?>
58
- <option value="<?php echo esc_attr( $wl->get_token() ) ?>"><?php printf( __( 'Move to %s', 'yith-woocommerce-wishlist' ), $wl->get_formatted_name() ) ?></option>
59
- <?php endforeach; ?>
60
- <?php endif; ?>
61
- <?php endif; ?>
62
- </select>
63
- <input type="submit" name="apply_bulk_actions" value="<?php _e( 'Apply', 'yith-woocommerce-wishlist' ) ?>"/>
64
- </div>
65
- <?php endif; ?>
66
-
67
- <div class="wishlist-actions">
68
- <?php if( $count && $show_update ) : ?>
69
- <!-- Update wishlist button -->
70
- <div class="yith_wcwl_wishlist_update">
71
- <input type="submit" name="update_wishlist" value="<?php _e( 'Update', 'yith-woocommerce-wishlist' ) ?>"/>
72
- </div>
73
- <?php endif; ?>
74
-
75
- <?php if( $count && $enable_add_all_to_cart ): ?>
76
- <!-- Add all to cart button -->
77
- <input type="submit" name="add_all_to_cart" value="<?php _e( 'Add all to cart', 'yith-woocommerce-wishlist' ) ?>" />
78
- <?php endif; ?>
79
- </div>
80
-
81
- <?php if( $count && ( $show_ask_estimate_button || $enable_add_all_to_cart ) ): ?>
82
- <div class="yith_wcwl_footer_additional_action">
83
- <?php if( $count && $show_ask_estimate_button ): ?>
84
- <!-- Ask an estimate button -->
85
- <a href="<?php echo ( $additional_info || ! is_user_logged_in() ) ? '#ask_an_estimate_popup' : $ask_estimate_url ?>" class="<?php echo esc_attr( $ask_an_estimate_classes ) ?> ask-an-estimate-button" <?php echo ( $additional_info ) ? 'data-rel="prettyPhoto[ask_an_estimate]"' : '' ?> >
86
- <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', $ask_an_estimate_icon )?>
87
- <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
88
- </a>
89
- <?php endif; ?>
90
-
91
-
92
- </div>
93
- <?php endif; ?>
94
-
95
- <?php if ( $count && $share_enabled ): ?>
96
- <!-- Sharing section -->
97
- <?php yith_wcwl_get_template( 'share.php', array_merge( $share_atts, array( 'wishlist' => $wishlist ) ) ); ?>
98
- <?php endif; ?>
99
- </div>
100
-
101
- <?php wp_nonce_field( 'yith_wcwl_edit_wishlist_action', 'yith_wcwl_edit_wishlist' ); ?>
102
- <input type="hidden" value="<?php echo $wishlist_token ?>" name="wishlist_id" id="wishlist_id">
103
-
104
- <?php do_action( 'yith_wcwl_after_wishlist', $wishlist ); ?>
105
 
106
  </form>
107
 
108
  <?php do_action( 'yith_wcwl_after_wishlist_form', $wishlist ); ?>
109
 
110
  <?php
111
- if( apply_filters( 'yith_wcwl_ask_an_estimate_conditions', $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ) ){
112
  yith_wcwl_get_template( 'wishlist-popup-ask-an-estimate.php', $var );
113
  }
114
  ?>
115
 
116
  <?php
117
- if( apply_filters( 'yith_wcwl_move_to_another_wishlist_popup_conditions', $move_to_another_wishlist && 'popup' == $move_to_another_wishlist_type && $is_user_owner && $available_multi_wishlist && count( $users_wishlists ) > 1, $wishlist ) ){
118
  yith_wcwl_get_template( 'wishlist-popup-move.php', $var );
119
  }
120
  ?>
2
  /**
3
  * Wishlist footer
4
  *
5
+ * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $wishlist \YITH_WCWL_Wishlist
14
+ * @var $wishlist_token string Current wishlist token
15
+ * @var $show_cb bool Whether to show checkbox column
16
+ * @var $show_update bool Whether to show update button or not
17
+ * @var $is_user_owner bool Whether current user is wishlist owner
18
+ * @var $is_private bool Whether current wishlist is private
19
+ * @var $share_enabled bool Whether share buttons should appear
20
+ * @var $share_atts array Array of options; shows which share links should be shown
21
+ * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
22
+ * @var $ask_estimate_url string Ask an estimate destination url
23
+ * @var $ask_an_estimate_icon string Ask an estimate button icon
24
+ * @var $ask_an_estimate_classes string Classes to use for Ask for an estimate button
25
+ * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
26
+ * @var $enable_add_all_to_cart bool Whether to show "Add all to Cart" button
27
+ * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
28
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
29
+ * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
30
+ * @var $users_wishlists array Array of current user wishlists
31
  */
32
 
33
  if ( ! defined( 'YITH_WCWL' ) ) {
34
  exit;
35
  } // Exit if accessed directly
36
  ?>
37
+ <div class="yith_wcwl_wishlist_footer">
38
+ <?php if ( $count && $show_cb ) : ?>
39
+ <!-- Bulk actions form -->
40
+ <div class="yith_wcwl_wishlist_bulk_action">
41
+ <label for="bulk_actions"><?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_bulk_actions_label', __( 'Apply this action to all the selected items:', 'yith-woocommerce-wishlist' ) ) ); ?></label>
42
+ <select name="bulk_actions" id="bulk_actions">
43
+ <option value="add_to_cart"><?php esc_html_e( 'Add to cart', 'yith-woocommerce-wishlist' ); ?></option>
44
+
45
+ <?php if ( $wishlist->current_user_can( 'remove_from_wishlist' ) ) : ?>
46
+ <option value="delete"><?php esc_html_e( 'Remove from wishlist', 'yith-woocommerce-wishlist' ); ?></option>
47
+ <?php endif; ?>
48
+
49
+ <?php if ( $available_multi_wishlist && count( $users_wishlists ) > 1 && $is_user_owner ) : ?>
50
+ <?php
51
+ foreach ( $users_wishlists as $wl ) :
52
+ /**
53
+ * @var $wl \YITH_WCWL_Wishlist
54
+ */
55
+ if ( $wl->get_token() === $wishlist_token ) {
56
+ continue;
57
+ }
58
+ ?>
59
+ <option value="<?php echo esc_attr( $wl->get_token() ); ?>"><?php echo esc_html( sprintf( __( 'Move to %s', 'yith-woocommerce-wishlist' ), $wl->get_formatted_name() ) ); ?></option>
60
+ <?php endforeach; ?>
61
+ <?php endif; ?>
62
+ </select>
63
+ <input type="submit" name="apply_bulk_actions" value="<?php esc_html_e( 'Apply', 'yith-woocommerce-wishlist' ); ?>"/>
64
+ </div>
65
+ <?php endif; ?>
66
+
67
+ <div class="wishlist-actions">
68
+ <?php if ( $count && $show_update ) : ?>
69
+ <!-- Update wishlist button -->
70
+ <div class="yith_wcwl_wishlist_update">
71
+ <input type="submit" name="update_wishlist" value="<?php esc_html_e( 'Update', 'yith-woocommerce-wishlist' ); ?>"/>
72
+ </div>
73
+ <?php endif; ?>
74
+
75
+ <?php if ( $count && $enable_add_all_to_cart ) : ?>
76
+ <!-- Add all to cart button -->
77
+ <input type="submit" name="add_all_to_cart" value="<?php esc_html_e( 'Add all to cart', 'yith-woocommerce-wishlist' ); ?>"/>
78
+ <?php endif; ?>
79
+ </div>
80
+
81
+ <?php if ( $count && ( $show_ask_estimate_button || $enable_add_all_to_cart ) ) : ?>
82
+ <div class="yith_wcwl_footer_additional_action">
83
+ <?php if ( $count && $show_ask_estimate_button ) : ?>
84
+ <!-- Ask an estimate button -->
85
+ <a href="<?php echo ( $additional_info || ! is_user_logged_in() ) ? '#ask_an_estimate_popup' : esc_url( $ask_estimate_url ); ?>" class="<?php echo esc_attr( $ask_an_estimate_classes ); ?> ask-an-estimate-button" <?php echo ( $additional_info ) ? 'data-rel="prettyPhoto[ask_an_estimate]"' : ''; ?> >
86
+ <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', $ask_an_estimate_icon ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
87
+ <?php echo esc_html( apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ); ?>
88
+ </a>
89
+ <?php endif; ?>
90
+
91
+
92
+ </div>
93
+ <?php endif; ?>
94
+
95
+ <?php if ( $count && $share_enabled ) : ?>
96
+ <!-- Sharing section -->
97
+ <?php yith_wcwl_get_template( 'share.php', array_merge( $share_atts, array( 'wishlist' => $wishlist ) ) ); ?>
98
+ <?php endif; ?>
99
+ </div>
100
+
101
+ <?php wp_nonce_field( 'yith_wcwl_edit_wishlist_action', 'yith_wcwl_edit_wishlist' ); ?>
102
+ <input type="hidden" value="<?php echo esc_attr( $wishlist_token ); ?>" name="wishlist_id" id="wishlist_id">
103
+
104
+ <?php do_action( 'yith_wcwl_after_wishlist', $wishlist ); ?>
105
 
106
  </form>
107
 
108
  <?php do_action( 'yith_wcwl_after_wishlist_form', $wishlist ); ?>
109
 
110
  <?php
111
+ if ( apply_filters( 'yith_wcwl_ask_an_estimate_conditions', $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ) ) {
112
  yith_wcwl_get_template( 'wishlist-popup-ask-an-estimate.php', $var );
113
  }
114
  ?>
115
 
116
  <?php
117
+ if ( apply_filters( 'yith_wcwl_move_to_another_wishlist_popup_conditions', $move_to_another_wishlist && 'popup' === $move_to_another_wishlist_type && $available_multi_wishlist && count( $users_wishlists ) > 1, $wishlist ) ) {
118
  yith_wcwl_get_template( 'wishlist-popup-move.php', $var );
119
  }
120
  ?>
templates/wishlist-view-footer.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Wishlist footer
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
@@ -10,110 +10,110 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $wishlist \YITH_WCWL_Wishlist
14
- * @var $wishlist_token string Current wishlist token
15
- * @var $show_cb bool Whether to show checkbox column
16
- * @var $show_update bool Whether to show update button or not
17
- * @var $is_user_owner bool Whether current user is wishlist owner
18
- * @var $is_private bool Whether current wishlist is private
19
- * @var $share_enabled bool Whether share buttons should appear
20
- * @var $share_atts array Array of options; shows which share links should be shown
21
- * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
22
- * @var $ask_estimate_url string Ask an estimate destination url
23
- * @var $ask_an_estimate_icon string Ask an estimate button icon
24
- * @var $ask_an_estimate_text string Ask an estimate button text
25
- * @var $ask_an_estimate_classes string Classes to use for Ask for an estimate button
26
- * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
27
- * @var $enable_add_all_to_cart bool Whether to show "Add all to Cart" button
28
- * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
29
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
30
- * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
31
- * @var $users_wishlists array Array of current user wishlists
32
  */
33
 
34
  if ( ! defined( 'YITH_WCWL' ) ) {
35
  exit;
36
  } // Exit if accessed directly
37
  ?>
38
- <div class="yith_wcwl_wishlist_footer">
39
- <?php if ( $count && $show_cb ) : ?>
40
- <!-- Bulk actions form -->
41
- <div class="yith_wcwl_wishlist_bulk_action">
42
- <label for="bulk_actions"><?php echo apply_filters( 'yith_wcwl_wishlist_bulk_actions_label', __( 'Apply this action to all the selected items:', 'yith-woocommerce-wishlist' ) ) ?></label>
43
- <select name="bulk_actions" id="bulk_actions">
44
- <option value="add_to_cart"><?php _e( 'Add to cart', 'yith-woocommerce-wishlist' ) ?></option>
45
-
46
- <?php if ( $is_user_owner ): ?>
47
- <option value="delete"><?php _e( 'Remove from wishlist', 'yith-woocommerce-wishlist' ) ?></option>
48
-
49
- <?php if( $available_multi_wishlist && count( $users_wishlists ) > 1 ): ?>
50
- <?php
51
- foreach( $users_wishlists as $wl ):
52
- /**
53
- * @var $wl \YITH_WCWL_Wishlist
54
- */
55
- if( $wl->get_token() == $wishlist_token ){
56
- continue;
57
- }
58
- ?>
59
- <option value="<?php echo esc_attr( $wl->get_token() ) ?>"><?php printf( __( 'Move to %s', 'yith-woocommerce-wishlist' ), $wl->get_formatted_name() ) ?></option>
60
- <?php endforeach; ?>
61
- <?php endif; ?>
62
- <?php endif; ?>
63
- </select>
64
- <input type="submit" name="apply_bulk_actions" value="<?php _e( 'Apply', 'yith-woocommerce-wishlist' ) ?>"/>
65
- </div>
66
- <?php endif; ?>
67
-
68
-
69
- <?php if( $count && $show_update ) : ?>
70
- <!-- Update wishlist button -->
71
- <div class="yith_wcwl_wishlist_update">
72
- <input type="submit" name="update_wishlist" value="<?php _e( 'Update', 'yith-woocommerce-wishlist' ) ?>"/>
73
- </div>
74
- <?php endif; ?>
75
-
76
-
77
- <?php if ( $count && $share_enabled ): ?>
78
- <!-- Sharing section -->
79
- <?php yith_wcwl_get_template( 'share.php', array_merge( $share_atts, array( 'wishlist' => $wishlist ) ) ); ?>
80
- <?php endif; ?>
81
-
82
- <?php if( $count && ( $show_ask_estimate_button || $enable_add_all_to_cart ) ): ?>
83
- <div class="yith_wcwl_footer_additional_action">
84
- <?php if( $count && $show_ask_estimate_button ): ?>
85
- <!-- Ask an estimate button -->
86
- <a href="<?php echo ( $additional_info || ! is_user_logged_in() ) ? '#ask_an_estimate_popup' : $ask_estimate_url ?>" class="<?php echo esc_attr( $ask_an_estimate_classes ) ?> ask-an-estimate-button" <?php echo ( $additional_info ) ? 'data-rel="prettyPhoto[ask_an_estimate]"' : '' ?> >
87
- <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', $ask_an_estimate_icon )?>
88
- <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', $ask_an_estimate_text ) ?>
89
- </a>
90
- <?php endif; ?>
91
-
92
- <?php if( $count && $enable_add_all_to_cart ): ?>
93
- <!-- Add all to cart button -->
94
- <input type="submit" name="add_all_to_cart" value="<?php _e( 'Add all to cart', 'yith-woocommerce-wishlist' ) ?>" />
95
- <?php endif; ?>
96
- </div>
97
- <?php endif; ?>
98
- </div>
99
-
100
- <?php wp_nonce_field( 'yith_wcwl_edit_wishlist_action', 'yith_wcwl_edit_wishlist' ); ?>
101
- <input type="hidden" value="<?php echo $wishlist_token ?>" name="wishlist_id" id="wishlist_id">
102
-
103
- <?php do_action( 'yith_wcwl_after_wishlist', $wishlist ); ?>
104
 
105
  </form>
106
 
107
  <?php do_action( 'yith_wcwl_after_wishlist_form', $wishlist ); ?>
108
 
109
  <?php
110
- if( apply_filters( 'yith_wcwl_ask_an_estimate_conditions', $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ) ){
111
  yith_wcwl_get_template( 'wishlist-popup-ask-an-estimate.php', $var );
112
  }
113
  ?>
114
 
115
  <?php
116
- if( apply_filters( 'yith_wcwl_move_to_another_wishlist_popup_conditions', $move_to_another_wishlist && 'popup' == $move_to_another_wishlist_type && $is_user_owner && $available_multi_wishlist && count( $users_wishlists ) > 1, $wishlist ) ){
117
  yith_wcwl_get_template( 'wishlist-popup-move.php', $var );
118
  }
119
  ?>
2
  /**
3
  * Wishlist footer
4
  *
5
+ * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $wishlist \YITH_WCWL_Wishlist
14
+ * @var $wishlist_token string Current wishlist token
15
+ * @var $show_cb bool Whether to show checkbox column
16
+ * @var $show_update bool Whether to show update button or not
17
+ * @var $is_user_owner bool Whether current user is wishlist owner
18
+ * @var $is_private bool Whether current wishlist is private
19
+ * @var $share_enabled bool Whether share buttons should appear
20
+ * @var $share_atts array Array of options; shows which share links should be shown
21
+ * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
22
+ * @var $ask_estimate_url string Ask an estimate destination url
23
+ * @var $ask_an_estimate_icon string Ask an estimate button icon
24
+ * @var $ask_an_estimate_text string Ask an estimate button text
25
+ * @var $ask_an_estimate_classes string Classes to use for Ask for an estimate button
26
+ * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
27
+ * @var $enable_add_all_to_cart bool Whether to show "Add all to Cart" button
28
+ * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
29
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
30
+ * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
31
+ * @var $users_wishlists array Array of current user wishlists
32
  */
33
 
34
  if ( ! defined( 'YITH_WCWL' ) ) {
35
  exit;
36
  } // Exit if accessed directly
37
  ?>
38
+ <div class="yith_wcwl_wishlist_footer">
39
+ <?php if ( $count && $show_cb ) : ?>
40
+ <!-- Bulk actions form -->
41
+ <div class="yith_wcwl_wishlist_bulk_action">
42
+ <label for="bulk_actions"><?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_bulk_actions_label', __( 'Apply this action to all the selected items:', 'yith-woocommerce-wishlist' ) ) ); ?></label>
43
+ <select name="bulk_actions" id="bulk_actions">
44
+ <option value="add_to_cart"><?php esc_html_e( 'Add to cart', 'yith-woocommerce-wishlist' ); ?></option>
45
+
46
+ <?php if ( $wishlist->current_user_can( 'remove_from_wishlist' ) ): ?>
47
+ <option value="delete"><?php esc_html_e( 'Remove from wishlist', 'yith-woocommerce-wishlist' ); ?></option>
48
+ <?php endif; ?>
49
+
50
+ <?php if ( $available_multi_wishlist && count( $users_wishlists ) > 1 && $is_user_owner ): ?>
51
+ <?php
52
+ foreach ( $users_wishlists as $wl ):
53
+ /**
54
+ * @var $wl \YITH_WCWL_Wishlist
55
+ */
56
+ if ( $wl->get_token() == $wishlist_token ) {
57
+ continue;
58
+ }
59
+ ?>
60
+ <option value="<?php echo esc_attr( $wl->get_token() ); ?>"><?php echo esc_html( sprintf( __( 'Move to %s', 'yith-woocommerce-wishlist' ), $wl->get_formatted_name() ) ); ?></option>
61
+ <?php endforeach; ?>
62
+ <?php endif; ?>
63
+ </select>
64
+ <input type="submit" name="apply_bulk_actions" value="<?php esc_html_e( 'Apply', 'yith-woocommerce-wishlist' ); ?>"/>
65
+ </div>
66
+ <?php endif; ?>
67
+
68
+
69
+ <?php if ( $count && $show_update ) : ?>
70
+ <!-- Update wishlist button -->
71
+ <div class="yith_wcwl_wishlist_update">
72
+ <input type="submit" name="update_wishlist" value="<?php esc_html_e( 'Update', 'yith-woocommerce-wishlist' ); ?>"/>
73
+ </div>
74
+ <?php endif; ?>
75
+
76
+
77
+ <?php if ( $count && $share_enabled ): ?>
78
+ <!-- Sharing section -->
79
+ <?php yith_wcwl_get_template( 'share.php', array_merge( $share_atts, array( 'wishlist' => $wishlist ) ) ); ?>
80
+ <?php endif; ?>
81
+
82
+ <?php if ( $count && ( $show_ask_estimate_button || $enable_add_all_to_cart ) ): ?>
83
+ <div class="yith_wcwl_footer_additional_action">
84
+ <?php if ( $count && $show_ask_estimate_button ): ?>
85
+ <!-- Ask an estimate button -->
86
+ <a href="<?php echo ( $additional_info || ! is_user_logged_in() ) ? '#ask_an_estimate_popup' : esc_url( $ask_estimate_url ); ?>" class="<?php echo esc_attr( $ask_an_estimate_classes ); ?> ask-an-estimate-button" <?php echo $additional_info ? 'data-rel="prettyPhoto[ask_an_estimate]"' : '' ?> >
87
+ <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', $ask_an_estimate_icon ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
88
+ <?php echo esc_html( apply_filters( 'yith_wcwl_ask_an_estimate_text', $ask_an_estimate_text ) ); ?>
89
+ </a>
90
+ <?php endif; ?>
91
+
92
+ <?php if ( $count && $enable_add_all_to_cart ): ?>
93
+ <!-- Add all to cart button -->
94
+ <input type="submit" name="add_all_to_cart" value="<?php esc_html_e( 'Add all to cart', 'yith-woocommerce-wishlist' ); ?>"/>
95
+ <?php endif; ?>
96
+ </div>
97
+ <?php endif; ?>
98
+ </div>
99
+
100
+ <?php wp_nonce_field( 'yith_wcwl_edit_wishlist_action', 'yith_wcwl_edit_wishlist' ); ?>
101
+ <input type="hidden" value="<?php echo esc_attr( $wishlist_token ); ?>" name="wishlist_id" id="wishlist_id">
102
+
103
+ <?php do_action( 'yith_wcwl_after_wishlist', $wishlist ); ?>
104
 
105
  </form>
106
 
107
  <?php do_action( 'yith_wcwl_after_wishlist_form', $wishlist ); ?>
108
 
109
  <?php
110
+ if ( apply_filters( 'yith_wcwl_ask_an_estimate_conditions', $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ) ) {
111
  yith_wcwl_get_template( 'wishlist-popup-ask-an-estimate.php', $var );
112
  }
113
  ?>
114
 
115
  <?php
116
+ if ( apply_filters( 'yith_wcwl_move_to_another_wishlist_popup_conditions', $move_to_another_wishlist && 'popup' == $move_to_another_wishlist_type && $available_multi_wishlist && count( $users_wishlists ) > 1, $wishlist ) ) {
117
  yith_wcwl_get_template( 'wishlist-popup-move.php', $var );
118
  }
119
  ?>
templates/wishlist-view-header.php CHANGED
@@ -12,6 +12,7 @@
12
  *
13
  * @var $wishlist \YITH_WCWL_Wishlist Current wishlist
14
  * @var $is_custom_list bool Whether current wishlist is custom
 
15
  * @var $form_action string Action for the wishlist form
16
  * @var $page_title string Page title
17
  * @var $fragment_options array Array of items to use for fragment generation
@@ -24,35 +25,35 @@ if ( ! defined( 'YITH_WCWL' ) ) {
24
 
25
  <?php do_action( 'yith_wcwl_before_wishlist_form', $wishlist ); ?>
26
 
27
- <form id="yith-wcwl-form" action="<?php echo $form_action ?>" method="post" class="woocommerce yith-wcwl-form wishlist-fragment" data-fragment-options="<?php echo esc_attr( json_encode( $fragment_options ) )?>">
28
 
29
  <!-- TITLE -->
30
  <?php
31
  do_action( 'yith_wcwl_before_wishlist_title', $wishlist );
32
 
33
- if( ! empty( $page_title ) ) :
34
  ?>
35
- <div class="wishlist-title <?php echo ( $is_custom_list ) ? 'wishlist-title-with-form' : ''?>">
36
- <?php echo apply_filters( 'yith_wcwl_wishlist_title', '<h2>' . $page_title . '</h2>' ); ?>
37
- <?php if( $is_custom_list ): ?>
38
  <a class="btn button show-title-form">
39
- <?php echo apply_filters( 'yith_wcwl_edit_title_icon', '<i class="fa fa-pencil"></i>' )?>
40
- <?php _e( 'Edit title', 'yith-woocommerce-wishlist' ) ?>
41
  </a>
42
  <?php endif; ?>
43
  </div>
44
- <?php if( $is_custom_list ): ?>
45
- <div class="hidden-title-form">
46
- <input type="text" value="<?php echo $page_title ?>" name="wishlist_name"/>
47
- <input type="submit" name="save_title" value="<?php _e( 'Save', 'yith-woocommerce-wishlist' )?>" />
48
- <a class="hide-title-form btn button">
49
- <?php echo apply_filters( 'yith_wcwl_cancel_wishlist_title_icon', '<i class="fa fa-remove"></i>' )?>
50
- <?php _e( 'Cancel', 'yith-woocommerce-wishlist' )?>
51
- </a>
52
- </div>
53
- <?php endif; ?>
54
  <?php
55
  endif;
56
 
57
- do_action( 'yith_wcwl_before_wishlist', $wishlist);
58
  ?>
12
  *
13
  * @var $wishlist \YITH_WCWL_Wishlist Current wishlist
14
  * @var $is_custom_list bool Whether current wishlist is custom
15
+ * @var $can_user_edit_title bool Whether current user can edit title
16
  * @var $form_action string Action for the wishlist form
17
  * @var $page_title string Page title
18
  * @var $fragment_options array Array of items to use for fragment generation
25
 
26
  <?php do_action( 'yith_wcwl_before_wishlist_form', $wishlist ); ?>
27
 
28
+ <form id="yith-wcwl-form" action="<?php echo esc_attr( $form_action ); ?>" method="post" class="woocommerce yith-wcwl-form wishlist-fragment" data-fragment-options="<?php echo esc_attr( json_encode( $fragment_options ) ); ?>">
29
 
30
  <!-- TITLE -->
31
  <?php
32
  do_action( 'yith_wcwl_before_wishlist_title', $wishlist );
33
 
34
+ if ( ! empty( $page_title ) ) :
35
  ?>
36
+ <div class="wishlist-title <?php echo ( $can_user_edit_title ) ? 'wishlist-title-with-form' : ''; ?>">
37
+ <?php echo apply_filters( 'yith_wcwl_wishlist_title', '<h2>' . esc_html( $page_title ) . '</h2>' ); ?>
38
+ <?php if( $can_user_edit_title ): ?>
39
  <a class="btn button show-title-form">
40
+ <?php echo apply_filters( 'yith_wcwl_edit_title_icon', '<i class="fa fa-pencil"></i>' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
41
+ <?php esc_html_e( 'Edit title', 'yith-woocommerce-wishlist' ); ?>
42
  </a>
43
  <?php endif; ?>
44
  </div>
45
+ <?php if ( $can_user_edit_title ) : ?>
46
+ <div class="hidden-title-form">
47
+ <input type="text" value="<?php echo esc_attr( $page_title ); ?>" name="wishlist_name"/>
48
+ <input type="submit" name="save_title" value="<?php esc_html_e( 'Save', 'yith-woocommerce-wishlist' ); ?>" />
49
+ <a class="hide-title-form btn button">
50
+ <?php echo apply_filters( 'yith_wcwl_cancel_wishlist_title_icon', '<i class="fa fa-remove"></i>' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
51
+ <?php esc_html_e( 'Cancel', 'yith-woocommerce-wishlist' ); ?>
52
+ </a>
53
+ </div>
54
+ <?php endif; ?>
55
  <?php
56
  endif;
57
 
58
+ do_action( 'yith_wcwl_before_wishlist', $wishlist );
59
  ?>
templates/wishlist-view-mobile.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Wishlist page template - Standard Layout
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
@@ -10,33 +10,33 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $wishlist \YITH_WCWL_Wishlist Current wishlist
14
- * @var $wishlist_items array Array of items to show for current page
15
- * @var $wishlist_token string Current wishlist token
16
- * @var $wishlist_id int Current wishlist id
17
- * @var $users_wishlists array Array of current user wishlists
18
- * @var $current_page int Current page
19
- * @var $page_links array Array of page links
20
- * @var $is_user_owner bool Whether current user is wishlist owner
21
- * @var $show_price bool Whether to show price column
22
- * @var $show_dateadded bool Whether to show item date of addition
23
- * @var $show_stock_status bool Whether to show product stock status
24
- * @var $show_add_to_cart bool Whether to show Add to Cart button
25
- * @var $show_remove_product bool Whether to show Remove button
26
- * @var $show_price_variations bool Whether to show price variation over time
27
- * @var $show_variation bool Whether to show variation attributes when possible
28
- * @var $show_cb bool Whether to show checkbox column
29
- * @var $show_quantity bool Whether to show input quantity or not
30
- * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
31
- * @var $show_last_column bool Whether to show last column (calculated basing on previous flags)
32
- * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
33
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
34
- * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
35
- * @var $price_excl_tax bool Whether to show price excluding taxes
36
- * @var $enable_drag_n_drop bool Whether to enable drag n drop feature
37
- * @var $repeat_remove_button bool Whether to repeat remove button in last column
38
- * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
39
- * @var $no_interactions bool
40
  */
41
 
42
  if ( ! defined( 'YITH_WCWL' ) ) {
@@ -45,201 +45,208 @@ if ( ! defined( 'YITH_WCWL' ) ) {
45
  ?>
46
 
47
  <!-- WISHLIST MOBILE -->
48
- <ul class="shop_table cart wishlist_table wishlist_view responsive mobile <?php echo $show_cb ? 'with-checkbox' : '' ?>" data-pagination="<?php echo esc_attr( $pagination )?>" data-per-page="<?php echo esc_attr( $per_page )?>" data-page="<?php echo esc_attr( $current_page )?>" data-id="<?php echo $wishlist_id ?>" data-token="<?php echo $wishlist_token ?>">
49
- <?php
50
- if( $wishlist && $wishlist->has_items() ) :
51
- foreach( $wishlist_items as $item ) :
52
- /**
53
- * @var $item \YITH_WCWL_Wishlist_Item
54
- */
55
- global $product;
56
-
57
- $product = $item->get_product();
58
- $availability = $product->get_availability();
59
- $stock_status = isset( $availability['class'] ) ? $availability['class'] : false;
60
-
61
- if( $product && $product->exists() ) :
62
- ?>
63
- <li id="yith-wcwl-row-<?php echo $item->get_product_id() ?>" data-row-id="<?php echo $item->get_product_id() ?>">
64
- <?php if( $show_cb ) : ?>
65
- <div class="product-checkbox">
66
- <input type="checkbox" value="yes" name="items[<?php echo esc_attr( $item->get_product_id() ) ?>][cb]" />
67
- </div>
68
- <?php endif ?>
69
-
70
- <div class="item-wrapper">
71
- <div class="product-thumbnail">
72
- <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ) ?>">
73
- <?php echo $product->get_image() ?>
74
- </a>
75
- </div>
76
-
77
- <div class="item-details">
78
- <div class="product-name">
79
- <h3><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></h3>
80
- <?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
81
- </div>
82
-
83
- <?php if( $show_variation || $show_dateadded || $show_price ): ?>
84
- <table class="item-details-table">
85
-
86
- <?php if( $show_variation && $product->is_type( 'variation' ) ): ?>
87
- <?php
88
- /**
89
- * @var $product \WC_Product_Variation
90
- */
91
- $attributes = $product->get_attributes();
92
-
93
- if( ! empty( $attributes ) ):
94
- foreach( $attributes as $name => $value ):
95
- if( ! taxonomy_exists( $name ) ){
96
- continue;
97
- }
98
-
99
- $term = get_term_by( 'slug', $value, $name );
100
-
101
- if ( ! is_wp_error( $term ) && ! empty( $term->name ) ) {
102
- $value = $term->name;
103
- }
104
- ?>
105
- <tr>
106
- <td class="label">
107
- <?php echo wc_attribute_label( $name, $product ) ?>:
108
- </td>
109
- <td class="value">
110
- <?php echo rawurldecode( $value ) ?>
111
- </td>
112
- </tr>
113
- <?php
114
- endforeach;
115
- endif;
116
- ?>
117
- <?php endif; ?>
118
-
119
- <?php if( $show_dateadded && $item->get_date_added() ): ?>
120
- <tr>
121
- <td class="label">
122
- <?php _e( 'Added on:', 'yith-woocommerce-wishlist' ) ?>
123
- </td>
124
- <td class="value">
125
- <?php echo $item->get_date_added_formatted() ?>
126
- </td>
127
- </tr>
128
- <?php endif; ?>
129
-
130
- <?php if( $show_price || $show_price_variations ) : ?>
131
- <tr>
132
- <td class="label">
133
- <?php _e( 'Price:', 'yith-woocommerce-wishlist' ) ?>
134
- </td>
135
- <td class="value">
136
- <?php
137
- if( $show_price ) {
138
- echo $item->get_formatted_product_price();
139
- }
140
-
141
- if( $show_price_variations ){
142
- echo $item->get_price_variation();
143
- }
144
- ?>
145
- </td>
146
- </tr>
147
- <?php endif ?>
148
-
149
- </table>
150
- <?php endif; ?>
151
- </div>
152
- </div>
153
-
154
- <div class="additional-info-wrapper">
155
- <?php if( $show_quantity || $show_stock_status ): ?>
156
- <table class="additional-info">
157
- <?php if( $show_quantity ) : ?>
158
- <tr>
159
- <td class="label">
160
- <?php _e( 'Quantity:', 'yith-woocommerce-wishlist' ) ?>
161
- </td>
162
- <td class="value">
163
- <?php if( ! $no_interactions && $is_user_owner ): ?>
164
- <input type="number" min="1" step="1" name="items[<?php echo esc_attr( $item->get_product_id() )?>][quantity]" value="<?php echo esc_attr( $item->get_quantity() )?>" />
165
- <?php else: ?>
166
- <?php echo $item->get_quantity() ?>
167
- <?php endif; ?>
168
- </td>
169
- </tr>
170
- <?php endif;?>
171
-
172
- <?php if( $show_stock_status ) : ?>
173
- <tr>
174
- <td class="label">
175
- <?php _e( 'Stock:', 'yith-woocommerce-wishlist' ) ?>
176
- </td>
177
- <td class="value">
178
- <?php echo $stock_status == 'out-of-stock' ? '<span class="wishlist-out-of-stock">' . __( 'Out of stock', 'yith-woocommerce-wishlist' ) . '</span>' : '<span class="wishlist-in-stock">' . __( 'In Stock', 'yith-woocommerce-wishlist' ) . '</span>'; ?>
179
- </td>
180
- </tr>
181
- <?php endif ?>
182
- </table>
183
- <?php endif; ?>
184
-
185
- <!-- Add to cart button -->
186
- <?php if( $show_add_to_cart && isset( $stock_status ) && $stock_status != 'out-of-stock' ): ?>
187
- <div class="product-add-to-cart">
188
- <?php woocommerce_template_loop_add_to_cart( array( 'quantity' => $show_quantity ? $item->get_quantity() : 1 ) ); ?>
189
- </div>
190
- <?php endif ?>
191
-
192
- <!-- Change wishlist -->
193
- <?php if( $move_to_another_wishlist && $available_multi_wishlist && count( $users_wishlists ) > 1 ): ?>
194
- <div class="move-to-another-wishlist">
195
- <?php if( 'select' == $move_to_another_wishlist_type ): ?>
196
- <select class="change-wishlist selectBox">
197
- <option value=""><?php _e( 'Move', 'yith-woocommerce-wishlist' ) ?></option>
198
- <?php
199
- foreach( $users_wishlists as $wl ):
200
- /**
201
- * @var $wl \YITH_WCWL_Wishlist
202
- */
203
- if( $wl->get_token() == $wishlist_token ){
204
- continue;
205
- }
206
- ?>
207
- <option value="<?php echo esc_attr( $wl->get_token() ) ?>">
208
- <?php echo sprintf( '%s - %s', $wl->get_formatted_name(), $wl->get_formatted_privacy() ); ?>
209
- </option>
210
- <?php
211
- endforeach;
212
- ?>
213
- </select>
214
- <?php else: ?>
215
- <a href="#move_to_another_wishlist" class="move-to-another-wishlist-button" data-rel="prettyPhoto[move_to_another_wishlist]">
216
- <?php echo apply_filters( 'yith_wcwl_move_to_another_list_label', __( 'Move to another list &rsaquo;', 'yith-woocommerce-wishlist' ) ) ?>
217
- </a>
218
- <?php endif; ?>
219
- </div>
220
- <?php endif; ?>
221
-
222
- <?php if( $show_remove_product ): ?>
223
- <div class="product-remove">
224
- <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item->get_product_id() ) ) ?>" class="remove_from_wishlist" title="<?php echo apply_filters( 'yith_wcwl_remove_product_wishlist_message_title', __( 'Remove this product', 'yith-woocommerce-wishlist' ) ); ?>"><i class="fa fa-trash"></i></a>
225
- </div>
226
- <?php endif; ?>
227
- </div>
228
- </li>
229
- <?php
230
- endif;
231
- endforeach;
232
- else: ?>
233
- <p class="wishlist-empty">
234
- <?php echo apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No products added to the wishlist', 'yith-woocommerce-wishlist' ) ) ?>
235
- </p>
236
- <?php
237
- endif;
238
-
239
- if( ! empty( $page_links ) ) : ?>
240
- <p class="pagination-row">
241
- <?php echo $page_links ?>
242
- </p>
243
- <?php endif ?>
244
-
245
- </ul>
 
 
 
 
 
 
 
2
  /**
3
  * Wishlist page template - Standard Layout
4
  *
5
+ * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $wishlist \YITH_WCWL_Wishlist Current wishlist
14
+ * @var $wishlist_items array Array of items to show for current page
15
+ * @var $wishlist_token string Current wishlist token
16
+ * @var $wishlist_id int Current wishlist id
17
+ * @var $users_wishlists array Array of current user wishlists
18
+ * @var $current_page int Current page
19
+ * @var $page_links array Array of page links
20
+ * @var $is_user_owner bool Whether current user is wishlist owner
21
+ * @var $show_price bool Whether to show price column
22
+ * @var $show_dateadded bool Whether to show item date of addition
23
+ * @var $show_stock_status bool Whether to show product stock status
24
+ * @var $show_add_to_cart bool Whether to show Add to Cart button
25
+ * @var $show_remove_product bool Whether to show Remove button
26
+ * @var $show_price_variations bool Whether to show price variation over time
27
+ * @var $show_variation bool Whether to show variation attributes when possible
28
+ * @var $show_cb bool Whether to show checkbox column
29
+ * @var $show_quantity bool Whether to show input quantity or not
30
+ * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
31
+ * @var $show_last_column bool Whether to show last column (calculated basing on previous flags)
32
+ * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
33
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
34
+ * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
35
+ * @var $price_excl_tax bool Whether to show price excluding taxes
36
+ * @var $enable_drag_n_drop bool Whether to enable drag n drop feature
37
+ * @var $repeat_remove_button bool Whether to repeat remove button in last column
38
+ * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
39
+ * @var $no_interactions bool
40
  */
41
 
42
  if ( ! defined( 'YITH_WCWL' ) ) {
45
  ?>
46
 
47
  <!-- WISHLIST MOBILE -->
48
+ <ul class="shop_table cart wishlist_table wishlist_view responsive mobile <?php echo $show_cb ? 'with-checkbox' : ''; ?>" data-pagination="<?php echo esc_attr( $pagination ); ?>" data-per-page="<?php echo esc_attr( $per_page ); ?>" data-page="<?php echo esc_attr( $current_page ); ?>" data-id="<?php echo esc_attr( $wishlist_id ); ?>" data-token="<?php echo esc_attr( $wishlist_token ); ?>">
49
+ <?php
50
+ if ( $wishlist && $wishlist->has_items() ) :
51
+ foreach ( $wishlist_items as $item ) :
52
+ /**
53
+ * @var $item \YITH_WCWL_Wishlist_Item
54
+ */
55
+ global $product;
56
+
57
+ $product = $item->get_product();
58
+ $availability = $product->get_availability();
59
+ $stock_status = isset( $availability['class'] ) ? $availability['class'] : false;
60
+
61
+ if ( $product && $product->exists() ) :
62
+ ?>
63
+ <li id="yith-wcwl-row-<?php echo esc_attr( $item->get_product_id() ); ?>" data-row-id="<?php echo esc_attr( $item->get_product_id() ); ?>">
64
+ <?php if ( $show_cb ) : ?>
65
+ <div class="product-checkbox">
66
+ <input type="checkbox" value="yes" name="items[<?php echo esc_attr( $item->get_product_id() ); ?>][cb]"/>
67
+ </div>
68
+ <?php endif ?>
69
+
70
+ <div class="item-wrapper">
71
+ <div class="product-thumbnail">
72
+ <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ); ?>">
73
+ <?php echo $product->get_image(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
74
+ </a>
75
+ </div>
76
+
77
+ <div class="item-details">
78
+ <div class="product-name">
79
+ <h3><?php echo esc_html( apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ); ?></h3>
80
+ <?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
81
+ </div>
82
+
83
+ <?php if ( $show_variation || $show_dateadded || $show_price ): ?>
84
+ <table class="item-details-table">
85
+
86
+ <?php if ( $show_variation && $product->is_type( 'variation' ) ): ?>
87
+ <?php
88
+ /**
89
+ * @var $product \WC_Product_Variation
90
+ */
91
+ $attributes = $product->get_attributes();
92
+
93
+ if ( ! empty( $attributes ) ):
94
+ foreach ( $attributes as $name => $value ):
95
+ if ( ! taxonomy_exists( $name ) ) {
96
+ continue;
97
+ }
98
+
99
+ $term = get_term_by( 'slug', $value, $name );
100
+
101
+ if ( ! is_wp_error( $term ) && ! empty( $term->name ) ) {
102
+ $value = $term->name;
103
+ }
104
+ ?>
105
+ <tr>
106
+ <td class="label">
107
+ <?php echo esc_attr( wc_attribute_label( $name, $product ) ); ?>:
108
+ </td>
109
+ <td class="value">
110
+ <?php echo esc_attr( rawurldecode( $value ) ); ?>
111
+ </td>
112
+ </tr>
113
+ <?php
114
+ endforeach;
115
+ endif;
116
+ ?>
117
+ <?php endif; ?>
118
+
119
+ <?php if ( $show_dateadded && $item->get_date_added() ): ?>
120
+ <tr>
121
+ <td class="label">
122
+ <?php esc_html_e( 'Added on:', 'yith-woocommerce-wishlist' ); ?>
123
+ </td>
124
+ <td class="value">
125
+ <?php echo esc_html( $item->get_date_added_formatted() ); ?>
126
+ </td>
127
+ </tr>
128
+ <?php endif; ?>
129
+
130
+ <?php if ( $show_price || $show_price_variations ) : ?>
131
+ <tr>
132
+ <td class="label">
133
+ <?php esc_html_e( 'Price:', 'yith-woocommerce-wishlist' ); ?>
134
+ </td>
135
+ <td class="value">
136
+ <?php
137
+ if ( $show_price ) {
138
+ echo $item->get_formatted_product_price(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
139
+ }
140
+
141
+ if ( $show_price_variations ) {
142
+ echo $item->get_price_variation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
143
+ }
144
+ ?>
145
+ </td>
146
+ </tr>
147
+ <?php endif ?>
148
+
149
+ </table>
150
+ <?php endif; ?>
151
+ </div>
152
+ </div>
153
+
154
+ <div class="additional-info-wrapper">
155
+ <?php if ( $show_quantity || $show_stock_status ): ?>
156
+ <table class="additional-info">
157
+ <?php if ( $show_quantity ) : ?>
158
+ <tr>
159
+ <td class="label">
160
+ <?php esc_html_e( 'Quantity:', 'yith-woocommerce-wishlist' ); ?>
161
+ </td>
162
+ <td class="value">
163
+ <?php if ( ! $no_interactions && $wishlist->current_user_can( 'update_quantity' ) ): ?>
164
+ <input type="number" min="1" step="1" name="items[<?php echo esc_attr( $item->get_product_id() ); ?>][quantity]" value="<?php echo esc_attr( $item->get_quantity() ); ?>"/>
165
+ <?php else: ?>
166
+ <?php echo esc_html( $item->get_quantity() ); ?>
167
+ <?php endif; ?>
168
+ </td>
169
+ </tr>
170
+ <?php endif; ?>
171
+
172
+ <?php if ( $show_stock_status ) : ?>
173
+ <tr>
174
+ <td class="label">
175
+ <?php esc_html_e( 'Stock:', 'yith-woocommerce-wishlist' ) ?>
176
+ </td>
177
+ <td class="value">
178
+ <?php echo $stock_status === 'out-of-stock' ? '<span class="wishlist-out-of-stock">' . esc_html__( 'Out of stock', 'yith-woocommerce-wishlist' ) . '</span>' : '<span class="wishlist-in-stock">' . esc_html__( 'In Stock', 'yith-woocommerce-wishlist' ) . '</span>'; ?>
179
+ </td>
180
+ </tr>
181
+ <?php endif ?>
182
+ </table>
183
+ <?php endif; ?>
184
+
185
+ <!-- Add to cart button -->
186
+ <?php if ( $show_add_to_cart && isset( $stock_status ) && $stock_status != 'out-of-stock' ): ?>
187
+ <div class="product-add-to-cart">
188
+ <?php woocommerce_template_loop_add_to_cart( array( 'quantity' => $show_quantity ? $item->get_quantity() : 1 ) ); ?>
189
+ </div>
190
+ <?php endif ?>
191
+
192
+ <!-- Change wishlist -->
193
+ <?php if ( $move_to_another_wishlist && $available_multi_wishlist && count( $users_wishlists ) > 1 ): ?>
194
+ <div class="move-to-another-wishlist">
195
+ <?php if ( 'select' == $move_to_another_wishlist_type ): ?>
196
+ <select class="change-wishlist selectBox">
197
+ <option value=""><?php esc_html_e( 'Move', 'yith-woocommerce-wishlist' ); ?></option>
198
+ <?php
199
+ foreach ( $users_wishlists as $wl ):
200
+ /**
201
+ * @var $wl \YITH_WCWL_Wishlist
202
+ */
203
+ if ( $wl->get_token() === $wishlist_token ) {
204
+ continue;
205
+ }
206
+ ?>
207
+ <option value="<?php echo esc_attr( $wl->get_token() ); ?>">
208
+ <?php echo esc_html( sprintf( '%s - %s', $wl->get_formatted_name(), $wl->get_formatted_privacy() ) ); ?>
209
+ </option>
210
+ <?php
211
+ endforeach;
212
+ ?>
213
+ </select>
214
+ <?php else: ?>
215
+ <a href="#move_to_another_wishlist" class="move-to-another-wishlist-button" data-rel="prettyPhoto[move_to_another_wishlist]">
216
+ <?php echo esc_html( apply_filters( 'yith_wcwl_move_to_another_list_label', __( 'Move to another list &rsaquo;', 'yith-woocommerce-wishlist' ) ) ); ?>
217
+ </a>
218
+ <?php endif; ?>
219
+ </div>
220
+ <?php endif; ?>
221
+
222
+ <?php if ( $show_remove_product ): ?>
223
+ <div class="product-remove">
224
+ <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item->get_product_id() ) ); ?>" class="remove_from_wishlist" title="<?php echo esc_html( apply_filters( 'yith_wcwl_remove_product_wishlist_message_title', __( 'Remove this product', 'yith-woocommerce-wishlist' ) ) ); ?>"><i class="fa fa-trash"></i></a>
225
+ </div>
226
+ <?php endif; ?>
227
+ </div>
228
+ </li>
229
+ <?php
230
+ endif;
231
+ endforeach;
232
+ else: ?>
233
+ <p class="wishlist-empty">
234
+ <?php echo esc_html( apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No products added to the wishlist', 'yith-woocommerce-wishlist' ) ) ); ?>
235
+ </p>
236
+ <?php
237
+ endif;
238
+
239
+ if ( ! empty( $page_links ) ) : ?>
240
+ <p class="pagination-row">
241
+ <?php echo $page_links; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
242
+ </p>
243
+ <?php endif ?>
244
+
245
+ </ul>
246
+
247
+ <?php if ( ! empty( $page_links ) ) :
248
+ ?>
249
+ <nav class="wishlist-pagination">
250
+ <?php echo $page_links; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
251
+ </nav>
252
+ <?php endif ?>
templates/wishlist-view.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Wishlist page template - Standard Layout
4
  *
5
- * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
@@ -10,33 +10,33 @@
10
  /**
11
  * Template variables:
12
  *
13
- * @var $wishlist \YITH_WCWL_Wishlist Current wishlist
14
- * @var $wishlist_items array Array of items to show for current page
15
- * @var $wishlist_token string Current wishlist token
16
- * @var $wishlist_id int Current wishlist id
17
- * @var $users_wishlists array Array of current user wishlists
18
- * @var $current_page int Current page
19
- * @var $page_links array Array of page links
20
- * @var $is_user_owner bool Whether current user is wishlist owner
21
- * @var $show_price bool Whether to show price column
22
- * @var $show_dateadded bool Whether to show item date of addition
23
- * @var $show_stock_status bool Whether to show product stock status
24
- * @var $show_add_to_cart bool Whether to show Add to Cart button
25
- * @var $show_remove_product bool Whether to show Remove button
26
- * @var $show_price_variations bool Whether to show price variation over time
27
- * @var $show_variation bool Whether to show variation attributes when possible
28
- * @var $show_cb bool Whether to show checkbox column
29
- * @var $show_quantity bool Whether to show input quantity or not
30
- * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
31
- * @var $show_last_column bool Whether to show last column (calculated basing on previous flags)
32
- * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
33
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
34
- * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
35
- * @var $price_excl_tax bool Whether to show price excluding taxes
36
- * @var $enable_drag_n_drop bool Whether to enable drag n drop feature
37
- * @var $repeat_remove_button bool Whether to repeat remove button in last column
38
- * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
39
- * @var $no_interactions bool
40
  */
41
 
42
  if ( ! defined( 'YITH_WCWL' ) ) {
@@ -45,220 +45,276 @@ if ( ! defined( 'YITH_WCWL' ) ) {
45
  ?>
46
 
47
  <!-- WISHLIST TABLE -->
48
- <table class="shop_table cart wishlist_table wishlist_view traditional responsive" data-pagination="<?php echo esc_attr( $pagination )?>" data-per-page="<?php echo esc_attr( $per_page )?>" data-page="<?php echo esc_attr( $current_page )?>" data-id="<?php echo $wishlist_id ?>" data-token="<?php echo $wishlist_token ?>">
49
-
50
- <?php $column_count = 2; ?>
51
-
52
- <thead>
53
- <tr>
54
- <?php if( $show_cb ) : $column_count ++; ?>
55
- <th class="product-checkbox">
56
- <input type="checkbox" value="" name="" id="bulk_add_to_cart"/>
57
- </th>
58
- <?php endif; ?>
59
-
60
- <?php if( $show_remove_product ): $column_count ++; ?>
61
- <th class="product-remove"></th>
62
- <?php endif; ?>
63
-
64
- <th class="product-thumbnail"></th>
65
-
66
- <th class="product-name">
67
- <span class="nobr">
68
- <?php echo apply_filters( 'yith_wcwl_wishlist_view_name_heading', __( 'Product name', 'yith-woocommerce-wishlist' ) ) ?>
69
- </span>
70
- </th>
71
-
72
- <?php if( $show_price || $show_price_variations ) : $column_count ++; ?>
73
- <th class="product-price">
74
- <span class="nobr">
75
- <?php echo apply_filters( 'yith_wcwl_wishlist_view_price_heading', __( 'Unit price', 'yith-woocommerce-wishlist' ) ) ?>
76
- </span>
77
- </th>
78
- <?php endif; ?>
79
-
80
- <?php if( $show_quantity ) : $column_count ++; ?>
81
- <th class="product-quantity">
82
- <span class="nobr">
83
- <?php echo apply_filters( 'yith_wcwl_wishlist_view_quantity_heading', __( 'Quantity', 'yith-woocommerce-wishlist' ) ) ?>
84
- </span>
85
- </th>
86
- <?php endif;?>
87
-
88
- <?php if( $show_stock_status ) : $column_count ++; ?>
89
- <th class="product-stock-status">
90
- <span class="nobr">
91
- <?php echo apply_filters( 'yith_wcwl_wishlist_view_stock_heading', __( 'Stock status', 'yith-woocommerce-wishlist' ) ) ?>
92
- </span>
93
- </th>
94
- <?php endif; ?>
95
-
96
- <?php if( $show_last_column ) : $column_count ++; ?>
97
- <th class="product-add-to-cart"></th>
98
- <?php endif; ?>
99
-
100
- <?php if( $enable_drag_n_drop ): $column_count ++; ?>
101
- <th class="product-arrange">
102
- <span class="nobr">
103
- <?php echo apply_filters( 'yith_wcwl_wishlist_view_arrange_heading', __( 'Arrange', 'yith-woocommerce-wishlist' ) )?>
104
- </span>
105
- </th>
106
- <?php endif; ?>
107
- </tr>
108
- </thead>
109
-
110
- <tbody class="wishlist-items-wrapper">
111
- <?php
112
- if( $wishlist && $wishlist->has_items() ) :
113
- foreach( $wishlist_items as $item ) :
114
- /**
115
- * @var $item \YITH_WCWL_Wishlist_Item
116
- */
117
- global $product;
118
-
119
- $product = $item->get_product();
120
- $availability = $product->get_availability();
121
- $stock_status = isset( $availability['class'] ) ? $availability['class'] : false;
122
-
123
- if( $product && $product->exists() ) :
124
- ?>
125
- <tr id="yith-wcwl-row-<?php echo $item->get_product_id() ?>" data-row-id="<?php echo $item->get_product_id() ?>">
126
- <?php if( $show_cb ) : ?>
127
- <td class="product-checkbox">
128
- <input type="checkbox" value="yes" name="items[<?php echo esc_attr( $item->get_product_id() ) ?>][cb]" />
129
- </td>
130
- <?php endif ?>
131
-
132
- <?php if( $show_remove_product ): ?>
133
- <td class="product-remove">
134
- <div>
135
- <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item->get_product_id() ) ) ?>" class="remove remove_from_wishlist" title="<?php echo apply_filters( 'yith_wcwl_remove_product_wishlist_message_title', __( 'Remove this product', 'yith-woocommerce-wishlist' ) ); ?>">&times;</a>
136
- </div>
137
- </td>
138
- <?php endif; ?>
139
-
140
- <td class="product-thumbnail">
141
- <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ) ?>">
142
- <?php echo $product->get_image() ?>
143
- </a>
144
- </td>
145
-
146
- <td class="product-name">
147
- <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ) ?>"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></a>
148
-
149
- <?php
150
- if( $show_variation && $product->is_type( 'variation' ) ){
151
- /**
152
- * @var $product \WC_Product_Variation
153
- */
154
- echo wc_get_formatted_variation( $product );
155
- }
156
- ?>
157
-
158
- <?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
159
- </td>
160
-
161
- <?php if( $show_price || $show_price_variations ) : ?>
162
- <td class="product-price">
163
- <?php
164
- if( $show_price ) {
165
- echo $item->get_formatted_product_price();
166
- }
167
-
168
- if( $show_price_variations ){
169
- echo $item->get_price_variation();
170
- }
171
- ?>
172
- </td>
173
- <?php endif ?>
174
-
175
- <?php if( $show_quantity ) : ?>
176
- <td class="product-quantity">
177
- <?php if( ! $no_interactions && $is_user_owner ): ?>
178
- <input type="number" min="1" step="1" name="items[<?php echo esc_attr( $item->get_product_id() )?>][quantity]" value="<?php echo esc_attr( $item->get_quantity() )?>" />
179
- <?php else: ?>
180
- <?php echo $item->get_quantity() ?>
181
- <?php endif; ?>
182
- </td>
183
- <?php endif;?>
184
-
185
- <?php if( $show_stock_status ) : ?>
186
- <td class="product-stock-status">
187
- <?php echo $stock_status == 'out-of-stock' ? '<span class="wishlist-out-of-stock">' . apply_filters( 'yith_wcwl_out_of_stock_label', __( 'Out of stock', 'yith-woocommerce-wishlist' ) ) . '</span>' : '<span class="wishlist-in-stock">' . apply_filters( 'yith_wcwl_in_stock_label', __( 'In Stock', 'yith-woocommerce-wishlist' ) ) . '</span>'; ?>
188
- </td>
189
- <?php endif ?>
190
-
191
- <?php if( $show_last_column ): ?>
192
- <td class="product-add-to-cart">
193
- <!-- Date added -->
194
- <?php
195
- if( $show_dateadded && $item->get_date_added() ):
196
- echo '<span class="dateadded">' . sprintf( __( 'Added on: %s', 'yith-woocommerce-wishlist' ), $item->get_date_added_formatted() ) . '</span>';
197
- endif;
198
- ?>
199
-
200
- <!-- Add to cart button -->
201
- <?php if( $show_add_to_cart && isset( $stock_status ) && $stock_status != 'out-of-stock' ): ?>
202
- <?php woocommerce_template_loop_add_to_cart( array( 'quantity' => $show_quantity ? $item->get_quantity() : 1 ) ); ?>
203
- <?php endif ?>
204
-
205
- <!-- Change wishlist -->
206
- <?php if( $move_to_another_wishlist && $available_multi_wishlist && count( $users_wishlists ) > 1 ): ?>
207
- <?php if( 'select' == $move_to_another_wishlist_type ): ?>
208
- <select class="change-wishlist selectBox">
209
- <option value=""><?php _e( 'Move', 'yith-woocommerce-wishlist' ) ?></option>
210
- <?php
211
- foreach( $users_wishlists as $wl ):
212
- /**
213
- * @var $wl \YITH_WCWL_Wishlist
214
- */
215
- if( $wl->get_token() == $wishlist_token ){
216
- continue;
217
- }
218
- ?>
219
- <option value="<?php echo esc_attr( $wl->get_token() ) ?>">
220
- <?php echo sprintf( '%s - %s', $wl->get_formatted_name(), $wl->get_formatted_privacy() ); ?>
221
- </option>
222
- <?php
223
- endforeach;
224
- ?>
225
- </select>
226
- <?php else: ?>
227
- <a href="#move_to_another_wishlist" class="move-to-another-wishlist-button" data-rel="prettyPhoto[move_to_another_wishlist]">
228
- <?php echo apply_filters( 'yith_wcwl_move_to_another_list_label', __( 'Move to another list &rsaquo;', 'yith-woocommerce-wishlist' ) ) ?>
229
- </a>
230
- <?php endif; ?>
231
- <?php endif; ?>
232
-
233
- <!-- Remove from wishlist -->
234
- <?php if( $repeat_remove_button ): ?>
235
- <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item->get_product_id() ) ) ?>" class="remove_from_wishlist button" title="<?php echo apply_filters( 'yith_wcwl_remove_product_wishlist_message_title',__( 'Remove this product', 'yith-woocommerce-wishlist' )); ?>"><?php _e( 'Remove', 'yith-woocommerce-wishlist' ) ?></a>
236
- <?php endif; ?>
237
- </td>
238
- <?php endif; ?>
239
-
240
- <?php if( $enable_drag_n_drop ): ?>
241
- <td class="product-arrange ">
242
- <i class="fa fa-arrows"></i>
243
- <input type="hidden" name="items[<?php echo esc_attr( $item->get_product_id() )?>][position]" value="<?php echo esc_attr( $item->get_position() )?>" />
244
- </td>
245
- <?php endif; ?>
246
- </tr>
247
- <?php
248
- endif;
249
- endforeach;
250
- else: ?>
251
- <tr>
252
- <td colspan="<?php echo esc_attr( $column_count ) ?>" class="wishlist-empty"><?php echo apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No products added to the wishlist', 'yith-woocommerce-wishlist' ) ) ?></td>
253
- </tr>
254
- <?php
255
- endif;
256
-
257
- if( ! empty( $page_links ) ) : ?>
258
- <tr class="pagination-row">
259
- <td colspan="<?php echo esc_attr( $column_count ) ?>"><?php echo $page_links ?></td>
260
- </tr>
261
- <?php endif ?>
262
- </tbody>
263
-
264
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * Wishlist page template - Standard Layout
4
  *
5
+ * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Wishlist
7
  * @version 3.0.0
8
  */
10
  /**
11
  * Template variables:
12
  *
13
+ * @var $wishlist \YITH_WCWL_Wishlist Current wishlist
14
+ * @var $wishlist_items array Array of items to show for current page
15
+ * @var $wishlist_token string Current wishlist token
16
+ * @var $wishlist_id int Current wishlist id
17
+ * @var $users_wishlists array Array of current user wishlists
18
+ * @var $current_page int Current page
19
+ * @var $page_links array Array of page links
20
+ * @var $is_user_owner bool Whether current user is wishlist owner
21
+ * @var $show_price bool Whether to show price column
22
+ * @var $show_dateadded bool Whether to show item date of addition
23
+ * @var $show_stock_status bool Whether to show product stock status
24
+ * @var $show_add_to_cart bool Whether to show Add to Cart button
25
+ * @var $show_remove_product bool Whether to show Remove button
26
+ * @var $show_price_variations bool Whether to show price variation over time
27
+ * @var $show_variation bool Whether to show variation attributes when possible
28
+ * @var $show_cb bool Whether to show checkbox column
29
+ * @var $show_quantity bool Whether to show input quantity or not
30
+ * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form
31
+ * @var $show_last_column bool Whether to show last column (calculated basing on previous flags)
32
+ * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select
33
  * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change
34
+ * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form
35
+ * @var $price_excl_tax bool Whether to show price excluding taxes
36
+ * @var $enable_drag_n_drop bool Whether to enable drag n drop feature
37
+ * @var $repeat_remove_button bool Whether to repeat remove button in last column
38
+ * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available
39
+ * @var $no_interactions bool
40
  */
41
 
42
  if ( ! defined( 'YITH_WCWL' ) ) {
45
  ?>
46
 
47
  <!-- WISHLIST TABLE -->
48
+ <table
49
+ class="shop_table cart wishlist_table wishlist_view traditional responsive <?php echo $no_interactions ? 'no-interactions' : ''; ?> <?php echo $enable_drag_n_drop ? 'sortable' : ''; ?> "
50
+ data-pagination="<?php echo esc_attr( $pagination ); ?>" data-per-page="<?php echo esc_attr( $per_page ); ?>"
51
+ data-page="<?php echo esc_attr( $current_page ); ?>" data-id="<?php echo esc_attr( $wishlist_id ); ?>"
52
+ data-token="<?php echo esc_attr( $wishlist_token ); ?>">
53
+
54
+ <?php $column_count = 2; ?>
55
+
56
+ <thead>
57
+ <tr>
58
+ <?php if ( $show_cb ) : ?>
59
+ <?php $column_count ++; ?>
60
+ <th class="product-checkbox">
61
+ <input type="checkbox" value="" name="" id="bulk_add_to_cart"/>
62
+ </th>
63
+ <?php endif; ?>
64
+
65
+ <?php if ( $show_remove_product ) : ?>
66
+ <?php $column_count ++; ?>
67
+ <th class="product-remove">
68
+ <span class="nobr">
69
+ <?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_view_remove_heading', '', $wishlist ) ); ?>
70
+ </span>
71
+ </th>
72
+ <?php endif; ?>
73
+
74
+ <th class="product-thumbnail"></th>
75
+
76
+ <th class="product-name">
77
+ <span class="nobr">
78
+ <?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_view_name_heading', __( 'Product name', 'yith-woocommerce-wishlist' ), $wishlist ) ); ?>
79
+ </span>
80
+ </th>
81
+
82
+ <?php if ( $show_price || $show_price_variations ) : ?>
83
+ <?php $column_count ++; ?>
84
+ <th class="product-price">
85
+ <span class="nobr">
86
+ <?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_view_price_heading', __( 'Unit price', 'yith-woocommerce-wishlist' ), $wishlist ) ); ?>
87
+ </span>
88
+ </th>
89
+ <?php endif; ?>
90
+
91
+ <?php if ( $show_quantity ) : ?>
92
+ <?php $column_count ++; ?>
93
+ <th class="product-quantity">
94
+ <span class="nobr">
95
+ <?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_view_quantity_heading', __( 'Quantity', 'yith-woocommerce-wishlist' ), $wishlist ) ); ?>
96
+ </span>
97
+ </th>
98
+ <?php endif; ?>
99
+
100
+ <?php if ( $show_stock_status ) : ?>
101
+ <?php $column_count ++; ?>
102
+ <th class="product-stock-status">
103
+ <span class="nobr">
104
+ <?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_view_stock_heading', __( 'Stock status', 'yith-woocommerce-wishlist' ), $wishlist ) ); ?>
105
+ </span>
106
+ </th>
107
+ <?php endif; ?>
108
+
109
+ <?php if ( $show_last_column ) : ?>
110
+ <?php $column_count ++; ?>
111
+ <th class="product-add-to-cart">
112
+ <span class="nobr">
113
+ <?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_view_cart_heading', '', $wishlist ) ); ?>
114
+ </span>
115
+ </th>
116
+ <?php endif; ?>
117
+
118
+ <?php if ( $enable_drag_n_drop ) : ?>
119
+ <?php $column_count ++; ?>
120
+ <th class="product-arrange">
121
+ <span class="nobr">
122
+ <?php echo esc_html( apply_filters( 'yith_wcwl_wishlist_view_arrange_heading', __( 'Arrange', 'yith-woocommerce-wishlist' ), $wishlist ) ); ?>
123
+ </span>
124
+ </th>
125
+ <?php endif; ?>
126
+ </tr>
127
+ </thead>
128
+
129
+ <tbody class="wishlist-items-wrapper">
130
+ <?php
131
+ if ( $wishlist && $wishlist->has_items() ) :
132
+ foreach ( $wishlist_items as $item ) :
133
+ // phpcs:ignore Generic.Commenting.DocComment
134
+ /**
135
+ * @var $item \YITH_WCWL_Wishlist_Item
136
+ */
137
+ global $product;
138
+
139
+ $product = $item->get_product();
140
+ $availability = $product->get_availability();
141
+ $stock_status = isset( $availability['class'] ) ? $availability['class'] : false;
142
+
143
+ if ( $product && $product->exists() ) :
144
+ ?>
145
+ <tr id="yith-wcwl-row-<?php echo esc_attr( $item->get_product_id() ); ?>" data-row-id="<?php echo esc_attr( $item->get_product_id() ); ?>">
146
+ <?php if ( $show_cb ) : ?>
147
+ <td class="product-checkbox">
148
+ <input type="checkbox" value="yes" name="items[<?php echo esc_attr( $item->get_product_id() ); ?>][cb]"/>
149
+ </td>
150
+ <?php endif ?>
151
+
152
+ <?php if ( $show_remove_product ) : ?>
153
+ <td class="product-remove">
154
+ <div>
155
+ <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item->get_product_id() ) ); ?>" class="remove remove_from_wishlist" title="<?php echo esc_html( apply_filters( 'yith_wcwl_remove_product_wishlist_message_title', __( 'Remove this product', 'yith-woocommerce-wishlist' ) ) ); ?>">&times;</a>
156
+ </div>
157
+ </td>
158
+ <?php endif; ?>
159
+
160
+ <td class="product-thumbnail">
161
+ <?php do_action( 'yith_wcwl_table_before_product_thumbnail', $item, $wishlist ); ?>
162
+
163
+ <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ); ?>">
164
+ <?php echo $product->get_image(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
165
+ </a>
166
+
167
+ <?php do_action( 'yith_wcwl_table_after_product_thumbnail', $item, $wishlist ); ?>
168
+ </td>
169
+
170
+ <td class="product-name">
171
+ <?php do_action( 'yith_wcwl_table_before_product_name', $item, $wishlist ); ?>
172
+
173
+ <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ); ?>"><?php echo esc_html( apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ); ?></a>
174
+
175
+ <?php
176
+ if ( $show_variation && $product->is_type( 'variation' ) ) {
177
+ // phpcs:ignore Generic.Commenting.DocComment
178
+ /**
179
+ * @var $product \WC_Product_Variation
180
+ */
181
+ echo wc_get_formatted_variation( $product ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
182
+ }
183
+ ?>
184
+
185
+ <?php do_action( 'yith_wcwl_table_after_product_name', $item, $wishlist ); ?>
186
+ </td>
187
+
188
+ <?php if ( $show_price || $show_price_variations ) : ?>
189
+ <td class="product-price">
190
+ <?php do_action( 'yith_wcwl_table_before_product_price', $item, $wishlist ); ?>
191
+
192
+ <?php
193
+ if ( $show_price ) {
194
+ echo $item->get_formatted_product_price(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
195
+ }
196
+
197
+ if ( $show_price_variations ) {
198
+ echo $item->get_price_variation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
199
+ }
200
+ ?>
201
+
202
+ <?php do_action( 'yith_wcwl_table_after_product_price', $item, $wishlist ); ?>
203
+ </td>
204
+ <?php endif ?>
205
+
206
+ <?php if ( $show_quantity ) : ?>
207
+ <td class="product-quantity">
208
+ <?php do_action( 'yith_wcwl_table_before_product_quantity', $item, $wishlist ); ?>
209
+
210
+ <?php if ( ! $no_interactions && $wishlist->current_user_can( 'update_quantity' ) ) : ?>
211
+ <input type="number" min="1" step="1" name="items[<?php echo esc_attr( $item->get_product_id() ); ?>][quantity]" value="<?php echo esc_attr( $item->get_quantity() ); ?>"/>
212
+ <?php else : ?>
213
+ <?php echo esc_html( $item->get_quantity() ); ?>
214
+ <?php endif; ?>
215
+
216
+ <?php do_action( 'yith_wcwl_table_after_product_quantity', $item, $wishlist ); ?>
217
+ </td>
218
+ <?php endif; ?>
219
+
220
+ <?php if ( $show_stock_status ) : ?>
221
+ <td class="product-stock-status">
222
+ <?php do_action( 'yith_wcwl_table_before_product_stock', $item, $wishlist ); ?>
223
+
224
+ <?php echo 'out-of-stock' === $stock_status ? '<span class="wishlist-out-of-stock">' . esc_html( apply_filters( 'yith_wcwl_out_of_stock_label', __( 'Out of stock', 'yith-woocommerce-wishlist' ) ) ) . '</span>' : '<span class="wishlist-in-stock">' . esc_html( apply_filters( 'yith_wcwl_in_stock_label', __( 'In Stock', 'yith-woocommerce-wishlist' ) ) ) . '</span>'; ?>
225
+
226
+ <?php do_action( 'yith_wcwl_table_after_product_stock', $item, $wishlist ); ?>
227
+ </td>
228
+ <?php endif ?>
229
+
230
+ <?php if ( $show_last_column ) : ?>
231
+ <td class="product-add-to-cart">
232
+ <?php do_action( 'yith_wcwl_table_before_product_cart', $item, $wishlist ); ?>
233
+
234
+ <!-- Date added -->
235
+ <?php
236
+ if ( $show_dateadded && $item->get_date_added() ) :
237
+ // translators: date added label: 1 date added.
238
+ echo '<span class="dateadded">' . esc_html( sprintf( __( 'Added on: %s', 'yith-woocommerce-wishlist' ), $item->get_date_added_formatted() ) ) . '</span>';
239
+ endif;
240
+ ?>
241
+
242
+ <?php do_action( 'yith_wcwl_table_product_before_add_to_cart', $item, $wishlist ); ?>
243
+
244
+ <!-- Add to cart button -->
245
+ <?php $show_add_to_cart = apply_filters( 'yith_wcwl_table_product_show_add_to_cart', $show_add_to_cart, $item, $wishlist ); ?>
246
+ <?php if ( $show_add_to_cart && isset( $stock_status ) && 'out-of-stock' !== $stock_status ) : ?>
247
+ <?php woocommerce_template_loop_add_to_cart( array( 'quantity' => $show_quantity ? $item->get_quantity() : 1 ) ); ?>
248
+ <?php endif ?>
249
+
250
+ <?php do_action( 'yith_wcwl_table_product_after_add_to_cart', $item, $wishlist ); ?>
251
+
252
+ <!-- Change wishlist -->
253
+ <?php $move_to_another_wishlist = apply_filters( 'yith_wcwl_table_product_move_to_another_wishlist', $move_to_another_wishlist, $item, $wishlist ); ?>
254
+ <?php if ( $move_to_another_wishlist && $available_multi_wishlist && count( $users_wishlists ) > 1 ) : ?>
255
+ <?php if ( 'select' === $move_to_another_wishlist_type ) : ?>
256
+ <select class="change-wishlist selectBox">
257
+ <option value=""><?php esc_html_e( 'Move', 'yith-woocommerce-wishlist' ); ?></option>
258
+ <?php
259
+ foreach ( $users_wishlists as $wl ) :
260
+ // phpcs:ignore Generic.Commenting.DocComment
261
+ /**
262
+ * @var $wl \YITH_WCWL_Wishlist
263
+ */
264
+ if ( $wl->get_token() === $wishlist_token ) {
265
+ continue;
266
+ }
267
+ ?>
268
+ <option value="<?php echo esc_attr( $wl->get_token() ); ?>">
269
+ <?php echo sprintf( '%s - %s', esc_html( $wl->get_formatted_name() ), esc_html( $wl->get_formatted_privacy() ) ); ?>
270
+ </option>
271
+ <?php
272
+ endforeach;
273
+ ?>
274
+ </select>
275
+ <?php else : ?>
276
+ <a href="#move_to_another_wishlist" class="move-to-another-wishlist-button" data-rel="prettyPhoto[move_to_another_wishlist]">
277
+ <?php echo esc_html( apply_filters( 'yith_wcwl_move_to_another_list_label', __( 'Move to another list &rsaquo;', 'yith-woocommerce-wishlist' ) ) ); ?>
278
+ </a>
279
+ <?php endif; ?>
280
+
281
+ <?php do_action( 'yith_wcwl_table_product_after_move_to_another_wishlist', $item, $wishlist ); ?>
282
+
283
+ <?php endif; ?>
284
+
285
+ <!-- Remove from wishlist -->
286
+ <?php if ( $repeat_remove_button ) : ?>
287
+ <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item->get_product_id() ) ); ?>" class="remove_from_wishlist button" title="<?php echo esc_html( apply_filters( 'yith_wcwl_remove_product_wishlist_message_title', __( 'Remove this product', 'yith-woocommerce-wishlist' ) ) ); ?>"><?php esc_html_e( 'Remove', 'yith-woocommerce-wishlist' ); ?></a>
288
+ <?php endif; ?>
289
+
290
+ <?php do_action( 'yith_wcwl_table_after_product_cart', $item, $wishlist ); ?>
291
+ </td>
292
+ <?php endif; ?>
293
+
294
+ <?php if ( $enable_drag_n_drop ) : ?>
295
+ <td class="product-arrange ">
296
+ <i class="fa fa-arrows"></i>
297
+ <input type="hidden" name="items[<?php echo esc_attr( $item->get_product_id() ); ?>][position]" value="<?php echo esc_attr( $item->get_position() ); ?>"/>
298
+ </td>
299
+ <?php endif; ?>
300
+ </tr>
301
+ <?php
302
+ endif;
303
+ endforeach;
304
+ else :
305
+ ?>
306
+ <tr>
307
+ <td colspan="<?php echo esc_attr( $column_count ); ?>" class="wishlist-empty"><?php echo esc_html( apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No products added to the wishlist', 'yith-woocommerce-wishlist' ), $wishlist ) ); ?></td>
308
+ </tr>
309
+ <?php
310
+ endif;
311
+
312
+ if ( ! empty( $page_links ) ) :
313
+ ?>
314
+ <tr class="pagination-row wishlist-pagination">
315
+ <td colspan="<?php echo esc_attr( $column_count ); ?>"><?php echo $page_links; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
316
+ </tr>
317
+ <?php endif ?>
318
+ </tbody>
319
+
320
+ </table>
templates/wishlist.php CHANGED
@@ -26,7 +26,7 @@ if ( ! defined( 'YITH_WCWL' ) ) {
26
  *
27
  * @hooked \YITH_WCWL_Frontend::wishlist_header - 10
28
  */
29
- do_action( 'yith_wcwl_wishlist_before_wishlist_content', $var )
30
  ?>
31
 
32
  <?php
@@ -35,7 +35,7 @@ do_action( 'yith_wcwl_wishlist_before_wishlist_content', $var )
35
  *
36
  * @hooked \YITH_WCWL_Frontend::main_wishlist_content - 10
37
  */
38
- do_action( 'yith_wcwl_wishlist_main_wishlist_content', $var )
39
  ?>
40
 
41
  <?php
@@ -44,5 +44,5 @@ do_action( 'yith_wcwl_wishlist_main_wishlist_content', $var )
44
  *
45
  * @hooked \YITH_WCWL_Frontend::wishlist_footer - 10
46
  */
47
- do_action( 'yith_wcwl_wishlist_after_wishlist_content', $var )
48
  ?>
26
  *
27
  * @hooked \YITH_WCWL_Frontend::wishlist_header - 10
28
  */
29
+ do_action( 'yith_wcwl_wishlist_before_wishlist_content', $var );
30
  ?>
31
 
32
  <?php
35
  *
36
  * @hooked \YITH_WCWL_Frontend::main_wishlist_content - 10
37
  */
38
+ do_action( 'yith_wcwl_wishlist_main_wishlist_content', $var );
39
  ?>
40
 
41
  <?php
44
  *
45
  * @hooked \YITH_WCWL_Frontend::wishlist_footer - 10
46
  */
47
+ do_action( 'yith_wcwl_wishlist_after_wishlist_content', $var );
48
  ?>
uninstall.php CHANGED
@@ -9,11 +9,11 @@
9
 
10
  // If uninstall not called from WordPress exit
11
  if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12
- exit;
13
  }
14
 
15
  function yith_wcwl_uninstall(){
16
- global $wpdb;
17
 
18
  if ( defined( 'YITH_WCWL_REMOVE_ALL_DATA' ) && true === YITH_WCWL_REMOVE_ALL_DATA && ! defined( 'YITH_WCWL_PREMIUM' ) ) {
19
 
@@ -41,17 +41,17 @@ function yith_wcwl_uninstall(){
41
 
42
 
43
  if ( ! is_multisite() ) {
44
- yith_wcwl_uninstall();
45
  }
46
  else {
47
- global $wpdb;
48
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
49
- $original_blog_id = get_current_blog_id();
50
 
51
- foreach ( $blog_ids as $blog_id ) {
52
- switch_to_blog( $blog_id );
53
- yith_wcwl_uninstall();
54
- }
55
 
56
- switch_to_blog( $original_blog_id );
57
  }
9
 
10
  // If uninstall not called from WordPress exit
11
  if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12
+ exit;
13
  }
14
 
15
  function yith_wcwl_uninstall(){
16
+ global $wpdb;
17
 
18
  if ( defined( 'YITH_WCWL_REMOVE_ALL_DATA' ) && true === YITH_WCWL_REMOVE_ALL_DATA && ! defined( 'YITH_WCWL_PREMIUM' ) ) {
19
 
41
 
42
 
43
  if ( ! is_multisite() ) {
44
+ yith_wcwl_uninstall();
45
  }
46
  else {
47
+ global $wpdb;
48
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
49
+ $original_blog_id = get_current_blog_id();
50
 
51
+ foreach ( $blog_ids as $blog_id ) {
52
+ switch_to_blog( $blog_id );
53
+ yith_wcwl_uninstall();
54
+ }
55
 
56
+ switch_to_blog( $original_blog_id );
57
  }