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
  wp_enqueue_style( 'yit-plugin-style' );
207
  wp_enqueue_script( 'yit-plugin-panel' );
@@ -325,8 +330,8 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
325
  public function add_premium_version_upgrade_to_menu() {
326
  global $submenu;
327
 
328
- if ( apply_filters( 'yit_show_upgrade_to_premium_version', isset( $submenu[ 'yit_plugin_panel' ] ) && !isset( $submenu[ 'yit_plugin_panel' ][ 'how_to' ] ) ) ) {
329
- $submenu[ 'yit_plugin_panel' ][ 'how_to' ] = array(
330
  sprintf( '%s%s%s', '<span id="yith-how-to-premium">', __( 'How to install premium version', 'yith-plugin-fw' ), '</span>' ),
331
  'install_plugins',
332
  '//support.yithemes.com/hc/en-us/articles/217840988',
@@ -889,14 +894,14 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
889
  */
890
  public static function sort_plugins() {
891
  global $submenu;
892
- if ( !empty( $submenu[ 'yit_plugin_panel' ] ) ) {
893
- $sorted_plugins = $submenu[ 'yit_plugin_panel' ];
894
 
895
  usort( $sorted_plugins, function ( $a, $b ) {
896
  return strcmp( current( $a ), current( $b ) );
897
  } );
898
 
899
- $submenu[ 'yit_plugin_panel' ] = $sorted_plugins;
900
  }
901
  }
902
 
@@ -909,8 +914,8 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
909
  public static function add_menu_class_in_yith_plugin( $menu ) {
910
  global $submenu;
911
 
912
- if ( !empty( $submenu[ 'yit_plugin_panel' ] ) ) {
913
- $item_count = count( $submenu[ 'yit_plugin_panel' ] );
914
  $columns = absint( $item_count / 20 ) + 1;
915
  $columns = max( 1, min( $columns, 3 ) );
916
  $columns = apply_filters( 'yith_plugin_fw_yith_plugins_menu_columns', $columns, $item_count );
@@ -918,7 +923,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
918
  if ( $columns > 1 ) {
919
  $class = "yith-plugin-fw-menu-$columns-columns";
920
  foreach ( $menu as $order => $top ) {
921
- if ( 'yit_plugin_panel' === $top[ 2 ] ) {
922
  $c = $menu[ $order ][ 4 ];
923
  $menu[ $order ][ 4 ] = add_cssclass( $class, $c );
924
  break;
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
  );
78
 
79
  $args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
80
+ if ( isset( $args[ 'parent_page' ] ) && 'yit_plugin_panel' === $args[ 'parent_page' ] )
81
+ $args[ 'parent_page' ] = 'yith_plugin_panel';
82
 
83
  $this->settings = $args;
84
  $this->_tabs_path_files = $this->get_tabs_path_files();
107
  /**
108
  * Init actions once to prevent multiple actions
109
  *
110
+ * @since 3.0.0
111
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
112
  */
113
  protected static function _init_actions() {
128
  *
129
  * @param $admin_body_classes
130
  *
131
+ * @since 3.0.0
132
  * @author Leanza Francesco <leanzafrancesco@gmail.com>
133
  *
134
  * @return string
151
  public function add_menu_page() {
152
  global $admin_page_hooks;
153
 
154
+ if ( !isset( $admin_page_hooks[ 'yith_plugin_panel' ] ) ) {
155
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
156
  $capability = apply_filters( 'yit_plugin_panel_menu_page_capability', 'manage_options' );
157
  $show = apply_filters( 'yit_plugin_panel_menu_page_show', true );
158
 
159
+ // YITH text must not be translated
160
+ if ( !!$show ) {
161
+ add_menu_page( 'yith_plugin_panel', 'YITH', $capability, 'yith_plugin_panel', null, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
162
+ $admin_page_hooks[ 'yith_plugin_panel' ] = 'yith-plugins'; // prevent issues for backward compatibility
163
+ }
164
  }
165
  }
166
 
175
  */
176
  public function remove_duplicate_submenu_page() {
177
  /* === Duplicate Items Hack === */
178
+ remove_submenu_page( 'yith_plugin_panel', 'yith_plugin_panel' );
179
  }
180
 
181
  /**
206
  wp_enqueue_script( 'yith-plugin-fw-fields' );
207
  }
208
 
209
+ if ( ( 'admin.php' == $pagenow && yith_plugin_fw_is_panel() ) || apply_filters( 'yit_plugin_panel_asset_loading', false ) ) {
210
  wp_enqueue_media();
211
  wp_enqueue_style( 'yit-plugin-style' );
212
  wp_enqueue_script( 'yit-plugin-panel' );
330
  public function add_premium_version_upgrade_to_menu() {
331
  global $submenu;
332
 
333
+ if ( apply_filters( 'yit_show_upgrade_to_premium_version', isset( $submenu[ 'yith_plugin_panel' ] ) && !isset( $submenu[ 'yith_plugin_panel' ][ 'how_to' ] ) ) ) {
334
+ $submenu[ 'yith_plugin_panel' ][ 'how_to' ] = array(
335
  sprintf( '%s%s%s', '<span id="yith-how-to-premium">', __( 'How to install premium version', 'yith-plugin-fw' ), '</span>' ),
336
  'install_plugins',
337
  '//support.yithemes.com/hc/en-us/articles/217840988',
894
  */
895
  public static function sort_plugins() {
896
  global $submenu;
897
+ if ( !empty( $submenu[ 'yith_plugin_panel' ] ) ) {
898
+ $sorted_plugins = $submenu[ 'yith_plugin_panel' ];
899
 
900
  usort( $sorted_plugins, function ( $a, $b ) {
901
  return strcmp( current( $a ), current( $b ) );
902
  } );
903
 
904
+ $submenu[ 'yith_plugin_panel' ] = $sorted_plugins;
905
  }
906
  }
907
 
914
  public static function add_menu_class_in_yith_plugin( $menu ) {
915
  global $submenu;
916
 
917
+ if ( !empty( $submenu[ 'yith_plugin_panel' ] ) ) {
918
+ $item_count = count( $submenu[ 'yith_plugin_panel' ] );
919
  $columns = absint( $item_count / 20 ) + 1;
920
  $columns = max( 1, min( $columns, 3 ) );
921
  $columns = apply_filters( 'yith_plugin_fw_yith_plugins_menu_columns', $columns, $item_count );
923
  if ( $columns > 1 ) {
924
  $class = "yith-plugin-fw-menu-$columns-columns";
925
  foreach ( $menu as $order => $top ) {
926
+ if ( 'yith_plugin_panel' === $top[ 2 ] ) {
927
  $c = $menu[ $order ][ 4 ];
928
  $menu[ $order ][ 4 ] = add_cssclass( $class, $c );
929
  break;
plugin-fw/lib/yit-plugin-subpanel.php CHANGED
@@ -18,7 +18,7 @@ if ( !class_exists( 'YIT_Plugin_SubPanel' ) ) {
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
@@ -96,13 +96,14 @@ if ( !class_exists( 'YIT_Plugin_SubPanel' ) ) {
96
  $logo = $admin_logo;
97
  }
98
 
99
- if ( !isset( $admin_page_hooks[ 'yit_plugin_panel' ] ) ) {
100
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
101
- add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'nosuchcapability', 'yit_plugin_panel', null, $logo, $position );
 
102
  }
103
 
104
- add_submenu_page( 'yit_plugin_panel', $this->settings[ 'label' ], $this->settings[ 'label' ], 'manage_options', $this->settings[ 'page' ], array( $this, 'yit_panel' ) );
105
- remove_submenu_page( 'yit_plugin_panel', 'yit_plugin_panel' );
106
 
107
  }
108
 
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
96
  $logo = $admin_logo;
97
  }
98
 
99
+ if ( !isset( $admin_page_hooks[ 'yith_plugin_panel' ] ) ) {
100
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
101
+ add_menu_page( 'yith_plugin_panel', 'YITH', 'nosuchcapability', 'yith_plugin_panel', null, $logo, $position );
102
+ $admin_page_hooks[ 'yith_plugin_panel' ] = 'yith-plugins'; // prevent issues for backward compatibility
103
  }
104
 
105
+ add_submenu_page( 'yith_plugin_panel', $this->settings[ 'label' ], $this->settings[ 'label' ], 'manage_options', $this->settings[ 'page' ], array( $this, 'yit_panel' ) );
106
+ remove_submenu_page( 'yith_plugin_panel', 'yith_plugin_panel' );
107
 
108
  }
109
 
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -7,610 +7,657 @@
7
  * It is also available through the world-wide-web at this URL:
8
  * http://www.gnu.org/licenses/gpl-3.0.txt
9
  */
10
- if ( !defined( 'ABSPATH' ) ) {
11
- exit;
12
  } // Exit if accessed directly
13
 
14
- if ( !class_exists( 'YIT_Upgrade' ) ) {
15
- /**
16
- * YIT Upgrade
17
- *
18
- * Notify and Update plugin
19
- *
20
- * @class YIT_Upgrade
21
- * @package Yithemes
22
- * @since 1.0
23
- * @author Your Inspiration Themes
24
- * @see WP_Updater Class
25
- */
26
- class YIT_Upgrade {
27
-
28
- /**
29
- * @var string XML notifier update
30
- */
31
- protected $_xml = 'http://update.yithemes.com/plugins/%plugin_slug%.xml';
32
-
33
- /**
34
- * @var string api server url
35
- */
36
- protected $_package_url = 'https://yithemes.com';
37
-
38
- /**
39
- * @var array The registered plugins
40
- */
41
- protected $_plugins = array();
42
-
43
- /**
44
- * @var YIT_Upgrade The main instance
45
- */
46
- protected static $_instance;
47
-
48
- /**
49
- * Construct
50
- *
51
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
52
- * @since 1.0
53
- */
54
- public function __construct() {
55
- add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download' ), 10, 3 );
56
- add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
57
-
58
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
-
60
- $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
61
- if ( $is_debug_enabled ) {
62
- $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
- add_filter( 'block_local_requests', '__return_false' );
64
- }
65
-
66
- add_action( 'install_plugins_pre_plugin-information', array( $this, 'show_changelog_for_premium_plugins' ) );
67
- add_action( 'wp_ajax_yith_plugin_fw_get_premium_changelog', array( $this, 'show_changelog_for_premium_plugins' ) );
68
- }
69
-
70
- /**
71
- * show changelog for premium plugins
72
- *
73
- * @since 3.0.14
74
- */
75
- public function show_changelog_for_premium_plugins() {
76
- if ( isset( $_GET[ 'plugin' ] ) && isset( $_GET[ 'section' ] ) && 'changelog' === $_GET[ 'section' ] ) {
77
- $plugin_init = $_GET[ 'plugin' ];
78
- if ( isset( $this->_plugins[ $plugin_init ] ) ) {
79
- // this is YITH Premium Plugin
80
- if ( !empty( $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ] ) ) {
81
- $plugin_name = $this->_plugins[ $plugin_init ][ 'info' ][ 'Name' ];
82
- $changelog = $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ];
83
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/changelog.php';
84
- if ( file_exists( $template ) ) {
85
- include( $template );
86
- }
87
- die();
88
- }
89
- $error = __( 'An unexpected error occurred, please try again later. Thanks!', 'yith-plugin-fw' );
90
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/error.php';
91
- if ( file_exists( $template ) ) {
92
- include( $template );
93
- } else {
94
- echo "<p>$error</p>";
95
- }
96
- die();
97
- }
98
- }
99
- }
100
-
101
- /**
102
- * Main plugin Instance
103
- *
104
- * @param $plugin_slug | string The plugin slug
105
- * @param $plugin_init | string The plugin init file
106
- *
107
- * @return void
108
- *
109
- * @since 1.0
110
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
111
- */
112
- public function register( $plugin_slug, $plugin_init ) {
113
-
114
- if ( !function_exists( 'get_plugins' ) ) {
115
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
116
- }
117
-
118
- $plugins = get_plugins();
119
- $plugin_info = $plugins[ $plugin_init ];
120
-
121
- $this->_plugins[ $plugin_init ] = array(
122
- 'info' => $plugin_info,
123
- 'slug' => $plugin_slug,
124
- );
125
-
126
- $transient = 'yith_register_' . md5( $plugin_slug );
127
- if ( apply_filters( 'yith_register_delete_transient', false ) ) {
128
- delete_transient( $transient );
129
- }
130
- $info = get_transient( $transient );
131
- if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
132
- $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
133
- $remote_xml = wp_remote_get( $xml );
134
-
135
- $error = false;
136
- if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
137
- $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
138
- if ( $plugin_remote_info ) {
139
- $info[ 'Latest' ] = (string) $plugin_remote_info->latest;
140
- $info[ 'changelog' ] = (string) $plugin_remote_info->changelog;
141
- if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
142
- YIT_Plugin_Licence()->check( $plugin_slug, false );
143
- }
144
- set_transient( $transient, $info, DAY_IN_SECONDS );
145
- } else {
146
- $error = true;
147
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
148
- __FILE__, __FUNCTION__, $plugin_slug ) );
149
- }
150
- } else {
151
- $error = true;
152
- }
153
-
154
- if ( $error ) {
155
- // If error, set empty value in the transient to prevent multiple requests
156
- $info = array( 'Latest' => '', 'changelog' => '' );
157
- set_transient( $transient, $info, HOUR_IN_SECONDS );
158
- }
159
- }
160
-
161
- $this->_plugins[ $plugin_init ][ 'info' ][ 'Latest' ] = $info[ 'Latest' ];
162
- $this->_plugins[ $plugin_init ][ 'info' ][ 'changelog' ] = $info[ 'changelog' ];
163
-
164
- /* === HOOKS === */
165
- if ( !is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
166
- add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
167
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
168
- } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
169
- add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
170
- }
171
- }
172
-
173
- /**
174
- * Add the multisite updater scripts
175
- *
176
- * @return void
177
- *
178
- * @since 1.0
179
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
180
- */
181
- public function multisite_updater_script() {
182
- $update_url = $changelogs = $details_url = array();
183
- $strings = array(
184
- 'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
185
- 'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
186
- 'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
187
- 'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
188
- 'update_now' => __( 'Update now.', 'yith-plugin-fw' )
189
-
190
- );
191
-
192
- foreach ( $this->_plugins as $init => $info ) {
193
- $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
194
- $details_url[ $init ] = admin_url( 'admin-ajax.php?action=yith_plugin_fw_get_premium_changelog&tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
195
- }
196
-
197
- $localize_script_args = array(
198
- 'registered' => $this->_plugins,
199
- 'activated' => YIT_Plugin_Licence()->get_activated_products(),
200
- 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
201
- 'update_url' => $update_url,
202
- 'details_url' => $details_url,
203
- 'strings' => $strings,
204
- );
205
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
206
- yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
207
-
208
- wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
209
- }
210
-
211
- public function admin_enqueue_scripts() {
212
- global $pagenow;
213
- if ( 'plugins.php' === $pagenow )
214
- wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
215
- }
216
-
217
- /**
218
- * Retrive the zip package file
219
- *
220
- * @param bool $reply Whether to bail without returning the package. Default false.
221
- * @param string $package The package file name.
222
- * @param \WP_Upgrader $upgrader WP_Upgrader instance.
223
- *
224
- * @return string | The download file
225
- *
226
- * @since 1.0
227
- * @see wp-admin/includes/class-wp-upgrader.php
228
- * @access public
229
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
230
- */
231
- public function upgrader_pre_download( $reply, $package, $upgrader ) {
232
- $plugin = false;
233
- $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
234
-
235
- if ( !$is_bulk ) {
236
- $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
237
- } else {
238
- //Bulk action upgrade
239
- $action_url = parse_url( $upgrader->skin->options[ 'url' ] );
240
- parse_str( rawurldecode( htmlspecialchars_decode( $action_url[ 'query' ] ) ), $output );
241
- $plugins = isset( $output[ 'plugins' ] ) ? $output[ 'plugins' ] : '';
242
- $plugins = explode( ',', $plugins );
243
- foreach ( $plugins as $plugin_init ) {
244
- $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_init );
245
- if ( $to_upgrade[ 'Name' ] == $upgrader->skin->plugin_info[ 'Name' ] ) {
246
- $plugin = $plugin_init;
247
- }
248
- }
249
- }
250
-
251
- /**
252
- * It isn't YITH Premium plugins, please wordpress update it for me!
253
- */
254
- if ( !$plugin ) {
255
- return $reply;
256
- }
257
-
258
- $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
259
-
260
- /**
261
- * False ? It isn't YITH Premium plugins, please wordpress update it for me!
262
- */
263
- if ( false === $plugin_info ) {
264
- return $reply;
265
- }
266
-
267
- $licence = YIT_Plugin_Licence()->get_licence();
268
- $product_id = $plugin_info[ 'product_id' ];
269
- $args = array(
270
- 'email' => $licence[ $product_id ][ 'email' ],
271
- 'licence_key' => $licence[ $product_id ][ 'licence_key' ],
272
- 'product_id' => $plugin_info[ 'product_id' ],
273
- 'secret_key' => $plugin_info[ 'secret_key' ],
274
- 'instance' => YIT_Plugin_Licence()->get_home_url(),
275
- 'wc-api' => 'download-api',
276
- 'request' => 'download'
277
- );
278
-
279
- if ( !preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
280
- //Local file or remote?
281
- return $package;
282
- }
283
-
284
- if ( empty( $package ) ) {
285
- return new WP_Error( 'no_package', $upgrader->strings[ 'no_package' ] );
286
- }
287
-
288
- $upgrader->skin->feedback( 'downloading_package', __( 'YITH Repository', 'yith-plugin-fw' ) );
289
-
290
- $download_file = $this->_download_url( $package, $args );
291
-
292
- /**
293
- * Regenerate update_plugins transient
294
- */
295
- $this->force_regenerate_update_transient();
296
-
297
- if ( is_wp_error( $download_file ) ) {
298
- return new WP_Error( 'download_failed', $upgrader->strings[ 'download_failed' ], $download_file->get_error_message() );
299
- }
300
-
301
- return $download_file;
302
- }
303
-
304
- /**
305
- * Retrive the temp filename
306
- *
307
- * @param string $url The package url
308
- * @param string $body The post data fields
309
- * @param int $timeout Execution timeout (default: 300)
310
- *
311
- * @return string | The temp filename
312
- *
313
- * @since 1.0
314
- * @see wp-admin/includes/class-wp-upgrader.php
315
- * @access protected
316
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
317
- */
318
- protected function _download_url( $url, $body, $timeout = 300 ) {
319
-
320
- //WARNING: The file is not automatically deleted, The script must unlink() the file.
321
- if ( !$url ) {
322
- return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yit' ) );
323
- }
324
-
325
- $tmpfname = wp_tempnam( $url );
326
-
327
- $args = array(
328
- 'timeout' => $timeout,
329
- 'stream' => true,
330
- 'filename' => $tmpfname,
331
- 'body' => $body
332
- );
333
-
334
- if ( !$tmpfname ) {
335
- return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yit' ) );
336
- }
337
-
338
- $response = wp_safe_remote_post( $url, $args );
339
-
340
- if ( is_wp_error( $response ) ) {
341
- unlink( $tmpfname );
342
-
343
- return $response;
344
- }
345
-
346
- if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
347
- unlink( $tmpfname );
348
-
349
- return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
350
- }
351
-
352
- $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
353
-
354
- if ( $content_md5 ) {
355
- $md5_check = verify_file_md5( $tmpfname, $content_md5 );
356
- if ( is_wp_error( $md5_check ) ) {
357
- unlink( $tmpfname );
358
-
359
- return $md5_check;
360
- }
361
- }
362
-
363
- return $tmpfname;
364
- }
365
-
366
- /**
367
- * Main plugin Instance
368
- *
369
- * @static
370
- * @return object Main instance
371
- *
372
- * @since 1.0
373
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
374
- */
375
- public static function instance() {
376
- if ( is_null( self::$_instance ) ) {
377
- self::$_instance = new self();
378
- }
379
-
380
- return self::$_instance;
381
- }
382
-
383
- /**
384
- * Delete the update plugins transient
385
- *
386
- * @return void
387
- *
388
- * @since 1.0
389
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
390
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
391
- */
392
- public function force_regenerate_update_transient() {
393
- delete_site_transient( 'update_plugins' );
394
- }
395
-
396
- /**
397
- * Check for plugins update
398
- *
399
- * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
400
- *
401
- * @param mixed $transient | update_plugins transient value
402
- * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
403
- *
404
- * @return mixed $transient | The new update_plugins transient value
405
- *
406
- * @since 1.0
407
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
408
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
409
- */
410
- public function check_update( $transient, $save = false ) {
411
-
412
- foreach ( $this->_plugins as $init => $plugin ) {
413
- $plugin_slug = $this->_plugins[ $init ][ 'slug' ];
414
- $xml = str_replace( '%plugin_slug%', $plugin_slug, $this->_xml );
415
- $remote_xml = wp_remote_get( $xml );
416
-
417
- if ( !is_wp_error( $remote_xml ) && isset( $remote_xml[ 'response' ][ 'code' ] ) && '200' == $remote_xml[ 'response' ][ 'code' ] ) {
418
-
419
- $plugin_remote_info = @simplexml_load_string( $remote_xml[ 'body' ] );
420
-
421
- if ( $plugin_remote_info ) {
422
-
423
- if ( version_compare( $plugin_remote_info->latest, $plugin[ 'info' ][ 'Version' ], '>' ) && !isset( $transient->response[ $init ] ) ) {
424
-
425
- $package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
426
-
427
- $obj = new stdClass();
428
- $obj->slug = (string) $init;
429
- $obj->new_version = (string) $plugin_remote_info->latest;
430
- $obj->changelog = (string) $plugin_remote_info->changelog;
431
- $obj->package = $package;
432
- $obj->plugin = $init;
433
- $transient->response[ $init ] = $obj;
434
- }
435
-
436
- } else {
437
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
438
- __FILE__, __FUNCTION__, $plugin_slug ) );
439
-
440
- return $transient;
441
- }
442
- }
443
- }
444
-
445
- if ( $save ) {
446
- set_site_transient( 'update_plugins', $transient );
447
- }
448
-
449
- return $transient;
450
- }
451
-
452
- /**
453
- * Add the plugin update row in plugin page
454
- *
455
- * @return void
456
- * @fire "in_theme_update_message-{$init}" action
457
- *
458
- * @since 1.0
459
- * @see after_plugin_row_{$init} action
460
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
461
- */
462
- public function plugin_update_row() {
463
-
464
- $current = get_site_transient( 'update_plugins' );
465
- $init = str_replace( 'after_plugin_row_', '', current_filter() );
466
-
467
- if ( !isset( $current->response[ $init ] ) ) {
468
- return false;
469
- }
470
-
471
- /**
472
- * stdClass Object
473
- */
474
- $r = $current->response[ $init ];
475
-
476
- $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
477
- $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
478
-
479
- /**
480
- * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
481
- */
482
- $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
483
-
484
- if ( is_network_admin() || !is_multisite() || true ) {
485
- global $wp_version;
486
- $is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
487
-
488
- echo '<tr class="plugin-update-tr' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
489
-
490
- echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
491
-
492
- echo( $is_wp_4_6 ? '<p>' : '' );
493
-
494
- if ( !current_user_can( 'update_plugins' ) ) {
495
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version );
496
- } elseif ( is_plugin_active_for_network( $init ) ) {
497
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version );
498
- } elseif ( empty( $r->package ) ) {
499
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ][ 'info' ][ 'Name' ] );
500
- } else {
501
- printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ][ 'info' ][ 'Name' ], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ][ 'info' ][ 'Name' ] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
502
- }
503
-
504
- echo( $is_wp_4_6 ? '</p>' : '' );
505
-
506
- /**
507
- * Fires at the end of the update message container in each
508
- * row of the themes list table.
509
- *
510
- * The dynamic portion of the hook name, `$theme_key`, refers to
511
- * the theme slug as found in the WordPress.org themes repository.
512
- *
513
- * @since Wordpress 3.1.0
514
- * }
515
- */
516
- do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
517
-
518
- echo '</div></td></tr>';
519
- }
520
- }
521
-
522
- /**
523
- * Remove the standard plugin_update_row
524
- *
525
- * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
526
- *
527
- * @return void
528
- * @fire "in_theme_update_message-{$init}" action
529
- *
530
- * @since 1.0
531
- * @see after_plugin_row_{$init} action
532
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
533
- */
534
- public function remove_wp_plugin_update_row() {
535
- foreach ( $this->_plugins as $init => $plugin ) {
536
- remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
537
- add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
538
- //add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
539
- }
540
- }
541
-
542
- public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
543
- $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
 
 
 
 
 
 
 
