YITH WooCommerce Quick View - Version 1.3.3

Version Description

Released Sep 27 - 2018

  • Update: Plugin Core.
  • Dev: New filter "yith_wcqv_show_quick_view_button".
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Quick View
Version 1.3.3
Comparing to
See all releases

Code changes from version 1.3.2 to 1.3.3

README.txt CHANGED
@@ -1,184 +1,187 @@
1
- === Plugin Name ===
2
- Contributors: yithemes
3
- Tags: woocommerce, quick view, woocommerce quick view, products quick view
4
- Requires at least: 4.0
5
- Tested up to: 4.9
6
- Stable tag: 1.3.2
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- This plugin adds the possibility to have a quick preview of the products right from product list
11
-
12
- == Description ==
13
- Sometimes the halfway is better: what if you are looking to a product in a list and its image is still too small?
14
-
15
- You have to open its product page, waiting for its loading and finally observe what you are interested into.
16
- So why don't use a simple way to look immediately at the product's distinctiveness? Here it is what Quick View can offer you.
17
-
18
- People are more attracted to what they can see clearly. And often the classic product lists are not enough to understand the real value of a product.
19
- That's when Quick View strikes successfully! Your clients will be free to look in a better way your products, reading also a small description with all the most important features and qualities you want to underline.
20
- In this way, they will be more focused on what they really want and they will proceed easily to the purchase step.
21
-
22
- **Main features:**
23
-
24
- * Add a button in product loop to open a modal window with the product summary using ajax
25
- * Choose to enable the prettyPhoto lightbox for images in quick view
26
- * Customize style of modal
27
-
28
-
29
- Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-quick-view/).
30
-
31
- == Installation ==
32
-
33
- 1. Unzip the downloaded zip file.
34
- 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
35
- 3. Activate `YITH WooCommerce Quick View` from Plugins page.
36
-
37
- == Screenshots ==
38
-
39
- 1. The plugin admin page.
40
- 2. The quick view button in shop page.
41
- 3. The quick view modal.
42
-
43
- == Changelog ==
44
-
45
- = 1.3.2 = Released Sep 12 - 2018
46
-
47
- * New: Support to WooCommerce 3.4.5.
48
- * New: Support to WordPress 4.9.8.
49
- * Update: Plugin Core.
50
- * Fix: Now is possible use shortcode [yith_quick_view] without specify the "product_id" parameter.
51
-
52
- = 1.3.1 = Released May 30 - 2018
53
-
54
- * New: Support to WooCommerce 3.4.0.
55
- * New: Support to WordPress 4.9.6.
56
- * Update: Plugin Core.
57
- * Fix: Product image zoom in Quick View modal.
58
- * Fix: Removed redirect to single product page after add to cart.
59
- * Fix: WPML compatibility issue.
60
-
61
- = 1.3.0 = Released Feb 01 - 2018
62
-
63
- * New: Support to WooCommerce 3.3.0.
64
- * New: Support to WordPress 4.9.2.
65
- * Update: Plugin Core.
66
-
67
- = 1.2.2 = Released Oct 11 - 2017
68
-
69
- * New: Support to WooCommerce 3.2.0 RC2.
70
- * New: Support to WordPress 4.8.2.
71
- * Fix: Compatibility issue with YITH WooCommerce Product Bundles.
72
- * Update: Plugin Core.
73
-
74
- = 1.2.1 = Released Apr 05 - 2017
75
-
76
- * Fix: Compatibility issue with YITH WooCommerce Wishlist.
77
- * Update: Plugin Core.
78
-
79
- = 1.2.0 = Released Mar 31 - 2017
80
-
81
- * New: Support to WordPress 4.7.3.
82
- * New: Support to WooCommerce 3.0.0 RC2.
83
- * New: Shortcode [yith_quick_view product_id="" label=""] for print "quick view" button of specified product.
84
- * Update: Plugin Core.
85
-
86
- = 1.1.4 = Released Oct 24 - 2016
87
-
88
- * Fix: Status code 404 for "Quick View" on single product page
89
-
90
- = 1.1.3 = Released Oct 20 - 2016
91
-
92
- * New: Support to WooCommerce 2.6.5
93
- * New: Support to WordPress 4.6.1
94
- * Update: Plugin Core.
95
- * Fix: Responsive style.
96
- * Fix: Add inline css using WordPress function wp_add_inline_style.
97
-
98
- = 1.1.2 = Released Jun 10 - 2016
99
-
100
- * New: Added minimized js files. Plugin loads full files version if the constant "SCRIPT_DEBUG" is defined and is true.
101
- * New: Support to WooCommerce 2.6 RC1
102
- * Update: Plugin Core
103
-
104
- = 1.1.1 = Released Apr 18 - 2016
105
-
106
- * New: Compatibility with WordPress 4.5
107
- * Update: Plugin Core
108
-
109
- = 1.1.0 = Released Oct 30 - 2015
110
-
111
- * New: Compatibility with YITH WooCommerce Wishlist
112
- * New: Compatibility with YITH WooCommerce Badge Management
113
- * New: Italian Language
114
- * Update: Language file .pot. Changed textdomain to yith-wcqv to yith-woocommerce-quick-view
115
- * Update: Plugin Core
116
-
117
- = 1.0.8 = Released Aug 24 - 2015
118
-
119
- * Fix: Main template issue
120
-
121
- = 1.0.7 = Released Aug 21 - 2015
122
-
123
- * New: Compatibility with Wordpress 4.3
124
- * New: WPML config xml
125
- * Update: Language file .pot
126
- * Fix: Default variation select
127
-
128
- = 1.0.6 = Released Aug 12 - 2015
129
-
130
- * Update: Plugin Core
131
-
132
- = 1.0.5 = Released Aug 11 - 2015
133
-
134
- * New: Compatibility with WooCommerce 2.4
135
- * Update: Plugin Core
136
- * Update: Language file
137
-
138
- = 1.0.4 = Released May 18 - 2015
139
-
140
- * New option for enable quick view also in mobile device
141
- * Compatibility with Wordpress 4.2.2
142
- * Minor bug fix
143
- * Update Plugin Core
144
- * Update Language file
145
-
146
- = 1.0.3 = Released Mar 11 - 2015
147
-
148
- * Minor bug fix
149
- * Update Plugin Core
150
-
151
- = 1.0.2 = Released Mar 06 - 2015
152
-
153
- * New: Action yith_quick_view_custom_style_scripts
154
- * New: Filter 'yith_quick_view_loader_gif
155
-
156
- = 1.0.1 = Released Feb 26 - 2015
157
-
158
- * Minor bug fix
159
-
160
- = 1.0.0 = Released Feb 17 - 2015
161
-
162
- * Initial release
163
-
164
- == Suggestions ==
165
-
166
- If you have suggestions about how to improve YITH WooCommerce Quick View, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH WooCommerce Quick View.
167
-
168
- == Translators ==
169
-
170
- = Available Languages =
171
- * English
172
- * Italian
173
-
174
- If you can't find this plugin in your language and want to translate it, use the dedicated tool at [Translating WordPress](https://translate.wordpress.org/locale/it/default/wp-plugins/yith-woocommerce-quick-view "Translating WordPress").
175
- Or, if you have created your own language pack, or have an update for an existing one, you can send it as an email attachment from our [Contacts page](http://yithemes.com/contact/ "Your Inspiration Themes") and we will bundle into YITH WooCommerce Quick View.
176
-
177
- == Upgrade notice ==
178
-
179
- = 1.3.2 = Released Sep 12 - 2018
180
-
181
- * New: Support to WooCommerce 3.4.5.
182
- * New: Support to WordPress 4.9.8.
183
- * Update: Plugin Core.
184
- * Fix: Now is possible use shortcode [yith_quick_view] without specify the "product_id" parameter.
1
+ === Plugin Name ===
2
+ Contributors: yithemes
3
+ Tags: woocommerce, quick view, woocommerce quick view, products quick view
4
+ Requires at least: 4.0
5
+ Tested up to: 4.9
6
+ Stable tag: 1.3.3
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ This plugin adds the possibility to have a quick preview of the products right from product list
11
+
12
+ == Description ==
13
+ Sometimes the halfway is better: what if you are looking to a product in a list and its image is still too small?
14
+
15
+ You have to open its product page, waiting for its loading and finally observe what you are interested into.
16
+ So why don't use a simple way to look immediately at the product's distinctiveness? Here it is what Quick View can offer you.
17
+
18
+ People are more attracted to what they can see clearly. And often the classic product lists are not enough to understand the real value of a product.
19
+ That's when Quick View strikes successfully! Your clients will be free to look in a better way your products, reading also a small description with all the most important features and qualities you want to underline.
20
+ In this way, they will be more focused on what they really want and they will proceed easily to the purchase step.
21
+
22
+ **Main features:**
23
+
24
+ * Add a button in product loop to open a modal window with the product summary using ajax
25
+ * Choose to enable the prettyPhoto lightbox for images in quick view
26
+ * Customize style of modal
27
+
28
+
29
+ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-quick-view/).
30
+
31
+ == Installation ==
32
+
33
+ 1. Unzip the downloaded zip file.
34
+ 2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
35
+ 3. Activate `YITH WooCommerce Quick View` from Plugins page.
36
+
37
+ == Screenshots ==
38
+
39
+ 1. The plugin admin page.
40
+ 2. The quick view button in shop page.
41
+ 3. The quick view modal.
42
+
43
+ == Changelog ==
44
+
45
+ = 1.3.3 = Released Sep 27 - 2018
46
+
47
+ * Update: Plugin Core.
48
+ * Dev: New filter "yith_wcqv_show_quick_view_button".
49
+
50
+ = 1.3.2 = Released Sep 12 - 2018
51
+
52
+ * New: Support to WooCommerce 3.4.5.
53
+ * New: Support to WordPress 4.9.8.
54
+ * Update: Plugin Core.
55
+ * Fix: Now is possible use shortcode [yith_quick_view] without specify the "product_id" parameter.
56
+
57
+ = 1.3.1 = Released May 30 - 2018
58
+
59
+ * New: Support to WooCommerce 3.4.0.
60
+ * New: Support to WordPress 4.9.6.
61
+ * Update: Plugin Core.
62
+ * Fix: Product image zoom in Quick View modal.
63
+ * Fix: Removed redirect to single product page after add to cart.
64
+ * Fix: WPML compatibility issue.
65
+
66
+ = 1.3.0 = Released Feb 01 - 2018
67
+
68
+ * New: Support to WooCommerce 3.3.0.
69
+ * New: Support to WordPress 4.9.2.
70
+ * Update: Plugin Core.
71
+
72
+ = 1.2.2 = Released Oct 11 - 2017
73
+
74
+ * New: Support to WooCommerce 3.2.0 RC2.
75
+ * New: Support to WordPress 4.8.2.
76
+ * Fix: Compatibility issue with YITH WooCommerce Product Bundles.
77
+ * Update: Plugin Core.
78
+
79
+ = 1.2.1 = Released Apr 05 - 2017
80
+
81
+ * Fix: Compatibility issue with YITH WooCommerce Wishlist.
82
+ * Update: Plugin Core.
83
+
84
+ = 1.2.0 = Released Mar 31 - 2017
85
+
86
+ * New: Support to WordPress 4.7.3.
87
+ * New: Support to WooCommerce 3.0.0 RC2.
88
+ * New: Shortcode [yith_quick_view product_id="" label=""] for print "quick view" button of specified product.
89
+ * Update: Plugin Core.
90
+
91
+ = 1.1.4 = Released Oct 24 - 2016
92
+
93
+ * Fix: Status code 404 for "Quick View" on single product page
94
+
95
+ = 1.1.3 = Released Oct 20 - 2016
96
+
97
+ * New: Support to WooCommerce 2.6.5
98
+ * New: Support to WordPress 4.6.1
99
+ * Update: Plugin Core.
100
+ * Fix: Responsive style.
101
+ * Fix: Add inline css using WordPress function wp_add_inline_style.
102
+
103
+ = 1.1.2 = Released Jun 10 - 2016
104
+
105
+ * New: Added minimized js files. Plugin loads full files version if the constant "SCRIPT_DEBUG" is defined and is true.
106
+ * New: Support to WooCommerce 2.6 RC1
107
+ * Update: Plugin Core
108
+
109
+ = 1.1.1 = Released Apr 18 - 2016
110
+
111
+ * New: Compatibility with WordPress 4.5
112
+ * Update: Plugin Core
113
+
114
+ = 1.1.0 = Released Oct 30 - 2015
115
+
116
+ * New: Compatibility with YITH WooCommerce Wishlist
117
+ * New: Compatibility with YITH WooCommerce Badge Management
118
+ * New: Italian Language
119
+ * Update: Language file .pot. Changed textdomain to yith-wcqv to yith-woocommerce-quick-view
120
+ * Update: Plugin Core
121
+
122
+ = 1.0.8 = Released Aug 24 - 2015
123
+
124
+ * Fix: Main template issue
125
+
126
+ = 1.0.7 = Released Aug 21 - 2015
127
+
128
+ * New: Compatibility with Wordpress 4.3
129
+ * New: WPML config xml
130
+ * Update: Language file .pot
131
+ * Fix: Default variation select
132
+
133
+ = 1.0.6 = Released Aug 12 - 2015
134
+
135
+ * Update: Plugin Core
136
+
137
+ = 1.0.5 = Released Aug 11 - 2015
138
+
139
+ * New: Compatibility with WooCommerce 2.4
140
+ * Update: Plugin Core
141
+ * Update: Language file
142
+
143
+ = 1.0.4 = Released May 18 - 2015
144
+
145
+ * New option for enable quick view also in mobile device
146
+ * Compatibility with Wordpress 4.2.2
147
+ * Minor bug fix
148
+ * Update Plugin Core
149
+ * Update Language file
150
+
151
+ = 1.0.3 = Released Mar 11 - 2015
152
+
153
+ * Minor bug fix
154
+ * Update Plugin Core
155
+
156
+ = 1.0.2 = Released Mar 06 - 2015
157
+
158
+ * New: Action yith_quick_view_custom_style_scripts
159
+ * New: Filter 'yith_quick_view_loader_gif
160
+
161
+ = 1.0.1 = Released Feb 26 - 2015
162
+
163
+ * Minor bug fix
164
+
165
+ = 1.0.0 = Released Feb 17 - 2015
166
+
167
+ * Initial release
168
+
169
+ == Suggestions ==
170
+
171
+ If you have suggestions about how to improve YITH WooCommerce Quick View, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH WooCommerce Quick View.
172
+
173
+ == Translators ==
174
+
175
+ = Available Languages =
176
+ * English
177
+ * Italian
178
+
179
+ If you can't find this plugin in your language and want to translate it, use the dedicated tool at [Translating WordPress](https://translate.wordpress.org/locale/it/default/wp-plugins/yith-woocommerce-quick-view "Translating WordPress").
180
+ Or, if you have created your own language pack, or have an update for an existing one, you can send it as an email attachment from our [Contacts page](http://yithemes.com/contact/ "Your Inspiration Themes") and we will bundle into YITH WooCommerce Quick View.
181
+
182
+ == Upgrade notice ==
183
+
184
+ = 1.3.3 = Released Sep 27 - 2018
185
+
186
+ * Update: Plugin Core.
187
+ * Dev: New filter "yith_wcqv_show_quick_view_button".
assets/css/yith-quick-view.css CHANGED
@@ -1,155 +1,155 @@
1
- /*=======================
2
- * MODAL POPUP STYLE
3
- ========================*/
4
-
5
- html.yith-quick-view-is-open,
6
- html.yith-quick-view-is-open body {
7
- overflow: hidden;
8
- }
9
-
10
- #yith-quick-view-modal {
11
- position: fixed;
12
- visibility: hidden;
13
- top: 0;
14
- left: 0;
15
- right: 0;
16
- bottom: 0;
17
- z-index: 1400;
18
- opacity: 0;
19
- text-align: center;
20
- -webkit-transition: all 0.3s;
21
- -moz-transition: all 0.3s;
22
- transition: all 0.3s;
23
- }
24
-
25
- #yith-quick-view-modal:before {
26
- content: '';
27
- display: inline-block;
28
- vertical-align: middle;
29
- height: 100%;
30
- width: 0;
31
- }
32
-
33
- #yith-quick-view-modal .yith-quick-view-overlay {
34
- position: absolute;
35
- top: 0;
36
- right: 0;
37
- bottom: 0;
38
- left: 0;
39
- background: rgba( 0, 0, 0, 0.8);
40
- }
41
-
42
- #yith-quick-view-modal .yith-wcqv-wrapper {
43
- display: inline-block;
44
- vertical-align: middle;
45
- visibility: hidden;
46
- -webkit-backface-visibility: hidden;
47
- -moz-backface-visibility: hidden;
48
- backface-visibility: hidden;
49
- text-align: left;
50
- height: 600px;
51
- width: 1000px;
52
- }
53
-
54
- #yith-quick-view-modal .yith-wcqv-main {
55
- -webkit-transform: translateY(20%);
56
- -moz-transform: translateY(20%);
57
- -ms-transform: translateY(20%);
58
- transform: translateY(20%);
59
- opacity: 0;
60
- height: 100%;
61
- -webkit-transition: all 0.3s;
62
- -moz-transition: all 0.3s;
63
- transition: all 0.3s;
64
- -webkit-box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.2);
65
- box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.2);
66
- }
67
-
68
- #yith-quick-view-modal.open,
69
- #yith-quick-view-modal.open .yith-wcqv-wrapper {
70
- visibility: visible;
71
- opacity: 1;
72
- }
73
-
74
- #yith-quick-view-modal #yith-quick-view-content {
75
- height: 100%;
76
- }
77
-
78
- #yith-quick-view-modal .yith-wcqv-main:after,
79
- #yith-quick-view-modal .yith-wcqv-main:before {
80
- content: '';
81
- display: table;
82
- clear: both;
83
- }
84
- #yith-quick-view-modal.open .yith-wcqv-main {
85
- -webkit-transform: translateY(0);
86
- -moz-transform: translateY(0);
87
- -ms-transform: translateY(0);
88
- transform: translateY(0);
89
- opacity: 1;
90
- height: 100%;
91
- overflow-y: scroll;
92
- position: relative;
93
- }
94
- #yith-quick-view-close {
95
- border: 1px solid;
96
- position: absolute;
97
- top: 5px;
98
- right: 5px;
99
- width: 20px;
100
- height: 20px;
101
- text-align: center;
102
- line-height: 18px;
103
- z-index: 2;
104
- opacity: 0.5;
105
- }
106
- #yith-quick-view-close:hover {
107
- opacity: 1;
108
- transition: all 0.2s ease;
109
- -webkit-transition: all 0.2s ease;
110
- -moz-transition: all 0.2s ease;
111
- -ms-transition: all 0.2s ease;
112
- }
113
- #yith-quick-view-content div.images {
114
- width: 40%;
115
- float: left;
116
- opacity: 1 !important;
117
- }
118
- #yith-quick-view-content div.summary {
119
- margin: 0;
120
- padding: 15px;
121
- width: 60%;
122
- float: left;
123
- }
124
- #yith-quick-view-content div.woocommerce-product-rating:after,
125
- #yith-quick-view-content div.woocommerce-product-rating:before {
126
- content: '';
127
- display: table;
128
- clear: both;
129
- }
130
- #yith-quick-view-content div.woocommerce-product-rating a.woocommerce-review-link {
131
- display: none;
132
- }
133
- #yith-quick-view-content .onsale {
134
- top: 5px;
135
- right: auto;
136
- left: 5px;
137
- }
138
-
139
- li.product .yith-wcqv-button .blockUI.blockOverlay:before {
140
- background: none;
141
- }
142
-
143
- @media( max-width: 480px ) {
144
- #yith-quick-view-content div.images,
145
- #yith-quick-view-content div.summary {
146
- width: 100%;
147
- float: none;
148
- }
149
- #yith-quick-view-content div.summary {
150
- margin: 0;
151
- padding: 15px;
152
- width: 100%;
153
- float: left;
154
- }
155
}
1
+ /*=======================
2
+ * MODAL POPUP STYLE
3
+ ========================*/
4
+
5
+ html.yith-quick-view-is-open,
6
+ html.yith-quick-view-is-open body {
7
+ overflow: hidden;
8
+ }
9
+
10
+ #yith-quick-view-modal {
11
+ position: fixed;
12
+ visibility: hidden;
13
+ top: 0;
14
+ left: 0;
15
+ right: 0;
16
+ bottom: 0;
17
+ z-index: 1400;
18
+ opacity: 0;
19
+ text-align: center;
20
+ -webkit-transition: all 0.3s;
21
+ -moz-transition: all 0.3s;
22
+ transition: all 0.3s;
23
+ }
24
+
25
+ #yith-quick-view-modal:before {
26
+ content: '';
27
+ display: inline-block;
28
+ vertical-align: middle;
29
+ height: 100%;
30
+ width: 0;
31
+ }
32
+
33
+ #yith-quick-view-modal .yith-quick-view-overlay {
34
+ position: absolute;
35
+ top: 0;
36
+ right: 0;
37
+ bottom: 0;
38
+ left: 0;
39
+ background: rgba( 0, 0, 0, 0.8);
40
+ }
41
+
42
+ #yith-quick-view-modal .yith-wcqv-wrapper {
43
+ display: inline-block;
44
+ vertical-align: middle;
45
+ visibility: hidden;
46
+ -webkit-backface-visibility: hidden;
47
+ -moz-backface-visibility: hidden;
48
+ backface-visibility: hidden;
49
+ text-align: left;
50
+ height: 600px;
51
+ width: 1000px;
52
+ }
53
+
54
+ #yith-quick-view-modal .yith-wcqv-main {
55
+ -webkit-transform: translateY(20%);
56
+ -moz-transform: translateY(20%);
57
+ -ms-transform: translateY(20%);
58
+ transform: translateY(20%);
59
+ opacity: 0;
60
+ height: 100%;
61
+ -webkit-transition: all 0.3s;
62
+ -moz-transition: all 0.3s;
63
+ transition: all 0.3s;
64
+ -webkit-box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.2);
65
+ box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.2);
66
+ }
67
+
68
+ #yith-quick-view-modal.open,
69
+ #yith-quick-view-modal.open .yith-wcqv-wrapper {
70
+ visibility: visible;
71
+ opacity: 1;
72
+ }
73
+
74
+ #yith-quick-view-modal #yith-quick-view-content {
75
+ height: 100%;
76
+ }
77
+
78
+ #yith-quick-view-modal .yith-wcqv-main:after,
79
+ #yith-quick-view-modal .yith-wcqv-main:before {
80
+ content: '';
81
+ display: table;
82
+ clear: both;
83
+ }
84
+ #yith-quick-view-modal.open .yith-wcqv-main {
85
+ -webkit-transform: translateY(0);
86
+ -moz-transform: translateY(0);
87
+ -ms-transform: translateY(0);
88
+ transform: translateY(0);
89
+ opacity: 1;
90
+ height: 100%;
91
+ overflow-y: scroll;
92
+ position: relative;
93
+ }
94
+ #yith-quick-view-close {
95
+ border: 1px solid;
96
+ position: absolute;
97
+ top: 5px;
98
+ right: 5px;
99
+ width: 20px;
100
+ height: 20px;
101
+ text-align: center;
102
+ line-height: 18px;
103
+ z-index: 2;
104
+ opacity: 0.5;
105
+ }
106
+ #yith-quick-view-close:hover {
107
+ opacity: 1;
108
+ transition: all 0.2s ease;
109
+ -webkit-transition: all 0.2s ease;
110
+ -moz-transition: all 0.2s ease;
111
+ -ms-transition: all 0.2s ease;
112
+ }
113
+ #yith-quick-view-content div.images {
114
+ width: 40%;
115
+ float: left;
116
+ opacity: 1 !important;
117
+ }
118
+ #yith-quick-view-content div.summary {
119
+ margin: 0;
120
+ padding: 15px;
121
+ width: 60%;
122
+ float: left;
123
+ }
124
+ #yith-quick-view-content div.woocommerce-product-rating:after,
125
+ #yith-quick-view-content div.woocommerce-product-rating:before {
126
+ content: '';
127
+ display: table;
128
+ clear: both;
129
+ }
130
+ #yith-quick-view-content div.woocommerce-product-rating a.woocommerce-review-link {
131
+ display: none;
132
+ }
133
+ #yith-quick-view-content .onsale {
134
+ top: 5px;
135
+ right: auto;
136
+ left: 5px;
137
+ }
138
+
139
+ li.product .yith-wcqv-button .blockUI.blockOverlay:before {
140
+ background: none;
141
+ }
142
+
143
+ @media( max-width: 480px ) {
144
+ #yith-quick-view-content div.images,
145
+ #yith-quick-view-content div.summary {
146
+ width: 100%;
147
+ float: none;
148
+ }
149
+ #yith-quick-view-content div.summary {
150
+ margin: 0;
151
+ padding: 15px;
152
+ width: 100%;
153
+ float: left;
154
+ }
155
}
assets/js/frontend.js CHANGED
@@ -1,185 +1,185 @@
1
- /**
2
- * frontend.js
3
- *
4
- * @author Your Inspiration Themes
5
- * @package YITH WooCommerce Quick View
6
- * @version 1.0.0
7
- */
8
-
9
- jQuery(document).ready(function($){
10
- "use strict";
11
-
12
- if( typeof yith_qv === 'undefined' ) {
13
- return;
14
- }
15
-
16
- var qv_modal = $(document).find( '#yith-quick-view-modal' ),
17
- qv_overlay = qv_modal.find( '.yith-quick-view-overlay'),
18
- qv_content = qv_modal.find( '#yith-quick-view-content' ),
19
- qv_close = qv_modal.find( '#yith-quick-view-close' ),
20
- qv_wrapper = qv_modal.find( '.yith-wcqv-wrapper'),
21
- qv_wrapper_w = qv_wrapper.width(),
22
- qv_wrapper_h = qv_wrapper.height(),
23
- center_modal = function() {
24
-
25
- var window_w = $(window).width(),
26
- window_h = $(window).height(),
27
- width = ( ( window_w - 60 ) > qv_wrapper_w ) ? qv_wrapper_w : ( window_w - 60 ),
28
- height = ( ( window_h - 120 ) > qv_wrapper_h ) ? qv_wrapper_h : ( window_h - 120 );
29
-
30
- qv_wrapper.css({
31
- 'left' : (( window_w/2 ) - ( width/2 )),
32
- 'top' : (( window_h/2 ) - ( height/2 )),
33
- 'width' : width + 'px',
34
- 'height' : height + 'px'
35
- });
36
- };
37
-
38
-
39
- /*==================
40
- *MAIN BUTTON OPEN
41
- ==================*/
42
-
43
- $.fn.yith_quick_view = function() {
44
-
45
- $(document).off( 'click', '.yith-wcqv-button' ).on( 'click', '.yith-wcqv-button', function(e){
46
- e.preventDefault();
47
-
48
- var t = $(this),
49
- product_id = t.data( 'product_id' ),
50
- is_blocked = false;
51
-
52
- if ( typeof yith_qv.loader !== 'undefined' ) {
53
- is_blocked = true;
54
- t.block({
55
- message: null,
56
- overlayCSS : {
57
- background: '#fff url(' + yith_qv.loader + ') no-repeat center',
58
- opacity : 0.5,
59
- cursor : 'none'
60
- }
61
- });
62
-
63
- if( ! qv_modal.hasClass( 'loading' ) ) {
64
- qv_modal.addClass('loading');
65
- }
66
-
67
- // stop loader
68
- $(document).trigger( 'qv_loading' );
69
- }
70
- ajax_call( t, product_id, is_blocked );
71
- });
72
- };
73
-
74
- /*================
75
- * MAIN AJAX CALL
76
- ================*/
77
-
78
- var ajax_call = function( t, product_id, is_blocked ) {
79
-
80
- $.ajax({
81
- url: yith_qv.ajaxurl,
82
- data: {
83
- action: 'yith_load_product_quick_view',
84
- product_id: product_id,
85
- lang: yith_qv.lang
86
- },
87
- dataType: 'html',
88
- type: 'POST',
89
- success: function (data) {
90
-
91
- qv_content.html(data);
92
-
93
- // quantity fields for WC 2.2
94
- if (yith_qv.is2_2) {
95
- qv_content.find('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)').addClass('buttons_added').append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');
96
- }
97
-
98
- // Variation Form
99
- var form_variation = qv_content.find('.variations_form');
100
- form_variation.each( function() {
101
- $( this ).wc_variation_form();
102
- // add Color and Label Integration
103
- if( typeof $.fn.yith_wccl !== 'undefined' ) {
104
- $(this).yith_wccl();
105
- }
106
- });
107
- form_variation.trigger( 'check_variations' );
108
- form_variation.trigger( 'reset_image' );
109
-
110
- // Init prettyPhoto
111
- if (typeof $.fn.prettyPhoto !== 'undefined') {
112
- qv_content.find("a[data-rel^='prettyPhoto'], a.zoom").prettyPhoto({
113
- hook: 'data-rel',
114
- social_tools: false,
115
- theme: 'pp_woocommerce',
116
- horizontal_padding: 20,
117
- opacity: 0.8,
118
- deeplinking: false
119
- });
120
- }
121
-
122
- if( typeof $.fn.wc_product_gallery !== 'undefined' ) {
123
- qv_content.find('.woocommerce-product-gallery').each(function () {
124
- $(this).wc_product_gallery();
125
- });
126
- }
127
-
128
- if (!qv_modal.hasClass('open')) {
129
- qv_modal.removeClass('loading').addClass('open');
130
- if (is_blocked)
131
- t.unblock();
132
- }
133
-
134
- // stop loader
135
- $(document).trigger('qv_loader_stop');
136
-
137
- }
138
- });
139
- };
140
-
141
- /*===================
142
- * CLOSE QUICK VIEW
143
- ===================*/
144
-
145
- var close_modal_qv = function() {
146
-
147
- // Close box by click overlay
148
- qv_overlay.on( 'click', function(e){
149
- close_qv();
150
- });
151
- // Close box with esc key
152
- $(document).keyup(function(e){
153
- if( e.keyCode === 27 )
154
- close_qv();
155
- });
156
- // Close box by click close button
157
- qv_close.on( 'click', function(e) {
158
- e.preventDefault();
159
- close_qv();
160
- });
161
-
162
- var close_qv = function() {
163
- qv_modal.removeClass('open').removeClass('loading');
164
-
165
- setTimeout(function () {
166
- qv_content.html('');
167
- }, 1000);
168
- }
169
- };
170
-
171
- close_modal_qv();
172
-
173
-
174
- center_modal();
175
- $( window ).on( 'resize', center_modal );
176
-
177
- // START
178
- $.fn.yith_quick_view();
179
-
180
- $( document ).on( 'yith_infs_adding_elem yith-wcan-ajax-filtered', function(){
181
- // RESTART
182
- $.fn.yith_quick_view();
183
- });
184
-
185
});
1
+ /**
2
+ * frontend.js
3
+ *
4
+ * @author Your Inspiration Themes
5
+ * @package YITH WooCommerce Quick View
6
+ * @version 1.0.0
7
+ */
8
+
9
+ jQuery(document).ready(function($){
10
+ "use strict";
11
+
12
+ if( typeof yith_qv === 'undefined' ) {
13
+ return;
14
+ }
15
+
16
+ var qv_modal = $(document).find( '#yith-quick-view-modal' ),
17
+ qv_overlay = qv_modal.find( '.yith-quick-view-overlay'),
18
+ qv_content = qv_modal.find( '#yith-quick-view-content' ),
19
+ qv_close = qv_modal.find( '#yith-quick-view-close' ),
20
+ qv_wrapper = qv_modal.find( '.yith-wcqv-wrapper'),
21
+ qv_wrapper_w = qv_wrapper.width(),
22
+ qv_wrapper_h = qv_wrapper.height(),
23
+ center_modal = function() {
24
+
25
+ var window_w = $(window).width(),
26
+ window_h = $(window).height(),
27
+ width = ( ( window_w - 60 ) > qv_wrapper_w ) ? qv_wrapper_w : ( window_w - 60 ),
28
+ height = ( ( window_h - 120 ) > qv_wrapper_h ) ? qv_wrapper_h : ( window_h - 120 );
29
+
30
+ qv_wrapper.css({
31
+ 'left' : (( window_w/2 ) - ( width/2 )),
32
+ 'top' : (( window_h/2 ) - ( height/2 )),
33
+ 'width' : width + 'px',
34
+ 'height' : height + 'px'
35
+ });
36
+ };
37
+
38
+
39
+ /*==================
40
+ *MAIN BUTTON OPEN
41
+ ==================*/
42
+
43
+ $.fn.yith_quick_view = function() {
44
+
45
+ $(document).off( 'click', '.yith-wcqv-button' ).on( 'click', '.yith-wcqv-button', function(e){
46
+ e.preventDefault();
47
+
48
+ var t = $(this),
49
+ product_id = t.data( 'product_id' ),
50
+ is_blocked = false;
51
+
52
+ if ( typeof yith_qv.loader !== 'undefined' ) {
53
+ is_blocked = true;
54
+ t.block({
55
+ message: null,
56
+ overlayCSS : {
57
+ background: '#fff url(' + yith_qv.loader + ') no-repeat center',
58
+ opacity : 0.5,
59
+ cursor : 'none'
60
+ }
61
+ });
62
+
63
+ if( ! qv_modal.hasClass( 'loading' ) ) {
64
+ qv_modal.addClass('loading');
65
+ }
66
+
67
+ // stop loader
68
+ $(document).trigger( 'qv_loading' );
69
+ }
70
+ ajax_call( t, product_id, is_blocked );
71
+ });
72
+ };
73
+
74
+ /*================
75
+ * MAIN AJAX CALL
76
+ ================*/
77
+
78
+ var ajax_call = function( t, product_id, is_blocked ) {
79
+
80
+ $.ajax({
81
+ url: yith_qv.ajaxurl,
82
+ data: {
83
+ action: 'yith_load_product_quick_view',
84
+ product_id: product_id,
85
+ lang: yith_qv.lang
86
+ },
87
+ dataType: 'html',
88
+ type: 'POST',
89
+ success: function (data) {
90
+
91
+ qv_content.html(data);
92
+
93
+ // quantity fields for WC 2.2
94
+ if (yith_qv.is2_2) {
95
+ qv_content.find('div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)').addClass('buttons_added').append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');
96
+ }
97
+
98
+ // Variation Form
99
+ var form_variation = qv_content.find('.variations_form');
100
+ form_variation.each( function() {
101
+ $( this ).wc_variation_form();
102
+ // add Color and Label Integration
103
+ if( typeof $.fn.yith_wccl !== 'undefined' ) {
104
+ $(this).yith_wccl();
105
+ }
106
+ });
107
+ form_variation.trigger( 'check_variations' );
108
+ form_variation.trigger( 'reset_image' );
109
+
110
+ // Init prettyPhoto
111
+ if (typeof $.fn.prettyPhoto !== 'undefined') {
112
+ qv_content.find("a[data-rel^='prettyPhoto'], a.zoom").prettyPhoto({
113
+ hook: 'data-rel',
114
+ social_tools: false,
115
+ theme: 'pp_woocommerce',
116
+ horizontal_padding: 20,
117
+ opacity: 0.8,
118
+ deeplinking: false
119
+ });
120
+ }
121
+
122
+ if( typeof $.fn.wc_product_gallery !== 'undefined' ) {
123
+ qv_content.find('.woocommerce-product-gallery').each(function () {
124
+ $(this).wc_product_gallery();
125
+ });
126
+ }
127
+
128
+ if (!qv_modal.hasClass('open')) {
129
+ qv_modal.removeClass('loading').addClass('open');
130
+ if (is_blocked)
131
+ t.unblock();
132
+ }
133
+
134
+ // stop loader
135
+ $(document).trigger('qv_loader_stop');
136
+
137
+ }
138
+ });
139
+ };
140
+
141
+ /*===================
142
+ * CLOSE QUICK VIEW
143
+ ===================*/
144
+
145
+ var close_modal_qv = function() {
146
+
147
+ // Close box by click overlay
148
+ qv_overlay.on( 'click', function(e){
149
+ close_qv();
150
+ });
151
+ // Close box with esc key
152
+ $(document).keyup(function(e){
153
+ if( e.keyCode === 27 )
154
+ close_qv();
155
+ });
156
+ // Close box by click close button
157
+ qv_close.on( 'click', function(e) {
158
+ e.preventDefault();
159
+ close_qv();
160
+ });
161
+
162
+ var close_qv = function() {
163
+ qv_modal.removeClass('open').removeClass('loading');
164
+
165
+ setTimeout(function () {
166
+ qv_content.html('');
167
+ }, 1000);
168
+ }
169
+ };
170
+
171
+ close_modal_qv();
172
+
173
+
174
+ center_modal();
175
+ $( window ).on( 'resize', center_modal );
176
+
177
+ // START
178
+ $.fn.yith_quick_view();
179
+
180
+ $( document ).on( 'yith_infs_adding_elem yith-wcan-ajax-filtered', function(){
181
+ // RESTART
182
+ $.fn.yith_quick_view();
183
+ });
184
+
185
});
assets/js/frontend.min.js CHANGED
@@ -1,8 +1,8 @@
1
- /**
2
- * frontend.js
3
- *
4
- * @author Your Inspiration Themes
5
- * @package YITH WooCommerce Quick View
6
- * @version 1.0.0
7
- */
8
jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof yith_qv){var a=e(document).find("#yith-quick-view-modal"),t=a.find(".yith-quick-view-overlay"),c=a.find("#yith-quick-view-content"),n=a.find("#yith-quick-view-close"),d=a.find(".yith-wcqv-wrapper"),u=d.width(),r=d.height(),i=function(){var t=e(window).width(),i=e(window).height(),n=u<t-60?u:t-60,o=r<i-120?r:i-120;d.css({left:t/2-n/2,top:i/2-o/2,width:n+"px",height:o+"px"})};e.fn.yith_quick_view=function(){e(document).off("click",".yith-wcqv-button").on("click",".yith-wcqv-button",function(t){t.preventDefault();var i=e(this),n=i.data("product_id"),o=!1;void 0!==yith_qv.loader&&(o=!0,i.block({message:null,overlayCSS:{background:"#fff url("+yith_qv.loader+") no-repeat center",opacity:.5,cursor:"none"}}),a.hasClass("loading")||a.addClass("loading"),e(document).trigger("qv_loading")),l(i,n,o)})};var l=function(n,t,o){e.ajax({url:yith_qv.ajaxurl,data:{action:"yith_load_product_quick_view",product_id:t,lang:yith_qv.lang},dataType:"html",type:"POST",success:function(t){c.html(t),yith_qv.is2_2&&c.find("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');var i=c.find(".variations_form");i.each(function(){e(this).wc_variation_form(),void 0!==e.fn.yith_wccl&&e(this).yith_wccl()}),i.trigger("check_variations"),i.trigger("reset_image"),void 0!==e.fn.prettyPhoto&&c.find("a[data-rel^='prettyPhoto'], a.zoom").prettyPhoto({hook:"data-rel",social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1}),void 0!==e.fn.wc_product_gallery&&c.find(".woocommerce-product-gallery").each(function(){e(this).wc_product_gallery()}),a.hasClass("open")||(a.removeClass("loading").addClass("open"),o&&n.unblock()),e(document).trigger("qv_loader_stop")}})};!function(){t.on("click",function(t){i()}),e(document).keyup(function(t){27===t.keyCode&&i()}),n.on("click",function(t){t.preventDefault(),i()});var i=function(){a.removeClass("open").removeClass("loading"),setTimeout(function(){c.html("")},1e3)}}(),i(),e(window).on("resize",i),e.fn.yith_quick_view(),e(document).on("yith_infs_adding_elem yith-wcan-ajax-filtered",function(){e.fn.yith_quick_view()})}});
1
+ /**
2
+ * frontend.js
3
+ *
4
+ * @author Your Inspiration Themes
5
+ * @package YITH WooCommerce Quick View
6
+ * @version 1.0.0
7
+ */
8
jQuery(document).ready(function(e){"use strict";if("undefined"!=typeof yith_qv){var a=e(document).find("#yith-quick-view-modal"),t=a.find(".yith-quick-view-overlay"),c=a.find("#yith-quick-view-content"),n=a.find("#yith-quick-view-close"),d=a.find(".yith-wcqv-wrapper"),u=d.width(),r=d.height(),i=function(){var t=e(window).width(),i=e(window).height(),n=u<t-60?u:t-60,o=r<i-120?r:i-120;d.css({left:t/2-n/2,top:i/2-o/2,width:n+"px",height:o+"px"})};e.fn.yith_quick_view=function(){e(document).off("click",".yith-wcqv-button").on("click",".yith-wcqv-button",function(t){t.preventDefault();var i=e(this),n=i.data("product_id"),o=!1;void 0!==yith_qv.loader&&(o=!0,i.block({message:null,overlayCSS:{background:"#fff url("+yith_qv.loader+") no-repeat center",opacity:.5,cursor:"none"}}),a.hasClass("loading")||a.addClass("loading"),e(document).trigger("qv_loading")),l(i,n,o)})};var l=function(n,t,o){e.ajax({url:yith_qv.ajaxurl,data:{action:"yith_load_product_quick_view",product_id:t,lang:yith_qv.lang},dataType:"html",type:"POST",success:function(t){c.html(t),yith_qv.is2_2&&c.find("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');var i=c.find(".variations_form");i.each(function(){e(this).wc_variation_form(),void 0!==e.fn.yith_wccl&&e(this).yith_wccl()}),i.trigger("check_variations"),i.trigger("reset_image"),void 0!==e.fn.prettyPhoto&&c.find("a[data-rel^='prettyPhoto'], a.zoom").prettyPhoto({hook:"data-rel",social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1}),void 0!==e.fn.wc_product_gallery&&c.find(".woocommerce-product-gallery").each(function(){e(this).wc_product_gallery()}),a.hasClass("open")||(a.removeClass("loading").addClass("open"),o&&n.unblock()),e(document).trigger("qv_loader_stop")}})};!function(){t.on("click",function(t){i()}),e(document).keyup(function(t){27===t.keyCode&&i()}),n.on("click",function(t){t.preventDefault(),i()});var i=function(){a.removeClass("open").removeClass("loading"),setTimeout(function(){c.html("")},1e3)}}(),i(),e(window).on("resize",i),e.fn.yith_quick_view(),e(document).on("yith_infs_adding_elem yith-wcan-ajax-filtered",function(){e.fn.yith_quick_view()})}});
includes/class.yith-wcqv-admin.php CHANGED
@@ -1,242 +1,244 @@
1
- <?php
2
- /**
3
- * Admin class
4
- *
5
- * @author Yithemes
6
- * @package YITH WooCommerce Quick View
7
- * @version 1.1.1
8
- */
9
-
10
- if ( ! defined( 'YITH_WCQV' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_WCQV_Admin' ) ) {
15
- /**
16
- * Admin class.
17
- * The class manage all the admin behaviors.
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WCQV_Admin {
22
-
23
- /**
24
- * Single instance of the class
25
- *
26
- * @var \YITH_WCQV_Admin
27
- * @since 1.0.0
28
- */
29
- protected static $instance;
30
-
31
- /**
32
- * Plugin options
33
- *
34
- * @var array
35
- * @access public
36
- * @since 1.0.0
37
- */
38
- public $options = array();
39
-
40
- /**
41
- * Plugin version
42
- *
43
- * @var string
44
- * @since 1.0.0
45
- */
46
- public $version = YITH_WCQV_VERSION;
47
-
48
- /**
49
- * @var $_panel Panel Object
50
- */
51
- protected $_panel;
52
-
53
- /**
54
- * @var $_premium string Premium tab template file name
55
- */
56
- protected $_premium = 'premium.php';
57
-
58
- /**
59
- * @var string Premium version landing link
60
- */
61
- protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-quick-view/';
62
-
63
- /**
64
- * @var string Quick View panel page
65
- */
66
- protected $_panel_page = 'yith_wcqv_panel';
67
-
68
- /**
69
- * Various links
70
- *
71
- * @var string
72
- * @access public
73
- * @since 1.0.0
74
- */
75
- public $doc_url = 'https://docs.yithemes.com/yith-woocommerce-quick-view/';
76
-
77
- /**
78
- * Returns single instance of the class
79
- *
80
- * @return \YITH_WCQV_Admin
81
- * @since 1.0.0
82
- */
83
- public static function get_instance(){
84
- if( is_null( self::$instance ) ){
85
- self::$instance = new self();
86
- }
87
-
88
- return self::$instance;
89
- }
90
-
91
- /**
92
- * Constructor
93
- *
94
- * @access public
95
- * @since 1.0.0
96
- */
97
- public function __construct() {
98
-
99
- // Add panel options
100
- add_action( 'admin_menu', array( $this, 'register_panel' ), 5) ;
101
-
102
- //Add action links
103
- add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCQV_DIR . '/' . basename( YITH_WCQV_FILE ) ), array( $this, 'action_links') );
104
- add_filter( 'yith_show_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 5 );
105
-
106
- add_action( 'yith_quick_view_premium', array( $this, 'premium_tab' ) );
107
-
108
- // YITH WCQV Loaded
109
- do_action( 'yith_wcqv_loaded' );
110
-
111
- }
112
-
113
-
114
- /**
115
- * Action Links
116
- *
117
- * add the action links to plugin admin page
118
- *
119
- * @param $links | links plugin array
120
- *
121
- * @return mixed Array
122
- * @since 1.0
123
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
124
- * @return mixed
125
- * @use plugin_action_links_{$plugin_file_name}
126
- */
127
- public function action_links( $links ) {
128
-
129
- $links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-quick-view' ) . '</a>';
130
- $links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-quick-view' ) . '</a>';
131
-
132
- return $links;
133
- }
134
-
135
- /**
136
- * Add a panel under YITH Plugins tab
137
- *
138
- * @return void
139
- * @since 1.0
140
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
141
- * @use /Yit_Plugin_Panel class
142
- * @see plugin-fw/lib/yit-plugin-panel.php
143
- */
144
- public function register_panel() {
145
-
146
- if ( ! empty( $this->_panel ) ) {
147
- return;
148
- }
149
-
150
- $admin_tabs = array(
151
- 'settings' => __( 'Settings', 'yith-woocommerce-quick-view' ),
152
- 'premium' => __( 'Premium Version', 'yith-woocommerce-quick-view' ),
153
- );
154
-
155
- $args = array(
156
- 'create_menu_page' => true,
157
- 'parent_slug' => '',
158
- 'page_title' => __( 'Quick View', 'yith-woocommerce-quick-view' ),
159
- 'menu_title' => __( 'Quick View', 'yith-woocommerce-quick-view' ),
160
- 'capability' => 'manage_options',
161
- 'parent' => '',
162
- 'parent_page' => 'yit_plugin_panel',
163
- 'page' => $this->_panel_page,
164
- 'admin-tabs' => $admin_tabs,
165
- 'options-path' => YITH_WCQV_DIR . '/plugin-options'
166
- );
167
-
168
-
169
- /* === Fixed: not updated theme === */
170
- if( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
171
- require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
172
- }
173
-
174
- $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
175
- }
176
-
177
- /**
178
- * Premium Tab Template
179
- *
180
- * Load the premium tab template on admin page
181
- *
182
- * @return void
183
- * @since 1.0
184
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
185
- * @return void
186
- */
187
- public function premium_tab() {
188
- $premium_tab_template = YITH_WCQV_TEMPLATE_PATH . '/admin/' . $this->_premium;
189
- if( file_exists( $premium_tab_template ) ) {
190
- include_once($premium_tab_template);
191
- }
192
-
193
- }
194
-
195
- /**
196
- * plugin_row_meta
197
- *
198
- * add the action links to plugin admin page
199
- *
200
- * @param $plugin_meta
201
- * @param $plugin_file
202
- * @param $plugin_data
203
- * @param $status
204
- *
205
- * @return Array
206
- * @since 1.0
207
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
208
- * @use plugin_row_meta
209
- */
210
- public function plugin_row_meta( $new_row_meta_args, $plugin_meta, $plugin_file, $plugin_data, $status ) {
211
- if ( defined( 'YITH_WCQV_INIT' ) && YITH_WCQV_INIT == $plugin_file ) {
212
- $new_row_meta_args['slug'] = YITH_WCQV_SLUG;
213
-
214
- if( defined( 'YITH_WCQV_PREMIUM' ) ){
215
- $new_row_meta_args['is_premium'] = true;
216
- }
217
- }
218
- return $new_row_meta_args;
219
- }
220
-
221
- /**
222
- * Get the premium landing uri
223
- *
224
- * @since 1.0.0
225
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
226
- * @return string The premium landing link
227
- */
228
- public function get_premium_landing_uri(){
229
- return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing.'?refer_id=1030585';
230
- }
231
-
232
- }
233
- }
234
- /**
235
- * Unique access to instance of YITH_WCQV_Admin class
236
- *
237
- * @return \YITH_WCQV_Admin
238
- * @since 1.0.0
239
- */
240
- function YITH_WCQV_Admin(){
241
- return YITH_WCQV_Admin::get_instance();
242
}
1
+ <?php
2
+ /**
3
+ * Admin class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Quick View
7
+ * @version 1.1.1
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCQV' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists( 'YITH_WCQV_Admin' ) ) {
15
+ /**
16
+ * Admin class.
17
+ * The class manage all the admin behaviors.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WCQV_Admin {
22
+
23
+ /**
24
+ * Single instance of the class
25
+ *
26
+ * @var \YITH_WCQV_Admin
27
+ * @since 1.0.0
28
+ */
29
+ protected static $instance;
30
+
31
+ /**
32
+ * Plugin options
33
+ *
34
+ * @var array
35
+ * @access public
36
+ * @since 1.0.0
37
+ */
38
+ public $options = array();
39
+
40
+ /**
41
+ * Plugin version
42
+ *
43
+ * @var string
44
+ * @since 1.0.0
45
+ */
46
+ public $version = YITH_WCQV_VERSION;
47
+
48
+ /**
49
+ * @var $_panel Panel Object
50
+ */
51
+ protected $_panel;
52
+
53
+ /**
54
+ * @var $_premium string Premium tab template file name
55
+ */
56
+ protected $_premium = 'premium.php';
57
+
58
+ /**
59
+ * @var string Premium version landing link
60
+ */
61
+ protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-quick-view/';
62
+
63
+ /**
64
+ * @var string Quick View panel page
65
+ */
66
+ protected $_panel_page = 'yith_wcqv_panel';
67
+
68
+ /**
69
+ * Various links
70
+ *
71
+ * @var string
72
+ * @access public
73
+ * @since 1.0.0
74
+ */
75
+ public $doc_url = 'https://docs.yithemes.com/yith-woocommerce-quick-view/';
76
+
77
+ /**
78
+ * Returns single instance of the class
79
+ *
80
+ * @return \YITH_WCQV_Admin
81
+ * @since 1.0.0
82
+ */
83
+ public static function get_instance(){
84
+ if( is_null( self::$instance ) ){
85
+ self::$instance = new self();
86
+ }
87
+
88
+ return self::$instance;
89
+ }
90
+
91
+ /**
92
+ * Constructor
93
+ *
94
+ * @access public
95
+ * @since 1.0.0
96
+ */
97
+ public function __construct() {
98
+
99
+ // Add panel options
100
+ add_action( 'admin_menu', array( $this, 'register_panel' ), 5) ;
101
+
102
+ //Add action links
103
+ add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCQV_DIR . '/' . basename( YITH_WCQV_FILE ) ), array( $this, 'action_links') );
104
+ add_filter( 'yith_show_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 5 );
105
+
106
+ add_action( 'yith_quick_view_premium', array( $this, 'premium_tab' ) );
107
+
108
+ // YITH WCQV Loaded
109
+ do_action( 'yith_wcqv_loaded' );
110
+
111
+ }
112
+
113
+
114
+ /**
115
+ * Action Links
116
+ *
117
+ * add the action links to plugin admin page
118
+ *
119
+ * @param $links | links plugin array
120
+ *
121
+ * @return mixed Array
122
+ * @since 1.0
123
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
124
+ * @return mixed
125
+ * @use plugin_action_links_{$plugin_file_name}
126
+ */
127
+ public function action_links( $links ) {
128
+
129
+ $links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-quick-view' ) . '</a>';
130
+ if( defined( 'YITH_WCQV_PREMIUM' ) && YITH_WCQV_PREMIUM ) {
131
+ $links[] = '<a href="' . YIT_Plugin_Licence()->get_license_activation_url() . '">' . __( 'License', 'yith-woocommerce-quick-view' ) . '</a>';
132
+ }
133
+
134
+ return $links;
135
+ }
136
+
137
+ /**
138
+ * Add a panel under YITH Plugins tab
139
+ *
140
+ * @return void
141
+ * @since 1.0
142
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
143
+ * @use /Yit_Plugin_Panel class
144
+ * @see plugin-fw/lib/yit-plugin-panel.php
145
+ */
146
+ public function register_panel() {
147
+
148
+ if ( ! empty( $this->_panel ) ) {
149
+ return;
150
+ }
151
+
152
+ $admin_tabs = array(
153
+ 'settings' => __( 'Settings', 'yith-woocommerce-quick-view' ),
154
+ 'premium' => __( 'Premium Version', 'yith-woocommerce-quick-view' ),
155
+ );
156
+
157
+ $args = array(
158
+ 'create_menu_page' => true,
159
+ 'parent_slug' => '',
160
+ 'page_title' => __( 'Quick View', 'yith-woocommerce-quick-view' ),
161
+ 'menu_title' => __( 'Quick View', 'yith-woocommerce-quick-view' ),
162
+ 'capability' => 'manage_options',
163
+ 'parent' => '',
164
+ 'parent_page' => 'yith_plugin_panel',
165
+ 'page' => $this->_panel_page,
166
+ 'admin-tabs' => $admin_tabs,
167
+ 'options-path' => YITH_WCQV_DIR . '/plugin-options'
168
+ );
169
+
170
+
171
+ /* === Fixed: not updated theme === */
172
+ if( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
173
+ require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
174
+ }
175
+
176
+ $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
177
+ }
178
+
179
+ /**
180
+ * Premium Tab Template
181
+ *
182
+ * Load the premium tab template on admin page
183
+ *
184
+ * @return void
185
+ * @since 1.0
186
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
187
+ * @return void
188
+ */
189
+ public function premium_tab() {
190
+ $premium_tab_template = YITH_WCQV_TEMPLATE_PATH . '/admin/' . $this->_premium;
191
+ if( file_exists( $premium_tab_template ) ) {
192
+ include_once($premium_tab_template);
193
+ }
194
+
195
+ }
196
+
197
+ /**
198
+ * plugin_row_meta
199
+ *
200
+ * add the action links to plugin admin page
201
+ *
202
+ * @param $plugin_meta
203
+ * @param $plugin_file
204
+ * @param $plugin_data
205
+ * @param $status
206
+ *
207
+ * @return Array
208
+ * @since 1.0
209
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
210
+ * @use plugin_row_meta
211
+ */
212
+ public function plugin_row_meta( $new_row_meta_args, $plugin_meta, $plugin_file, $plugin_data, $status ) {
213
+ if ( defined( 'YITH_WCQV_INIT' ) && YITH_WCQV_INIT == $plugin_file ) {
214
+ $new_row_meta_args['slug'] = YITH_WCQV_SLUG;
215
+
216
+ if( defined( 'YITH_WCQV_PREMIUM' ) ){
217
+ $new_row_meta_args['is_premium'] = true;
218
+ }
219
+ }
220
+ return $new_row_meta_args;
221
+ }
222
+
223
+ /**
224
+ * Get the premium landing uri
225
+ *
226
+ * @since 1.0.0
227
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
228
+ * @return string The premium landing link
229
+ */
230
+ public function get_premium_landing_uri(){
231
+ return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing.'?refer_id=1030585';
232
+ }
233
+
234
+ }
235
+ }
236
+ /**
237
+ * Unique access to instance of YITH_WCQV_Admin class
238
+ *
239
+ * @return \YITH_WCQV_Admin
240
+ * @since 1.0.0
241
+ */
242
+ function YITH_WCQV_Admin(){
243
+ return YITH_WCQV_Admin::get_instance();
244
}
includes/class.yith-wcqv-frontend.php CHANGED
@@ -1,359 +1,363 @@
1
- <?php
2
- /**
3
- * Frontend class
4
- *
5
- * @author Yithemes
6
- * @package YITH WooCommerce Quick View
7
- * @version 1.1.1
8
- */
9
-
10
- if ( ! defined( 'YITH_WCQV' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if( ! class_exists( 'YITH_WCQV_Frontend' ) ) {
15
- /**
16
- * Admin class.
17
- * The class manage all the Frontend behaviors.
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WCQV_Frontend {
22
-
23
- /**
24
- * Single instance of the class
25
- *
26
- * @var \YITH_WCQV_Frontend
27
- * @since 1.0.0
28
- */
29
- protected static $instance;
30
-
31
- /**
32
- * Plugin version
33
- *
34
- * @var string
35
- * @since 1.0.0
36
- */
37
- public $version = YITH_WCQV_VERSION;
38
-
39
- /**
40
- * Returns single instance of the class
41
- *
42
- * @return \YITH_WCQV_Frontend
43
- * @since 1.0.0
44
- */
45
- public static function get_instance(){
46
- if( is_null( self::$instance ) ){
47
- self::$instance = new self();
48
- }
49
-
50
- return self::$instance;
51
- }
52
-
53
- /**
54
- * Constructor
55
- *
56
- * @access public
57
- * @since 1.0.0
58
- */
59
- public function __construct() {
60
-
61
- // custom styles and javascripts
62
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
63
-
64
- // quick view ajax
65
- add_action( 'wp_ajax_yith_load_product_quick_view', array( $this, 'yith_load_product_quick_view_ajax' ) );
66
- add_action( 'wp_ajax_nopriv_yith_load_product_quick_view', array( $this, 'yith_load_product_quick_view_ajax' ) );
67
-
68
- // add button
69
- add_action( 'woocommerce_after_shop_loop_item', array( $this, 'yith_add_quick_view_button' ), 15 );
70
- add_action( 'yith_wcwl_table_after_product_name', array( $this, 'yith_add_quick_view_button' ), 15, 0 );
71
-
72
- // load modal template
73
- add_action( 'wp_footer', array( $this, 'yith_quick_view' ) );
74
-
75
- // load action for product template
76
- $this->yith_quick_view_action_template();
77
-
78
- add_shortcode( 'yith_quick_view', array( $this, 'quick_view_shortcode' ) );
79
- add_filter( 'woocommerce_add_to_cart_form_action', array( $this, 'avoid_redirect_to_single_page'), 10, 1 );
80
- }
81
-
82
- /**
83
- * Enqueue styles and scripts
84
- *
85
- * @access public
86
- * @return void
87
- * @since 1.0.0
88
- * @author Francesco Licandro <francesco.licandro@yithemes.com>
89
- */
90
- public function enqueue_styles_scripts() {
91
-
92
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
93
-
94
- wp_register_script( 'yith-wcqv-frontend', YITH_WCQV_ASSETS_URL . '/js/frontend'.$suffix.'.js', array('jquery'), $this->version, true);
95
- wp_enqueue_script( 'yith-wcqv-frontend' );
96
- wp_enqueue_style( 'yith-quick-view', YITH_WCQV_ASSETS_URL . '/css/yith-quick-view.css' );
97
-
98
- $background_modal = get_option( 'yith-wcqv-background-modal' );
99
- $close_color = get_option( 'yith-wcqv-close-color' );
100
- $close_color_hover = get_option( 'yith-wcqv-close-color-hover' );
101
-
102
- $inline_style = "
103
- #yith-quick-view-modal .yith-wcqv-main{background:{$background_modal};}
104
- #yith-quick-view-close{color:{$close_color};}
105
- #yith-quick-view-close:hover{color:{$close_color_hover};}";
106
-
107
- wp_add_inline_style( 'yith-quick-view', $inline_style );
108
- }
109
-
110
- /**
111
- * Add quick view button in wc product loop
112
- *
113
- * @access public
114
- * @param integer|string $product_id The product id
115
- * @param string $label The button label
116
- * @param boolean $return
117
- * @return string|void
118
- * @since 1.0.0
119
- * @author Francesco Licandro <francesco.licandro@yithemes.com>
120
- */
121
- public function yith_add_quick_view_button( $product_id = 0, $label = '', $return = false ) {
122
-
123
- global $product;
124
-
125
- if( ! $product_id ){
126
- $product instanceof WC_Product && $product_id = yit_get_prop( $product, 'id', true );
127
- }
128
-
129
- $button = '';
130
- if( $product_id ) {
131
- // get label
132
- ! $label && $label = $this->get_button_label();
133
-
134
- $button = '<a href="#" class="button yith-wcqv-button" data-product_id="' . $product_id . '">' . $label . '</a>';
135
- $button = apply_filters('yith_add_quick_view_button_html', $button, $label, $product);
136
- }
137
-
138
- if( $return ) {
139
- return $button;
140
- }
141
-
142
- echo $button;
143
- }
144
-
145
- /**
146
- * Enqueue scripts and pass variable to js used in quick view
147
- *
148
- * @access public
149
- * @return bool
150
- * @since 1.0.0
151
- * @author Francesco Licandro <francesco.licandro@yithemes.com>
152
- */
153
- public function yith_woocommerce_quick_view() {
154
-
155
- wp_enqueue_script( 'wc-add-to-cart-variation' );
156
- if( version_compare( WC()->version, '3.0.0', '>=' ) ) {
157
- if( current_theme_supports('wc-product-gallery-zoom') ) {
158
- wp_enqueue_script('zoom');
159
- }
160
- if( current_theme_supports('wc-product-gallery-lightbox') ) {
161
- wp_enqueue_script('photoswipe-ui-default');
162
- wp_enqueue_style('photoswipe-default-skin');
163
- if( has_action('wp_footer', 'woocommerce_photoswipe') === FALSE ) {
164
- add_action('wp_footer', 'woocommerce_photoswipe', 15);
165
- }
166
- }
167
- wp_enqueue_script('wc-single-product');
168
- }
169
-
170
- // enqueue wc color e label variation style
171
- wp_enqueue_script( 'yith_wccl_frontend' );
172
- wp_enqueue_style( 'yith_wccl_frontend' );
173
-
174
- $lightbox_en = get_option( 'yith-wcqv-enable-lightbox' ) == 'yes' ? true : false;
175
-
176
- // if enabled load prettyPhoto css
177
- if( $lightbox_en ) {
178
-
179
- $assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
180
-
181
- wp_enqueue_script( 'prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.min.js', array( 'jquery' ), '3.1.5', true );
182
- wp_enqueue_style( 'woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css' );
183
- }
184
-
185
- $version = version_compare( preg_replace( '/-beta-([0-9]+)/', '', WC()->version ), '2.3.0', '<' );
186
-
187
- // loader gif
188
- $loader = apply_filters( 'yith_quick_view_loader_gif', YITH_WCQV_ASSETS_URL . '/image/qv-loader.gif' );
189
-
190
- // Allow user to load custom style and scripts
191
- do_action( 'yith_quick_view_custom_style_scripts' );
192
-
193
- wp_localize_script( 'yith-wcqv-frontend', 'yith_qv', array (
194
- 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
195
- 'loader' => $loader,
196
- 'is2_2' => $version,
197
- 'lang' => defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : ''
198
- )
199
- );
200
-
201
- return true;
202
- }
203
-
204
- /**
205
- * Ajax action to load product in quick view
206
- *
207
- * @access public
208
- * @return void
209
- * @since 1.0.0
210
- * @author Francesco Licandro <francesco.licandro@yithemes.com>
211
- */
212
- public function yith_load_product_quick_view_ajax() {
213
-
214
- if ( ! isset( $_REQUEST['product_id'] ) ) {
215
- die();
216
- }
217
-
218
- global $sitepress;
219
-
220
- $product_id = intval( $_REQUEST['product_id'] );
221
-
222
- /**
223
- * WPML Suppot: Localize Ajax Call
224
- */
225
- $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : '';
226
- if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
227
- $sitepress->switch_lang( $lang, true );
228
- }
229
-
230
- // set the main wp query for the product
231
- wp( 'p=' . $product_id . '&post_type=product' );
232
-
233
- // remove product thumbnails gallery
234
- remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
235
-
236
- // change template for variable products
237
- if ( isset( $GLOBALS['yith_wccl'] ) ) {
238
- $GLOBALS['yith_wccl']->obj = new YITH_WCCL_Frontend( YITH_WCCL_VERSION );
239
- $GLOBALS['yith_wccl']->obj->override();
240
- }
241
-
242
- ob_start();
243
-
244
- // load content template
245
- wc_get_template( 'yith-quick-view-content.php', array(), '', YITH_WCQV_DIR . 'templates/' );
246
-
247
- echo ob_get_clean();
248
-
249
- die();
250
- }
251
-
252
- /**
253
- * Load quick view template
254
- *
255
- * @access public
256
- * @return void
257
- * @since 1.0.0
258
- * @author Francesco Licandro <francesco.licandro@yithemes.com>
259
- */
260
- public function yith_quick_view() {
261
- $this->yith_woocommerce_quick_view();
262
- wc_get_template( 'yith-quick-view.php', array(), '', YITH_WCQV_DIR . 'templates/' );
263
- }
264
-
265
- /**
266
- * Load wc action for quick view product template
267
- *
268
- * @access public
269
- * @return void
270
- * @since 1.0.0
271
- * @author Francesco Licandro <francesco.licandro@yithemes.com>
272
- */
273
- public function yith_quick_view_action_template() {
274
-
275
- // Image
276
- add_action( 'yith_wcqv_product_image', 'woocommerce_show_product_sale_flash', 10 );
277
- add_action( 'yith_wcqv_product_image', 'woocommerce_show_product_images', 20 );
278
-
279
- // Summary
280
- add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_title', 5 );
281
- add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_rating', 10 );
282
- add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_price', 15 );
283
- add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_excerpt', 20 );
284
- add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_add_to_cart', 25 );
285
- add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_meta', 30 );
286
- }
287
-
288
- /**
289
- * Get Quick View button label
290
- *
291
- * @author Francesco Licandro
292
- * @since 1.2.0
293
- * @return string
294
- */
295
- public function get_button_label(){
296
- $label = get_option( 'yith-wcqv-button-label' );
297
- $label = call_user_func( '__' , $label, 'yith-woocommerce-quick-view' );
298
-
299
- return apply_filters( 'yith_wcqv_button_label', esc_html( $label ) );
300
- }
301
-
302
- /**
303
- * Quick View shortcode button
304
- *
305
- * @access public
306
- * @since 1.0.7
307
- * @param array $atts
308
- * @return string
309
- * @author Francesco Licandro
310
- */
311
- public function quick_view_shortcode( $atts ) {
312
-
313
- $atts = shortcode_atts(array(
314
- 'product_id' => 0,
315
- 'label' => ''
316
- ), $atts );
317
-
318
- extract( $atts );
319
-
320
- return $this->yith_add_quick_view_button( intval( $product_id ), $label, true );
321
- }
322
-
323
- /**
324
- * Check if is quick view
325
- *
326
- * @access public
327
- * @return bool
328
- * @since 1.3.1
329
- * @author Francesco Licandro <francesco.licandro@yithemes.com>
330
- */
331
- public function yith_is_quick_view() {
332
- return ( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yith_load_product_quick_view' ) ? true : false;
333
- }
334
-
335
- /**
336
- * Avoid redirect to single product page on add to cart action in quick view
337
- *
338
- * @since 1.3.1
339
- * @author Francesco Licandro
340
- * @param string $value
341
- * @return string
342
- */
343
- public function avoid_redirect_to_single_page( $value ){
344
- if( $this->yith_is_quick_view() ) {
345
- return '';
346
- }
347
- return $value;
348
- }
349
- }
350
- }
351
- /**
352
- * Unique access to instance of YITH_WCQV_Frontend class
353
- *
354
- * @return \YITH_WCQV_Frontend
355
- * @since 1.0.0
356
- */
357
- function YITH_WCQV_Frontend(){
358
- return YITH_WCQV_Frontend::get_instance();
359
- }
1
+ <?php
2
+ /**
3
+ * Frontend class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Quick View
7
+ * @version 1.1.1
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCQV' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if( ! class_exists( 'YITH_WCQV_Frontend' ) ) {
15
+ /**
16
+ * Admin class.
17
+ * The class manage all the Frontend behaviors.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WCQV_Frontend {
22
+
23
+ /**
24
+ * Single instance of the class
25
+ *
26
+ * @var \YITH_WCQV_Frontend
27
+ * @since 1.0.0
28
+ */
29
+ protected static $instance;
30
+
31
+ /**
32
+ * Plugin version
33
+ *
34
+ * @var string
35
+ * @since 1.0.0
36
+ */
37
+ public $version = YITH_WCQV_VERSION;
38
+
39
+ /**
40
+ * Returns single instance of the class
41
+ *
42
+ * @return \YITH_WCQV_Frontend
43
+ * @since 1.0.0
44
+ */
45
+ public static function get_instance(){
46
+ if( is_null( self::$instance ) ){
47
+ self::$instance = new self();
48
+ }
49
+
50
+ return self::$instance;
51
+ }
52
+
53
+ /**
54
+ * Constructor
55
+ *
56
+ * @access public
57
+ * @since 1.0.0
58
+ */
59
+ public function __construct() {
60
+
61
+ // custom styles and javascripts
62
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
63
+
64
+ // quick view ajax
65
+ add_action( 'wp_ajax_yith_load_product_quick_view', array( $this, 'yith_load_product_quick_view_ajax' ) );
66
+ add_action( 'wp_ajax_nopriv_yith_load_product_quick_view', array( $this, 'yith_load_product_quick_view_ajax' ) );
67
+
68
+ // add button
69
+ add_action( 'woocommerce_after_shop_loop_item', array( $this, 'yith_add_quick_view_button' ), 15 );
70
+ add_action( 'yith_wcwl_table_after_product_name', array( $this, 'yith_add_quick_view_button' ), 15, 0 );
71
+
72
+ // load modal template
73
+ add_action( 'wp_footer', array( $this, 'yith_quick_view' ) );
74
+
75
+ // load action for product template
76
+ $this->yith_quick_view_action_template();
77
+
78
+ add_shortcode( 'yith_quick_view', array( $this, 'quick_view_shortcode' ) );
79
+ add_filter( 'woocommerce_add_to_cart_form_action', array( $this, 'avoid_redirect_to_single_page'), 10, 1 );
80
+ }
81
+
82
+ /**
83
+ * Enqueue styles and scripts
84
+ *
85
+ * @access public
86
+ * @return void
87
+ * @since 1.0.0
88
+ * @author Francesco Licandro <francesco.licandro@yithemes.com>
89
+ */
90
+ public function enqueue_styles_scripts() {
91
+
92
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
93
+
94
+ wp_register_script( 'yith-wcqv-frontend', YITH_WCQV_ASSETS_URL . '/js/frontend'.$suffix.'.js', array('jquery'), $this->version, true);
95
+ wp_enqueue_script( 'yith-wcqv-frontend' );
96
+ wp_enqueue_style( 'yith-quick-view', YITH_WCQV_ASSETS_URL . '/css/yith-quick-view.css' );
97
+
98
+ $background_modal = get_option( 'yith-wcqv-background-modal' );
99
+ $close_color = get_option( 'yith-wcqv-close-color' );
100
+ $close_color_hover = get_option( 'yith-wcqv-close-color-hover' );
101
+
102
+ $inline_style = "
103
+ #yith-quick-view-modal .yith-wcqv-main{background:{$background_modal};}
104
+ #yith-quick-view-close{color:{$close_color};}
105
+ #yith-quick-view-close:hover{color:{$close_color_hover};}";
106
+
107
+ wp_add_inline_style( 'yith-quick-view', $inline_style );
108
+ }
109
+
110
+ /**
111
+ * Add quick view button in wc product loop
112
+ *
113
+ * @access public
114
+ * @param integer|string $product_id The product id
115
+ * @param string $label The button label
116
+ * @param boolean $return
117
+ * @return string|void
118
+ * @since 1.0.0
119
+ * @author Francesco Licandro <francesco.licandro@yithemes.com>
120
+ */
121
+ public function yith_add_quick_view_button( $product_id = 0, $label = '', $return = false ) {
122
+
123
+ global $product;
124
+
125
+ if( ! $product_id ){
126
+ $product instanceof WC_Product && $product_id = yit_get_prop( $product, 'id', true );
127
+ }
128
+
129
+ $show_quick_view_button = apply_filters( 'yith_wcqv_show_quick_view_button', true, $product_id );
130
+
131
+ if( !$show_quick_view_button ) return;
132
+
133
+ $button = '';
134
+ if( $product_id ) {
135
+ // get label
136
+ ! $label && $label = $this->get_button_label();
137
+
138
+ $button = '<a href="#" class="button yith-wcqv-button" data-product_id="' . $product_id . '">' . $label . '</a>';
139
+ $button = apply_filters('yith_add_quick_view_button_html', $button, $label, $product);
140
+ }
141
+
142
+ if( $return ) {
143
+ return $button;
144
+ }
145
+
146
+ echo $button;
147
+ }
148
+
149
+ /**
150
+ * Enqueue scripts and pass variable to js used in quick view
151
+ *
152
+ * @access public
153
+ * @return bool
154
+ * @since 1.0.0
155
+ * @author Francesco Licandro <francesco.licandro@yithemes.com>
156
+ */
157
+ public function yith_woocommerce_quick_view() {
158
+
159
+ wp_enqueue_script( 'wc-add-to-cart-variation' );
160
+ if( version_compare( WC()->version, '3.0.0', '>=' ) ) {
161
+ if( current_theme_supports('wc-product-gallery-zoom') ) {
162
+ wp_enqueue_script('zoom');
163
+ }
164
+ if( current_theme_supports('wc-product-gallery-lightbox') ) {
165
+ wp_enqueue_script('photoswipe-ui-default');
166
+ wp_enqueue_style('photoswipe-default-skin');
167
+ if( has_action('wp_footer', 'woocommerce_photoswipe') === FALSE ) {
168
+ add_action('wp_footer', 'woocommerce_photoswipe', 15);
169
+ }
170
+ }
171
+ wp_enqueue_script('wc-single-product');
172
+ }
173
+
174
+ // enqueue wc color e label variation style
175
+ wp_enqueue_script( 'yith_wccl_frontend' );
176
+ wp_enqueue_style( 'yith_wccl_frontend' );
177
+
178
+ $lightbox_en = get_option( 'yith-wcqv-enable-lightbox' ) == 'yes' ? true : false;
179
+
180
+ // if enabled load prettyPhoto css
181
+ if( $lightbox_en ) {
182
+
183
+ $assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
184
+
185
+ wp_enqueue_script( 'prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.min.js', array( 'jquery' ), '3.1.5', true );
186
+ wp_enqueue_style( 'woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css' );
187
+ }
188
+
189
+ $version = version_compare( preg_replace( '/-beta-([0-9]+)/', '', WC()->version ), '2.3.0', '<' );
190
+
191
+ // loader gif
192
+ $loader = apply_filters( 'yith_quick_view_loader_gif', YITH_WCQV_ASSETS_URL . '/image/qv-loader.gif' );
193
+
194
+ // Allow user to load custom style and scripts
195
+ do_action( 'yith_quick_view_custom_style_scripts' );
196
+
197
+ wp_localize_script( 'yith-wcqv-frontend', 'yith_qv', array (
198
+ 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
199
+ 'loader' => $loader,
200
+ 'is2_2' => $version,
201
+ 'lang' => defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : ''
202
+ )
203
+ );
204
+
205
+ return true;
206
+ }
207
+
208
+ /**
209
+ * Ajax action to load product in quick view
210
+ *
211
+ * @access public
212
+ * @return void
213
+ * @since 1.0.0
214
+ * @author Francesco Licandro <francesco.licandro@yithemes.com>
215
+ */
216
+ public function yith_load_product_quick_view_ajax() {
217
+
218
+ if ( ! isset( $_REQUEST['product_id'] ) ) {
219
+ die();
220
+ }
221
+
222
+ global $sitepress;
223
+
224
+ $product_id = intval( $_REQUEST['product_id'] );
225
+
226
+ /**
227
+ * WPML Suppot: Localize Ajax Call
228
+ */
229
+ $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : '';
230
+ if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
231
+ $sitepress->switch_lang( $lang, true );
232
+ }
233
+
234
+ // set the main wp query for the product
235
+ wp( 'p=' . $product_id . '&post_type=product' );
236
+
237
+ // remove product thumbnails gallery
238
+ remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
239
+
240
+ // change template for variable products
241
+ if ( isset( $GLOBALS['yith_wccl'] ) ) {
242
+ $GLOBALS['yith_wccl']->obj = new YITH_WCCL_Frontend( YITH_WCCL_VERSION );
243
+ $GLOBALS['yith_wccl']->obj->override();
244
+ }
245
+
246
+ ob_start();
247
+
248
+ // load content template
249
+ wc_get_template( 'yith-quick-view-content.php', array(), '', YITH_WCQV_DIR . 'templates/' );
250
+
251
+ echo ob_get_clean();
252
+
253
+ die();
254
+ }
255
+
256
+ /**
257
+ * Load quick view template
258
+ *
259
+ * @access public
260
+ * @return void
261
+ * @since 1.0.0
262
+ * @author Francesco Licandro <francesco.licandro@yithemes.com>
263
+ */
264
+ public function yith_quick_view() {
265
+ $this->yith_woocommerce_quick_view();
266
+ wc_get_template( 'yith-quick-view.php', array(), '', YITH_WCQV_DIR . 'templates/' );
267
+ }
268
+
269
+ /**
270
+ * Load wc action for quick view product template
271
+ *
272
+ * @access public
273
+ * @return void
274
+ * @since 1.0.0
275
+ * @author Francesco Licandro <francesco.licandro@yithemes.com>
276
+ */
277
+ public function yith_quick_view_action_template() {
278
+
279
+ // Image
280
+ add_action( 'yith_wcqv_product_image', 'woocommerce_show_product_sale_flash', 10 );
281
+ add_action( 'yith_wcqv_product_image', 'woocommerce_show_product_images', 20 );
282
+
283
+ // Summary
284
+ add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_title', 5 );
285
+ add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_rating', 10 );
286
+ add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_price', 15 );
287
+ add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_excerpt', 20 );
288
+ add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_add_to_cart', 25 );
289
+ add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_meta', 30 );
290
+ }
291
+
292
+ /**
293
+ * Get Quick View button label
294
+ *
295
+ * @author Francesco Licandro
296
+ * @since 1.2.0
297
+ * @return string
298
+ */
299
+ public function get_button_label(){
300
+ $label = get_option( 'yith-wcqv-button-label' );
301
+ $label = call_user_func( '__' , $label, 'yith-woocommerce-quick-view' );
302
+
303
+ return apply_filters( 'yith_wcqv_button_label', esc_html( $label ) );
304
+ }
305
+
306
+ /**
307
+ * Quick View shortcode button
308
+ *
309
+ * @access public
310
+ * @since 1.0.7
311
+ * @param array $atts
312
+ * @return string
313
+ * @author Francesco Licandro
314
+ */
315
+ public function quick_view_shortcode( $atts ) {
316
+
317
+ $atts = shortcode_atts(array(
318
+ 'product_id' => 0,
319
+ 'label' => ''
320
+ ), $atts );
321
+
322
+ extract( $atts );
323
+
324
+ return $this->yith_add_quick_view_button( intval( $product_id ), $label, true );
325
+ }
326
+
327
+ /**
328
+ * Check if is quick view
329
+ *
330
+ * @access public
331
+ * @return bool
332
+ * @since 1.3.1
333
+ * @author Francesco Licandro <francesco.licandro@yithemes.com>
334
+ */
335
+ public function yith_is_quick_view() {
336
+ return ( defined('DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yith_load_product_quick_view' ) ? true : false;
337
+ }
338
+
339
+ /**
340
+ * Avoid redirect to single product page on add to cart action in quick view
341
+ *
342
+ * @since 1.3.1
343
+ * @author Francesco Licandro
344
+ * @param string $value
345
+ * @return string
346
+ */
347
+ public function avoid_redirect_to_single_page( $value ){
348
+ if( $this->yith_is_quick_view() ) {
349
+ return '';
350
+ }
351
+ return $value;
352
+ }
353
+ }
354
+ }
355
+ /**
356
+ * Unique access to instance of YITH_WCQV_Frontend class
357
+ *
358
+ * @return \YITH_WCQV_Frontend
359
+ * @since 1.0.0
360
+ */
361
+ function YITH_WCQV_Frontend(){
362
+ return YITH_WCQV_Frontend::get_instance();
363
+ }
includes/class.yith-wcqv.php CHANGED
@@ -1,157 +1,157 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Yithemes
6
- * @package YITH WooCommerce Quick View
7
- * @version 1.0.0
8
- */
9
-
10
-
11
- if ( ! defined( 'YITH_WCQV' ) ) {
12
- exit;
13
- } // Exit if accessed directly
14
-
15
- if ( ! class_exists( 'YITH_WCQV' ) ) {
16
- /**
17
- * YITH WooCommerce Quick View
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WCQV {
22
-
23
- /**
24
- * Single instance of the class
25
- *
26
- * @var \YITH_WCQV
27
- * @since 1.0.0
28
- */
29
- protected static $instance;
30
-
31
- /**
32
- * Plugin version
33
- *
34
- * @var string
35
- * @since 1.0.0
36
- */
37
- public $version = YITH_WCQV_VERSION;
38
-
39
- /**
40
- * Plugin object
41
- *
42
- * @var string
43
- * @since 1.0.0
44
- */
45
- public $obj = null;
46
-
47
- /**
48
- * Returns single instance of the class
49
- *
50
- * @return \YITH_WCQV
51
- * @since 1.0.0
52
- */
53
- public static function get_instance(){
54
- if( is_null( self::$instance ) ){
55
- self::$instance = new self();
56
- }
57
-
58
- return self::$instance;
59
- }
60
-
61
- /**
62
- * Constructor
63
- *
64
- * @return mixed| YITH_WCQV_Admin | YITH_WCQV_Frontend
65
- * @since 1.0.0
66
- */
67
- public function __construct() {
68
-
69
- // Load Plugin Framework
70
- add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
71
-
72
- $action = array(
73
- 'woocommerce_get_refreshed_fragments',
74
- 'woocommerce_apply_coupon',
75
- 'woocommerce_remove_coupon',
76
- 'woocommerce_update_shipping_method',
77
- 'woocommerce_update_order_review',
78
- 'woocommerce_add_to_cart',
79
- 'woocommerce_checkout'
80
- );
81
-
82
- // Exit if is woocommerce ajax
83
- if( defined( 'DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $action ) ) {
84
- return;
85
- }
86
-
87
- if ( $this->is_admin() ) {
88
- // load admin classes
89
- require_once( 'class.yith-wcqv-admin.php' );
90
- YITH_WCQV_Admin();
91
- }
92
-
93
- if( $this->load_frontend() ) {
94
- // load frontend classes
95
- require_once( 'class.yith-wcqv-frontend.php' );
96
- YITH_WCQV_Frontend();
97
- }
98
- }
99
-
100
- /**
101
- * Check if context is admin
102
- *
103
- * @author Francesco Licandro
104
- * @since 1.2.0
105
- * @return boolean
106
- */
107
- public function is_admin(){
108
- $is_ajax = ( defined( 'DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend' );
109
- return apply_filters( 'yith_wcqv_is_admin', is_admin() && ! $is_ajax );
110
- }
111
-
112
- /**
113
- * Check if load or not frontend
114
- *
115
- * @author Francesco Licandro
116
- * @since 1.2.0
117
- * @return boolean
118
- */
119
- public function load_frontend(){
120
- // Class frontend
121
- $enable = get_option( 'yith-wcqv-enable', 'yes' ) == 'yes';
122
- $enable_on_mobile = get_option( 'yith-wcqv-enable-mobile', 'yes' ) == 'yes';
123
- $is_mobile = wp_is_mobile();
124
-
125
- return apply_filters( 'yith_wcqv_load_frontend', ( ! $is_mobile && $enable ) || ( $is_mobile && $enable_on_mobile ) );
126
- }
127
-
128
-
129
- /**
130
- * Load Plugin Framework
131
- *
132
- * @since 1.0
133
- * @access public
134
- * @return void
135
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
136
- */
137
- public function plugin_fw_loader() {
138
- if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
139
- global $plugin_fw_data;
140
- if( ! empty( $plugin_fw_data ) ){
141
- $plugin_fw_file = array_shift( $plugin_fw_data );
142
- require_once( $plugin_fw_file );
143
- }
144
- }
145
- }
146
- }
147
- }
148
-
149
- /**
150
- * Unique access to instance of YITH_WCQV class
151
- *
152
- * @return \YITH_WCQV
153
- * @since 1.0.0
154
- */
155
- function YITH_WCQV(){
156
- return YITH_WCQV::get_instance();
157
}
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Quick View
7
+ * @version 1.0.0
8
+ */
9
+
10
+
11
+ if ( ! defined( 'YITH_WCQV' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YITH_WCQV' ) ) {
16
+ /**
17
+ * YITH WooCommerce Quick View
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WCQV {
22
+
23
+ /**
24
+ * Single instance of the class
25
+ *
26
+ * @var \YITH_WCQV
27
+ * @since 1.0.0
28
+ */
29
+ protected static $instance;
30
+
31
+ /**
32
+ * Plugin version
33
+ *
34
+ * @var string
35
+ * @since 1.0.0
36
+ */
37
+ public $version = YITH_WCQV_VERSION;
38
+
39
+ /**
40
+ * Plugin object
41
+ *
42
+ * @var string
43
+ * @since 1.0.0
44
+ */
45
+ public $obj = null;
46
+
47
+ /**
48
+ * Returns single instance of the class
49
+ *
50
+ * @return \YITH_WCQV
51
+ * @since 1.0.0
52
+ */
53
+ public static function get_instance(){
54
+ if( is_null( self::$instance ) ){
55
+ self::$instance = new self();
56
+ }
57
+
58
+ return self::$instance;
59
+ }
60
+
61
+ /**
62
+ * Constructor
63
+ *
64
+ * @return mixed| YITH_WCQV_Admin | YITH_WCQV_Frontend
65
+ * @since 1.0.0
66
+ */
67
+ public function __construct() {
68
+
69
+ // Load Plugin Framework
70
+ add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
71
+
72
+ $action = array(
73
+ 'woocommerce_get_refreshed_fragments',
74
+ 'woocommerce_apply_coupon',
75
+ 'woocommerce_remove_coupon',
76
+ 'woocommerce_update_shipping_method',
77
+ 'woocommerce_update_order_review',
78
+ 'woocommerce_add_to_cart',
79
+ 'woocommerce_checkout'
80
+ );
81
+
82
+ // Exit if is woocommerce ajax
83
+ if( defined( 'DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $action ) ) {
84
+ return;
85
+ }
86
+
87
+ if ( $this->is_admin() ) {
88
+ // load admin classes
89
+ require_once( 'class.yith-wcqv-admin.php' );
90
+ YITH_WCQV_Admin();
91
+ }
92
+
93
+ if( $this->load_frontend() ) {
94
+ // load frontend classes
95
+ require_once( 'class.yith-wcqv-frontend.php' );
96
+ YITH_WCQV_Frontend();
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Check if context is admin
102
+ *
103
+ * @author Francesco Licandro
104
+ * @since 1.2.0
105
+ * @return boolean
106
+ */
107
+ public function is_admin(){
108
+ $is_ajax = ( defined( 'DOING_AJAX') && DOING_AJAX && isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend' );
109
+ return apply_filters( 'yith_wcqv_is_admin', is_admin() && ! $is_ajax );
110
+ }
111
+
112
+ /**
113
+ * Check if load or not frontend
114
+ *
115
+ * @author Francesco Licandro
116
+ * @since 1.2.0
117
+ * @return boolean
118
+ */
119
+ public function load_frontend(){
120
+ // Class frontend
121
+ $enable = get_option( 'yith-wcqv-enable', 'yes' ) == 'yes';
122
+ $enable_on_mobile = get_option( 'yith-wcqv-enable-mobile', 'yes' ) == 'yes';
123
+ $is_mobile = wp_is_mobile();
124
+
125
+ return apply_filters( 'yith_wcqv_load_frontend', ( ! $is_mobile && $enable ) || ( $is_mobile && $enable_on_mobile ) );
126
+ }
127
+
128
+
129
+ /**
130
+ * Load Plugin Framework
131
+ *
132
+ * @since 1.0
133
+ * @access public
134
+ * @return void
135
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
136
+ */
137
+ public function plugin_fw_loader() {
138
+ if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
139
+ global $plugin_fw_data;
140
+ if( ! empty( $plugin_fw_data ) ){
141
+ $plugin_fw_file = array_shift( $plugin_fw_data );
142
+ require_once( $plugin_fw_file );
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Unique access to instance of YITH_WCQV class
151
+ *
152
+ * @return \YITH_WCQV
153
+ * @since 1.0.0
154
+ */
155
+ function YITH_WCQV(){
156
+ return YITH_WCQV::get_instance();
157
}
init.php CHANGED
@@ -1,135 +1,135 @@
1
- <?php
2
- /**
3
- * Plugin Name: YITH WooCommerce Quick View
4
- * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-quick-view
5
- * Description: The <code><strong>YITH WooCommerce Quick View</strong></code> plugin allows your customers to have a quick look about products. <a href="https://yithemes.com/" target="_blank">Find new awesome plugins on <strong>YITH</strong></a>.
6
- * Version: 1.3.2
7
- * Author: YITHEMES
8
- * Author URI: https://yithemes.com/
9
- * Text Domain: yith-woocommerce-quick-view
10
- * Domain Path: /languages/
11
- * WC requires at least: 2.5.0
12
- * WC tested up to: 3.4.0
13
- *
14
- * @author Yithemes
15
- * @package YITH WooCommerce Quick View
16
- * @version 1.3.2
17
- */
18
- /* Copyright 2015 Your Inspiration Themes (email : plugins@yithemes.com)
19
-
20
- This program is free software; you can redistribute it and/or modify
21
- it under the terms of the GNU General Public License, version 2, as
22
- published by the Free Software Foundation.
23
-
24
- This program is distributed in the hope that it will be useful,
25
- but WITHOUT ANY WARRANTY; without even the implied warranty of
26
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
- GNU General Public License for more details.
28
-
29
- You should have received a copy of the GNU General Public License
30
- along with this program; if not, write to the Free Software
31
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
- */
33
-
34
- if ( !defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
35
-
36
- if ( ! function_exists( 'is_plugin_active' ) ) {
37
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
38
- }
39
-
40
- function yith_wcqv_install_woocommerce_admin_notice() {
41
- ?>
42
- <div class="error">
43
- <p><?php _e( 'YITH WooCommerce Quick View is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-quick-view' ); ?></p>
44
- </div>
45
- <?php
46
- }
47
-
48
-
49
- function yith_wcqv_install_free_admin_notice() {
50
- ?>
51
- <div class="error">
52
- <p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Quick View while you are using the premium one.', 'yith-woocommerce-quick-view' ); ?></p>
53
- </div>
54
- <?php
55
- }
56
-
57
- if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
58
- require_once 'plugin-fw/yit-plugin-registration-hook.php';
59
- }
60
- register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
61
-
62
-
63
- if ( ! defined( 'YITH_WCQV_VERSION' ) ){
64
- define( 'YITH_WCQV_VERSION', '1.3.2' );
65
- }
66
-
67
- if ( ! defined( 'YITH_WCQV_FREE_INIT' ) ) {
68
- define( 'YITH_WCQV_FREE_INIT', plugin_basename( __FILE__ ) );
69
- }
70
-
71
- if ( ! defined( 'YITH_WCQV_INIT' ) ) {
72
- define( 'YITH_WCQV_INIT', plugin_basename( __FILE__ ) );
73
- }
74
-
75
- if ( ! defined( 'YITH_WCQV' ) ) {
76
- define( 'YITH_WCQV', true );
77
- }
78
-
79
- if ( ! defined( 'YITH_WCQV_FILE' ) ) {
80
- define( 'YITH_WCQV_FILE', __FILE__ );
81
- }
82
-
83
- if ( ! defined( 'YITH_WCQV_URL' ) ) {
84
- define( 'YITH_WCQV_URL', plugin_dir_url( __FILE__ ) );
85
- }
86
-
87
- if ( ! defined( 'YITH_WCQV_DIR' ) ) {
88
- define( 'YITH_WCQV_DIR', plugin_dir_path( __FILE__ ) );
89
- }
90
-
91
- if ( ! defined( 'YITH_WCQV_TEMPLATE_PATH' ) ) {
92
- define( 'YITH_WCQV_TEMPLATE_PATH', YITH_WCQV_DIR . 'templates' );
93
- }
94
-
95
- if ( ! defined( 'YITH_WCQV_ASSETS_URL' ) ) {
96
- define( 'YITH_WCQV_ASSETS_URL', YITH_WCQV_URL . 'assets' );
97
- }
98
-
99
- if ( ! defined( 'YITH_WCQV_SLUG' ) ) {
100
- define( 'YITH_WCQV_SLUG', 'yith-woocommerce-quick-view' );
101
- }
102
-
103
- /* Plugin Framework Version Check */
104
- if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WCQV_DIR . 'plugin-fw/init.php' ) ) {
105
- require_once( YITH_WCQV_DIR . 'plugin-fw/init.php' );
106
- }
107
- yit_maybe_plugin_fw_loader( YITH_WCQV_DIR );
108
-
109
- function yith_wcqv_init() {
110
-
111
- load_plugin_textdomain( 'yith-woocommerce-quick-view', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
112
-
113
- // Load required classes and functions
114
- require_once('includes/class.yith-wcqv.php');
115
-
116
- // Let's start the game!
117
- YITH_WCQV();
118
- }
119
- add_action( 'yith_wcqv_init', 'yith_wcqv_init' );
120
-
121
-
122
- function yith_wcqv_install() {
123
-
124
- if ( ! function_exists( 'WC' ) ) {
125
- add_action( 'admin_notices', 'yith_wcqv_install_woocommerce_admin_notice' );
126
- }
127
- elseif ( defined( 'YITH_WCQV_PREMIUM' ) ) {
128
- add_action( 'admin_notices', 'yith_wcqv_install_free_admin_notice' );
129
- deactivate_plugins( plugin_basename( __FILE__ ) );
130
- }
131
- else {
132
- do_action( 'yith_wcqv_init' );
133
- }
134
- }
135
add_action( 'plugins_loaded', 'yith_wcqv_install', 11 );
1
+ <?php
2
+ /**
3
+ * Plugin Name: YITH WooCommerce Quick View
4
+ * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-quick-view
5
+ * Description: The <code><strong>YITH WooCommerce Quick View</strong></code> plugin allows your customers to have a quick look about products. <a href="https://yithemes.com/" target="_blank">Find new awesome plugins on <strong>YITH</strong></a>.
6
+ * Version: 1.3.3
7
+ * Author: YITH
8
+ * Author URI: https://yithemes.com/
9
+ * Text Domain: yith-woocommerce-quick-view
10
+ * Domain Path: /languages/
11
+ * WC requires at least: 2.5.0
12
+ * WC tested up to: 3.4.0
13
+ *
14
+ * @author YITH
15
+ * @package YITH WooCommerce Quick View
16
+ * @version 1.3.3
17
+ */
18
+ /* Copyright 2015 Your Inspiration Themes (email : plugins@yithemes.com)
19
+
20
+ This program is free software; you can redistribute it and/or modify
21
+ it under the terms of the GNU General Public License, version 2, as
22
+ published by the Free Software Foundation.
23
+
24
+ This program is distributed in the hope that it will be useful,
25
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ GNU General Public License for more details.
28
+
29
+ You should have received a copy of the GNU General Public License
30
+ along with this program; if not, write to the Free Software
31
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
+ */
33
+
34
+ if ( !defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
35
+
36
+ if ( ! function_exists( 'is_plugin_active' ) ) {
37
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
38
+ }
39
+
40
+ function yith_wcqv_install_woocommerce_admin_notice() {
41
+ ?>
42
+ <div class="error">
43
+ <p><?php _e( 'YITH WooCommerce Quick View is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-quick-view' ); ?></p>
44
+ </div>
45
+ <?php
46
+ }
47
+
48
+
49
+ function yith_wcqv_install_free_admin_notice() {
50
+ ?>
51
+ <div class="error">
52
+ <p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Quick View while you are using the premium one.', 'yith-woocommerce-quick-view' ); ?></p>
53
+ </div>
54
+ <?php
55
+ }
56
+
57
+ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
58
+ require_once 'plugin-fw/yit-plugin-registration-hook.php';
59
+ }
60
+ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
61
+
62
+
63
+ if ( ! defined( 'YITH_WCQV_VERSION' ) ){
64
+ define( 'YITH_WCQV_VERSION', '1.3.3' );
65
+ }
66
+
67
+ if ( ! defined( 'YITH_WCQV_FREE_INIT' ) ) {
68
+ define( 'YITH_WCQV_FREE_INIT', plugin_basename( __FILE__ ) );
69
+ }
70
+
71
+ if ( ! defined( 'YITH_WCQV_INIT' ) ) {
72
+ define( 'YITH_WCQV_INIT', plugin_basename( __FILE__ ) );
73
+ }
74
+
75
+ if ( ! defined( 'YITH_WCQV' ) ) {
76
+ define( 'YITH_WCQV', true );
77
+ }
78
+
79
+ if ( ! defined( 'YITH_WCQV_FILE' ) ) {
80
+ define( 'YITH_WCQV_FILE', __FILE__ );
81
+ }
82
+
83
+ if ( ! defined( 'YITH_WCQV_URL' ) ) {
84
+ define( 'YITH_WCQV_URL', plugin_dir_url( __FILE__ ) );
85
+ }
86
+
87
+ if ( ! defined( 'YITH_WCQV_DIR' ) ) {
88
+ define( 'YITH_WCQV_DIR', plugin_dir_path( __FILE__ ) );
89
+ }
90
+
91
+ if ( ! defined( 'YITH_WCQV_TEMPLATE_PATH' ) ) {
92
+ define( 'YITH_WCQV_TEMPLATE_PATH', YITH_WCQV_DIR . 'templates' );
93
+ }
94
+
95
+ if ( ! defined( 'YITH_WCQV_ASSETS_URL' ) ) {
96
+ define( 'YITH_WCQV_ASSETS_URL', YITH_WCQV_URL . 'assets' );
97
+ }
98
+
99
+ if ( ! defined( 'YITH_WCQV_SLUG' ) ) {
100
+ define( 'YITH_WCQV_SLUG', 'yith-woocommerce-quick-view' );
101
+ }
102
+
103
+ /* Plugin Framework Version Check */
104
+ if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WCQV_DIR . 'plugin-fw/init.php' ) ) {
105
+ require_once( YITH_WCQV_DIR . 'plugin-fw/init.php' );
106
+ }
107
+ yit_maybe_plugin_fw_loader( YITH_WCQV_DIR );
108
+
109
+ function yith_wcqv_init() {
110
+
111
+ load_plugin_textdomain( 'yith-woocommerce-quick-view', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
112
+
113
+ // Load required classes and functions
114
+ require_once('includes/class.yith-wcqv.php');
115
+
116
+ // Let's start the game!
117
+ YITH_WCQV();
118
+ }
119
+ add_action( 'yith_wcqv_init', 'yith_wcqv_init' );
120
+
121
+
122
+ function yith_wcqv_install() {
123
+
124
+ if ( ! function_exists( 'WC' ) ) {
125
+ add_action( 'admin_notices', 'yith_wcqv_install_woocommerce_admin_notice' );
126
+ }
127
+ elseif ( defined( 'YITH_WCQV_PREMIUM' ) ) {
128
+ add_action( 'admin_notices', 'yith_wcqv_install_free_admin_notice' );
129
+ deactivate_plugins( plugin_basename( __FILE__ ) );
130
+ }
131
+ else {
132
+ do_action( 'yith_wcqv_init' );
133
+ }
134
+ }
135
add_action( 'plugins_loaded', 'yith_wcqv_install', 11 );
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
<?php
2
/**
3
* Framework Name: YIT Plugin Framework
4
- * Version: 3.0.21
5
* Author: YITHEMES
6
* Text Domain: yith-plugin-fw
7
* Domain Path: /languages/
8
*
9
* @author Your Inspiration Themes
10
- * @version 3.0.20
11
*/
12
/**
13
* This file belongs to the YIT Plugin Framework.
1
<?php
2
/**
3
* Framework Name: YIT Plugin Framework
4
+ * Version: 3.0.23
5
* Author: YITHEMES
6
* Text Domain: yith-plugin-fw
7
* Domain Path: /languages/
8
*
9
* @author Your Inspiration Themes
10
+ * @version 3.0.23
11
*/
12
/**
13
* This file belongs to the YIT Plugin Framework.
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -59,9 +59,11 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
59
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
60
*/
61
public function __construct( $args = array() ) {
62
-
63
$args = apply_filters( 'yit_plugin_fw_wc_panel_option_args', $args );
64
if ( !empty( $args ) ) {
65
$this->settings = $args;
66
$this->_tabs_path_files = $this->get_tabs_path_files();
67
@@ -176,7 +178,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
176
* @param $screen_ids
177
*
178
* @return mixed
179
- * @since 1.0.0
180
* @author Antonino Scarfì <antonino.scarfi@yithemes.com>
181
*/
182
public function add_allowed_screen_id( $screen_ids ) {
@@ -323,7 +325,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
323
do_action( 'yit_panel_wc_after_update' );
324
325
} elseif ( isset( $_REQUEST[ 'yit-action' ] ) && $_REQUEST[ 'yit-action' ] == 'wc-options-reset'
326
- && isset( $_POST[ 'yith_wc_reset_options_nonce' ] ) && wp_verify_nonce( $_POST[ 'yith_wc_reset_options_nonce' ], 'yith_wc_reset_options_' . $this->settings[ 'page' ] )
327
) {
328
329
do_action( 'yit_panel_wc_before_reset' );
@@ -404,7 +406,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
404
*
405
* @access public
406
* @return void
407
- * @since 1.0.0
408
*/
409
public function set_default_options() {
410
// check if the default options for this panel are already set
@@ -450,7 +452,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
450
* Add the woocommerce body class in plugin panel page
451
*
452
* @author Andrea Grillo <andrea.grillo@yithemes.com>
453
- * @since 2.0
454
*
455
* @param $classes The body classes
456
*
@@ -474,7 +476,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
474
*
475
* @return mixed Filtered return value
476
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
477
- * @since 2.0
478
*/
479
public function maybe_unserialize_panel_data( $value, $option, $raw_value ) {
480
@@ -506,7 +508,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
506
*
507
* @return mixed Filtered return value
508
* @author Leanza Francesco <leanzafrancesco@gmail.com>
509
- * @since 3.0.0
510
*/
511
public static function sanitize_option( $value, $option, $raw_value ) {
512
if ( isset( $option[ 'type' ] ) && 'yith-field' === $option[ 'type' ] ) {
59
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
60
*/
61
public function __construct( $args = array() ) {
62
$args = apply_filters( 'yit_plugin_fw_wc_panel_option_args', $args );
63
if ( !empty( $args ) ) {
64
+ if ( isset( $args[ 'parent_page' ] ) && 'yit_plugin_panel' === $args[ 'parent_page' ] )
65
+ $args[ 'parent_page' ] = 'yith_plugin_panel';
66
+
67
$this->settings = $args;
68
$this->_tabs_path_files = $this->get_tabs_path_files();
69
178
* @param $screen_ids
179
*
180
* @return mixed
181
+ * @since 1.0.0
182
* @author Antonino Scarfì <antonino.scarfi@yithemes.com>
183
*/
184
public function add_allowed_screen_id( $screen_ids ) {
325
do_action( 'yit_panel_wc_after_update' );
326
327
} elseif ( isset( $_REQUEST[ 'yit-action' ] ) && $_REQUEST[ 'yit-action' ] == 'wc-options-reset'
328
+ && isset( $_POST[ 'yith_wc_reset_options_nonce' ] ) && wp_verify_nonce( $_POST[ 'yith_wc_reset_options_nonce' ], 'yith_wc_reset_options_' . $this->settings[ 'page' ] )
329
) {
330
331
do_action( 'yit_panel_wc_before_reset' );
406
*
407
* @access public
408
* @return void
409
+ * @since 1.0.0
410
*/
411
public function set_default_options() {
412
// check if the default options for this panel are already set
452
* Add the woocommerce body class in plugin panel page
453
*
454
* @author Andrea Grillo <andrea.grillo@yithemes.com>
455
+ * @since 2.0
456
*
457
* @param $classes The body classes
458
*
476
*
477
* @return mixed Filtered return value
478
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
479
+ * @since 2.0
480
*/
481
public function maybe_unserialize_panel_data( $value, $option, $raw_value ) {
482
508
*
509
* @return mixed Filtered return value
510
* @author Leanza Francesco <leanzafrancesco@gmail.com>
511
+ * @since 3.0.0
512
*/
513
public static function sanitize_option( $value, $option, $raw_value ) {
514
if ( isset( $option[ 'type' ] ) && 'yith-field' === $option[ 'type' ] ) {
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -18,7 +18,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
18
*
19
* Setting Page to Manage Plugins
20
*
21
- * @class YIT_Plugin_Panel
22
* @package Yithemes
23
* @since 1.0
24
* @author Your Inspiration Themes
@@ -77,6 +77,8 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
77
);
78
79
$args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
80
81
$this->settings = $args;
82
$this->_tabs_path_files = $this->get_tabs_path_files();
@@ -105,7 +107,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
105
/**
106
* Init actions once to prevent multiple actions
107
*
108
- * @since 3.0.0
109
* @author Leanza Francesco <leanzafrancesco@gmail.com>
110
*/
111
protected static function _init_actions() {
@@ -126,7 +128,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
126
*
127
* @param $admin_body_classes
128
*
129
- * @since 3.0.0
130
* @author Leanza Francesco <leanzafrancesco@gmail.com>
131
*
132
* @return string
@@ -149,13 +151,16 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
149
public function add_menu_page() {
150
global $admin_page_hooks;
151
152
- if ( !isset( $admin_page_hooks[ 'yit_plugin_panel' ] ) ) {
153
$position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
154
$capability = apply_filters( 'yit_plugin_panel_menu_page_capability', 'manage_options' );
155
$show = apply_filters( 'yit_plugin_panel_menu_page_show', true );
156
157
- // YITH Plugins text must not be translated
158
- !!$show && add_menu_page( 'yit_plugin_panel', 'YITH Plugins', $capability, 'yit_plugin_panel', null, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
159
}
160
}
161
@@ -170,7 +175,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
170
*/
171
public function remove_duplicate_submenu_page() {
172
/* === Duplicate Items Hack === */
173
- remove_submenu_page( 'yit_plugin_panel', 'yit_plugin_panel' );
174
}
175
176
/**
@@ -201,7 +206,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
201
wp_enqueue_script( 'yith-plugin-fw-fields' );
202
}
203
204
- if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) || apply_filters( 'yit_plugin_panel_asset_loading', false ) ) {
205
wp_enqueue_media();
206