Version Description
- Added: Support to WooCommerce 2.1.x
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Zoom Magnifier |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.1.0
- README.md +14 -0
- README.txt +7 -2
- assets/js/frontend.js +1 -1
- assets/js/frontend.min.js +1 -1
- class.yith-wcmg-admin.php +540 -498
- class.yith-wcmg-frontend.php +11 -3
- class.yith-wcmg.php +2 -2
- functions.yith-wcmg.php +15 -3
- init.php +2 -2
- templates/single-product/product-image-magnifier.php +4 -2
- templates/single-product/product-thumbnails-magnifier.php +1 -1
- uninstall.php +1 -1
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
YITH WooCommerce Zoom Magnifier
|
2 |
+
==============
|
3 |
+
|
4 |
+
YITH WooCommerce Zoom Magnifier is Wordpress plugins that enables you to add a zoom effect to product images. It requires WooCommerce.
|
5 |
+
|
6 |
+
Offer to your visitors a chance to inspect in detail the quality of your products. With YITH WooCommerce Zoom Magnifier you can add a zoom effect to all your product images.
|
7 |
+
The Wordpress plugin also adds a slider below the featured image with your product gallery images.
|
8 |
+
|
9 |
+
Working demo are available:
|
10 |
+
|
11 |
+
**[LIVE DEMO 1](http://demo.yithemes.com/room09/product/africa-style/)** - **[LIVE DEMO 2](http://demo.yithemes.com/bazar/shop/ankle-shoes/)**
|
12 |
+
|
13 |
+
|
14 |
+
Full documentation is available [here](http://yithemes.com/docs-plugins/yith_magnifier/).
|
README.txt
CHANGED
@@ -3,12 +3,13 @@
|
|
3 |
Contributors: yithemes
|
4 |
Tags: zoom, magnifier, woocommerce, products, themes, yit, e-commerce, shop
|
5 |
Requires at least: 3.5.1
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
YITH WooCommerce Zoom Magnifier is a Wordpress plugins that enables you to add a zoom effect to product images.
|
|
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -69,6 +70,10 @@ The size of the Zoom Image is automatically setted. If you want to change these
|
|
69 |
|
70 |
== Changelog ==
|
71 |
|
|
|
|
|
|
|
|
|
72 |
= 1.0.8 =
|
73 |
|
74 |
* Added: ability to change the slider programmatically
|
3 |
Contributors: yithemes
|
4 |
Tags: zoom, magnifier, woocommerce, products, themes, yit, e-commerce, shop
|
5 |
Requires at least: 3.5.1
|
6 |
+
Tested up to: 3.8.1
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
YITH WooCommerce Zoom Magnifier is a Wordpress plugins that enables you to add a zoom effect to product images.
|
12 |
+
WooCommerce 2.1.x Compatible.
|
13 |
|
14 |
== Description ==
|
15 |
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 1.1.0 =
|
74 |
+
|
75 |
+
* Added: Support to WooCommerce 2.1.x
|
76 |
+
|
77 |
= 1.0.8 =
|
78 |
|
79 |
* Added: ability to change the slider programmatically
|
assets/js/frontend.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
*
|
4 |
* @author Your Inspiration Themes
|
5 |
* @package YITH WooCommerce Zoom Magnifier
|
6 |
-
* @version 1.0
|
7 |
*/
|
8 |
jQuery(document).ready(function($){
|
9 |
|
3 |
*
|
4 |
* @author Your Inspiration Themes
|
5 |
* @package YITH WooCommerce Zoom Magnifier
|
6 |
+
* @version 1.1.0
|
7 |
*/
|
8 |
jQuery(document).ready(function($){
|
9 |
|
assets/js/frontend.min.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
*
|
4 |
* @author Your Inspiration Themes
|
5 |
* @package YITH WooCommerce Zoom Magnifier
|
6 |
-
* @version 1.0
|
7 |
*/
|
8 |
jQuery(document).ready(function(b){var a=b(".images"),d=b(".yith_magnifier_zoom"),f=b(".yith_magnifier_zoom img"),e=a.find(".yith_magnifier_zoom").attr("href"),g=a.find(".yith_magnifier_zoom img").attr("src");a.yith_magnifier(yith_magnifier_options);b(document).on("found_variation","form.variations_form",function(b,c){var h=c.image_src?c.image_src:g;d.attr("href",c.image_magnifier?c.image_magnifier:e);f.attr("src",h);a.data("yith_magnifier")&&a.yith_magnifier("destroy");a.yith_magnifier(yith_magnifier_options)}).on("reset_image",
|
9 |
function(b){d.attr("href",e);a.data("yith_magnifier")&&a.yith_magnifier("destroy");a.yith_magnifier(yith_magnifier_options)});b("form.variations_form .variations select").trigger("change")});
|
3 |
*
|
4 |
* @author Your Inspiration Themes
|
5 |
* @package YITH WooCommerce Zoom Magnifier
|
6 |
+
* @version 1.1.0
|
7 |
*/
|
8 |
jQuery(document).ready(function(b){var a=b(".images"),d=b(".yith_magnifier_zoom"),f=b(".yith_magnifier_zoom img"),e=a.find(".yith_magnifier_zoom").attr("href"),g=a.find(".yith_magnifier_zoom img").attr("src");a.yith_magnifier(yith_magnifier_options);b(document).on("found_variation","form.variations_form",function(b,c){var h=c.image_src?c.image_src:g;d.attr("href",c.image_magnifier?c.image_magnifier:e);f.attr("src",h);a.data("yith_magnifier")&&a.yith_magnifier("destroy");a.yith_magnifier(yith_magnifier_options)}).on("reset_image",
|
9 |
function(b){d.attr("href",e);a.data("yith_magnifier")&&a.yith_magnifier("destroy");a.yith_magnifier(yith_magnifier_options)});b("form.variations_form .variations select").trigger("change")});
|
class.yith-wcmg-admin.php
CHANGED
@@ -2,29 +2,31 @@
|
|
2 |
/**
|
3 |
* Admin class
|
4 |
*
|
5 |
-
* @author
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
-
* @version 1.0
|
8 |
*/
|
9 |
|
10 |
-
if ( !defined( 'YITH_WCMG' ) ) {
|
|
|
|
|
11 |
|
12 |
-
if( !class_exists( 'YITH_WCMG_Admin' ) ) {
|
13 |
/**
|
14 |
-
* Admin class.
|
15 |
-
|
16 |
*
|
17 |
* @since 1.0.0
|
18 |
*/
|
19 |
class YITH_WCMG_Admin {
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
/**
|
30 |
* Plugin version
|
@@ -43,123 +45,129 @@ if( !class_exists( 'YITH_WCMG_Admin' ) ) {
|
|
43 |
*/
|
44 |
public $banner_url = 'http://cdn.yithemes.com/plugins/yith_magnifier.php?url';
|
45 |
public $banner_img = 'http://cdn.yithemes.com/plugins/yith_magnifier.php';
|
46 |
-
public $doc_url
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
$this->version = $version;
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
add_filter( 'plugin_action_links_' . plugin_basename( dirname(__FILE__) . '/init.php' ), array( $this, 'action_links' ) );
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
if ( !has_action(
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
add_action( 'woocommerce_admin_field_banner', array( $this, 'admin_fields_banner' ) );
|
68 |
-
|
69 |
|
70 |
add_action( 'woocommerce_update_option_slider', array( $this, 'admin_update_option' ) );
|
71 |
add_action( 'woocommerce_update_option_picker', array( $this, 'admin_update_option' ) );
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
|
77 |
//Apply filters
|
78 |
-
$this->banner_url = apply_filters('yith_wcmg_banner_url', $this->banner_url);
|
79 |
|
80 |
// YITH WCMG Loaded
|
81 |
do_action( 'yith_wcmg_loaded' );
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
/**
|
98 |
* Update plugin options.
|
99 |
-
*
|
100 |
* @return void
|
101 |
* @since 1.0.0
|
102 |
*/
|
103 |
public function update_options() {
|
104 |
-
foreach( $this->options as $option ) {
|
105 |
-
woocommerce_update_options( $option );
|
106 |
}
|
107 |
}
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
121 |
return $tabs;
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
160 |
/**
|
161 |
* Print all plugin options.
|
162 |
-
*
|
163 |
* @return void
|
164 |
* @since 1.0.0
|
165 |
*/
|
@@ -180,421 +188,444 @@ if( !class_exists( 'YITH_WCMG_Admin' ) ) {
|
|
180 |
</li>
|
181 |
</ul>
|
182 |
<br class="clear" />
|
183 |
-
|
184 |
<?php
|
185 |
-
$option_theme = apply_filters('yith_wcmg_options_theme_plugin', $this->options );
|
186 |
-
foreach( $option_theme as $id => $tab ) : ?>
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
<?php endforeach ?>
|
192 |
</div>
|
193 |
-
|
194 |
}
|
195 |
|
196 |
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
array(
|
215 |
-
'name' => __( 'Enable YITH Magnifier', 'yit' ),
|
216 |
-
'desc' => __( 'Enable the plugin or use the Woocommerce default product image.', 'yit' ),
|
217 |
-
'id' => 'yith_wcmg_enable_plugin',
|
218 |
-
'std' => 'yes',
|
219 |
-
'default' => 'yes',
|
220 |
-
'type' => 'checkbox'
|
221 |
-
),
|
222 |
-
|
223 |
-
array(
|
224 |
-
'name' => __( 'Forcing Zoom Image sizes', 'yit' ),
|
225 |
-
'desc' => __( 'If disabled, you will able to customize the sizes of Zoom Images. Please disable at your own risk; the magnifier should not properly work with unproportioned image sizes.', 'yit' ),
|
226 |
-
'id' => 'yith_wcmg_force_sizes',
|
227 |
-
'std' => 'yes',
|
228 |
-
'default' => 'yes',
|
229 |
-
'type' => 'checkbox'
|
230 |
-
),
|
231 |
-
|
232 |
-
array( 'type' => 'sectionend', 'id' => 'yith_wcmg_general_end' )
|
233 |
-
),
|
234 |
-
'magnifier' => array(
|
235 |
-
array(
|
236 |
-
'name' => __( 'Magnifier Settings', 'yit' ),
|
237 |
-
'type' => 'title',
|
238 |
-
'desc' => '',
|
239 |
-
'id' => 'yith_wcmg_magnifier'
|
240 |
-
),
|
241 |
-
|
242 |
-
array(
|
243 |
-
'name' => __( 'Zoom Area Width', 'yit' ),
|
244 |
-
'desc' => __( 'The width of magnifier box (default: auto)', 'yit' ),
|
245 |
-
'id' => 'yith_wcmg_zoom_width',
|
246 |
-
'std' => 'auto',
|
247 |
-
'default' => 'auto',
|
248 |
-
'type' => 'text',
|
249 |
-
),
|
250 |
-
|
251 |
-
array(
|
252 |
-
'name' => __( 'Zoom Area Height', 'yit' ),
|
253 |
-
'desc' => __( 'The height of magnifier box (default: auto)', 'yit' ),
|
254 |
-
'id' => 'yith_wcmg_zoom_height',
|
255 |
-
'std' => 'auto',
|
256 |
-
'default' => 'auto',
|
257 |
-
'type' => 'text',
|
258 |
-
),
|
259 |
-
|
260 |
-
array(
|
261 |
-
'name' => __( 'Zoom Area Position', 'yit' ),
|
262 |
-
'desc' => __( 'The magnifier position', 'yit' ),
|
263 |
-
'id' => 'yith_wcmg_zoom_position',
|
264 |
-
'std' => 'right',
|
265 |
-
'default' => 'right',
|
266 |
-
'type' => 'select',
|
267 |
-
'options' => array(
|
268 |
-
'right' => __( 'Right', 'yit' ),
|
269 |
-
'inside' => __( 'Inside', 'yit' )
|
270 |
-
)
|
271 |
-
),
|
272 |
-
|
273 |
-
array(
|
274 |
-
'name' => __( 'Zoom Area Mobile Position', 'yit' ),
|
275 |
-
'desc' => __( 'The magnifier position with mobile devices (iPhone, Android, etc.)', 'yit' ),
|
276 |
-
'id' => 'yith_wcmg_zoom_mobile_position',
|
277 |
-
'std' => 'default',
|
278 |
-
'default' => 'inside',
|
279 |
-
'type' => 'select',
|
280 |
-
'options' => array(
|
281 |
-
'default' => __( 'Default', 'yit' ),
|
282 |
-
'inside' => __( 'Inside', 'yit' ),
|
283 |
-
'disable' => __( 'Disable', 'yit' )
|
284 |
-
)
|
285 |
-
),
|
286 |
-
|
287 |
-
array(
|
288 |
-
'name' => __( 'Loading label', 'yit' ),
|
289 |
-
'desc' => '',
|
290 |
-
'id' => 'yith_wcmg_loading_label',
|
291 |
-
'std' => __('Loading...', 'yit' ),
|
292 |
-
'default' => __('Loading...', 'yit' ),
|
293 |
-
'type' => 'text',
|
294 |
-
),
|
295 |
-
/*
|
296 |
-
array(
|
297 |
-
'name' => __( 'Tint', 'yit' ),
|
298 |
-
'desc' => '',
|
299 |
-
'id' => 'yith_wcmg_tint',
|
300 |
-
'std' => '',
|
301 |
-
'default' => '',
|
302 |
-
'type' => 'picker',
|
303 |
-
),
|
304 |
-
|
305 |
-
array(
|
306 |
-
'name' => __( 'Tint Opacity', 'yit' ),
|
307 |
-
'desc' => '',
|
308 |
-
'id' => 'yith_wcmg_tint_opacity',
|
309 |
-
'std' => 0.5,
|
310 |
-
'default' => 0.5,
|
311 |
-
'type' => 'slider',
|
312 |
-
'min' => 0,
|
313 |
-
'max' => 1,
|
314 |
-
'step' => .1
|
315 |
-
),
|
316 |
-
*/
|
317 |
-
array(
|
318 |
-
'name' => __( 'Lens Opacity', 'yit' ),
|
319 |
-
'desc' => '',
|
320 |
-
'id' => 'yith_wcmg_lens_opacity',
|
321 |
-
'std' => 0.5,
|
322 |
-
'default' => 0.5,
|
323 |
-
'type' => 'slider',
|
324 |
-
'min' => 0,
|
325 |
-
'max' => 1,
|
326 |
-
'step' => .1
|
327 |
-
),
|
328 |
-
/*
|
329 |
-
array(
|
330 |
-
'name' => __( 'Smoothness', 'yit' ),
|
331 |
-
'desc' => '',
|
332 |
-
'id' => 'yith_wcmg_smooth',
|
333 |
-
'std' => 3,
|
334 |
-
'default' => 3,
|
335 |
-
'type' => 'slider',
|
336 |
-
'min' => 1,
|
337 |
-
'max' => 5,
|
338 |
-
'step' => 1
|
339 |
-
),
|
340 |
-
*/
|
341 |
-
array(
|
342 |
-
'name' => __( 'Blur', 'yit' ),
|
343 |
-
'desc' => __( 'Add a blur effect to the small image on mouse hover.', 'yit' ),
|
344 |
-
'id' => 'yith_wcmg_softfocus',
|
345 |
-
'std' => 'no',
|
346 |
-
'default' => 'no',
|
347 |
-
'type' => 'checkbox'
|
348 |
-
),
|
349 |
-
|
350 |
-
array( 'type' => 'sectionend', 'id' => 'yith_wcmg_magnifier_end' )
|
351 |
-
),
|
352 |
-
'slider' => array(
|
353 |
-
array(
|
354 |
-
'name' => __( 'Slider Settings', 'yit' ),
|
355 |
-
'type' => 'title',
|
356 |
-
'desc' => '',
|
357 |
-
'id' => 'yith_wcmg_slider'
|
358 |
-
),
|
359 |
|
360 |
array(
|
361 |
-
'name'
|
362 |
-
'desc'
|
363 |
-
'id'
|
364 |
-
'std'
|
365 |
-
'default'
|
366 |
-
'type'
|
367 |
),
|
368 |
|
369 |
array(
|
370 |
-
'name'
|
371 |
-
'desc'
|
372 |
-
'id'
|
373 |
-
'std'
|
374 |
-
'default'
|
375 |
-
'type'
|
376 |
),
|
377 |
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
});
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
|
|
|
|
|
|
|
|
|
|
522 |
|
523 |
/**
|
524 |
* Save the admin field: slider
|
525 |
*
|
526 |
* @access public
|
|
|
527 |
* @param mixed $value
|
|
|
528 |
* @return void
|
529 |
* @since 1.0.0
|
530 |
*/
|
531 |
-
public function admin_update_option($value) {
|
532 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
}
|
534 |
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
|
|
|
|
|
|
576 |
});
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
wp_enqueue_script( 'jquery-ui' );
|
592 |
wp_enqueue_script( 'jquery-ui-core' );
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
|
599 |
|
600 |
/**
|
@@ -605,7 +636,7 @@ if( !class_exists( 'YITH_WCMG_Admin' ) ) {
|
|
605 |
* @since 1.0.0
|
606 |
*/
|
607 |
protected function _printBanner() {
|
608 |
-
|
609 |
<div class="yith_banner">
|
610 |
<a href="<?php echo $this->banner_url ?>" target="_blank">
|
611 |
<img src="<?php echo $this->banner_img ?>" alt="" />
|
@@ -619,13 +650,24 @@ if( !class_exists( 'YITH_WCMG_Admin' ) ) {
|
|
619 |
* action_links function.
|
620 |
*
|
621 |
* @access public
|
|
|
622 |
* @param mixed $links
|
|
|
623 |
* @return void
|
624 |
*/
|
625 |
public function action_links( $links ) {
|
626 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
627 |
$plugin_links = array(
|
628 |
-
'<a href="' . admin_url( 'admin.php?page=
|
629 |
'<a href="' . $this->doc_url . '">' . __( 'Docs', 'yit' ) . '</a>',
|
630 |
);
|
631 |
|
2 |
/**
|
3 |
* Admin class
|
4 |
*
|
5 |
+
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
+
* @version 1.1.0
|
8 |
*/
|
9 |
|
10 |
+
if ( ! defined( 'YITH_WCMG' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
|
14 |
+
if ( ! class_exists( 'YITH_WCMG_Admin' ) ) {
|
15 |
/**
|
16 |
+
* Admin class.
|
17 |
+
* The class manage all the admin behaviors.
|
18 |
*
|
19 |
* @since 1.0.0
|
20 |
*/
|
21 |
class YITH_WCMG_Admin {
|
22 |
+
/**
|
23 |
+
* Plugin options
|
24 |
+
*
|
25 |
+
* @var array
|
26 |
+
* @access public
|
27 |
+
* @since 1.0.0
|
28 |
+
*/
|
29 |
+
public $options = array();
|
30 |
|
31 |
/**
|
32 |
* Plugin version
|
45 |
*/
|
46 |
public $banner_url = 'http://cdn.yithemes.com/plugins/yith_magnifier.php?url';
|
47 |
public $banner_img = 'http://cdn.yithemes.com/plugins/yith_magnifier.php';
|
48 |
+
public $doc_url = 'http://yithemes.com/docs-plugins/yith_magnifier/';
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Constructor
|
52 |
+
*
|
53 |
+
* @access public
|
54 |
+
* @since 1.0.0
|
55 |
+
*/
|
56 |
+
public function __construct( $version ) {
|
57 |
+
$this->options = $this->_initOptions();
|
58 |
$this->version = $version;
|
59 |
|
60 |
+
//Actions
|
61 |
+
add_action( 'init', array( $this, 'init' ) );
|
62 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
63 |
+
add_filter( 'plugin_action_links_' . plugin_basename( dirname( __FILE__ ) . '/init.php' ), array( $this, 'action_links' ) );
|
64 |
+
|
65 |
+
add_action( 'woocommerce_settings_tabs_yith_wcmg', array( $this, 'print_plugin_options' ) );
|
66 |
+
add_action( 'woocommerce_update_options_yith_wcmg', array( $this, 'update_options' ) );
|
67 |
+
if ( ! has_action( 'woocommerce_admin_field_slider' ) ) {
|
68 |
+
add_action( 'woocommerce_admin_field_slider', array( $this, 'admin_fields_slider' ) );
|
69 |
+
}
|
70 |
+
if ( ! has_action( 'woocommerce_admin_field_picker' ) ) {
|
71 |
+
add_action( 'woocommerce_admin_field_picker', array( $this, 'admin_fields_picker' ) );
|
72 |
+
}
|
73 |
add_action( 'woocommerce_admin_field_banner', array( $this, 'admin_fields_banner' ) );
|
74 |
+
add_action( 'admin_print_footer_scripts', array( $this, 'admin_fields_image_deps' ) );
|
75 |
|
76 |
add_action( 'woocommerce_update_option_slider', array( $this, 'admin_update_option' ) );
|
77 |
add_action( 'woocommerce_update_option_picker', array( $this, 'admin_update_option' ) );
|
78 |
|
79 |
+
//Filters
|
80 |
+
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_tab_woocommerce' ), 30 );
|
81 |
+
add_filter( 'woocommerce_catalog_settings', array( $this, 'add_catalog_image_size' ) );
|
82 |
|
83 |
//Apply filters
|
84 |
+
$this->banner_url = apply_filters( 'yith_wcmg_banner_url', $this->banner_url );
|
85 |
|
86 |
// YITH WCMG Loaded
|
87 |
do_action( 'yith_wcmg_loaded' );
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Init method:
|
93 |
+
* - default options
|
94 |
+
*
|
95 |
+
* @access public
|
96 |
+
* @since 1.0.0
|
97 |
+
*/
|
98 |
+
public function init() {
|
99 |
+
$this->_default_options();
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
/**
|
104 |
* Update plugin options.
|
105 |
+
*
|
106 |
* @return void
|
107 |
* @since 1.0.0
|
108 |
*/
|
109 |
public function update_options() {
|
110 |
+
foreach ( $this->options as $option ) {
|
111 |
+
woocommerce_update_options( $option );
|
112 |
}
|
113 |
}
|
114 |
+
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Add Magnifier's tab to Woocommerce -> Settings page
|
118 |
+
*
|
119 |
+
* @access public
|
120 |
+
*
|
121 |
+
* @param array $tabs
|
122 |
+
*
|
123 |
+
* @return array
|
124 |
+
*/
|
125 |
+
public function add_tab_woocommerce( $tabs ) {
|
126 |
+
$tabs['yith_wcmg'] = __( 'Magnifier', 'yit' );
|
127 |
+
|
128 |
return $tabs;
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Add Zoom Image size to Woocommerce -> Catalog
|
134 |
+
*
|
135 |
+
* @access public
|
136 |
+
*
|
137 |
+
* @param array $settings
|
138 |
+
*
|
139 |
+
* @return array
|
140 |
+
*/
|
141 |
+
public function add_catalog_image_size( $settings ) {
|
142 |
+
$tmp = $settings[count( $settings ) - 1];
|
143 |
+
unset( $settings[count( $settings ) - 1] );
|
144 |
+
|
145 |
+
$settings[] = array(
|
146 |
+
'name' => __( 'Catalog Zoom Images', 'yit' ),
|
147 |
+
'desc' => __( 'The size of images used within the magnifier box', 'yit' ),
|
148 |
+
'id' => 'woocommerce_magnifier_image',
|
149 |
+
'css' => '',
|
150 |
+
'type' => 'image_width',
|
151 |
+
'default' => array(
|
152 |
+
'width' => 600,
|
153 |
+
'height' => 600,
|
154 |
+
'crop' => true
|
155 |
+
),
|
156 |
+
'std' => array(
|
157 |
+
'width' => 600,
|
158 |
+
'height' => 600,
|
159 |
+
'crop' => true
|
160 |
+
),
|
161 |
+
'desc_tip' => true
|
162 |
+
);
|
163 |
+
$settings[] = $tmp;
|
164 |
+
return $settings;
|
165 |
+
}
|
166 |
+
|
167 |
+
|
168 |
/**
|
169 |
* Print all plugin options.
|
170 |
+
*
|
171 |
* @return void
|
172 |
* @since 1.0.0
|
173 |
*/
|
188 |
</li>
|
189 |
</ul>
|
190 |
<br class="clear" />
|
191 |
+
|
192 |
<?php
|
193 |
+
$option_theme = apply_filters( 'yith_wcmg_options_theme_plugin', $this->options );
|
194 |
+
foreach ( $option_theme as $id => $tab ) : ?>
|
195 |
+
<!-- tab #<?php echo $id ?> -->
|
196 |
+
<div class="section" id="yith_wcmg_<?php echo $id ?>">
|
197 |
+
<?php woocommerce_admin_fields( $option_theme[$id] ) ?>
|
198 |
+
</div>
|
199 |
<?php endforeach ?>
|
200 |
</div>
|
201 |
+
<?php
|
202 |
}
|
203 |
|
204 |
|
205 |
+
/**
|
206 |
+
* Initialize the options
|
207 |
+
*
|
208 |
+
* @access protected
|
209 |
+
* @return array
|
210 |
+
* @since 1.0.0
|
211 |
+
*/
|
212 |
+
protected function _initOptions() {
|
213 |
+
$options = array(
|
214 |
+
'general' => array(
|
215 |
+
array(
|
216 |
+
'name' => __( 'General Settings', 'yit' ),
|
217 |
+
'type' => 'title',
|
218 |
+
'desc' => '',
|
219 |
+
'id' => 'yith_wcmg_general'
|
220 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
array(
|
223 |
+
'name' => __( 'Enable YITH Magnifier', 'yit' ),
|
224 |
+
'desc' => __( 'Enable the plugin or use the Woocommerce default product image.', 'yit' ),
|
225 |
+
'id' => 'yith_wcmg_enable_plugin',
|
226 |
+
'std' => 'yes',
|
227 |
+
'default' => 'yes',
|
228 |
+
'type' => 'checkbox'
|
229 |
),
|
230 |
|
231 |
array(
|
232 |
+
'name' => __( 'Forcing Zoom Image sizes', 'yit' ),
|
233 |
+
'desc' => __( 'If disabled, you will able to customize the sizes of Zoom Images. Please disable at your own risk; the magnifier should not properly work with unproportioned image sizes.', 'yit' ),
|
234 |
+
'id' => 'yith_wcmg_force_sizes',
|
235 |
+
'std' => 'yes',
|
236 |
+
'default' => 'yes',
|
237 |
+
'type' => 'checkbox'
|
238 |
),
|
239 |
|
240 |
+
array( 'type' => 'sectionend', 'id' => 'yith_wcmg_general_end' )
|
241 |
+
),
|
242 |
+
'magnifier' => array(
|
243 |
+
array(
|
244 |
+
'name' => __( 'Magnifier Settings', 'yit' ),
|
245 |
+
'type' => 'title',
|
246 |
+
'desc' => '',
|
247 |
+
'id' => 'yith_wcmg_magnifier'
|
248 |
+
),
|
249 |
+
|
250 |
+
array(
|
251 |
+
'name' => __( 'Zoom Area Width', 'yit' ),
|
252 |
+
'desc' => __( 'The width of magnifier box (default: auto)', 'yit' ),
|
253 |
+
'id' => 'yith_wcmg_zoom_width',
|
254 |
+
'std' => 'auto',
|
255 |
+
'default' => 'auto',
|
256 |
+
'type' => 'text',
|
257 |
+
),
|
258 |
+
|
259 |
+
array(
|
260 |
+
'name' => __( 'Zoom Area Height', 'yit' ),
|
261 |
+
'desc' => __( 'The height of magnifier box (default: auto)', 'yit' ),
|
262 |
+
'id' => 'yith_wcmg_zoom_height',
|
263 |
+
'std' => 'auto',
|
264 |
+
'default' => 'auto',
|
265 |
+
'type' => 'text',
|
266 |
+
),
|
267 |
+
|
268 |
+
array(
|
269 |
+
'name' => __( 'Zoom Area Position', 'yit' ),
|
270 |
+
'desc' => __( 'The magnifier position', 'yit' ),
|
271 |
+
'id' => 'yith_wcmg_zoom_position',
|
272 |
+
'std' => 'right',
|
273 |
+
'default' => 'right',
|
274 |
+
'type' => 'select',
|
275 |
+
'options' => array(
|
276 |
+
'right' => __( 'Right', 'yit' ),
|
277 |
+
'inside' => __( 'Inside', 'yit' )
|
278 |
+
)
|
279 |
+
),
|
280 |
+
|
281 |
+
array(
|
282 |
+
'name' => __( 'Zoom Area Mobile Position', 'yit' ),
|
283 |
+
'desc' => __( 'The magnifier position with mobile devices (iPhone, Android, etc.)', 'yit' ),
|
284 |
+
'id' => 'yith_wcmg_zoom_mobile_position',
|
285 |
+
'std' => 'default',
|
286 |
+
'default' => 'inside',
|
287 |
+
'type' => 'select',
|
288 |
+
'options' => array(
|
289 |
+
'default' => __( 'Default', 'yit' ),
|
290 |
+
'inside' => __( 'Inside', 'yit' ),
|
291 |
+
'disable' => __( 'Disable', 'yit' )
|
292 |
+
)
|
293 |
+
),
|
294 |
+
|
295 |
+
array(
|
296 |
+
'name' => __( 'Loading label', 'yit' ),
|
297 |
+
'desc' => '',
|
298 |
+
'id' => 'yith_wcmg_loading_label',
|
299 |
+
'std' => __( 'Loading...', 'yit' ),
|
300 |
+
'default' => __( 'Loading...', 'yit' ),
|
301 |
+
'type' => 'text',
|
302 |
+
),
|
303 |
+
/*
|
304 |
+
array(
|
305 |
+
'name' => __( 'Tint', 'yit' ),
|
306 |
+
'desc' => '',
|
307 |
+
'id' => 'yith_wcmg_tint',
|
308 |
+
'std' => '',
|
309 |
+
'default' => '',
|
310 |
+
'type' => 'picker',
|
311 |
+
),
|
312 |
+
|
313 |
+
array(
|
314 |
+
'name' => __( 'Tint Opacity', 'yit' ),
|
315 |
+
'desc' => '',
|
316 |
+
'id' => 'yith_wcmg_tint_opacity',
|
317 |
+
'std' => 0.5,
|
318 |
+
'default' => 0.5,
|
319 |
+
'type' => 'slider',
|
320 |
+
'min' => 0,
|
321 |
+
'max' => 1,
|
322 |
+
'step' => .1
|
323 |
+
),
|
324 |
+
*/
|
325 |
+
array(
|
326 |
+
'name' => __( 'Lens Opacity', 'yit' ),
|
327 |
+
'desc' => '',
|
328 |
+
'id' => 'yith_wcmg_lens_opacity',
|
329 |
+
'std' => 0.5,
|
330 |
+
'default' => 0.5,
|
331 |
+
'type' => 'slider',
|
332 |
+
'min' => 0,
|
333 |
+
'max' => 1,
|
334 |
+
'step' => .1
|
335 |
+
),
|
336 |
+
/*
|
337 |
+
array(
|
338 |
+
'name' => __( 'Smoothness', 'yit' ),
|
339 |
+
'desc' => '',
|
340 |
+
'id' => 'yith_wcmg_smooth',
|
341 |
+
'std' => 3,
|
342 |
+
'default' => 3,
|
343 |
+
'type' => 'slider',
|
344 |
+
'min' => 1,
|
345 |
+
'max' => 5,
|
346 |
+
'step' => 1
|
347 |
+
),
|
348 |
+
*/
|
349 |
+
array(
|
350 |
+
'name' => __( 'Blur', 'yit' ),
|
351 |
+
'desc' => __( 'Add a blur effect to the small image on mouse hover.', 'yit' ),
|
352 |
+
'id' => 'yith_wcmg_softfocus',
|
353 |
+
'std' => 'no',
|
354 |
+
'default' => 'no',
|
355 |
+
'type' => 'checkbox'
|
356 |
+
),
|
357 |
+
|
358 |
+
array( 'type' => 'sectionend', 'id' => 'yith_wcmg_magnifier_end' )
|
359 |
+
),
|
360 |
+
'slider' => array(
|
361 |
+
array(
|
362 |
+
'name' => __( 'Slider Settings', 'yit' ),
|
363 |
+
'type' => 'title',
|
364 |
+
'desc' => '',
|
365 |
+
'id' => 'yith_wcmg_slider'
|
366 |
+
),
|
367 |
+
|
368 |
+
array(
|
369 |
+
'name' => __( 'Enable Slider', 'yit' ),
|
370 |
+
'desc' => __( 'Enable Thumbnail slider.', 'yit' ),
|
371 |
+
'id' => 'yith_wcmg_enableslider',
|
372 |
+
'std' => 'yes',
|
373 |
+
'default' => 'yes',
|
374 |
+
'type' => 'checkbox'
|
375 |
+
),
|
376 |
+
|
377 |
+
array(
|
378 |
+
'name' => __( 'Enable Slider Responsive', 'yit' ),
|
379 |
+
'desc' => __( 'The option fits the thumbnails within the available space. Disable it if you want to manage by yourself the thumbnails (eg. add margins, paddings, etc.)', 'yit' ),
|
380 |
+
'id' => 'yith_wcmg_slider_responsive',
|
381 |
+
'std' => 'yes',
|
382 |
+
'default' => 'yes',
|
383 |
+
'type' => 'checkbox'
|
384 |
+
),
|
385 |
+
|
386 |
+
array(
|
387 |
+
'name' => __( 'Items', 'yit' ),
|
388 |
+
'desc' => __( 'Number of items to show', 'yit' ),
|
389 |
+
'id' => 'yith_wcmg_slider_items',
|
390 |
+
'std' => 3,
|
391 |
+
'default' => 3,
|
392 |
+
'type' => 'slider',
|
393 |
+
'min' => 1,
|
394 |
+
'max' => 10,
|
395 |
+
'step' => 1
|
396 |
+
),
|
397 |
+
|
398 |
+
array(
|
399 |
+
'name' => __( 'Circular carousel', 'yit' ),
|
400 |
+
'desc' => __( 'Determines whether the carousel should be circular.', 'yit' ),
|
401 |
+
'id' => 'yith_wcmg_slider_circular',
|
402 |
+
'std' => 'yes',
|
403 |
+
'default' => 'yes',
|
404 |
+
'type' => 'checkbox'
|
405 |
+
),
|
406 |
+
|
407 |
+
array(
|
408 |
+
'name' => __( 'Infinite carousel', 'yit' ),
|
409 |
+
'desc' => __( 'Determines whether the carousel should be infinite. Note: It is possible to create a non-circular, infinite carousel, but it is not possible to create a circular, non-infinite carousel.', 'yit' ),
|
410 |
+
'id' => 'yith_wcmg_slider_infinite',
|
411 |
+
'std' => 'yes',
|
412 |
+
'default' => 'yes',
|
413 |
+
'type' => 'checkbox'
|
414 |
+
),
|
415 |
+
/*
|
416 |
+
array(
|
417 |
+
'name' => __( 'Slider direction', 'yit' ),
|
418 |
+
'desc' => __( 'The direction to scroll the carousel.', 'yit' ),
|
419 |
+
'id' => 'yith_wcmg_slider_direction',
|
420 |
+
'std' => 'yes',
|
421 |
+
'default' => 'yes',
|
422 |
+
'type' => 'select',
|
423 |
+
'options' => array(
|
424 |
+
'left' => __('Left', 'yit' ),
|
425 |
+
'right' => __('Right', 'yit' )
|
426 |
+
)
|
427 |
+
),
|
428 |
+
*/
|
429 |
+
array( 'type' => 'sectionend', 'id' => 'yith_wcmg_slider_end' )
|
430 |
+
)
|
431 |
+
);
|
432 |
+
|
433 |
+
return apply_filters( 'yith_wcmg_tab_options', $options );
|
434 |
+
}
|
435 |
+
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Default options
|
439 |
+
*
|
440 |
+
* Sets up the default options used on the settings page
|
441 |
+
*
|
442 |
+
* @access protected
|
443 |
+
* @return void
|
444 |
+
* @since 1.0.0
|
445 |
+
*/
|
446 |
+
protected function _default_options() {
|
447 |
+
foreach ( $this->options as $section ) {
|
448 |
+
foreach ( $section as $value ) {
|
449 |
+
if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
|
450 |
+
if ( $value['type'] == 'image_width' ) {
|
451 |
+
add_option( $value['id'] . '_width', $value['std'] );
|
452 |
+
add_option( $value['id'] . '_height', $value['std'] );
|
453 |
+
}
|
454 |
+
else {
|
455 |
+
add_option( $value['id'], $value['std'] );
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
}
|
461 |
+
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Create new Woocommerce admin field: slider
|
465 |
+
*
|
466 |
+
* @access public
|
467 |
+
*
|
468 |
+
* @param array $value
|
469 |
+
*
|
470 |
+
* @return void
|
471 |
+
* @since 1.0.0
|
472 |
+
*/
|
473 |
+
public function admin_fields_slider( $value ) {
|
474 |
+
$slider_value = ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) ?
|
475 |
+
esc_attr( stripslashes( get_option( $value['id'] ) ) ) :
|
476 |
+
esc_attr( $value['std'] );
|
477 |
+
|
478 |
+
?>
|
479 |
+
<tr valign="top">
|
480 |
+
<th scope="row" class="titledesc">
|
481 |
+
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
|
482 |
+
</th>
|
483 |
+
<td class="forminp">
|
484 |
+
<div id="<?php echo esc_attr( $value['id'] ); ?>_slider" class="yith_woocommerce_slider" style="width: 300px; float: left;"></div>
|
485 |
+
<div id="<?php echo esc_attr( $value['id'] ); ?>_value" class="yith_woocommerce_slider_value ui-state-default ui-corner-all"><?php echo $slider_value ?></div>
|
486 |
+
<input name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'] ); ?>" type="hidden" value="<?php echo $slider_value ?>" /> <?php echo $value['desc']; ?>
|
487 |
+
</td>
|
488 |
+
</tr>
|
489 |
+
|
490 |
+
|
491 |
+
|
492 |
+
<script>
|
493 |
+
jQuery(document).ready(function ($) {
|
494 |
+
$('#<?php echo esc_attr( $value['id'] ); ?>_slider').slider({
|
495 |
+
min : <?php echo $value['min'] ?>,
|
496 |
+
max : <?php echo $value['max'] ?>,
|
497 |
+
step : <?php echo $value['step'] ?>,
|
498 |
+
value: <?php echo $slider_value ?>,
|
499 |
+
slide: function (event, ui) {
|
500 |
+
$("#<?php echo esc_attr( $value['id'] ); ?>").val(ui.value);
|
501 |
+
$("#<?php echo esc_attr( $value['id'] ); ?>_value").text(ui.value);
|
502 |
+
}
|
503 |
+
});
|
504 |
});
|
505 |
+
</script>
|
506 |
+
|
507 |
+
<?php
|
508 |
+
}
|
509 |
+
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Create new Woocommerce admin field: picker
|
513 |
+
*
|
514 |
+
* @access public
|
515 |
+
*
|
516 |
+
* @param array $value
|
517 |
+
*
|
518 |
+
* @return void
|
519 |
+
* @since 1.0.0
|
520 |
+
*/
|
521 |
+
public function admin_fields_picker( $value ) {
|
522 |
+
$picker_value = ( get_option( $value['id'] ) !== false && get_option( $value['id'] ) !== null ) ?
|
523 |
+
esc_attr( stripslashes( get_option( $value['id'] ) ) ) :
|
524 |
+
esc_attr( $value['std'] );
|
525 |
+
|
526 |
+
?>
|
527 |
+
<tr valign="top">
|
528 |
+
<th scope="row" class="titledesc">
|
529 |
+
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
|
530 |
+
</th>
|
531 |
+
<td class="forminp">
|
532 |
+
<div class="color_box"><strong><?php echo $value['name']; ?></strong>
|
533 |
+
<input name="<?php echo esc_attr( $value['id'] ) ?>" id="<?php echo esc_attr( $value['id'] ) ?>" type="text" value="<?php echo $picker_value ?>" class="colorpick" />
|
534 |
+
|
535 |
+
<div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ) ?>" class="colorpickdiv"></div>
|
536 |
+
</div> <?php echo $value['desc']; ?></td>
|
537 |
+
</tr>
|
538 |
+
<?php
|
539 |
+
}
|
540 |
|
541 |
/**
|
542 |
* Save the admin field: slider
|
543 |
*
|
544 |
* @access public
|
545 |
+
*
|
546 |
* @param mixed $value
|
547 |
+
*
|
548 |
* @return void
|
549 |
* @since 1.0.0
|
550 |
*/
|
551 |
+
public function admin_update_option( $value ) {
|
552 |
+
global $woocommerce;
|
553 |
+
|
554 |
+
if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $woocommerce->version ), '2.1', '<' ) ) {
|
555 |
+
$wc_clean = 'woocommerce_clean';
|
556 |
+
}
|
557 |
+
else {
|
558 |
+
$wc_clean = 'wc_clean';
|
559 |
+
}
|
560 |
+
|
561 |
+
update_option( $value['id'], woocommerce_clean( $_POST[$value['id']] ) );
|
562 |
}
|
563 |
|
564 |
+
/**
|
565 |
+
* Create new Woocommerce admin field: image deps
|
566 |
+
*
|
567 |
+
* @access public
|
568 |
+
*
|
569 |
+
* @param array $value
|
570 |
+
*
|
571 |
+
* @return void
|
572 |
+
* @since 1.0.0
|
573 |
+
*/
|
574 |
+
public function admin_fields_image_deps( $value ) {
|
575 |
+
global $woocommerce;
|
576 |
+
|
577 |
+
$force = get_option( 'yith_wcmg_force_sizes' ) == 'yes';
|
578 |
+
|
579 |
+
if ( $force ) {
|
580 |
+
$value['desc'] = 'These values are automatically calculated based on the values of the Single product. If you\'d like to customize yourself the values, please disable the "Forcing Zoom Image sizes" in "Magnifier" tab.';
|
581 |
+
}
|
582 |
+
|
583 |
+
if ( $force && isset( $_GET['page'] ) && isset( $_GET['tab'] ) && ( $_GET['page'] == 'woocommerce_settings' || $_GET['page'] == 'wc-settings' ) && $_GET['tab'] == 'catalog' ): ?>
|
584 |
+
<script>
|
585 |
+
jQuery(document).ready(function ($) {
|
586 |
+
$('#woocommerce_magnifier_image-width, #woocommerce_magnifier_image-height, #woocommerce_magnifier_image-crop').attr('disabled', 'disabled');
|
587 |
+
|
588 |
+
$('#shop_single_image_size-width, #shop_single_image_size-height').on('keyup', function () {
|
589 |
+
var value = parseInt($(this).val());
|
590 |
+
var input = (this.id).indexOf('width') >= 0 ? 'width' : 'height';
|
591 |
+
|
592 |
+
if (!isNaN(value)) {
|
593 |
+
$('#woocommerce_magnifier_image-' + input).val(value * 2);
|
594 |
+
}
|
595 |
+
});
|
596 |
+
|
597 |
+
$('#shop_single_image_size-crop').on('change', function () {
|
598 |
+
if ($(this).is(':checked')) {
|
599 |
+
$('#woocommerce_magnifier_image-crop').attr('checked', 'checked');
|
600 |
+
} else {
|
601 |
+
$('#woocommerce_magnifier_image-crop').removeAttr('checked');
|
602 |
+
}
|
603 |
+
});
|
604 |
+
|
605 |
+
$('#mainform').on('submit', function () {
|
606 |
+
$(':disabled').removeAttr('disabled');
|
607 |
+
});
|
608 |
});
|
609 |
+
</script>
|
610 |
+
<?php endif;
|
611 |
+
}
|
612 |
+
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Enqueue admin styles and scripts
|
616 |
+
*
|
617 |
+
* @access public
|
618 |
+
* @return void
|
619 |
+
* @since 1.0.0
|
620 |
+
*/
|
621 |
+
public function enqueue_styles_scripts() {
|
622 |
+
wp_enqueue_script( 'jquery-ui' );
|
|
|
623 |
wp_enqueue_script( 'jquery-ui-core' );
|
624 |
+
wp_enqueue_script( 'jquery-ui-mouse' );
|
625 |
+
wp_enqueue_script( 'jquery-ui-slider' );
|
626 |
+
|
627 |
+
wp_enqueue_style( 'yith_wcmg_admin', YITH_WCMG_URL . 'assets/css/admin.css' );
|
628 |
+
}
|
629 |
|
630 |
|
631 |
/**
|
636 |
* @since 1.0.0
|
637 |
*/
|
638 |
protected function _printBanner() {
|
639 |
+
?>
|
640 |
<div class="yith_banner">
|
641 |
<a href="<?php echo $this->banner_url ?>" target="_blank">
|
642 |
<img src="<?php echo $this->banner_img ?>" alt="" />
|
650 |
* action_links function.
|
651 |
*
|
652 |
* @access public
|
653 |
+
*
|
654 |
* @param mixed $links
|
655 |
+
*
|
656 |
* @return void
|
657 |
*/
|
658 |
public function action_links( $links ) {
|
659 |
|
660 |
+
global $woocommerce;
|
661 |
+
|
662 |
+
if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $woocommerce->version ), '2.1', '<' ) ) {
|
663 |
+
$wc_settings = 'woocommerce_settings';
|
664 |
+
}
|
665 |
+
else {
|
666 |
+
$wc_settings = 'wc-settings';
|
667 |
+
}
|
668 |
+
|
669 |
$plugin_links = array(
|
670 |
+
'<a href="' . admin_url( 'admin.php?page=' . $wc_settings . '&tab=yith_wcmg' ) . '">' . __( 'Settings', 'yit' ) . '</a>',
|
671 |
'<a href="' . $this->doc_url . '">' . __( 'Docs', 'yit' ) . '</a>',
|
672 |
);
|
673 |
|
class.yith-wcmg-frontend.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
-
* @version 1.0
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
|
@@ -63,7 +63,11 @@ if( !class_exists( 'YITH_WCMG_Frontend' ) ) {
|
|
63 |
* @since 1.0.0
|
64 |
*/
|
65 |
public function show_product_images() {
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
|
@@ -75,7 +79,11 @@ if( !class_exists( 'YITH_WCMG_Frontend' ) ) {
|
|
75 |
* @since 1.0.0
|
76 |
*/
|
77 |
public function show_product_thumbnails() {
|
78 |
-
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
+
* @version 1.1.0
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
|
63 |
* @since 1.0.0
|
64 |
*/
|
65 |
public function show_product_images() {
|
66 |
+
|
67 |
+
/** FIX WOO 2.1 */
|
68 |
+
$wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woocommerce_get_template';
|
69 |
+
|
70 |
+
$wc_get_template( 'single-product/product-image-magnifier.php', array(), '', YITH_WCMG_DIR . 'templates/' );
|
71 |
}
|
72 |
|
73 |
|
79 |
* @since 1.0.0
|
80 |
*/
|
81 |
public function show_product_thumbnails() {
|
82 |
+
|
83 |
+
/** FIX WOO 2.1 */
|
84 |
+
$wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woocommerce_get_template';
|
85 |
+
|
86 |
+
$wc_get_template( 'single-product/product-thumbnails-magnifier.php', array(), '', YITH_WCMG_DIR . 'templates/' );
|
87 |
}
|
88 |
|
89 |
|
class.yith-wcmg.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
-
* @version 1.0
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
|
@@ -22,7 +22,7 @@ if( !class_exists( 'YITH_WCMG' ) ) {
|
|
22 |
* @var string
|
23 |
* @since 1.0.0
|
24 |
*/
|
25 |
-
public $version = '1.0
|
26 |
|
27 |
/**
|
28 |
* Plugin object
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
+
* @version 1.1.0
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
|
22 |
* @var string
|
23 |
* @since 1.0.0
|
24 |
*/
|
25 |
+
public $version = '1.1.0';
|
26 |
|
27 |
/**
|
28 |
* Plugin object
|
functions.yith-wcmg.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
-
* @version 1.0
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
|
@@ -32,7 +32,7 @@ if( !function_exists( 'yit_shop_single_w' ) ) {
|
|
32 |
*/
|
33 |
function yit_shop_single_w() {
|
34 |
global $woocommerce;
|
35 |
-
$size =
|
36 |
return $size['width'];
|
37 |
}
|
38 |
}
|
@@ -46,7 +46,19 @@ if( !function_exists( 'yit_shop_thumbnail_w' ) ) {
|
|
46 |
*/
|
47 |
function yit_shop_thumbnail_w() {
|
48 |
global $woocommerce;
|
49 |
-
$size =
|
50 |
return $size['width'];
|
51 |
}
|
52 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
+
* @version 1.1.0
|
8 |
*/
|
9 |
|
10 |
if ( !defined( 'YITH_WCMG' ) ) { exit; } // Exit if accessed directly
|
32 |
*/
|
33 |
function yit_shop_single_w() {
|
34 |
global $woocommerce;
|
35 |
+
$size = yit_get_image_size('shop_single');
|
36 |
return $size['width'];
|
37 |
}
|
38 |
}
|
46 |
*/
|
47 |
function yit_shop_thumbnail_w() {
|
48 |
global $woocommerce;
|
49 |
+
$size = yit_get_image_size('shop_thumbnail');
|
50 |
return $size['width'];
|
51 |
}
|
52 |
}
|
53 |
+
|
54 |
+
/* FIX TO WOOCOMMERCE 2.1 */
|
55 |
+
if( !function_exists( 'yit_get_image_size' ) ){
|
56 |
+
function yit_get_image_size( $size ){
|
57 |
+
if( function_exists('wc_get_image_size')){
|
58 |
+
return wc_get_image_size( $size );
|
59 |
+
}else{
|
60 |
+
global $woocommerce;
|
61 |
+
return $woocommerce->get_image_size( $size );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Zoom Magnifier
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Zoom Magnifier enables you to add a zoom effect to product images.
|
6 |
-
* Version: 1.0
|
7 |
* Author: Your Inspiration Themes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yit
|
@@ -11,7 +11,7 @@
|
|
11 |
*
|
12 |
* @author Your Inspiration Themes
|
13 |
* @package YITH WooCommerce Magnifier
|
14 |
-
* @version 1.0
|
15 |
*/
|
16 |
/* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
|
17 |
|
3 |
* Plugin Name: YITH WooCommerce Zoom Magnifier
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Zoom Magnifier enables you to add a zoom effect to product images.
|
6 |
+
* Version: 1.1.0
|
7 |
* Author: Your Inspiration Themes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yit
|
11 |
*
|
12 |
* @author Your Inspiration Themes
|
13 |
* @package YITH WooCommerce Magnifier
|
14 |
+
* @version 1.1.0
|
15 |
*/
|
16 |
/* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
|
17 |
|
templates/single-product/product-image-magnifier.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author YIThemes
|
6 |
* @package YITH_Magnifier/Templates
|
7 |
-
* @version 1.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -23,10 +23,12 @@ $enable_slider = get_option('yith_wcmg_enableslider') == 'yes' ? true : false;
|
|
23 |
$image_link = wp_get_attachment_url( get_post_thumbnail_id() );
|
24 |
list( $magnifier_url, $magnifier_width, $magnifier_height ) = wp_get_attachment_image_src( get_post_thumbnail_id(), "shop_magnifier" );
|
25 |
|
|
|
|
|
26 |
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="yith_magnifier_zoom woocommerce-main-image" title="%s">%s</a>', $magnifier_url, $image_title, $image ), $post->ID );
|
27 |
|
28 |
} else {
|
29 |
-
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="yith_magnifier_zoom woocommerce-main-image"><img src="%s" alt="Placeholder" /></a>',
|
30 |
}
|
31 |
?>
|
32 |
|
4 |
*
|
5 |
* @author YIThemes
|
6 |
* @package YITH_Magnifier/Templates
|
7 |
+
* @version 1.1.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
23 |
$image_link = wp_get_attachment_url( get_post_thumbnail_id() );
|
24 |
list( $magnifier_url, $magnifier_width, $magnifier_height ) = wp_get_attachment_image_src( get_post_thumbnail_id(), "shop_magnifier" );
|
25 |
|
26 |
+
$placeholder = function_exists('wc_placeholder_img_src') ? wc_placeholder_img_src() : woocommerce_placeholder_img_src();
|
27 |
+
|
28 |
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="yith_magnifier_zoom woocommerce-main-image" title="%s">%s</a>', $magnifier_url, $image_title, $image ), $post->ID );
|
29 |
|
30 |
} else {
|
31 |
+
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="yith_magnifier_zoom woocommerce-main-image"><img src="%s" alt="Placeholder" /></a>', $placeholder, $placeholder ), $post->ID );
|
32 |
}
|
33 |
?>
|
34 |
|
templates/single-product/product-thumbnails-magnifier.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author YIThemes
|
6 |
* @package YITH_Magnifier/Templates
|
7 |
-
* @version 1.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
4 |
*
|
5 |
* @author YIThemes
|
6 |
* @package YITH_Magnifier/Templates
|
7 |
+
* @version 1.1.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
uninstall.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
-
* @version 1.0
|
8 |
*/
|
9 |
|
10 |
// If uninstall not called from WordPress exit
|
4 |
*
|
5 |
* @author Your Inspiration Themes
|
6 |
* @package YITH WooCommerce Zoom Magnifier
|
7 |
+
* @version 1.1.0
|
8 |
*/
|
9 |
|
10 |
// If uninstall not called from WordPress exit
|