544
  <div class='yit-plugin-changelog'>
545
  <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
546
  <p>{$changelog}</p>
547
  </div>
548
  </div>";
549
 
550
- if ( $echo ) {
551
- echo $res;
552
- } else {
553
- return $res;
554
- }
555
- }
556
-
557
- /**
558
- * Auto-Update Plugin in multisite
559
- *
560
- * Manage the non standard upgrade-plugin-multisite action
561
- *
562
- * @return void
563
- *
564
- * @since 1.0
565
- * @see upgrade-plugin action
566
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
567
- */
568
- public function upgrade_plugin_multisite() {
569
-
570
- $plugin = isset( $_REQUEST[ 'plugin' ] ) ? trim( $_REQUEST[ 'plugin' ] ) : '';
571
- $action = isset( $_REQUEST[ 'action' ] ) ? $_REQUEST[ 'action' ] : '';
572
-
573
- if ( 'upgrade-plugin-multisite' != $action ) {
574
- wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
575
- }
576
-
577
- if ( !current_user_can( 'update_plugins' ) ) {
578
- wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
579
- }
580
-
581
- $this->check_update( get_site_transient( 'update_plugins' ), true );
582
-
583
- check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
584
-
585
- $title = __( 'Update Plugin', 'yith-plugin-fw' );
586
- $parent_file = 'plugins.php';
587
- $submenu_file = 'plugins.php';
588
-
589
- wp_enqueue_script( 'updates' );
590
- require_once( ABSPATH . 'wp-admin/admin-header.php' );
591
-
592
- $nonce = 'upgrade-plugin-multisite_' . $plugin;
593
- $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
594
-
595
- $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
596
- $upgrader->upgrade( $plugin );
597
-
598
- include( ABSPATH . 'wp-admin/admin-footer.php' );
599
- }
600
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  }
602
 
603
- if ( !function_exists( 'YIT_Upgrade' ) ) {
604
- /**
605
- * Main instance of plugin
606
- *
607
- * @return YIT_Upgrade
608
- * @since 1.0
609
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
610
- */
611
- function YIT_Upgrade() {
612
- return YIT_Upgrade::instance();
613
- }
614
  }
615
 
616
  /**
7
  * It is also available through the world-wide-web at this URL:
8
  * http://www.gnu.org/licenses/gpl-3.0.txt
9
  */
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
  } // Exit if accessed directly
13
 
14
+ if ( ! class_exists( 'YIT_Upgrade' ) ) {
15
+ /**
16
+ * YIT Upgrade
17
+ *
18
+ * Notify and Update plugin
19
+ *
20
+ * @class YIT_Upgrade
21
+ * @package Yithemes
22
+ * @since 1.0
23
+ * @author Your Inspiration Themes
24
+ * @see WP_Updater Class
25
+ */
26
+ class YIT_Upgrade {
27
+
28
+ /**
29
+ * @var string XML notifier update
30
+ */
31
+ protected $_remote_url = 'https://update.yithemes.com/plugin-xml.php';
32
+
33
+ /**
34
+ * @var string api server url
35
+ */
36
+ protected $_package_url = 'https://yithemes.com';
37
+
38
+ /**
39
+ * @var array The registered plugins
40
+ */
41
+ protected $_plugins = array();
42
+
43
+ /**
44
+ * @var YIT_Upgrade The main instance
45
+ */
46
+ protected static $_instance;
47
+
48
+ /**
49
+ * Construct
50
+ *
51
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
52
+ * @since 1.0
53
+ */
54
+ public function __construct() {
55
+ add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download' ), 10, 3 );
56
+ add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
57
+
58
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
+
60
+ $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
61
+ if ( $is_debug_enabled ) {
62
+ $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
+ add_filter( 'block_local_requests', '__return_false' );
64
+ }
65
+
66
+ add_action( 'install_plugins_pre_plugin-information', array(
67
+ $this,
68
+ 'show_changelog_for_premium_plugins'
69
+ ) );
70
+ add_action( 'wp_ajax_yith_plugin_fw_get_premium_changelog', array(
71
+ $this,
72
+ 'show_changelog_for_premium_plugins'
73
+ ) );
74
+ }
75
+
76
+ /**
77
+ * show changelog for premium plugins
78
+ *
79
+ * @since 3.0.14
80
+ */
81
+ public function show_changelog_for_premium_plugins() {
82
+ if ( isset( $_GET['plugin'] ) && isset( $_GET['section'] ) && 'changelog' === $_GET['section'] ) {
83
+ $plugin_init = $_GET['plugin'];
84
+ if ( isset( $this->_plugins[ $plugin_init ] ) ) {
85
+ // this is YITH Premium Plugin
86
+ if ( ! empty( $this->_plugins[ $plugin_init ]['info']['changelog'] ) ) {
87
+ $plugin_name = $this->_plugins[ $plugin_init ]['info']['Name'];
88
+ $changelog = $this->_plugins[ $plugin_init ]['info']['changelog'];
89
+ $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/changelog.php';
90
+ if ( file_exists( $template ) ) {
91
+ include( $template );
92
+ }
93
+ die();
94
+ }
95
+ $error = __( 'An unexpected error occurred, please try again later. Thanks!', 'yith-plugin-fw' );
96
+ $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/error.php';
97
+ if ( file_exists( $template ) ) {
98
+ include( $template );
99
+ } else {
100
+ echo "<p>$error</p>";
101
+ }
102
+ die();
103
+ }
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Main plugin Instance
109
+ *
110
+ * @param $plugin_slug | string The plugin slug
111
+ * @param $plugin_init | string The plugin init file
112
+ *
113
+ * @return void
114
+ *
115
+ * @since 1.0
116
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
117
+ */
118
+ public function register( $plugin_slug, $plugin_init ) {
119
+
120
+ if ( ! function_exists( 'get_plugins' ) ) {
121
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
122
+ }
123
+
124
+ $plugins = get_plugins();
125
+ $plugin_info = $plugins[ $plugin_init ];
126
+
127
+ $plugin = $this->_plugins[ $plugin_init ] = array(
128
+ 'info' => $plugin_info,
129
+ 'slug' => $plugin_slug,
130
+ );
131
+
132
+ $transient = 'yith_register_' . md5( $plugin_slug );
133
+ if ( apply_filters( 'yith_register_delete_transient', false ) ) {
134
+ delete_transient( $transient );
135
+ }
136
+ $info = get_transient( $transient );
137
+ if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
138
+ $xml = $this->get_remote_url( $plugin );
139
+ $remote_xml = wp_remote_get( $xml );
140
+
141
+ $error = false;
142
+ if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
143
+ $plugin_remote_info = @simplexml_load_string( $remote_xml['body'] );
144
+ if ( $plugin_remote_info ) {
145
+ $info['Latest'] = (string) $plugin_remote_info->latest;
146
+ $info['changelog'] = (string) $plugin_remote_info->changelog;
147
+ if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
148
+ YIT_Plugin_Licence()->check( $plugin_slug, false );
149
+ }
150
+ set_transient( $transient, $info, DAY_IN_SECONDS );
151
+ } else {
152
+ $error = true;
153
+ error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
154
+ __FILE__, __FUNCTION__, $plugin_slug ) );
155
+ }
156
+ } else {
157
+ $error = true;
158
+ }
159
+
160
+ if ( $error ) {
161
+ // If error, set empty value in the transient to prevent multiple requests
162
+ $info = array( 'Latest' => '', 'changelog' => '' );
163
+ set_transient( $transient, $info, HOUR_IN_SECONDS );
164
+ }
165
+ }
166
+
167
+ $this->_plugins[ $plugin_init ]['info']['Latest'] = $info['Latest'];
168
+ $this->_plugins[ $plugin_init ]['info']['changelog'] = $info['changelog'];
169
+
170
+ /* === HOOKS === */
171
+ if ( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
172
+ add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
173
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
174
+ } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
175
+ add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Add the multisite updater scripts
181
+ *
182
+ * @return void
183
+ *
184
+ * @since 1.0
185
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
186
+ */
187
+ public function multisite_updater_script() {
188
+ $update_url = $changelogs = $details_url = array();
189
+ $strings = array(
190
+ 'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
191
+ 'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
192
+ 'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
193
+ 'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
194
+ 'update_now' => __( 'Update now.', 'yith-plugin-fw' )
195
+
196
+ );
197
+
198
+ foreach ( $this->_plugins as $init => $info ) {
199
+ $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
200
+ $details_url[ $init ] = admin_url( 'admin-ajax.php?action=yith_plugin_fw_get_premium_changelog&tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
201
+ }
202
+
203
+ $localize_script_args = array(
204
+ 'registered' => $this->_plugins,
205
+ 'activated' => YIT_Plugin_Licence()->get_activated_products(),
206
+ 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
207
+ 'update_url' => $update_url,
208
+ 'details_url' => $details_url,
209
+ 'strings' => $strings,
210
+ );
211
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
212
+ yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
213
+
214
+ wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
215
+ }
216
+
217
+ public function admin_enqueue_scripts() {
218
+ global $pagenow;
219
+ if ( 'plugins.php' === $pagenow ) {
220
+ wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Retrive the zip package file
226
+ *
227
+ * @param bool $reply Whether to bail without returning the package. Default false.
228
+ * @param string $package The package file name.
229
+ * @param \WP_Upgrader $upgrader WP_Upgrader instance.
230
+ *
231
+ * @return string | The download file
232
+ *
233
+ * @since 1.0
234
+ * @see wp-admin/includes/class-wp-upgrader.php
235
+ * @access public
236
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
237
+ */
238
+ public function upgrader_pre_download( $reply, $package, $upgrader ) {
239
+ $plugin = false;
240
+ $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
241
+
242
+ if ( ! $is_bulk ) {
243
+ $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
244
+ } else {
245
+ //Bulk action upgrade
246
+ $action_url = parse_url( $upgrader->skin->options['url'] );
247
+ parse_str( rawurldecode( htmlspecialchars_decode( $action_url['query'] ) ), $output );
248
+ $plugins = isset( $output['plugins'] ) ? $output['plugins'] : '';
249
+ $plugins = explode( ',', $plugins );
250
+ foreach ( $plugins as $plugin_init ) {
251
+ $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_init );
252
+ if ( $to_upgrade['Name'] == $upgrader->skin->plugin_info['Name'] ) {
253
+ $plugin = $plugin_init;
254
+ }
255
+ }
256
+ }
257
+
258
+ /**
259
+ * It isn't YITH Premium plugins, please wordpress update it for me!
260
+ */
261
+ if ( ! $plugin ) {
262
+ return $reply;
263
+ }
264
+
265
+ $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
266
+
267
+ /**
268
+ * False ? It isn't YITH Premium plugins, please wordpress update it for me!
269
+ */
270
+ if ( false === $plugin_info ) {
271
+ return $reply;
272
+ }
273
+
274
+ $licence = YIT_Plugin_Licence()->get_licence();
275
+ $product_id = $plugin_info['product_id'];
276
+ $args = array(
277
+ 'email' => $licence[ $product_id ]['email'],
278
+ 'licence_key' => $licence[ $product_id ]['licence_key'],
279
+ 'product_id' => $plugin_info['product_id'],
280
+ 'secret_key' => $plugin_info['secret_key'],
281
+ 'instance' => YIT_Plugin_Licence()->get_home_url(),
282
+ 'wc-api' => 'download-api',
283
+ 'request' => 'download'
284
+ );
285
+
286
+ if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
287
+ //Local file or remote?
288
+ return $package;
289
+ }
290
+
291
+ if ( empty( $package ) ) {
292
+ return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
293
+ }
294
+
295
+ $upgrader->skin->feedback( 'downloading_package', __( 'YITH Repository', 'yith-plugin-fw' ) );
296
+
297
+ $download_file = $this->_download_url( $package, $args );
298
+
299
+ /**
300
+ * Regenerate update_plugins transient
301
+ */
302
+ $this->force_regenerate_update_transient();
303
+
304
+ if ( is_wp_error( $download_file ) ) {
305
+ return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
306
+ }
307
+
308
+ return $download_file;
309
+ }
310
+
311
+ /**
312
+ * Retrive the temp filename
313
+ *
314
+ * @param string $url The package url
315
+ * @param string $body The post data fields
316
+ * @param int $timeout Execution timeout (default: 300)
317
+ *
318
+ * @return string | The temp filename
319
+ *
320
+ * @since 1.0
321
+ * @see wp-admin/includes/class-wp-upgrader.php
322
+ * @access protected
323
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
324
+ */
325
+ protected function _download_url( $url, $body, $timeout = 300 ) {
326
+
327
+ //WARNING: The file is not automatically deleted, The script must unlink() the file.
328
+ if ( ! $url ) {
329
+ return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yit' ) );
330
+ }
331
+
332
+ $tmpfname = wp_tempnam( $url );
333
+
334
+ $args = array(
335
+ 'timeout' => $timeout,
336
+ 'stream' => true,
337
+ 'filename' => $tmpfname,
338
+ 'body' => $body
339
+ );
340
+
341
+ if ( ! $tmpfname ) {
342
+ return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yit' ) );
343
+ }
344
+
345
+ $response = wp_safe_remote_post( $url, $args );
346
+
347
+ if ( is_wp_error( $response ) ) {
348
+ unlink( $tmpfname );
349
+
350
+ return $response;
351
+ }
352
+
353
+ if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
354
+ unlink( $tmpfname );
355
+
356
+ return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
357
+ }
358
+
359
+ $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
360
+
361
+ if ( $content_md5 ) {
362
+ $md5_check = verify_file_md5( $tmpfname, $content_md5 );
363
+ if ( is_wp_error( $md5_check ) ) {
364
+ unlink( $tmpfname );
365
+
366
+ return $md5_check;
367
+ }
368
+ }
369
+
370
+ return $tmpfname;
371
+ }
372
+
373
+ /**
374
+ * Main plugin Instance
375
+ *
376
+ * @static
377
+ * @return object Main instance
378
+ *
379
+ * @since 1.0
380
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
381
+ */
382
+ public static function instance() {
383
+ if ( is_null( self::$_instance ) ) {
384
+ self::$_instance = new self();
385
+ }
386
+
387
+ return self::$_instance;
388
+ }
389
+
390
+ /**
391
+ * Delete the update plugins transient
392
+ *
393
+ * @return void
394
+ *
395
+ * @since 1.0
396
+ * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
397
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
398
+ */
399
+ public function force_regenerate_update_transient() {
400
+ delete_site_transient( 'update_plugins' );
401
+ }
402
+
403
+ /**
404
+ * Check for plugins update
405
+ *
406
+ * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
407
+ *
408
+ * @param mixed $transient | update_plugins transient value
409
+ * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
410
+ *
411
+ * @return mixed $transient | The new update_plugins transient value
412
+ *
413
+ * @since 1.0
414
+ * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
415
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
416
+ */
417
+ public function check_update( $transient, $save = false ) {
418
+
419
+ foreach ( $this->_plugins as $init => $plugin ) {
420
+ $plugin_slug = $this->_plugins[ $init ]['slug'];
421
+ $xml = $this->get_remote_url( $plugin );
422
+ $remote_xml = wp_remote_get( $xml );
423
+
424
+ if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
425
+
426
+ $plugin_remote_info = @simplexml_load_string( $remote_xml['body'] );
427
+
428
+ if ( $plugin_remote_info ) {
429
+
430
+ if ( version_compare( $plugin_remote_info->latest, $plugin['info']['Version'], '>' ) && ! isset( $transient->response[ $init ] ) ) {
431
+
432
+ $package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
433
+
434
+ $obj = new stdClass();
435
+ $obj->slug = (string) $init;
436
+ $obj->new_version = (string) $plugin_remote_info->latest;
437
+ $obj->changelog = (string) $plugin_remote_info->changelog;
438
+ $obj->package = $package;
439
+ $obj->plugin = $init;
440
+ $transient->response[ $init ] = $obj;
441
+ }
442
+
443
+ } else {
444
+ error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
445
+ __FILE__, __FUNCTION__, $plugin_slug ) );
446
+
447
+ return $transient;
448
+ }
449
+ }
450
+ }
451
+
452
+ if ( $save ) {
453
+ set_site_transient( 'update_plugins', $transient );
454
+ }
455
+
456
+ return $transient;
457
+ }
458
+
459
+ /**
460
+ * Add the plugin update row in plugin page
461
+ *
462
+ * @return void
463
+ * @fire "in_theme_update_message-{$init}" action
464
+ *
465
+ * @since 1.0
466
+ * @see after_plugin_row_{$init} action
467
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
468
+ */
469
+ public function plugin_update_row() {
470
+
471
+ $current = get_site_transient( 'update_plugins' );
472
+ $init = str_replace( 'after_plugin_row_', '', current_filter() );
473
+
474
+ if ( ! isset( $current->response[ $init ] ) ) {
475
+ return false;
476
+ }
477
+
478
+ /**
479
+ * stdClass Object
480
+ */
481
+ $r = $current->response[ $init ];
482
+
483
+ $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
484
+ $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
485
+
486
+ /**
487
+ * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
488
+ */
489
+ $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
490
+
491
+ if ( is_network_admin() || ! is_multisite() || true ) {
492
+ global $wp_version;
493
+ $is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
494
+
495
+ echo '<tr class="plugin-update-tr' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
496
+
497
+ echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
498
+
499
+ echo( $is_wp_4_6 ? '<p>' : '' );
500
+
501
+ if ( ! current_user_can( 'update_plugins' ) ) {
502
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
503
+ } elseif ( is_plugin_active_for_network( $init ) ) {
504
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
505
+ } elseif ( empty( $r->package ) ) {
506
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
507
+ } else {
508
+ printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
509
+ }
510
+
511
+ echo( $is_wp_4_6 ? '</p>' : '' );
512
+
513
+ /**
514
+ * Fires at the end of the update message container in each
515
+ * row of the themes list table.
516
+ *
517
+ * The dynamic portion of the hook name, `$theme_key`, refers to
518
+ * the theme slug as found in the WordPress.org themes repository.
519
+ *
520
+ * @since Wordpress 3.1.0
521
+ * }
522
+ */
523
+ do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
524
+
525
+ echo '</div></td></tr>';
526
+ }
527
+ }
528
+
529
+ /**
530
+ * Remove the standard plugin_update_row
531
+ *
532
+ * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
533
+ *
534
+ * @return void
535
+ * @fire "in_theme_update_message-{$init}" action
536
+ *
537
+ * @since 1.0
538
+ * @see after_plugin_row_{$init} action
539
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
540
+ */
541
+ public function remove_wp_plugin_update_row() {
542
+ foreach ( $this->_plugins as $init => $plugin ) {
543
+ remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
544
+ add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
545
+ //add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
546
+ }
547
+ }
548
+
549
+ public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
550
+ $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
551
  <div class='yit-plugin-changelog'>
552
  <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
553
  <p>{$changelog}</p>
554
  </div>
555
  </div>";
556
 
557
+ if ( $echo ) {
558
+ echo $res;
559
+ } else {
560
+ return $res;
561
+ }
562
+ }
563
+
564
+ /**
565
+ * Auto-Update Plugin in multisite
566
+ *
567
+ * Manage the non standard upgrade-plugin-multisite action
568
+ *
569
+ * @return void
570
+ *
571
+ * @since 1.0
572
+ * @see upgrade-plugin action
573
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
574
+ */
575
+ public function upgrade_plugin_multisite() {
576
+
577
+ $plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : '';
578
+ $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
579
+
580
+ if ( 'upgrade-plugin-multisite' != $action ) {
581
+ wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
582
+ }
583
+
584
+ if ( ! current_user_can( 'update_plugins' ) ) {
585
+ wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
586
+ }
587
+
588
+ $this->check_update( get_site_transient( 'update_plugins' ), true );
589
+
590
+ check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
591
+
592
+ $title = __( 'Update Plugin', 'yith-plugin-fw' );
593
+ $parent_file = 'plugins.php';
594
+ $submenu_file = 'plugins.php';
595
+
596
+ wp_enqueue_script( 'updates' );
597
+ require_once( ABSPATH . 'wp-admin/admin-header.php' );
598
+
599
+ $nonce = 'upgrade-plugin-multisite_' . $plugin;
600
+ $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
601
+
602
+ $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
603
+ $upgrader->upgrade( $plugin );
604
+
605
+ include( ABSPATH . 'wp-admin/admin-footer.php' );
606
+ }
607
+
608
+ /**
609
+ * Retreive the remote url with query string args
610
+ *
611
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
612
+ * @return string the remote url
613
+ */
614
+ public function get_remote_url( $plugin_info ) {
615
+
616
+ $license = $is_membership_license = false;
617
+ $slug = isset( $plugin_info['slug'] ) ? $plugin_info['slug'] : false;
618
+
619
+ if( function_exists( 'YIT_Plugin_Licence' ) && false !== $slug ){
620
+ //Get license for YITH Plugins
621
+ $enabled_license = YIT_Plugin_Licence()->get_licence();
622
+
623
+ if( isset( $enabled_license[ $slug ]['licence_key'] ) ){
624
+ $license = $enabled_license[ $slug ]['licence_key'];
625
+ }
626
+
627
+ if( isset( $enabled_license[ $slug ]['is_membership'] ) ){
628
+ $is_membership_license = $enabled_license[ $slug ]['is_membership'];
629
+ }
630
+ }
631
+
632
+ $args = array(
633
+ 'plugin' => $slug,
634
+ 'instance' => md5( $_SERVER['SERVER_NAME'] ),
635
+ 'license' => $license,
636
+ 'is_membership_license' => $is_membership_license,
637
+ 'server_ip' => $_SERVER['SERVER_ADDR'],
638
+ 'version' => isset( $plugin_info['info']['Version'] ) ? $plugin_info['info']['Version'] : '1.0.0'
639
+ );
640
+
641
+ $args = apply_filters( 'yith_get_remove_url_args', $args );
642
+
643
+ $url = add_query_arg( $args, $this->_remote_url );
644
+
645
+ return $url;
646
+ }
647
+ }
648
  }
649
 
650
+ if ( ! function_exists( 'YIT_Upgrade' ) ) {
651
+ /**
652
+ * Main instance of plugin
653
+ *
654
+ * @return YIT_Upgrade
655
+ * @since 1.0
656
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
657
+ */
658
+ function YIT_Upgrade() {
659
+ return YIT_Upgrade::instance();
660
+ }
661
  }
662
 
663
  /**
plugin-fw/licence/assets/js/yit-licence.js CHANGED
@@ -8,189 +8,193 @@
8
  */
9
 
10
 
11
- (function ($) {
12
 
13
  /* === Licence API === */
14
 
15
- var licence_activation = function (button) {
16
- button.on('click', function (e, button) {
17
  e.preventDefault();
18
 
19
- var t = $(this),
20
- form_id = t.data('formid'),
21
- form = $('#' + form_id),
22
- data = form.serialize(),
23
- message = $(form).find('.message'),
24
- message_wrapper = $(form).find('.message-wrapper'),
25
- email = form.find('.user-email'),
26
- licence_key = form.find('.licence-key'),
27
- email_val = form.find('.user-email').val(),
28
- licence_key_val = form.find('.licence-key').val(),
29
- error = false,
30
- error_fields = new Array(),
31
- product_row = form.find('.product-row'),
32
- licence_activation = $('.licence-activation'),
33
- spinner = $('#products-to-active').find('.spinner');
34
 
35
  /* Init Input Fields */
36
  message.empty();
37
- message_wrapper.removeClass('visible')
38
- email.removeClass('require');
39
- licence_key.removeClass('require');
40
- product_row.removeClass('error');
41
- spinner.addClass('show');
42
- t.add(licence_activation).prop("disabled", true).addClass('clicked');
43
-
44
- if ('' == email_val) {
45
  error = true;
46
  error_fields[ error_fields.length ] = licence_message.email;
47
- email.addClass('require');
48
  }
49
 
50
- if ('' == licence_key_val) {
51
  error = true;
52
  error_fields[ error_fields.length ] = licence_message.license_key;
53
- licence_key.addClass('require');
54
  }
55
 
56
- if (false == error) {
57
- jQuery.ajax({
58
- type : 'POST',
59
- url : ajaxurl,
60
- data : data,
61
- success: function (response) {
62
-
63
- spinner.removeClass('show');
64
- t.add(licence_activation).prop("disabled", false).removeClass('clicked');
65
-
66
- if (true == response.activated) {
67
- $('.product-licence-activation').empty().replaceWith(response.template);
68
- licence_api();
69
- } else if (false != response) {
70
- message.text(response.error);
71
- message_wrapper.addClass('visible');
72
- product_row.addClass('error');
73
- } else {
74
- message.text(licence_message.server);
75
- message_wrapper.addClass('visible');
76
- product_row.addClass('error');
77
- }
78
- }
79
- });
 
 
 
 
80
  } else {
81
- if (error_fields.length == 1) {
82
- message.text(licence_message.error.replace('%field%', error_fields[0]));
83
- message_wrapper.addClass('visible');
84
- product_row.addClass('error');
85
  } else {
86
  var message_text = licence_message.errors;
87
- for (var i = 0; i < error_fields.length; i++) {
88
- message_text = message_text.replace('%field_' + ( i + 1) + '%', error_fields[i]);
89
- message_wrapper.addClass('visible');
90
  }
91
- message.text(message_text);
92
- message_wrapper.addClass('visible');
93
- product_row.addClass('error');
94
  }
95
 
96
- spinner.removeClass('show');
97
- t.add(licence_activation).prop("disabled", false).removeClass('clicked');
98
  }
99
- });
100
  };
101
 
102
- var licence_update = function (button) {
103
- button.on('click', function (e) {
104
  e.preventDefault();
105
 
106
- var t = $(this),
107
- form = $('#licence-check-update'),
108
  data = form.serialize();
109
 
110
- t.prop("disabled", true).addClass('clicked');
111
- form.find('div.spinner').addClass('show');
112
-
113
- jQuery.ajax({
114
- type : 'POST',
115
- url : ajaxurl,
116
- data : data,
117
- success: function (response) {
118
- $('.product-licence-activation').empty().replaceWith(response.template);
119
- licence_api();
120
- }
121
- });
122
- });
123
  };
124
 
125
- var licence_deactivate = function (button) {
126
- button.on('click', function (e) {
127
  e.preventDefault();
128
 
129
  var check = script_info.is_debug == true ? true : confirm( licence_message.are_you_sure );
130
 
131
- if( check == true ){
132
- var t = $(this),
133
- licence_key = t.data('licence-key'),
134
- licence_email = t.data('licence-email'),
135
- product_init = t.data('product-init'),
136
- action = t.data('action'),
137
- renew = $('.licence-renew'),
138
- deactive = $('.licence-deactive'),
139
- message = $('#yith-licence-notice'),
140
- activated_table = $('.activated-table');
141
-
142
- t.add(renew).add(deactive).prop("disabled", true).addClass('clicked');
143
- $('#activated-products').find('.spinner').addClass('show');
144
-
145
- jQuery.ajax({
146
- type : 'POST',
147
- url : ajaxurl,
148
- data : {
149
- action: action,
150
- licence_key: licence_key,
151
- email: licence_email,
152
- product_init: product_init
153
- },
154
- success: function (response) {
155
- message.css( 'maxWidth', activated_table.width() );
156
- if (false == response.activated && typeof response.error == 'undefined') {
157
- $('.product-licence-activation').empty().replaceWith(response.template);
158
- licence_api();
159
- }
160
-
161
- if (false == response.activated && typeof response.error != 'undefined') {
162
- message.find('p.yith-licence-notice-message').html(response.error);
163
- message.removeClass('notice-success').addClass('notice-error visible');
164
- t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
165
- $('#activated-products').find('.spinner').removeClass('show');
166
- }
167
-
168
- else if (false == response) {
169
- message.find('p.yith-licence-notice-message').html(licence_message.server);
170
- message.removeClass('notice-success').addClass('notice-error visible');
171
- t.add(renew).add(deactive).add(renew).prop("disabled", false).removeClass('clicked');
172
- $('#activated-products').find('.spinner').removeClass('show');
173
- }
174
- }
175
- });
176
  }
177
- });
178
  };
179
 
180
  var licence_api = function () {
181
- var button = $('.licence-activation'),
182
- check = $('.licence-check'),
183
- deactivated = $('.licence-deactive');
184
 
185
- licence_activation(button);
186
- licence_update(check);
187
- licence_deactivate(deactivated);
188
  };
189
 
190
  licence_api();
191
 
192
- $('body').on('click', '.yit-changelog-button', function (e) {
193
- $('#TB_window').remove();
194
- });
195
 
196
- })(jQuery);
8
  */
9
 
10
 
11
+ ( function ( $ ) {
12
 
13
  /* === Licence API === */
14
 
15
+ var licence_activation = function ( button ) {
16
+ button.on( 'click', function ( e, button ) {
17
  e.preventDefault();
18
 
19
+ var t = $( this ),
20
+ form_id = t.data( 'formid' ),
21
+ form = $( '#' + form_id ),
22
+ data = form.serialize(),
23
+ message = $( form ).find( '.message' ),
24
+ message_wrapper = $( form ).find( '.message-wrapper' ),
25
+ email = form.find( '.user-email' ),
26
+ licence_key = form.find( '.licence-key' ),
27
+ email_val = form.find( '.user-email' ).val(),
28
+ licence_key_val = form.find( '.licence-key' ).val(),
29
+ error = false,
30
+ error_fields = new Array(),
31
+ product_row = form.find( '.product-row' ),
32
+ licence_activation = $( '.licence-activation' ),
33
+ spinner = $( '#products-to-active' ).find( '.spinner' );
34
 
35
  /* Init Input Fields */
36
  message.empty();
37
+ message_wrapper.removeClass( 'visible' );
38
+ email.removeClass( 'require' );
39
+ licence_key.removeClass( 'require' );
40
+ product_row.removeClass( 'error' );
41
+ spinner.addClass( 'show' );
42
+ t.add( licence_activation ).prop( "disabled", true ).addClass( 'clicked' );
43
+
44
+ if ( '' === email_val ) {
45
  error = true;
46
  error_fields[ error_fields.length ] = licence_message.email;
47
+ email.addClass( 'require' );
48
  }
49
 
50
+ if ( '' === licence_key_val ) {
51
  error = true;
52
  error_fields[ error_fields.length ] = licence_message.license_key;
53
+ licence_key.addClass( 'require' );
54
  }
55
 
56
+ if ( false === error ) {
57
+ jQuery.ajax( {
58
+ type : 'POST',
59
+ url : ajaxurl,
60
+ data : data,
61
+ success: function ( response ) {
62
+
63
+ spinner.removeClass( 'show' );
64
+ t.add( licence_activation ).prop( "disabled", false ).removeClass( 'clicked' );
65
+
66
+ if ( true === response.activated ) {
67
+ $( '.product-licence-activation' ).empty().replaceWith( response.template );
68
+ licence_api();
69
+ } else if ( false !== response && typeof response.error !== 'undefined' ) {
70
+ message.text( response.error );
71
+ message_wrapper.addClass( 'visible' );
72
+ product_row.addClass( 'error' );
73
+ } else {
74
+ message.text( licence_message.server );
75
+ message_wrapper.addClass( 'visible' );
76
+ product_row.addClass( 'error' );
77
+ }
78
+
79
+ if ( typeof response.debug !== 'undefined' ) {
80
+ console.log( response.debug );
81
+ }
82
+ }
83
+ } );
84
  } else {
85
+ if ( error_fields.length == 1 ) {
86
+ message.text( licence_message.error.replace( '%field%', error_fields[ 0 ] ) );
87
+ message_wrapper.addClass( 'visible' );
88
+ product_row.addClass( 'error' );
89
  } else {
90
  var message_text = licence_message.errors;
91
+ for ( var i = 0; i < error_fields.length; i++ ) {
92
+ message_text = message_text.replace( '%field_' + ( i + 1 ) + '%', error_fields[ i ] );
93
+ message_wrapper.addClass( 'visible' );
94
  }
95
+ message.text( message_text );
96
+ message_wrapper.addClass( 'visible' );
97
+ product_row.addClass( 'error' );
98
  }
99
 
100
+ spinner.removeClass( 'show' );
101
+ t.add( licence_activation ).prop( "disabled", false ).removeClass( 'clicked' );
102
  }
103
+ } );
104
  };
105
 
106
+ var licence_update = function ( button ) {
107
+ button.on( 'click', function ( e ) {
108
  e.preventDefault();
109
 
110
+ var t = $( this ),
111
+ form = $( '#licence-check-update' ),
112
  data = form.serialize();
113
 
114
+ t.prop( "disabled", true ).addClass( 'clicked' );
115
+ form.find( 'div.spinner' ).addClass( 'show' );
116
+
117
+ jQuery.ajax( {
118
+ type : 'POST',
119
+ url : ajaxurl,
120
+ data : data,
121
+ success: function ( response ) {
122
+ $( '.product-licence-activation' ).empty().replaceWith( response.template );
123
+ licence_api();
124
+ }
125
+ } );
126
+ } );
127
  };
128
 
129
+ var licence_deactivate = function ( button ) {
130
+ button.on( 'click', function ( e ) {
131
  e.preventDefault();
132
 
133
  var check = script_info.is_debug == true ? true : confirm( licence_message.are_you_sure );
134
 
135
+ if ( check == true ) {
136
+ var t = $( this ),
137
+ licence_key = t.data( 'licence-key' ),
138
+ licence_email = t.data( 'licence-email' ),
139
+ product_init = t.data( 'product-init' ),
140
+ action = t.data( 'action' ),
141
+ renew = $( '.licence-renew' ),
142
+ deactive = $( '.licence-deactive' ),
143
+ message = $( '#yith-licence-notice' ),
144
+ activated_table = $( '.activated-table' );
145
+
146
+ t.add( renew ).add( deactive ).prop( "disabled", true ).addClass( 'clicked' );
147
+ $( '#activated-products' ).find( '.spinner' ).addClass( 'show' );
148
+
149
+ jQuery.ajax( {
150
+ type : 'POST',
151
+ url : ajaxurl,
152
+ data : {
153
+ action : action,
154
+ licence_key : licence_key,
155
+ email : licence_email,
156
+ product_init: product_init
157
+ },
158
+ success: function ( response ) {
159
+ message.css( 'maxWidth', activated_table.width() );
160
+ if ( false == response.activated && typeof response.error == 'undefined' ) {
161
+ $( '.product-licence-activation' ).empty().replaceWith( response.template );
162
+ licence_api();
163
+ }
164
+
165
+ if ( false == response.activated && typeof response.error != 'undefined' ) {
166
+ message.find( 'p.yith-licence-notice-message' ).html( response.error );
167
+ message.removeClass( 'notice-success' ).addClass( 'notice-error visible' );
168
+ t.add( renew ).add( deactive ).add( renew ).prop( "disabled", false ).removeClass( 'clicked' );
169
+ $( '#activated-products' ).find( '.spinner' ).removeClass( 'show' );
170
+ }
171
+
172
+ else if ( false == response ) {
173
+ message.find( 'p.yith-licence-notice-message' ).html( licence_message.server );
174
+ message.removeClass( 'notice-success' ).addClass( 'notice-error visible' );
175
+ t.add( renew ).add( deactive ).add( renew ).prop( "disabled", false ).removeClass( 'clicked' );
176
+ $( '#activated-products' ).find( '.spinner' ).removeClass( 'show' );
177
+ }
178
+ }
179
+ } );
180
  }
181
+ } );
182
  };
183
 
184
  var licence_api = function () {
185
+ var button = $( '.licence-activation' ),
186
+ check = $( '.licence-check' ),
187
+ deactivated = $( '.licence-deactive' );
188
 
189
+ licence_activation( button );
190
+ licence_update( check );
191
+ licence_deactivate( deactivated );
192
  };
193
 
194
  licence_api();
195
 
196
+ $( 'body' ).on( 'click', '.yit-changelog-button', function ( e ) {
197
+ $( '#TB_window' ).remove();
198
+ } );
199
 
200
+ } )( jQuery );
plugin-fw/licence/assets/js/yit-licence.min.js CHANGED
@@ -1,7 +1,10 @@
1
- (function(b){var k=function(a){a.on("click",function(v,e){v.preventDefault();var a=b(this),c=a.data("formid"),d=b("#"+c),f=d.serialize(),h=b(d).find(".message"),g=b(d).find(".message-wrapper"),m=d.find(".user-email"),u=d.find(".licence-key"),k=d.find(".user-email").val(),t=d.find(".licence-key").val(),n=!1,c=[],p=d.find(".product-row"),q=b(".licence-activation"),r=b("#products-to-active").find(".spinner");h.empty();g.removeClass("visible");m.removeClass("require");u.removeClass("require");p.removeClass("error");
2
- r.addClass("show");a.add(q).prop("disabled",!0).addClass("clicked");""==k&&(n=!0,c[c.length]=licence_message.email,m.addClass("require"));""==t&&(n=!0,c[c.length]=licence_message.license_key,u.addClass("require"));if(0==n)jQuery.ajax({type:"POST",url:ajaxurl,data:f,success:function(c){r.removeClass("show");a.add(q).prop("disabled",!1).removeClass("clicked");1==c.activated?(b(".product-licence-activation").empty().replaceWith(c.template),l()):(0!=c?h.text(c.error):h.text(licence_message.server),g.addClass("visible"),
3
- p.addClass("error"))}});else{if(1==c.length)h.text(licence_message.error.replace("%field%",c[0]));else{d=licence_message.errors;for(f=0;f<c.length;f++)d=d.replace("%field_"+(f+1)+"%",c[f]),g.addClass("visible");h.text(d)}g.addClass("visible");p.addClass("error");r.removeClass("show");a.add(q).prop("disabled",!1).removeClass("clicked")}})},t=function(a){a.on("click",function(a){a.preventDefault();a=b(this);var e=b("#licence-check-update"),k=e.serialize();a.prop("disabled",!0).addClass("clicked");e.find("div.spinner").addClass("show");
4
- jQuery.ajax({type:"POST",url:ajaxurl,data:k,success:function(c){b(".product-licence-activation").empty().replaceWith(c.template);l()}})})},w=function(a){a.on("click",function(a){a.preventDefault();if(1==(1==script_info.is_debug?!0:confirm(licence_message.are_you_sure))){var e=b(this);a=e.data("licence-key");var k=e.data("licence-email"),c=e.data("product-init"),d=e.data("action"),f=b(".licence-renew"),h=b(".licence-deactive"),g=b("#yith-licence-notice"),m=b(".activated-table");e.add(f).add(h).prop("disabled",
5
- !0).addClass("clicked");b("#activated-products").find(".spinner").addClass("show");jQuery.ajax({type:"POST",url:ajaxurl,data:{action:d,licence_key:a,email:k,product_init:c},success:function(a){g.css("maxWidth",m.width());0==a.activated&&"undefined"==typeof a.error&&(b(".product-licence-activation").empty().replaceWith(a.template),l());0==a.activated&&"undefined"!=typeof a.error?(g.find("p.yith-licence-notice-message").html(a.error),g.removeClass("notice-success").addClass("notice-error visible"),
6
- e.add(f).add(h).add(f).prop("disabled",!1).removeClass("clicked"),b("#activated-products").find(".spinner").removeClass("show")):0==a&&(g.find("p.yith-licence-notice-message").html(licence_message.server),g.removeClass("notice-success").addClass("notice-error visible"),e.add(f).add(h).add(f).prop("disabled",!1).removeClass("clicked"),b("#activated-products").find(".spinner").removeClass("show"))}})}})},l=function(){var a=b(".licence-activation"),l=b(".licence-check"),e=b(".licence-deactive");k(a);
7
- t(l);w(e)};l();b("body").on("click",".yit-changelog-button",function(a){b("#TB_window").remove()})})(jQuery);
 
 
 
1
+ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,d,b){a instanceof String&&(a=String(a));for(var e=a.length,f=0;f<e;f++){var k=a[f];if(d.call(b,k,f,a))return{i:f,v:k}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,d,b){a!=Array.prototype&&a!=Object.prototype&&(a[d]=b.value)};
2
+ $jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,d,b,e){if(d){b=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var f=a[e];f in b||(b[f]={});b=b[f]}a=a[a.length-1];e=b[a];d=d(e);d!=e&&null!=d&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:d})}};
3
+ $jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
4
+ (function(a){var d=function(b){b.on("click",function(g,c){g.preventDefault();var b=a(this);g=b.data("formid");c=a("#"+g);var d=c.serialize(),e=a(c).find(".message"),h=a(c).find(".message-wrapper"),k=c.find(".user-email"),l=c.find(".licence-key"),m=c.find(".user-email").val(),t=c.find(".licence-key").val(),n=!1;g=[];var p=c.find(".product-row"),q=a(".licence-activation"),r=a("#products-to-active").find(".spinner");e.empty();h.removeClass("visible");k.removeClass("require");l.removeClass("require");
5
+ p.removeClass("error");r.addClass("show");b.add(q).prop("disabled",!0).addClass("clicked");""===m&&(n=!0,g[g.length]=licence_message.email,k.addClass("require"));""===t&&(n=!0,g[g.length]=licence_message.license_key,l.addClass("require"));if(!1===n)jQuery.ajax({type:"POST",url:ajaxurl,data:d,success:function(c){r.removeClass("show");b.add(q).prop("disabled",!1).removeClass("clicked");!0===c.activated?(a(".product-licence-activation").empty().replaceWith(c.template),f()):(!1!==c&&"undefined"!==typeof c.error?
6
+ e.text(c.error):e.text(licence_message.server),h.addClass("visible"),p.addClass("error"));"undefined"!==typeof c.debug&&console.log(c.debug)}});else{if(1==g.length)e.text(licence_message.error.replace("%field%",g[0]));else{c=licence_message.errors;for(d=0;d<g.length;d++)c=c.replace("%field_"+(d+1)+"%",g[d]),h.addClass("visible");e.text(c)}h.addClass("visible");p.addClass("error");r.removeClass("show");b.add(q).prop("disabled",!1).removeClass("clicked")}})},b=function(b){b.on("click",function(b){b.preventDefault();
7
+ b=a(this);var c=a("#licence-check-update"),d=c.serialize();b.prop("disabled",!0).addClass("clicked");c.find("div.spinner").addClass("show");jQuery.ajax({type:"POST",url:ajaxurl,data:d,success:function(c){a(".product-licence-activation").empty().replaceWith(c.template);f()}})})},e=function(b){b.on("click",function(b){b.preventDefault();if(1==(1==script_info.is_debug?!0:confirm(licence_message.are_you_sure))){var c=a(this);b=c.data("licence-key");var d=c.data("licence-email"),e=c.data("product-init"),
8
+ g=c.data("action"),h=a(".licence-renew"),k=a(".licence-deactive"),l=a("#yith-licence-notice"),m=a(".activated-table");c.add(h).add(k).prop("disabled",!0).addClass("clicked");a("#activated-products").find(".spinner").addClass("show");jQuery.ajax({type:"POST",url:ajaxurl,data:{action:g,licence_key:b,email:d,product_init:e},success:function(b){l.css("maxWidth",m.width());0==b.activated&&"undefined"==typeof b.error&&(a(".product-licence-activation").empty().replaceWith(b.template),f());0==b.activated&&
9
+ "undefined"!=typeof b.error?(l.find("p.yith-licence-notice-message").html(b.error),l.removeClass("notice-success").addClass("notice-error visible"),c.add(h).add(k).add(h).prop("disabled",!1).removeClass("clicked"),a("#activated-products").find(".spinner").removeClass("show")):0==b&&(l.find("p.yith-licence-notice-message").html(licence_message.server),l.removeClass("notice-success").addClass("notice-error visible"),c.add(h).add(k).add(h).prop("disabled",!1).removeClass("clicked"),a("#activated-products").find(".spinner").removeClass("show"))}})}})},
10
+ f=function(){var f=a(".licence-activation"),g=a(".licence-check"),c=a(".licence-deactive");d(f);b(g);e(c)};f();a("body").on("click",".yit-changelog-button",function(b){a("#TB_window").remove()})})(jQuery);
plugin-fw/licence/lib/yit-licence.php CHANGED
@@ -171,15 +171,14 @@ if ( !class_exists( 'YIT_Licence' ) ) {
171
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
172
  */
173
  public function admin_enqueue_scripts() {
174
-
175
  /**
176
  * Support to YIT Framework < 2.0
177
  */
178
- $filename = function_exists( 'yit_load_js_file' ) ? yit_load_js_file( 'yit-licence.js' ) : 'yit-licence.js';
179
  $script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
180
  $style_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
181
 
182
- wp_register_script( 'yit-licence', $script_path . '/licence/assets/js/' . $filename, array( 'jquery' ), '1.0.0', true );
183
  wp_register_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
184
 
185
  /* Localize Scripts */
@@ -211,7 +210,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
211
  * Send a request to API server to activate plugins
212
  *
213
  * @return void
214
- * @use wp_send_json
215
  *
216
  * @since 1.0
217
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
@@ -265,6 +264,14 @@ if ( !class_exists( 'YIT_Licence' ) ) {
265
  $body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 200 ) );
266
  }
267
 
 
 
 
 
 
 
 
 
268
  wp_send_json( $body );
269
  }
270
 
@@ -274,7 +281,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
274
  * Send a request to API server to activate plugins
275
  *
276
  * @return void
277
- * @use wp_send_json
278
  *
279
  * @since 1.0
280
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
@@ -446,9 +453,9 @@ if ( !class_exists( 'YIT_Licence' ) ) {
446
  * Check for licence update
447
  *
448
  * @return void
449
- * @since 2.5
450
  *
451
- * @use YIT_Theme_Licence->check()
452
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
453
  */
454
  public function check_all() {
@@ -463,7 +470,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
463
  * Send a request to API server to check activate plugins and update the informations
464
  *
465
  * @return void
466
- * @use YIT_Theme_Licence->check()
467
  *
468
  * @since 1.0
469
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
171
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
172
  */
173
  public function admin_enqueue_scripts() {
174
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
175
  /**
176
  * Support to YIT Framework < 2.0
177
  */
 
178
  $script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
179
  $style_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
180
 
181
+ wp_register_script( 'yit-licence', $script_path . '/licence/assets/js/yit-licence' . $suffix . '.js', array( 'jquery' ), '1.0.0', true );
182
  wp_register_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
183
 
184
  /* Localize Scripts */
210
  * Send a request to API server to activate plugins
211
  *
212
  * @return void
213
+ * @use wp_send_json
214
  *
215
  * @since 1.0
216
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
264
  $body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 200 ) );
265
  }
266
 
267
+ if ( !empty( $_REQUEST[ 'debug' ] ) ) {
268
+ $body = is_array( $body ) ? $body : array();
269
+ $body[ 'debug' ] = array( 'response' => $response );
270
+ if ( 'print_r' === $_REQUEST[ 'debug' ] ) {
271
+ $body[ 'debug' ] = print_r( $body[ 'debug' ], true );
272
+ }
273
+ }
274
+
275
  wp_send_json( $body );
276
  }
277
 
281
  * Send a request to API server to activate plugins
282
  *
283
  * @return void
284
+ * @use wp_send_json
285
  *
286
  * @since 1.0
287
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
453
  * Check for licence update
454
  *
455
  * @return void
456
+ * @since 2.5
457
  *
458
+ * @use YIT_Theme_Licence->check()
459
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
460
  */
461
  public function check_all() {
470
  * Send a request to API server to check activate plugins and update the informations
471
  *
472
  * @return void
473
+ * @use YIT_Theme_Licence->check()
474
  *
475
  * @since 1.0
476
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
plugin-fw/licence/lib/yit-plugin-licence.php CHANGED
@@ -63,7 +63,7 @@ if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
63
  }
64
 
65
  $this->_settings = array(
66
- 'parent_page' => 'yit_plugin_panel',
67
  'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
68
  'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
69
  'capability' => 'manage_options',
63
  }
64
 
65
  $this->_settings = array(
66
+ 'parent_page' => 'yith_plugin_panel',
67
  'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
68
  'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
69
  'capability' => 'manage_options',
plugin-fw/licence/templates/panel/activation/activation-panel.php CHANGED
@@ -8,15 +8,16 @@
8
  * http://www.gnu.org/licenses/gpl-3.0.txt
9
  */
10
 
11
- $to_active_products = $this->get_to_active_products();
12
- $activated_products = $this->get_activated_products();
13
- $no_active_products = $this->get_no_active_licence_key();
14
- $expired_products = isset( $no_active_products[ '106' ] ) ? $no_active_products[ '106' ] : array();
15
- $banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_products[ '107' ] : array();
16
- $notice = isset( $notice ) ? $notice : '';
17
- $notice_class = ! empty( $notice ) ? 'notice notice-success visible' : 'notice notice-success';
18
- $to_activate_check = $this instanceof YIT_Theme_Licence ? 1 : 2;
19
- $num_members_products_activate = $this->get_number_of_membership_products();
 
20
  ?>
21
 
22
  <div class="yit-container product-licence-activation">
@@ -25,8 +26,8 @@ $num_members_products_activate = $this->get_number_of_membership_products();
25
  <div class="licence-check-section">
26
  <form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
27
  <span class="licence-label" style="display: block;"><?php _e( 'Have you updated your licenses? Have you asked for an extension? Update information concerning your products.', 'yith-plugin-fw' ); ?></span>
28
- <input type="hidden" name="action" value="yith_update_licence_information-<?php echo $this->get_product_type(); ?>" />
29
- <input type="submit" name="submit" value="<?php _e( 'Update license information', 'yith-plugin-fw' ) ?>" class="button-licence licence-check" />
30
  <div class="spinner"></div>
31
  </form>
32
  </div>
@@ -37,32 +38,35 @@ $num_members_products_activate = $this->get_number_of_membership_products();
37
 
38
  <!-- To Active Products -->
39
 
40
- <?php if( ! empty( $to_active_products ) ) : ?>
41
  <h3 id="products-to-active" class="to-active">
42
  <?php echo _n( 'Product to activate', 'Products to activate', $to_activate_check, 'yith-plugin-fw' ) ?>
43
  <span class="spinner"></span>
44
  </h3>
45
  <div class="to-active-wrapper">
46
- <?php foreach( $to_active_products as $init => $info ) : ?>
47
- <form class="to-active-form" method="post" id="<?php echo $info['product_id'] ?>" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
 
 
 
48
  <table class="to-active-table">
49
  <tbody>
50
- <tr class="product-row">
51
- <td class="product-name">
52
- <?php echo $this->display_product_name( $info['Name'] ) ?>
53
- </td>
54
- <td>
55
- <input type="email" name="email" placeholder="Your email on Yithemes.com" value="" class="user-email" />
56
- </td>
57
- <td>
58
- <input type="text" name="licence_key" placeholder="License Key" value="" class="licence-key" />
59
- </td>
60
- <td class="activate-button">
61
- <input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' )?>" class="button-licence licence-activation" data-formid="<?php echo $info['product_id'] ?>"/>
62
- </td>
63
- </tr>
64
- <input type="hidden" name="action" value="yith_activate-<?php echo $this->get_product_type(); ?>" />
65
- <input type="hidden" name="product_init" value="<?php echo $init ?>" />
66
  </tbody>
67
  </table>
68
  <div class="message-wrapper">
@@ -75,164 +79,164 @@ $num_members_products_activate = $this->get_number_of_membership_products();
75
 
76
  <!-- Activated Products -->
77
 
78
- <?php if( ! empty( $activated_products ) ) : ?>
79
  <h3 id="activated-products">
80
  <?php _e( 'Activated', 'yith-plugin-fw' ) ?>
81
  <span class="spinner"></span>
82
  </h3>
83
  <table class="activated-table">
84
  <thead>
85
- <tr>
86
- <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
87
- <?php if( $this->show_extra_info ) : ?>
88
- <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
89
- <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
 
 
 
 
 
 
 
 
90
  <?php endif; ?>
 
91
 
92
- <th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
93
-
94
- <?php if( $this->show_extra_info ) : ?>
95
- <th><?php _e( 'Remaining', 'yith-plugin-fw' ) ?></th>
96
- <?php if( $num_members_products_activate ) : ?>
97
- <th><?php _e( 'Club Subscription', 'yith-plugin-fw' ) ?></th>
98
- <?php endif; ?>
99
- <?php endif; ?>
100
-
101
- <th><?php _e( 'License Actions', 'yith-plugin-fw' ) ?></th>
102
- </tr>
103
  </thead>
104
  <tbody>
105
- <?php foreach( $activated_products as $init => $info ) : ?>
106
- <tr>
107
- <td class="product-name">
108
- <?php echo $this->display_product_name( $info['Name'] ) ?>
 
 
 
 
 
109
  </td>
 
 
 
 
110
 
111
- <?php if( $this->show_extra_info ) : ?>
112
- <td class="product-licence-email">
113
- <?php echo $info['licence']['email'] ?>
114
- </td>
115
- <td class="product-licence-key">
116
- <?php echo $info['licence']['licence_key'] ?>
117
- </td>
118
- <?php endif; ?>
119
 
120
- <td class="product-licence-expires">
121
- <?php echo date("F j, Y", $info['licence']['licence_expires'] ); ?>
 
122
  </td>
123
-
124
- <?php if( $this->show_extra_info ) : ?>
125
- <td class="product-licence-remaining">
126
- <?php printf( __( '%1s out of %2s', 'yith-plugin-fw' ), $info['licence']['activation_remaining'], $info['licence']['activation_limit'] ); ?>
127
  </td>
128
- <?php if( $num_members_products_activate ) : ?>
129
- <td class="product-licence-membership">
130
- <span class="dashicons dashicons-<?php echo $info['licence']['is_membership'] ? 'yes' : 'no-alt' ?>"></span>
131
- </td>
132
- <?php endif; ?>
133
  <?php endif; ?>
 
134
 
135
- <td>
136
- <a class="button-licence licence-deactive"
137
- href="#"
138
- data-licence-email="<?php echo $info['licence']['email'] ?>"
139
- data-licence-key="<?php echo $info['licence']['licence_key'] ?>"
140
- data-product-init="<?php echo $init ?>"
141
- data-action="yith_deactivate-<?php echo $this->get_product_type(); ?>">
142
- <?php _e( 'Deactivate', 'yith-plugin-fw' ) ?>
 
 
 
 
 
143
  </a>
144
-
145
- <?php if( ! $info['licence']['is_membership'] && $this->show_renew_button ) : ?>
146
- <a class="button-licence licence-renew" href="<?php echo esc_url( $this->get_renewing_uri( $info['licence']['licence_key'] ) ) ?>" target="_blank">
147
- <?php _e( 'Renew', 'yith-plugin-fw' ) ?>
148
- </a>
149
- <?php endif; ?>
150
- </td>
151
- </tr>
152
- <?php endforeach; ?>
153
  </tbody>
154
  </table>
155
- <?php endif;?>
156
 
157
- <!-- Banned Products -->
158
 
159
- <?php if( ! empty( $banned_products ) ) : ?>
160
  <h3><?php _e( 'Banned', 'yith-plugin-fw' ) ?></h3>
161
  <table class="expired-table">
162
  <thead>
 
 
 
 
 
 
 
 
 
 
163
  <tr>
164
- <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
165
- <?php if( $this->show_extra_info ) : ?>
166
- <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
167
- <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
 
 
168
  <?php endif; ?>
169
  </tr>
170
- </thead>
171
- <tbody>
172
- <?php foreach( $banned_products as $init => $info ) : ?>
173
- <tr>
174
- <td class="product-name">
175
- <?php echo $this->display_product_name( $info['Name'] ) ?>
176
- </td>
177
- <?php if( $this->show_extra_info ) : ?>
178
- <td class="product-licence-email"><?php echo $info['licence']['email'] ?></td>
179
- <td class="product-licence-key"><?php echo $info['licence']['licence_key'] ?></td>
180
- <?php endif; ?>
181
- </tr>
182
- <?php endforeach; ?>
183
  </tbody>
184
  </table>
185
- <?php endif;?>
186
 
187
  <!-- Expired Products -->
188
 
189
- <?php if( ! empty( $expired_products ) ) : ?>
190
  <h3><?php _e( 'Expired', 'yith-plugin-fw' ) ?></h3>
191
  <table class="expired-table">
192
  <thead>
193
- <tr>
194
- <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
195
 
196
- <?php if( $this->show_extra_info ) : ?>
197
- <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
198
- <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
199
- <?php endif; ?>
200
 
201
- <th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
202
 
203
- <?php if( $this->show_renew_button ) : ?>
204
- <th><?php _e( 'Renew', 'yith-plugin-fw' ) ?></th>
205
- <?php endif; ?>
206
- </tr>
207
  </thead>
208
  <tbody>
209
- <?php foreach( $expired_products as $init => $info ) : ?>
210
- <tr>
211
- <td class="product-name">
212
- <?php echo $this->display_product_name( $info['Name'] ) ?>
213
- </td>
214
 
215
- <?php if( $this->show_extra_info ) : ?>
216
- <td class="product-licence-email"><?php echo $info['licence']['email'] ?></td>
217
- <td class="product-licence-key"><?php echo $info['licence']['licence_key'] ?></td>
218
- <?php endif; ?>
219
 
220
- <td class="product-licence-expires"><?php echo date("F j, Y", $info['licence']['licence_expires'] ); ?></td>
221
 
222
- <?php if( $this->show_renew_button ) : ?>
223
- <td>
224
- <a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info['licence']['licence_key'] ) ?>" target="_blank">
225
- <?php if( $info['licence']['is_membership'] ) : ?>
226
- <?php _e( 'Order again', 'yith-plugin-fw' ) ?>
227
- <?php else : ?>
228
- <?php __( 'Renew license', 'yith-plugin-fw' ) ?>
229
- <?php endif; ?>
230
- </a>
231
- </td>
232
- <?php endif; ?>
233
- </tr>
234
- <?php endforeach; ?>
235
  </tbody>
236
  </table>
237
- <?php endif;?>
238
  </div>
8
  * http://www.gnu.org/licenses/gpl-3.0.txt
9
  */
10
 
11
+ $to_active_products = $this->get_to_active_products();
12
+ $activated_products = $this->get_activated_products();
13
+ $no_active_products = $this->get_no_active_licence_key();
14
+ $expired_products = isset( $no_active_products[ '106' ] ) ? $no_active_products[ '106' ] : array();
15
+ $banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_products[ '107' ] : array();
16
+ $notice = isset( $notice ) ? $notice : '';
17
+ $notice_class = !empty( $notice ) ? 'notice notice-success visible' : 'notice notice-success';
18
+ $to_activate_check = $this instanceof YIT_Theme_Licence ? 1 : 2;
19
+ $num_members_products_activate = $this->get_number_of_membership_products();
20
+ $debug = isset( $_REQUEST[ 'yith-license-debug' ] ) ? $_REQUEST[ 'yith-license-debug' ] : false;
21
  ?>
22
 
23
  <div class="yit-container product-licence-activation">
26
  <div class="licence-check-section">
27
  <form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
28
  <span class="licence-label" style="display: block;"><?php _e( 'Have you updated your licenses? Have you asked for an extension? Update information concerning your products.', 'yith-plugin-fw' ); ?></span>
29
+ <input type="hidden" name="action" value="yith_update_licence_information-<?php echo $this->get_product_type(); ?>"/>
30
+ <input type="submit" name="submit" value="<?php _e( 'Update license information', 'yith-plugin-fw' ) ?>" class="button-licence licence-check"/>
31
  <div class="spinner"></div>
32
  </form>
33
  </div>
38
 
39
  <!-- To Active Products -->
40
 
41
+ <?php if ( !empty( $to_active_products ) ) : ?>
42
  <h3 id="products-to-active" class="to-active">
43
  <?php echo _n( 'Product to activate', 'Products to activate', $to_activate_check, 'yith-plugin-fw' ) ?>
44
  <span class="spinner"></span>
45
  </h3>
46
  <div class="to-active-wrapper">
47
+ <?php foreach ( $to_active_products as $init => $info ) : ?>
48
+ <form class="to-active-form" method="post" id="<?php echo $info[ 'product_id' ] ?>" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
49
+ <?php if ( $debug ): ?>
50
+ <input type="hidden" name="debug" value="<?php echo $debug ?>"/>
51
+ <?php endif ?>
52
  <table class="to-active-table">
53
  <tbody>
54
+ <tr class="product-row">
55
+ <td class="product-name">
56
+ <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
57
+ </td>
58
+ <td>
59
+ <input type="email" name="email" placeholder="Your email on Yithemes.com" value="" class="user-email"/>
60
+ </td>
61
+ <td>
62
+ <input type="text" name="licence_key" placeholder="License Key" value="" class="licence-key"/>
63
+ </td>
64
+ <td class="activate-button">
65
+ <input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' ) ?>" class="button-licence licence-activation" data-formid="<?php echo $info[ 'product_id' ] ?>"/>
66
+ </td>
67
+ </tr>
68
+ <input type="hidden" name="action" value="yith_activate-<?php echo $this->get_product_type(); ?>"/>
69
+ <input type="hidden" name="product_init" value="<?php echo $init ?>"/>
70
  </tbody>
71
  </table>
72
  <div class="message-wrapper">
79
 
80
  <!-- Activated Products -->
81
 
82
+ <?php if ( !empty( $activated_products ) ) : ?>
83
  <h3 id="activated-products">
84
  <?php _e( 'Activated', 'yith-plugin-fw' ) ?>
85
  <span class="spinner"></span>
86
  </h3>
87
  <table class="activated-table">
88
  <thead>
89
+ <tr>
90
+ <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
91
+ <?php if ( $this->show_extra_info ) : ?>
92
+ <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
93
+ <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
94
+ <?php endif; ?>
95
+
96
+ <th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
97
+
98
+ <?php if ( $this->show_extra_info ) : ?>
99
+ <th><?php _e( 'Remaining', 'yith-plugin-fw' ) ?></th>
100
+ <?php if ( $num_members_products_activate ) : ?>
101
+ <th><?php _e( 'Club Subscription', 'yith-plugin-fw' ) ?></th>
102
  <?php endif; ?>
103
+ <?php endif; ?>
104
 
105
+ <th><?php _e( 'License Actions', 'yith-plugin-fw' ) ?></th>
106
+ </tr>
 
 
 
 
 
 
 
 
 
107
  </thead>
108
  <tbody>
109
+ <?php foreach ( $activated_products as $init => $info ) : ?>
110
+ <tr>
111
+ <td class="product-name">
112
+ <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
113
+ </td>
114
+
115
+ <?php if ( $this->show_extra_info ) : ?>
116
+ <td class="product-licence-email">
117
+ <?php echo $info[ 'licence' ][ 'email' ] ?>
118
  </td>
119
+ <td class="product-licence-key">
120
+ <?php echo $info[ 'licence' ][ 'licence_key' ] ?>
121
+ </td>
122
+ <?php endif; ?>
123
 
124
+ <td class="product-licence-expires">
125
+ <?php echo date( "F j, Y", $info[ 'licence' ][ 'licence_expires' ] ); ?>
126
+ </td>
 
 
 
 
 
127
 
128
+ <?php if ( $this->show_extra_info ) : ?>
129
+ <td class="product-licence-remaining">
130
+ <?php printf( __( '%1s out of %2s', 'yith-plugin-fw' ), $info[ 'licence' ][ 'activation_remaining' ], $info[ 'licence' ][ 'activation_limit' ] ); ?>
131
  </td>
132
+ <?php if ( $num_members_products_activate ) : ?>
133
+ <td class="product-licence-membership">
134
+ <span class="dashicons dashicons-<?php echo $info[ 'licence' ][ 'is_membership' ] ? 'yes' : 'no-alt' ?>"></span>
 
135
  </td>
 
 
 
 
 
136
  <?php endif; ?>
137
+ <?php endif; ?>
138
 
139
+ <td>
140
+ <a class="button-licence licence-deactive"
141
+ href="#"
142
+ data-licence-email="<?php echo $info[ 'licence' ][ 'email' ] ?>"
143
+ data-licence-key="<?php echo $info[ 'licence' ][ 'licence_key' ] ?>"
144
+ data-product-init="<?php echo $init ?>"
145
+ data-action="yith_deactivate-<?php echo $this->get_product_type(); ?>">
146
+ <?php _e( 'Deactivate', 'yith-plugin-fw' ) ?>
147
+ </a>
148
+
149
+ <?php if ( !$info[ 'licence' ][ 'is_membership' ] && $this->show_renew_button ) : ?>
150
+ <a class="button-licence licence-renew" href="<?php echo esc_url( $this->get_renewing_uri( $info[ 'licence' ][ 'licence_key' ] ) ) ?>" target="_blank">
151
+ <?php _e( 'Renew', 'yith-plugin-fw' ) ?>
152
  </a>
153
+ <?php endif; ?>
154
+ </td>
155
+ </tr>
156
+ <?php endforeach; ?>
 
 
 
 
 
157
  </tbody>
158
  </table>
159
+ <?php endif; ?>
160
 
161
+ <!-- Banned Products -->
162
 
163
+ <?php if ( !empty( $banned_products ) ) : ?>
164
  <h3><?php _e( 'Banned', 'yith-plugin-fw' ) ?></h3>
165
  <table class="expired-table">
166
  <thead>
167
+ <tr>
168
+ <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
169
+ <?php if ( $this->show_extra_info ) : ?>
170
+ <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
171
+ <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
172
+ <?php endif; ?>
173
+ </tr>
174
+ </thead>
175
+ <tbody>
176
+ <?php foreach ( $banned_products as $init => $info ) : ?>
177
  <tr>
178
+ <td class="product-name">
179
+ <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
180
+ </td>
181
+ <?php if ( $this->show_extra_info ) : ?>
182
+ <td class="product-licence-email"><?php echo $info[ 'licence' ][ 'email' ] ?></td>
183
+ <td class="product-licence-key"><?php echo $info[ 'licence' ][ 'licence_key' ] ?></td>
184
  <?php endif; ?>
185
  </tr>
186
+ <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
187
  </tbody>
188
  </table>
189
+ <?php endif; ?>
190
 
191
  <!-- Expired Products -->
192
 
193
+ <?php if ( !empty( $expired_products ) ) : ?>
194
  <h3><?php _e( 'Expired', 'yith-plugin-fw' ) ?></h3>
195
  <table class="expired-table">
196
  <thead>
197
+ <tr>
198
+ <th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
199
 
200
+ <?php if ( $this->show_extra_info ) : ?>
201
+ <th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
202
+ <th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
203
+ <?php endif; ?>
204
 
205
+ <th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
206
 
207
+ <?php if ( $this->show_renew_button ) : ?>
208
+ <th><?php _e( 'Renew', 'yith-plugin-fw' ) ?></th>
209
+ <?php endif; ?>
210
+ </tr>
211
  </thead>
212
  <tbody>
213
+ <?php foreach ( $expired_products as $init => $info ) : ?>
214
+ <tr>
215
+ <td class="product-name">
216
+ <?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
217
+ </td>
218
 
219
+ <?php if ( $this->show_extra_info ) : ?>
220
+ <td class="product-licence-email"><?php echo $info[ 'licence' ][ 'email' ] ?></td>
221
+ <td class="product-licence-key"><?php echo $info[ 'licence' ][ 'licence_key' ] ?></td>
222
+ <?php endif; ?>
223
 
224
+ <td class="product-licence-expires"><?php echo date( "F j, Y", $info[ 'licence' ][ 'licence_expires' ] ); ?></td>
225
 
226
+ <?php if ( $this->show_renew_button ) : ?>
227
+ <td>
228
+ <a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info[ 'licence' ][ 'licence_key' ] ) ?>" target="_blank">
229
+ <?php if ( $info[ 'licence' ][ 'is_membership' ] ) : ?>
230
+ <?php _e( 'Order again', 'yith-plugin-fw' ) ?>
231
+ <?php else : ?>
232
+ <?php __( 'Renew license', 'yith-plugin-fw' ) ?>
233
+ <?php endif; ?>
234
+ </a>
235
+ </td>
236
+ <?php endif; ?>
237
+ </tr>
238
+ <?php endforeach; ?>
239
  </tbody>
240
  </table>
241
+ <?php endif; ?>
242
  </div>
plugin-fw/templates/privacy/html-policy-content.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
- /**
3
- * @var array $sections
4
- */
5
- ?>
6
- <div class="wp-suggested-text">
7
- <?php do_action( 'yith_plugin_fw_privacy_guide_content_before' ); ?>
8
-
9
- <?php
10
- foreach ( $sections as $key => $section ) {
11
- $action = "yith_plugin_fw_privacy_guide_content_{$key}";
12
- $content = apply_filters( 'yith_plugin_fw_privacy_guide_content', '', $key );
13
-
14
- if ( has_action( $action ) || !empty( $section[ 'tutorial' ] ) || !empty( $section[ 'description' ] ) || $content ) {
15
- if ( !empty( $section[ 'title' ] ) ) {
16
- echo "<h2>{$section['title']}</h2>";
17
- }
18
-
19
- if ( !empty( $section[ 'tutorial' ] ) ) {
20
- echo "<p class='privacy-policy-tutorial'>{$section['tutorial']}</p>";
21
- }
22
-
23
- if ( !empty( $section[ 'description' ] ) ) {
24
- echo "<p>{$section['description']}</p>";
25
- }
26
-
27
- if ( !empty( $content ) ) {
28
- echo $content;
29
- }
30
- }
31
-
32
- do_action( $action );
33
- }
34
- ?>
35
-
36
- <?php do_action( 'yith_plugin_fw_privacy_guide_content_after' ); ?>
37
  </div>
1
+ <?php
2
+ /**
3
+ * @var array $sections
4
+ */
5
+ ?>
6
+ <div class="wp-suggested-text">
7
+ <?php do_action( 'yith_plugin_fw_privacy_guide_content_before' ); ?>
8
+
9
+ <?php
10
+ foreach ( $sections as $key => $section ) {
11
+ $action = "yith_plugin_fw_privacy_guide_content_{$key}";
12
+ $content = apply_filters( 'yith_plugin_fw_privacy_guide_content', '', $key );
13
+
14
+ if ( has_action( $action ) || !empty( $section[ 'tutorial' ] ) || !empty( $section[ 'description' ] ) || $content ) {
15
+ if ( !empty( $section[ 'title' ] ) ) {
16
+ echo "<h2>{$section['title']}</h2>";
17
+ }
18
+
19
+ if ( !empty( $section[ 'tutorial' ] ) ) {
20
+ echo "<p class='privacy-policy-tutorial'>{$section['tutorial']}</p>";
21
+ }
22
+
23
+ if ( !empty( $section[ 'description' ] ) ) {
24
+ echo "<p>{$section['description']}</p>";
25
+ }
26
+
27
+ if ( !empty( $content ) ) {
28
+ echo $content;
29
+ }
30
+ }
31
+
32
+ do_action( $action );
33
+ }
34
+ ?>
35
+
36
+ <?php do_action( 'yith_plugin_fw_privacy_guide_content_after' ); ?>
37
  </div>
plugin-fw/yit-functions.php CHANGED
@@ -282,7 +282,7 @@ if ( !function_exists( 'yit_plugin_get_attachment_id' ) ) {
282
  continue;
283
  }
284
 
285
- foreach ( (array)$meta[ 'sizes' ] as $size => $values ) {
286
  if ( $values[ 'file' ] == $file && $url == str_replace( 'https://', 'http://', array_shift( wp_get_attachment_image_src( $id, $size ) ) ) ) {
287
 
288
  return $id;
@@ -484,7 +484,7 @@ if ( !function_exists( 'yit_registered_sidebars' ) ) {
484
  $return = array( '' => '' );
485
  }
486
 
487
- foreach ( ( array )$wp_registered_sidebars as $the_ ) {
488
  $return[ $the_[ 'name' ] ] = $the_[ 'name' ];
489
  }
490
 
@@ -1140,15 +1140,24 @@ if ( !function_exists( 'yith_plugin_fw_get_version' ) ) {
1140
  }
1141
  }
1142
 
1143
- if ( ! function_exists( 'yith_get_premium_support_url' ) ) {
1144
- //@TODO: To Remove
1145
- /**
1146
- * Return the url for My Account > Support dashboard
1147
- *
1148
- * @return string The complete string, if the main string is not empty or null
1149
- * @since 2.0.0
1150
- */
1151
- function yith_get_premium_support_url() {
1152
- return 'https://yithemes.com/my-account/support/dashboard/';
1153
- }
1154
  }
 
 
 
 
 
 
 
 
 
282
  continue;
283
  }
284
 
285
+ foreach ( (array) $meta[ 'sizes' ] as $size => $values ) {
286
  if ( $values[ 'file' ] == $file && $url == str_replace( 'https://', 'http://', array_shift( wp_get_attachment_image_src( $id, $size ) ) ) ) {
287
 
288
  return $id;
484
  $return = array( '' => '' );
485
  }
486
 
487
+ foreach ( ( array ) $wp_registered_sidebars as $the_ ) {
488
  $return[ $the_[ 'name' ] ] = $the_[ 'name' ];
489
  }
490
 
1140
  }
1141
  }
1142
 
1143
+ if ( !function_exists( 'yith_get_premium_support_url' ) ) {
1144
+ //@TODO: To Remove
1145
+ /**
1146
+ * Return the url for My Account > Support dashboard
1147
+ *
1148
+ * @return string The complete string, if the main string is not empty or null
1149
+ * @since 2.0.0
1150
+ */
1151
+ function yith_get_premium_support_url() {
1152
+ return 'https://yithemes.com/my-account/support/dashboard/';
1153
+ }
1154
  }
1155
+
1156
+ if ( !function_exists( 'yith_plugin_fw_is_panel' ) ) {
1157
+ function yith_plugin_fw_is_panel() {
1158
+ $panel_screen_id = 'yith-plugins_page';
1159
+ $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
1160
+
1161
+ return $screen instanceof WP_Screen && strpos( $screen->id, $panel_screen_id ) !== false;
1162
+ }
1163
+ }
plugin-options/premium-options.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- return array(
4
- 'premium' => array(
5
- 'home' => array(
6
- 'type' => 'custom_tab',
7
- 'action' => 'yith_quick_view_premium',
8
- )
9
- )
10
  );
1
+ <?php
2
+
3
+ return array(
4
+ 'premium' => array(
5
+ 'home' => array(
6
+ 'type' => 'custom_tab',
7
+ 'action' => 'yith_quick_view_premium',
8
+ )
9
+ )
10
  );
plugin-options/settings-options.php CHANGED
@@ -1,90 +1,90 @@
1
- <?php
2
-
3
- $settings = array(
4
-
5
- 'settings' => array(
6
-
7
- 'general-options' => array(
8
- 'title' => __( 'General Options', 'yith-woocommerce-quick-view' ),
9
- 'type' => 'title',
10
- 'desc' => '',
11
- 'id' => 'yith-wcqv-general-options'
12
- ),
13
-
14
- 'enable-quick-view' => array(
15
- 'id' => 'yith-wcqv-enable',
16
- 'name' => __( 'Enable Quick View', 'yith-woocommerce-quick-view' ),
17
- 'type' => 'checkbox',
18
- 'default' => 'yes'
19
- ),
20
-
21
- 'enable-quick-view-mobile' => array(
22
- 'id' => 'yith-wcqv-enable-mobile',
23
- 'name' => __( 'Enable Quick View on mobile', 'yith-woocommerce-quick-view' ),
24
- 'desc' => __( 'Enable quick view features on mobile device too', 'yith-woocommerce-quick-view' ),
25
- 'type' => 'checkbox',
26
- 'default' => 'yes'
27
- ),
28
-
29
- 'quick-view-label' => array(
30
- 'id' => 'yith-wcqv-button-label',
31
- 'name' => __( 'Quick View Button Label', 'yith-woocommerce-quick-view' ),
32
- 'desc' => __( 'Label for the quick view button in the WooCommerce loop.', 'yith-woocommerce-quick-view' ),
33
- 'type' => 'text',
34
- 'default' => __( 'Quick View', 'yith-woocommerce-quick-view' ),
35
- ),
36
-
37
- 'enable-lightbox' => array(
38
- 'id' => 'yith-wcqv-enable-lightbox',
39
- 'name' => __( 'Enable Lightbox', 'yith-woocommerce-quick-view' ),
40
- 'desc' => __( 'Enable lightbox. Product images will open in a lightbox.', 'yith-woocommerce-quick-view' ),
41
- 'type' => 'checkbox',
42
- 'default' => 'yes'
43
- ),
44
-
45
- 'general-options-end' => array(
46
- 'type' => 'sectionend',
47
- 'id' => 'yith-wcqv-general-options'
48
- ),
49
-
50
- 'style-options' => array(
51
- 'title' => __( 'Style Options', 'yith-woocommerce-quick-view' ),
52
- 'desc' => '',
53
- 'type' => 'title',
54
- 'id' => 'yith-wcqv-style-options'
55
- ),
56
-
57
- 'background-color-modal' => array(
58
- 'name' => __( 'Modal Window Background Color', 'yith-woocommerce-quick-view' ),
59
- 'type' => 'color',
60
- 'desc' => '',
61
- 'id' => 'yith-wcqv-background-modal',
62
- 'default' => '#ffffff'
63
- ),
64
-
65
- 'close-button-color' => array(
66
- 'name' => __( 'Closing Button Color', 'yith-woocommerce-quick-view' ),
67
- 'type' => 'color',
68
- 'desc' => '',
69
- 'id' => 'yith-wcqv-close-color',
70
- 'default' => '#cdcdcd'
71
- ),
72
-
73
- 'close-button-color-hover' => array(
74
- 'name' => __( 'Closing Button Hover Color', 'yith-woocommerce-quick-view' ),
75
- 'type' => 'color',
76
- 'desc' => '',
77
- 'id' => 'yith-wcqv-close-color-hover',
78
- 'default' => '#ff0000'
79
- ),
80
-
81
- 'style-options-end' => array(
82
- 'type' => 'sectionend',
83
- 'id' => 'yith-wcqv-style-options'
84
- ),
85
-
86
-
87
- )
88
- );
89
-
90
  return apply_filters( 'yith_wcqv_panel_settings_options', $settings );
1
+ <?php
2
+
3
+ $settings = array(
4
+
5
+ 'settings' => array(
6
+
7
+ 'general-options' => array(
8
+ 'title' => __( 'General Options', 'yith-woocommerce-quick-view' ),
9
+ 'type' => 'title',
10
+ 'desc' => '',
11
+ 'id' => 'yith-wcqv-general-options'
12
+ ),
13
+
14
+ 'enable-quick-view' => array(
15
+ 'id' => 'yith-wcqv-enable',
16
+ 'name' => __( 'Enable Quick View', 'yith-woocommerce-quick-view' ),
17
+ 'type' => 'checkbox',
18
+ 'default' => 'yes'
19
+ ),
20
+
21
+ 'enable-quick-view-mobile' => array(
22
+ 'id' => 'yith-wcqv-enable-mobile',
23
+ 'name' => __( 'Enable Quick View on mobile', 'yith-woocommerce-quick-view' ),
24
+ 'desc' => __( 'Enable quick view features on mobile device too', 'yith-woocommerce-quick-view' ),
25
+ 'type' => 'checkbox',
26
+ 'default' => 'yes'
27
+ ),
28
+
29
+ 'quick-view-label' => array(
30
+ 'id' => 'yith-wcqv-button-label',
31
+ 'name' => __( 'Quick View Button Label', 'yith-woocommerce-quick-view' ),
32
+ 'desc' => __( 'Label for the quick view button in the WooCommerce loop.', 'yith-woocommerce-quick-view' ),
33
+ 'type' => 'text',
34
+ 'default' => __( 'Quick View', 'yith-woocommerce-quick-view' ),
35
+ ),
36
+
37
+ 'enable-lightbox' => array(
38
+ 'id' => 'yith-wcqv-enable-lightbox',
39
+ 'name' => __( 'Enable Lightbox', 'yith-woocommerce-quick-view' ),
40
+ 'desc' => __( 'Enable lightbox. Product images will open in a lightbox.', 'yith-woocommerce-quick-view' ),
41
+ 'type' => 'checkbox',
42
+ 'default' => 'yes'
43
+ ),
44
+
45
+ 'general-options-end' => array(
46
+ 'type' => 'sectionend',
47
+ 'id' => 'yith-wcqv-general-options'
48
+ ),
49
+
50
+ 'style-options' => array(
51
+ 'title' => __( 'Style Options', 'yith-woocommerce-quick-view' ),
52
+ 'desc' => '',
53
+ 'type' => 'title',
54
+ 'id' => 'yith-wcqv-style-options'
55
+ ),
56
+
57
+ 'background-color-modal' => array(
58
+ 'name' => __( 'Modal Window Background Color', 'yith-woocommerce-quick-view' ),
59
+ 'type' => 'color',
60
+ 'desc' => '',
61
+ 'id' => 'yith-wcqv-background-modal',
62
+ 'default' => '#ffffff'
63
+ ),
64
+
65
+ 'close-button-color' => array(
66
+ 'name' => __( 'Closing Button Color', 'yith-woocommerce-quick-view' ),
67
+ 'type' => 'color',
68
+ 'desc' => '',
69
+ 'id' => 'yith-wcqv-close-color',
70
+ 'default' => '#cdcdcd'
71
+ ),
72
+
73
+ 'close-button-color-hover' => array(
74
+ 'name' => __( 'Closing Button Hover Color', 'yith-woocommerce-quick-view' ),
75
+ 'type' => 'color',
76
+ 'desc' => '',
77
+ 'id' => 'yith-wcqv-close-color-hover',
78
+ 'default' => '#ff0000'
79
+ ),
80
+
81
+ 'style-options-end' => array(
82
+ 'type' => 'sectionend',
83
+ 'id' => 'yith-wcqv-style-options'
84
+ ),
85
+
86
+
87
+ )
88
+ );
89
+
90
  return apply_filters( 'yith_wcqv_panel_settings_options', $settings );
templates/admin/premium.php CHANGED
@@ -1,373 +1,373 @@
1
- <style>
2
- .section{
3
- overflow-x: hidden;
4
- }
5
-
6
- .section{
7
- margin-left: -20px;
8
- margin-right: -20px;
9
- font-family: "Raleway",san-serif;
10
- }
11
- .section h1{
12
- text-align: center;
13
- text-transform: uppercase;
14
- color: #808a97;
15
- font-size: 35px;
16
- font-weight: 700;
17
- line-height: normal;
18
- display: inline-block;
19
- width: 100%;
20
- margin: 50px 0 0;
21
- }
22
- .section:nth-child(even){
23
- background-color: #fff;
24
- }
25
- .section:nth-child(odd){
26
- background-color: #f1f1f1;
27
- }
28
- .section .section-title img{
29
- display: table-cell;
30
- vertical-align: middle;
31
- width: auto;
32
- margin-right: 15px;
33
- }
34
- .section h2,
35
- .section h3 {
36
- display: inline-block;
37
- vertical-align: middle;
38
- padding: 0;
39
- font-size: 24px;
40
- font-weight: 700;
41
- color: #808a97;
42
- text-transform: uppercase;
43
- }
44
-
45
- .section .section-title h2{
46
- display: table-cell;
47
- vertical-align: middle;
48
- line-height: 27px;
49
- }
50
-
51
- .section-title{
52
- display: table;
53
- }
54
-
55
- .section h3 {
56
- font-size: 14px;
57
- line-height: 28px;
58
- margin-bottom: 0;
59
- display: block;
60
- }
61
-
62
- .section p{
63
- font-size: 13px;
64
- margin: 25px 0;
65
- }
66
- .section ul li{
67
- margin-bottom: 4px;
68
- }
69
- .landing-container{
70
- max-width: 750px;
71
- margin-left: auto;
72
- margin-right: auto;
73
- padding: 50px 0 30px;
74
- }
75
- .landing-container:after{
76
- display: block;
77
- clear: both;
78
- content: '';
79
- }
80
- .landing-container .col-1,
81
- .landing-container .col-2{
82
- float: left;
83
- box-sizing: border-box;
84
- padding: 0 15px;
85
- }
86
- .landing-container .col-1 img{
87
- width: 100%;
88
- }
89
- .landing-container .col-1{
90
- width: 55%;
91
- }
92
- .landing-container .col-2{
93
- width: 45%;
94
- }
95
- .premium-cta{
96
- background-color: #808a97;
97
- color: #fff;
98
- border-radius: 6px;
99
- padding: 20px 15px;
100
- }
101
- .premium-cta:after{
102
- content: '';
103
- display: block;
104
- clear: both;
105
- }
106
- .premium-cta p{
107
- margin: 7px 0;
108
- font-size: 14px;
109
- font-weight: 500;
110
- display: inline-block;
111
- width: 60%;
112
- }
113
- .premium-cta a.button{
114
- border-radius: 6px;
115
- height: 60px;
116
- float: right;
117
- background: url(<?php echo YITH_WCQV_ASSETS_URL?>/image/upgrade.png) #ff643f no-repeat 13px 13px;
118
- border-color: #ff643f;
119
- box-shadow: none;
120
- outline: none;
121
- color: #fff;
122
- position: relative;
123
- padding: 9px 50px 9px 70px;
124
- }
125
- .premium-cta a.button:hover,
126
- .premium-cta a.button:active,
127
- .premium-cta a.button:focus{
128
- color: #fff;
129
- background: url(<?php echo YITH_WCQV_ASSETS_URL?>/image/upgrade.png) #971d00 no-repeat 13px 13px;
130
- border-color: #971d00;
131
- box-shadow: none;
132
- outline: none;
133
- }
134
- .premium-cta a.button:focus{
135
- top: 1px;
136
- }
137
- .premium-cta a.button span{
138
- line-height: 13px;
139
- }
140
- .premium-cta a.button .highlight{
141
- display: block;
142
- font-size: 20px;
143
- font-weight: 700;
144
- line-height: 20px;
145
- }
146
- .premium-cta .highlight{
147
- text-transform: uppercase;
148
- background: none;
149
- font-weight: 800;
150
- color: #fff;
151
- }
152
-
153
- @media (max-width: 768px) {
154
- .section{margin: 0}
155
- .premium-cta p{
156
- width: 100%;
157
- }
158
- .premium-cta{
159
- text-align: center;
160
- }
161
- .premium-cta a.button{
162
- float: none;
163
- }
164
- .section .section-title h2{
165
- display: block;
166
- margin-top: 15px;
167
- }
168
- }
169
-
170
- @media (max-width: 480px){
171
- .wrap{
172
- margin-right: 0;
173
- }
174
- .section{
175
- margin: 0;
176
- }
177
- .landing-container .col-1,
178
- .landing-container .col-2{
179
- width: 100%;
180
- padding: 0 15px;
181
- }
182
- .section-odd .col-1 {
183
- float: left;
184
- margin-right: -100%;
185
- }
186
- .section-odd .col-2 {
187
- float: right;
188
- margin-top: 100%;
189
- }
190
- .section-even .landing-container .col-1{
191
- margin-bottom: 26px;
192
- }
193
- }
194
-
195
- @media (max-width: 320px){
196
- .premium-cta a.button{
197
- padding: 9px 20px 9px 70px;
198
- }
199
-
200
- .section .section-title img{
201
- display: none;
202
- }
203
- }
204
- </style>
205
- <div class="landing">
206
- <div class="section section-cta section-odd">
207
- <div class="landing-container">
208
- <div class="premium-cta">
209
- <p>
210
- <?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to benefit from all features!','ywqa'),'<span class="highlight">','</span>' );?>
211
- </p>
212
- <a href="<?php echo YITH_WCQV_Admin()->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
213
- <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-quick-view');?></span>
214
- <span><?php _e('to the premium version','yith-woocommerce-quick-view');?></span>
215
- </a>
216
- </div>
217
- </div>
218
- </div>
219
- <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/01-bg.png) no-repeat #fff; background-position: 85% 75%">
220
- <h1><?php _e('Premium Features','yith-woocommerce-quick-view');?></h1>
221
- <div class="landing-container">
222
- <div class="col-1">
223
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/01.png" alt="<?php _e('Button type','yith-woocommerce-quick-view') ?>" />
224
- </div>
225
- <div class="col-2">
226
- <div class="section-title">
227
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/01-icon.png" alt="Review Title"/>
228
- <h2><?php _e('BUTTON TYPE','yith-woocommerce-quick-view');?></h2>
229
- </div>
230
- <p><?php echo sprintf( __('Choose between the button or a custom icon to access the %1$sQuick View%2$s: you can choose to place it after the "Add To Cart" button or inside the thumbnail of the product.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
231
- </div>
232
- </div>
233
- </div>
234
- <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/02-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
235
- <div class="landing-container">
236
- <div class="col-2">
237
- <div class="section-title">
238
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/02-icon.png" alt="<?php _e('Product Navigation','yith-woocommerce-quick-view');?>" />
239
- <h2><?php _e('Product Navigation','yith-woocommerce-quick-view'); ?> </h2>
240
- </div>
241
- <p><?php echo sprintf( __('The navigation in the "Quick View" allows browsing among %1$sproducts%2$s displayed in it. The navigation arrows show on mousehover the image of the next/previous product.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
242
- </div>
243
- <div class="col-1">
244
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/02.png" alt="<?php _e('Product Navigation','yith-woocommerce-quick-view');?>" />
245
- </div>
246
- </div>
247
- </div>
248
- <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/03-bg.png) no-repeat #fff; background-position: 85% 100%">
249
- <div class="landing-container">
250
- <div class="col-1">
251
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/03.png" alt="Icon 03" />
252
- </div>
253
- <div class="col-2">
254
- <div class="section-title">
255
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/03-icon.png" alt="<?php _e('Content to display','yith-woocommerce-quick-view') ?>" />
256
- <h2><?php _e('Content to display','yith-woocommerce-quick-view') ?></h2>
257
- </div>
258
- <p><?php echo sprintf( __('The display of the product information in the "Quick View" are managed by %1$sadministrators%2$s who can decide whether to show everything or only a part of it.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
259
- </div>
260
- </div>
261
- </div>
262
- <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/07-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
263
- <div class="landing-container">
264
- <div class="col-2">
265
- <div class="section-title">
266
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/07-icon.png" alt="icon 04" />
267
- <h2><?php _e('Quick View Type','yith-woocommerce-quick-view');?> </h2>
268
- </div>
269
- <p><?php echo sprintf( __('Quick view has two different displaying modes: the first one opens it as a %1$smodal window%2$s, the other one opens it in the page itself with a %1$scascading effect%2$s above content page.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
270
- </div>
271
- <div class="col-1">
272
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/07.png" alt="<?php _e('Quick view type','yith-woocommerce-quick-view');?>" />
273
- </div>
274
- </div>
275
- </div>
276
- <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/08-bg.png) no-repeat #fff; background-position: 85% 100%">
277
- <div class="landing-container">
278
- <div class="col-1">
279
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/08.png" alt="View details" />
280
- </div>
281
- <div class="col-2">
282
- <div class="section-title">
283
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/08-icon.png" alt="Vote the review" />
284
- <h2><?php _e('"View details" button','yith-woocommerce-quick-view');?></h2>
285
- </div>
286
- <p><?php echo sprintf( __('An additional button that allows users to access product detail page directly from quick view window just with a click of the mouse.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
287
- </div>
288
- </div>
289
- </div>
290
- <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/04-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
291
- <div class="landing-container">
292
- <div class="col-2">
293
- <div class="section-title">
294
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/04-icon.png" alt="Number" />
295
- <h2><?php _e('Type of product images','yith-woocommerce-quick-view');?></h2>
296
- </div>
297
- <p><?php echo sprintf( __('Each product can have more than one image: choose whether to hide or show them with the %1$sslider%2$s effect or in the classic %1$sWooCommerce%2$s display.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
298
- </div>
299
- <div class="col-1">
300
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/04.png" alt="Icon 04" />
301
- </div>
302
- </div>
303
- </div>
304
- <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/05-bg.png) no-repeat #fff; background-position: 85% 100%">
305
- <div class="landing-container">
306
- <div class="col-1">
307
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/05.png" alt="Share" />
308
- </div>
309
- <div class="col-2">
310
- <div class="section-title">
311
- <img src="<?php echo YITH_WCQV_ASSETS_URL?>/image/05-icon.png" alt="icon 05" />
312
- <h2><?php _e('SHARE','yith-woocommerce-quick-view');?></h2>
313
- </div>
314
- <p><?php echo sprintf( __('%1$sQuick View is also social-friendly!%2$s Activating this option, you will be able to share the Quick View on Facebook, Twitter, Pinterest, Google+, or sending an email.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
315
- </div>
316
- </div>
317
- </div>
318
- <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/06-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
319
- <div class="landing-container">
320
- <div class="col-2">
321
- <div class="section-title">
322
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/06-icon.png" alt="Icon 06" />
323
- <h2><?php _e('Style Options','yith-woocommerce-quick-view');?></h2>
324
- </div>
325
- <p><?php echo sprintf( __('A rich option panel to change the colors of the %1$s"Quick View"%2$s button and of everything that is within the modal window generated.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
326
- </div>
327
- <div class="col-1">
328
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/06.png" alt="<?php _e('Style Options','yith-woocommerce-quick-view') ?>" />
329
- </div>
330
- </div>
331
- </div>
332
- <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/09-bg.png) no-repeat #fff; background-position: 85% 100%">
333
- <div class="landing-container">
334
- <div class="col-1">
335
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/09.png" alt="" />
336
- </div>
337
- <div class="col-2">
338
- <div class="section-title">
339
- <img src="<?php echo YITH_WCQV_ASSETS_URL?>/image/09-icon.png" alt="icon 09" />
340
- <h2><?php _e('SHORTCODE','yith-woocommerce-quick-view');?></h2>
341
- </div>
342
- <p><?php echo sprintf( __('The shortcode of plugin is a $1$srapid$2$s and $1$seasy$2$s solution: you can add a button in any spot of the page to allow your users to see the quick view of a specific product in your store.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
343
- </div>
344
- </div>
345
- </div>
346
- <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/09-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
347
- <div class="landing-container">
348
- <div class="col-2">
349
- <div class="section-title">
350
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/09-icon.png" alt="Icon 10" />
351
- <h2><?php _e('Compatibility with other YITH\'s plugins','yith-woocommerce-quick-view');?></h2>
352
- </div>
353
- <p><?php echo sprintf( __('Thanks to the compatibility with %1$sYITH WooCommerce Zoom Magnifier, YITH WooCommerce Badge Management%2$s and %1$sYITH WooCommerce Wishlist%2$s, you will be free to enrich further the content of your quick view.%3$s Zoom the product image, show a badge, or add the button to open the quick view in all products available in your users\' wishlists. With YITH\'s plugins you make the difference.','yith-woocommerce-quick-view'),'<b>','</b>','<br>' );?></p>
354
- </div>
355
- <div class="col-1">
356
- <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/10.png" alt="" />
357
- </div>
358
- </div>
359
- </div>
360
- <div class="section section-cta section-odd">
361
- <div class="landing-container">
362
- <div class="premium-cta">
363
- <p>
364
- <?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to benefit from all features!','ywqa'),'<span class="highlight">','</span>' );?>
365
- </p>
366
- <a href="<?php echo YITH_WCQV_Admin()->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
367
- <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-quick-view');?></span>
368
- <span><?php _e('to the premium version','yith-woocommerce-quick-view');?></span>
369
- </a>
370
- </div>
371
- </div>
372
- </div>
373
  </div>
1
+ <style>
2
+ .section{
3
+ overflow-x: hidden;
4
+ }
5
+
6
+ .section{
7
+ margin-left: -20px;
8
+ margin-right: -20px;
9
+ font-family: "Raleway",san-serif;
10
+ }
11
+ .section h1{
12
+ text-align: center;
13
+ text-transform: uppercase;
14
+ color: #808a97;
15
+ font-size: 35px;
16
+ font-weight: 700;
17
+ line-height: normal;
18
+ display: inline-block;
19
+ width: 100%;
20
+ margin: 50px 0 0;
21
+ }
22
+ .section:nth-child(even){
23
+ background-color: #fff;
24
+ }
25
+ .section:nth-child(odd){
26
+ background-color: #f1f1f1;
27
+ }
28
+ .section .section-title img{
29
+ display: table-cell;
30
+ vertical-align: middle;
31
+ width: auto;
32
+ margin-right: 15px;
33
+ }
34
+ .section h2,
35
+ .section h3 {
36
+ display: inline-block;
37
+ vertical-align: middle;
38
+ padding: 0;
39
+ font-size: 24px;
40
+ font-weight: 700;
41
+ color: #808a97;
42
+ text-transform: uppercase;
43
+ }
44
+
45
+ .section .section-title h2{
46
+ display: table-cell;
47
+ vertical-align: middle;
48
+ line-height: 27px;
49
+ }
50
+
51
+ .section-title{
52
+ display: table;
53
+ }
54
+
55
+ .section h3 {
56
+ font-size: 14px;
57
+ line-height: 28px;
58
+ margin-bottom: 0;
59
+ display: block;
60
+ }
61
+
62
+ .section p{
63
+ font-size: 13px;
64
+ margin: 25px 0;
65
+ }
66
+ .section ul li{
67
+ margin-bottom: 4px;
68
+ }
69
+ .landing-container{
70
+ max-width: 750px;
71
+ margin-left: auto;
72
+ margin-right: auto;
73
+ padding: 50px 0 30px;
74
+ }
75
+ .landing-container:after{
76
+ display: block;
77
+ clear: both;
78
+ content: '';
79
+ }
80
+ .landing-container .col-1,
81
+ .landing-container .col-2{
82
+ float: left;
83
+ box-sizing: border-box;
84
+ padding: 0 15px;
85
+ }
86
+ .landing-container .col-1 img{
87
+ width: 100%;
88
+ }
89
+ .landing-container .col-1{
90
+ width: 55%;
91
+ }
92
+ .landing-container .col-2{
93
+ width: 45%;
94
+ }
95
+ .premium-cta{
96
+ background-color: #808a97;
97
+ color: #fff;
98
+ border-radius: 6px;
99
+ padding: 20px 15px;
100
+ }
101
+ .premium-cta:after{
102
+ content: '';
103
+ display: block;
104
+ clear: both;
105
+ }
106
+ .premium-cta p{
107
+ margin: 7px 0;
108
+ font-size: 14px;
109
+ font-weight: 500;
110
+ display: inline-block;
111
+ width: 60%;
112
+ }
113
+ .premium-cta a.button{
114
+ border-radius: 6px;
115
+ height: 60px;
116
+ float: right;
117
+ background: url(<?php echo YITH_WCQV_ASSETS_URL?>/image/upgrade.png) #ff643f no-repeat 13px 13px;
118
+ border-color: #ff643f;
119
+ box-shadow: none;
120
+ outline: none;
121
+ color: #fff;
122
+ position: relative;
123
+ padding: 9px 50px 9px 70px;
124
+ }
125
+ .premium-cta a.button:hover,
126
+ .premium-cta a.button:active,
127
+ .premium-cta a.button:focus{
128
+ color: #fff;
129
+ background: url(<?php echo YITH_WCQV_ASSETS_URL?>/image/upgrade.png) #971d00 no-repeat 13px 13px;
130
+ border-color: #971d00;
131
+ box-shadow: none;
132
+ outline: none;
133
+ }
134
+ .premium-cta a.button:focus{
135
+ top: 1px;
136
+ }
137
+ .premium-cta a.button span{
138
+ line-height: 13px;
139
+ }
140
+ .premium-cta a.button .highlight{
141
+ display: block;
142
+ font-size: 20px;
143
+ font-weight: 700;
144
+ line-height: 20px;
145
+ }
146
+ .premium-cta .highlight{
147
+ text-transform: uppercase;
148
+ background: none;
149
+ font-weight: 800;
150
+ color: #fff;
151
+ }
152
+
153
+ @media (max-width: 768px) {
154
+ .section{margin: 0}
155
+ .premium-cta p{
156
+ width: 100%;
157
+ }
158
+ .premium-cta{
159
+ text-align: center;
160
+ }
161
+ .premium-cta a.button{
162
+ float: none;
163
+ }
164
+ .section .section-title h2{
165
+ display: block;
166
+ margin-top: 15px;
167
+ }
168
+ }
169
+
170
+ @media (max-width: 480px){
171
+ .wrap{
172
+ margin-right: 0;
173
+ }
174
+ .section{
175
+ margin: 0;
176
+ }
177
+ .landing-container .col-1,
178
+ .landing-container .col-2{
179
+ width: 100%;
180
+ padding: 0 15px;
181
+ }
182
+ .section-odd .col-1 {
183
+ float: left;
184
+ margin-right: -100%;
185
+ }
186
+ .section-odd .col-2 {
187
+ float: right;
188
+ margin-top: 100%;
189
+ }
190
+ .section-even .landing-container .col-1{
191
+ margin-bottom: 26px;
192
+ }
193
+ }
194
+
195
+ @media (max-width: 320px){
196
+ .premium-cta a.button{
197
+ padding: 9px 20px 9px 70px;
198
+ }
199
+
200
+ .section .section-title img{
201
+ display: none;
202
+ }
203
+ }
204
+ </style>
205
+ <div class="landing">
206
+ <div class="section section-cta section-odd">
207
+ <div class="landing-container">
208
+ <div class="premium-cta">
209
+ <p>
210
+ <?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to benefit from all features!','ywqa'),'<span class="highlight">','</span>' );?>
211
+ </p>
212
+ <a href="<?php echo YITH_WCQV_Admin()->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
213
+ <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-quick-view');?></span>
214
+ <span><?php _e('to the premium version','yith-woocommerce-quick-view');?></span>
215
+ </a>
216
+ </div>
217
+ </div>
218
+ </div>
219
+ <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/01-bg.png) no-repeat #fff; background-position: 85% 75%">
220
+ <h1><?php _e('Premium Features','yith-woocommerce-quick-view');?></h1>
221
+ <div class="landing-container">
222
+ <div class="col-1">
223
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/01.png" alt="<?php _e('Button type','yith-woocommerce-quick-view') ?>" />
224
+ </div>
225
+ <div class="col-2">
226
+ <div class="section-title">
227
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/01-icon.png" alt="Review Title"/>
228
+ <h2><?php _e('BUTTON TYPE','yith-woocommerce-quick-view');?></h2>
229
+ </div>
230
+ <p><?php echo sprintf( __('Choose between the button or a custom icon to access the %1$sQuick View%2$s: you can choose to place it after the "Add To Cart" button or inside the thumbnail of the product.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
231
+ </div>
232
+ </div>
233
+ </div>
234
+ <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/02-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
235
+ <div class="landing-container">
236
+ <div class="col-2">
237
+ <div class="section-title">
238
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/02-icon.png" alt="<?php _e('Product Navigation','yith-woocommerce-quick-view');?>" />
239
+ <h2><?php _e('Product Navigation','yith-woocommerce-quick-view'); ?> </h2>
240
+ </div>
241
+ <p><?php echo sprintf( __('The navigation in the "Quick View" allows browsing among %1$sproducts%2$s displayed in it. The navigation arrows show on mousehover the image of the next/previous product.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
242
+ </div>
243
+ <div class="col-1">
244
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/02.png" alt="<?php _e('Product Navigation','yith-woocommerce-quick-view');?>" />
245
+ </div>
246
+ </div>
247
+ </div>
248
+ <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/03-bg.png) no-repeat #fff; background-position: 85% 100%">
249
+ <div class="landing-container">
250
+ <div class="col-1">
251
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/03.png" alt="Icon 03" />
252
+ </div>
253
+ <div class="col-2">
254
+ <div class="section-title">
255
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/03-icon.png" alt="<?php _e('Content to display','yith-woocommerce-quick-view') ?>" />
256
+ <h2><?php _e('Content to display','yith-woocommerce-quick-view') ?></h2>
257
+ </div>
258
+ <p><?php echo sprintf( __('The display of the product information in the "Quick View" are managed by %1$sadministrators%2$s who can decide whether to show everything or only a part of it.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
259
+ </div>
260
+ </div>
261
+ </div>
262
+ <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/07-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
263
+ <div class="landing-container">
264
+ <div class="col-2">
265
+ <div class="section-title">
266
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/07-icon.png" alt="icon 04" />
267
+ <h2><?php _e('Quick View Type','yith-woocommerce-quick-view');?> </h2>
268
+ </div>
269
+ <p><?php echo sprintf( __('Quick view has two different displaying modes: the first one opens it as a %1$smodal window%2$s, the other one opens it in the page itself with a %1$scascading effect%2$s above content page.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
270
+ </div>
271
+ <div class="col-1">
272
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/07.png" alt="<?php _e('Quick view type','yith-woocommerce-quick-view');?>" />
273
+ </div>
274
+ </div>
275
+ </div>
276
+ <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/08-bg.png) no-repeat #fff; background-position: 85% 100%">
277
+ <div class="landing-container">
278
+ <div class="col-1">
279
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/08.png" alt="View details" />
280
+ </div>
281
+ <div class="col-2">
282
+ <div class="section-title">
283
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/08-icon.png" alt="Vote the review" />
284
+ <h2><?php _e('"View details" button','yith-woocommerce-quick-view');?></h2>
285
+ </div>
286
+ <p><?php echo sprintf( __('An additional button that allows users to access product detail page directly from quick view window just with a click of the mouse.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
287
+ </div>
288
+ </div>
289
+ </div>
290
+ <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/04-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
291
+ <div class="landing-container">
292
+ <div class="col-2">
293
+ <div class="section-title">
294
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/04-icon.png" alt="Number" />
295
+ <h2><?php _e('Type of product images','yith-woocommerce-quick-view');?></h2>
296
+ </div>
297
+ <p><?php echo sprintf( __('Each product can have more than one image: choose whether to hide or show them with the %1$sslider%2$s effect or in the classic %1$sWooCommerce%2$s display.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
298
+ </div>
299
+ <div class="col-1">
300
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/04.png" alt="Icon 04" />
301
+ </div>
302
+ </div>
303
+ </div>
304
+ <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/05-bg.png) no-repeat #fff; background-position: 85% 100%">
305
+ <div class="landing-container">
306
+ <div class="col-1">
307
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/05.png" alt="Share" />
308
+ </div>
309
+ <div class="col-2">
310
+ <div class="section-title">
311
+ <img src="<?php echo YITH_WCQV_ASSETS_URL?>/image/05-icon.png" alt="icon 05" />
312
+ <h2><?php _e('SHARE','yith-woocommerce-quick-view');?></h2>
313
+ </div>
314
+ <p><?php echo sprintf( __('%1$sQuick View is also social-friendly!%2$s Activating this option, you will be able to share the Quick View on Facebook, Twitter, Pinterest, Google+, or sending an email.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
315
+ </div>
316
+ </div>
317
+ </div>
318
+ <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/06-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
319
+ <div class="landing-container">
320
+ <div class="col-2">
321
+ <div class="section-title">
322
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/06-icon.png" alt="Icon 06" />
323
+ <h2><?php _e('Style Options','yith-woocommerce-quick-view');?></h2>
324
+ </div>
325
+ <p><?php echo sprintf( __('A rich option panel to change the colors of the %1$s"Quick View"%2$s button and of everything that is within the modal window generated.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
326
+ </div>
327
+ <div class="col-1">
328
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/06.png" alt="<?php _e('Style Options','yith-woocommerce-quick-view') ?>" />
329
+ </div>
330
+ </div>
331
+ </div>
332
+ <div class="section section-even clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/09-bg.png) no-repeat #fff; background-position: 85% 100%">
333
+ <div class="landing-container">
334
+ <div class="col-1">
335
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/09.png" alt="" />
336
+ </div>
337
+ <div class="col-2">
338
+ <div class="section-title">
339
+ <img src="<?php echo YITH_WCQV_ASSETS_URL?>/image/09-icon.png" alt="icon 09" />
340
+ <h2><?php _e('SHORTCODE','yith-woocommerce-quick-view');?></h2>
341
+ </div>
342
+ <p><?php echo sprintf( __('The shortcode of plugin is a $1$srapid$2$s and $1$seasy$2$s solution: you can add a button in any spot of the page to allow your users to see the quick view of a specific product in your store.','yith-woocommerce-quick-view'),'<b>','</b>' );?></p>
343
+ </div>
344
+ </div>
345
+ </div>
346
+ <div class="section section-odd clear" style="background: url(<?php echo YITH_WCQV_ASSETS_URL ?>/image/09-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
347
+ <div class="landing-container">
348
+ <div class="col-2">
349
+ <div class="section-title">
350
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/09-icon.png" alt="Icon 10" />
351
+ <h2><?php _e('Compatibility with other YITH\'s plugins','yith-woocommerce-quick-view');?></h2>
352
+ </div>
353
+ <p><?php echo sprintf( __('Thanks to the compatibility with %1$sYITH WooCommerce Zoom Magnifier, YITH WooCommerce Badge Management%2$s and %1$sYITH WooCommerce Wishlist%2$s, you will be free to enrich further the content of your quick view.%3$s Zoom the product image, show a badge, or add the button to open the quick view in all products available in your users\' wishlists. With YITH\'s plugins you make the difference.','yith-woocommerce-quick-view'),'<b>','</b>','<br>' );?></p>
354
+ </div>
355
+ <div class="col-1">
356
+ <img src="<?php echo YITH_WCQV_ASSETS_URL ?>/image/10.png" alt="" />
357
+ </div>
358
+ </div>
359
+ </div>
360
+ <div class="section section-cta section-odd">
361
+ <div class="landing-container">
362
+ <div class="premium-cta">
363
+ <p>
364
+ <?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to benefit from all features!','ywqa'),'<span class="highlight">','</span>' );?>
365
+ </p>
366
+ <a href="<?php echo YITH_WCQV_Admin()->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
367
+ <span class="highlight"><?php _e('UPGRADE','yith-woocommerce-quick-view');?></span>
368
+ <span><?php _e('to the premium version','yith-woocommerce-quick-view');?></span>
369
+ </a>
370
+ </div>
371
+ </div>
372
+ </div>
373
  </div>
templates/yith-quick-view-content.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
- /*
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
-
11
- while ( have_posts() ) : the_post(); ?>
12
-
13
- <div class="product">
14
-
15
- <div id="product-<?php the_ID(); ?>" <?php post_class('product'); ?>>
16
-
17
- <?php do_action( 'yith_wcqv_product_image' ); ?>
18
-
19
- <div class="summary entry-summary">
20
- <div class="summary-content">
21
- <?php do_action( 'yith_wcqv_product_summary' ); ?>
22
- </div>
23
- </div>
24
-
25
- </div>
26
-
27
- </div>
28
-
29
  <?php endwhile; // end of the loop.
1
+ <?php
2
+ /*
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+
11
+ while ( have_posts() ) : the_post(); ?>
12
+
13
+ <div class="product">
14
+
15
+ <div id="product-<?php the_ID(); ?>" <?php post_class('product'); ?>>
16
+
17
+ <?php do_action( 'yith_wcqv_product_image' ); ?>
18
+
19
+ <div class="summary entry-summary">
20
+ <div class="summary-content">
21
+ <?php do_action( 'yith_wcqv_product_summary' ); ?>
22
+ </div>
23
+ </div>
24
+
25
+ </div>
26
+
27
+ </div>
28
+
29
  <?php endwhile; // end of the loop.
templates/yith-quick-view.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
- /*
3
- * This file belongs to the YIT Framework.
4
- *
5
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
- * that is bundled with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://www.gnu.org/licenses/gpl-3.0.txt
9
- */
10
- ?>
11
-
12
- <div id="yith-quick-view-modal">
13
-
14
- <div class="yith-quick-view-overlay"></div>
15
-
16
- <div class="yith-wcqv-wrapper">
17
-
18
- <div class="yith-wcqv-main">
19
-
20
- <div class="yith-wcqv-head">
21
- <a href="#" id="yith-quick-view-close" class="yith-wcqv-close">X</a>
22
- </div>
23
-
24
- <div id="yith-quick-view-content" class="woocommerce single-product"></div>
25
-
26
- </div>
27
-
28
- </div>
29
-
30
  </div>
1
+ <?php
2
+ /*
3
+ * This file belongs to the YIT Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ */
10
+ ?>
11
+
12
+ <div id="yith-quick-view-modal">
13
+
14
+ <div class="yith-quick-view-overlay"></div>
15
+
16
+ <div class="yith-wcqv-wrapper">
17
+
18
+ <div class="yith-wcqv-main">
19
+
20
+ <div class="yith-wcqv-head">
21
+ <a href="#" id="yith-quick-view-close" class="yith-wcqv-close">X</a>
22
+ </div>
23
+
24
+ <div id="yith-quick-view-content" class="woocommerce single-product"></div>
25
+
26
+ </div>
27
+
28
+ </div>
29
+
30
  </div>
uninstall.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
- /**
3
- * Uninstall plugin
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Quick View
7
- * @version 1.0.0
8
- */
9
-
10
- // If uninstall not called from WordPress exit
11
- if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12
- exit;
13
- }
1
+ <?php
2
+ /**
3
+ * Uninstall plugin
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Quick View
7
+ * @version 1.0.0
8
+ */
9
+
10
+ // If uninstall not called from WordPress exit
11
+ if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
12
+ exit;
13
+ }
wpml-config.xml CHANGED
@@ -1,5 +1,5 @@
1
- <wpml-config>
2
- <admin-texts>
3
- <key name="yith-wcqv-button-label" />
4
- </admin-texts>
5
  </wpml-config>
1
+ <wpml-config>
2
+ <admin-texts>
3
+ <key name="yith-wcqv-button-label" />
4
+ </admin-texts>
5
  </wpml-config>