WP Image Zoom - Version 1.39

Version Description

Download this release

Release Info

Developer diana_burduja
Plugin Icon 128x128 WP Image Zoom
Version 1.39
Comparing to
See all releases

Code changes from version 1.38 to 1.39

assets/css/style.min.css CHANGED
@@ -133,4 +133,14 @@ h2 a:hover,h3 a.nav-tab:hover{text-decoration:none}@font-face{font-family:Ralewa
133
  border-left: 3px solid transparent;
134
  border-right: 3px solid transparent;
135
  }
136
-
 
 
 
 
 
 
 
 
 
 
133
  border-left: 3px solid transparent;
134
  border-right: 3px solid transparent;
135
  }
136
+ .form-group .input-group-text, .form-group .input-group-buttons {
137
+ width: auto;
138
+ }
139
+ .form-group input[type="checkbox"] {
140
+ width: 1.4rem;
141
+ height: 1.4rem;
142
+ border-radius: 0;
143
+ line-height: 2rem;
144
+ padding-left: 0.1rem !important;
145
+ }
146
+ .form-group label[for=zwPositioning] + div { float: left; }
assets/js/image_zoom-init.js CHANGED
@@ -48,13 +48,16 @@ jQuery(document).ready(function( $ ){
48
 
49
  // Start the zoom for the normal images
50
  options.zIndex = 112400;
51
- $("img.zoooom").image_zoom(options);
 
 
 
52
 
53
  // WooCommerce category pages
54
  if ( IZ.woo_categories == '1' ) {
55
  var cat_class = '.tax-product_cat .products img, .post-type-archive-product .products img';
56
  $(cat_class).image_zoom(options);
57
- $(document).on('ready yith-wcan-ajax-filtered', function() {
58
  $('.zoomContainer').remove();
59
  $(cat_class).image_zoom(options);
60
  } );
48
 
49
  // Start the zoom for the normal images
50
  options.zIndex = 112400;
51
+ setTimeout( function() {
52
+ $("img.zoooom.jetpack-lazy-image").image_zoom(options);
53
+ }, 300 );
54
+ $("img.zoooom:not(.jetpack-lazy-image)").image_zoom( options );
55
 
56
  // WooCommerce category pages
57
  if ( IZ.woo_categories == '1' ) {
58
  var cat_class = '.tax-product_cat .products img, .post-type-archive-product .products img';
59
  $(cat_class).image_zoom(options);
60
+ $(document).on('yith-wcan-ajax-filtered', function() {
61
  $('.zoomContainer').remove();
62
  $(cat_class).image_zoom(options);
63
  } );
image-zoooom.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Image Zoom
4
  * Plugin URI: https://wordpress.org/plugins/wp-image-zoooom/
5
  * Description: Add zoom effect over the an image, whether it is an image in a post/page or the featured image of a product in a WooCommerce shop
6
- * Version: 1.38
7
  * Author: SilkyPress
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
@@ -12,7 +12,7 @@
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3.0
15
- * WC tested up to: 3.8
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
@@ -26,8 +26,7 @@ if ( ! class_exists( 'ImageZoooom' ) ) :
26
  * @class ImageZoooom
27
  */
28
  final class ImageZoooom {
29
- public $plugin;
30
- public $version = '1.38';
31
  public $theme = '';
32
  protected static $_instance = null;
33
 
@@ -77,12 +76,11 @@ final class ImageZoooom {
77
 
78
  $this->theme = strtolower(get_template());
79
  include_once( 'includes/settings.php' );
80
- $this->plugin = wp_image_zoooom_settings('plugin');
81
 
82
  if ( is_admin() ) {
83
  $this->load_plugin_textdomain();
84
  include_once( 'includes/admin-side.php' );
85
- // include_once( 'includes/image-zoom-notices.php' );
86
  }
87
  add_action( 'template_redirect', array( $this, 'template_redirect' ) );
88
  add_action( 'vc_after_init', array( $this, 'js_composer' ) );
3
  * Plugin Name: WP Image Zoom
4
  * Plugin URI: https://wordpress.org/plugins/wp-image-zoooom/
5
  * Description: Add zoom effect over the an image, whether it is an image in a post/page or the featured image of a product in a WooCommerce shop
6
+ * Version: 1.39
7
  * Author: SilkyPress
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3.0
15
+ * WC tested up to: 3.9
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
26
  * @class ImageZoooom
27
  */
28
  final class ImageZoooom {
29
+ public $version = '1.39';
 
30
  public $theme = '';
31
  protected static $_instance = null;
32
 
76
 
77
  $this->theme = strtolower(get_template());
78
  include_once( 'includes/settings.php' );
 
79
 
80
  if ( is_admin() ) {
81
  $this->load_plugin_textdomain();
82
  include_once( 'includes/admin-side.php' );
83
+ new ImageZoooom_Admin();
84
  }
85
  add_action( 'template_redirect', array( $this, 'template_redirect' ) );
86
  add_action( 'vc_after_init', array( $this, 'js_composer' ) );
includes/admin-side.php CHANGED
@@ -1,467 +1,257 @@
1
  <?php
 
 
 
 
 
2
 
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit; // Exit if accessed directly
5
- }
6
 
7
  /**
8
- * ImageZoooom_Admin
9
  */
10
  class ImageZoooom_Admin {
11
 
12
- public $messages = array();
13
- private $tab = 'general';
14
- public $plugin;
15
-
16
- /**
17
- * Constructor
18
- */
19
- public function __construct() {
20
-
21
- if ( ! function_exists( 'is_plugin_active' ) ) {
22
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
23
- }
24
-
25
- if (strtolower(get_template()) === 'enfold') {
26
- add_theme_support('avia_template_builder_custom_css');
27
- }
28
-
29
- add_action( 'admin_menu', array( $this, 'admin_menu' ) );
30
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
31
- add_action( 'admin_head', array( $this, 'iz_add_tinymce_button' ) );
32
- add_action( 'admin_head', array( $this, 'gutenberg_style' ) );
33
- add_action( 'enqueue_block_editor_assets', array($this, 'enqueue_block_editor_assets' ) );
34
- $this->plugin = wp_image_zoooom_settings('plugin');
35
- $this->warnings();
36
- }
37
-
38
- /**
39
- * Add menu items
40
- */
41
- public function admin_menu() {
42
- add_menu_page(
43
- __( 'WP Image Zoom', 'wp-image-zoooom' ),
44
- __( 'WP Image Zoom', 'wp-image-zoooom' ),
45
- 'administrator',
46
- 'zoooom_settings',
47
- array( $this, 'admin_settings_page' ),
48
- IMAGE_ZOOM_URL . 'assets/images/icon.svg'
49
- );
50
- }
51
-
52
- /**
53
- * Load the javascript and css scripts
54
- */
55
- public function admin_enqueue_scripts( $hook ) {
56
- if ( $hook != 'toplevel_page_zoooom_settings' )
57
- return false;
58
-
59
- $url = IMAGE_ZOOM_URL. 'assets/';
60
- $frm_url = IMAGE_ZOOM_URL. 'includes/frm/assets/';
61
- $v = IMAGE_ZOOM_VERSION;
62
-
63
- // Register the javascript files
64
- if ( $this->plugin['testing'] == true ) {
65
- wp_register_script( 'bootstrap', $frm_url. 'bootstrap.min.js' , array( 'jquery' ), $v, true );
66
- wp_register_script( 'image_zoooom', $url.'js/jquery.image_zoom.js' , array( 'jquery' ), $v, true );
67
- if ( !isset($_GET['tab']) || $_GET['tab'] == 'settings' ) {
68
- wp_register_script( 'zoooom-settings', $url. 'js/image_zoom.settings.js', array( 'image_zoooom' ), $v, true );
69
- }
70
- } else {
71
- wp_register_script( 'bootstrap', $frm_url.'bootstrap.min.js', array( 'jquery' ), $v, true );
72
- wp_register_script( 'image_zoooom', $url.'js/jquery.image_zoom.min.js', array( 'jquery' ), $v, true );
73
- if ( !isset($_GET['tab']) || $_GET['tab'] == 'settings' ) {
74
- wp_register_script( 'zoooom-settings', $url.'js/image_zoom.settings.js', array( 'image_zoooom' ), $v, true );
75
- }
76
- }
77
-
78
- // Enqueue the javascript files
79
- wp_enqueue_script( 'bootstrap' );
80
- wp_enqueue_script( 'image_zoooom' );
81
- wp_enqueue_script( 'zoooom-settings' );
82
-
83
- // Register the css files
84
- wp_register_style( 'bootstrap', $frm_url.'bootstrap.min.css', array(), $v);
85
- if ( $this->plugin['testing'] == true ) {
86
- wp_register_style( 'zoooom', $url.'css/style.css', array(), $v);
87
- } else {
88
- wp_register_style( 'zoooom', $url.'css/style.min.css', array(), $v);
89
- }
90
-
91
- // Enqueue the css files
92
- wp_enqueue_style( 'bootstrap' );
93
- wp_enqueue_style( 'zoooom' );
94
- }
95
-
96
- /**
97
- * Build an array with settings that will be used in the form
98
- * @access public
99
- */
100
- public function get_settings( $id = '' ) {
101
- $settings = wp_image_zoooom_settings('settings');
102
- $pro_fields = wp_image_zoooom_settings('pro_fields');
103
-
104
- $settings = array_merge( $settings, $pro_fields );
105
-
106
- if ( isset( $settings[$id] ) ) {
107
- $settings[$id]['name'] = $id;
108
- return $settings[$id];
109
- } elseif ( empty( $id ) ) {
110
- return $settings;
111
- }
112
- return false;
113
- }
114
-
115
-
116
- /**
117
- * Add "with Image Zoom" style for the Image block in Gutenberg
118
- * @access public
119
- */
120
- public function enqueue_block_editor_assets() {
121
- wp_enqueue_script(
122
- 'gutenberg-zoom-style',
123
- IMAGE_ZOOM_URL . 'assets/js/gutenberg-zoom-style.js',
124
- array( 'wp-blocks', 'wp-dom' ),
125
- filemtime( IMAGE_ZOOM_PATH . '/assets/js/gutenberg-zoom-style.js' ),
126
- true
127
- );
128
- }
129
-
130
-
131
- /**
132
- * Output the admin page
133
- * @access public
134
- */
135
- public function admin_settings_page() {
136
-
137
- if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'general' ) {
138
- if ( ! empty( $_POST ) ) {
139
- check_admin_referer('iz_general');
140
- $new_settings = $this->validate_general( $_POST );
141
- update_option( 'zoooom_general', $new_settings );
142
- $this->add_message( 'success', '<b>'.__('Your settings have been saved.', 'wp-image-zoooom') . '</b>' );
143
- }
144
-
145
- $template = IMAGE_ZOOM_PATH . "/includes/image-zoom-admin-general.php";
146
- load_template( $template );
147
-
148
- $this->tab = 'general';
149
-
150
- return;
151
- }
152
-
153
- if ( ! empty( $_POST ) ) {
154
- check_admin_referer('iz_template');
155
- $new_settings = $this->validate_settings( $_POST );
156
- // $new_settings_js = $this->generate_js_settings( $new_settings );
157
- update_option( 'zoooom_settings', $new_settings );
158
- // update_option( 'zoooom_settings_js', $new_settings_js );
159
- $this->add_message( 'success', '<b>'.__('Your settings have been saved.', 'wp-image-zoooom') . '</b>' );
160
- }
161
-
162
- $template = IMAGE_ZOOM_PATH . "/includes/image-zoom-admin-template.php";
163
- load_template( $template );
164
-
165
- $this->tab = 'settings';
166
- }
167
-
168
- /**
169
- * Build the jquery.image_zoom.js options and save them directly in the database
170
- * @access private
171
- */
172
- /*
173
- private function generate_js_settings( $settings ) {
174
- $options = array();
175
- switch ( $settings['lensShape'] ) {
176
- case 'none' :
177
- $options[] = 'zoomType : "inner"';
178
- $options[] = 'cursor: "'.$settings['cursorType'].'"';
179
- $options[] = 'easingAmount: '.$settings['zwEasing'];
180
- break;
181
- case 'square' :
182
- case 'round' :
183
- $options[] = 'lensShape : "' .$settings['lensShape'].'"';
184
- $options[] = 'zoomType : "lens"';
185
- $options[] = 'lensSize : "' .$settings['lensSize'].'"';
186
- $options[] = 'borderSize : "' .$settings['borderThickness'].'"';
187
- $options[] = 'borderColour : "' .$settings['borderColor'].'"';
188
- $options[] = 'cursor : "' .$settings['cursorType'].'"';
189
- $options[] = 'lensFadeIn : "' .$settings['lensFade'].'"';
190
- $options[] = 'lensFadeOut : "' .$settings['lensFade'].'"';
191
- if ( $settings['tint'] == true ) {
192
- $options[] = 'tint : true';
193
- $options[] = 'tintColour: "' . $settings['tintColor'] . '"';
194
- $options[] = 'tintOpacity: "' . $settings['tintOpacity'] . '"';
195
- }
196
-
197
- break;
198
- case 'square' :
199
- break;
200
- case 'zoom_window' :
201
- $options[] = 'lensShape : "square"';
202
- $options[] = 'lensSize : "' .$settings['lensSize'].'"';
203
- $options[] = 'lensBorderSize : "' .$settings['borderThickness'].'"';
204
- $options[] = 'lensBorderColour: "' .$settings['borderColor'].'"';
205
- $options[] = 'borderRadius : "' .$settings['zwBorderRadius'].'"';
206
- $options[] = 'cursor : "' .$settings['cursorType'].'"';
207
- $options[] = 'zoomWindowWidth : "' .$settings['zwWidth'].'"';
208
- $options[] = 'zoomWindowHeight: "' .$settings['zwHeight'].'"';
209
- $options[] = 'zoomWindowOffsetx: "' .$settings['zwPadding'].'"';
210
- $options[] = 'borderSize : "' .$settings['zwBorderThickness'].'"';
211
- $options[] = 'borderColour : "' .$settings['zwBorderColor'].'"';
212
- $options[] = 'zoomWindowShadow : "' .$settings['zwShadow'].'"';
213
- $options[] = 'lensFadeIn : "' .$settings['lensFade'].'"';
214
- $options[] = 'lensFadeOut : "' .$settings['lensFade'].'"';
215
- $options[] = 'zoomWindowFadeIn :"' .$settings['zwFade'].'"';
216
- $options[] = 'zoomWindowFadeOut :"' .$settings['zwFade'].'"';
217
- $options[] = 'easingAmount : "'.$settings['zwEasing'].'"';
218
- if ( $settings['tint'] == true ) {
219
- $options[] = 'tint : true';
220
- $options[] = 'tintColour: "' . $settings['tintColor'] . '"';
221
- $options[] = 'tintOpacity: "' . $settings['tintOpacity'] . '"';
222
- }
223
-
224
- break;
225
- }
226
- if (count($options) == 0) return false;
227
-
228
- $options = implode(', ', $options);
229
-
230
- return $options;
231
- }
232
- */
233
-
234
-
235
- /**
236
- * Check the validity of the settings. The validity has to be the same as the javascript validation in image-zoom.settings.js
237
- * @access public
238
- */
239
- public function validate_settings( $post ) {
240
- $settings = $this->get_settings();
241
-
242
- $new_settings = array();
243
- foreach ( $settings as $_key => $_value ) {
244
- if ( isset( $post[$_key] ) && $post[$_key] != $_value['value'] ) {
245
- $new_settings[$_key] = $post[$_key];
246
- } else {
247
- $new_settings[$_key] = $_value['value'];
248
- }
249
- }
250
-
251
- $new_settings['lensShape'] = $this->validateValuesSet('lensShape', $new_settings['lensShape']);
252
- $new_settings['cursorType'] = $this->validateValuesSet('cursorType', $new_settings['cursorType']);
253
- $new_settings['zwEasing'] = $this->validateRange('zwEasing', $new_settings['zwEasing'], 'int', 0, 200);
254
- $new_settings['lensSize'] = $this->validateRange('lensSize', $new_settings['lensSize'], 'int', 20, 2000);
255
- $new_settings['borderThickness'] = $this->validateRange('borderThickness', $new_settings['borderThickness'], 'int', 0, 200);
256
- $new_settings['borderColor'] = $this->validateColor('borderColor', $new_settings['borderColor']);
257
- $new_settings['lensFade'] = $this->validateRange('lensFade', $new_settings['lensFade'], 'float', 0, 10);
258
- $new_settings['tint'] = $this->validateCheckbox('tint', $new_settings['tint']);
259
- $new_settings['tintColor'] = $this->validateColor('tintColor', $new_settings['tintColor']);
260
- $new_settings['tintOpacity'] = $this->validateRange('tintOpacity', $new_settings['tintOpacity'], 'float', 0, 1);
261
- $new_settings['zwWidth'] = $this->validateRange('zwWidth', $new_settings['zwWidth'], 'int', 0, 2000);
262
- $new_settings['zwHeight'] = $this->validateRange('zwHeight', $new_settings['zwHeight'], 'int', 0, 2000);
263
- $new_settings['zwPadding'] = $this->validateRange('zwPadding', $new_settings['zwPadding'], 'int', 0, 200 );
264
- $new_settings['zwBorderThickness'] = $this->validateRange('zwBorderThickness', $new_settings['zwBorderThickness'], 'int', 0, 200);
265
- $new_settings['zwBorderRadius'] = $this->validateRange('zwBorderRadius', $new_settings['zwBorderRadius'], 'int', 0, 500);
266
- $new_settings['zwShadow'] = $this->validateRange('zwShadow', $new_settings['zwShadow'], 'int', 0, 500);
267
- $new_settings['zwFade'] = $this->validateRange('zwFade', $new_settings['zwFade'], 'float', 0, 10);
268
-
269
- return $new_settings;
270
- }
271
-
272
- public function validate_general( $post = null) {
273
- $settings = $this->get_settings();
274
-
275
- if( $post == null ) {
276
- return array(
277
- 'enable_woocommerce' => true,
278
- 'exchange_thumbnails' => true,
279
- 'enable_mobile' => false,
280
- 'woo_cat' => false,
281
- 'force_woocommerce' => true,
282
- );
283
- }
284
-
285
- if ( ! isset( $post['enable_woocommerce'] ) )
286
- $post['enable_woocommerce'] = false;
287
- if ( ! isset( $post['exchange_thumbnails'] ) )
288
- $post['exchange_thumbnails'] = false;
289
- if ( ! isset( $post['enable_mobile'] ) )
290
- $post['enable_mobile'] = false;
291
- if ( ! isset( $post['woo_cat'] ) )
292
- $post['woo_cat'] = false;
293
- if ( ! isset( $post['force_woocommerce'] ) )
294
- $post['force_woocommerce'] = false;
295
-
296
- $new_settings = array(
297
- 'enable_woocommerce' => $this->validateCheckbox('enable_woocommerce', $post['enable_woocommerce']),
298
- 'exchange_thumbnails' => $this->validateCheckbox('exchange_thumbnails', $post['exchange_thumbnails']),
299
- 'enable_mobile' => $this->validateCheckbox('enable_mobile', $post['enable_mobile']),
300
- 'woo_cat' => $this->validateCheckbox('woo_cat', $post['woo_cat']),
301
- 'force_woocommerce' => $this->validateCheckbox('force_woocommerce', $post['force_woocommerce']),
302
- );
303
-
304
- return $new_settings;
305
- }
306
-
307
- /**
308
- * Helper to validate a checkbox
309
- * @access private
310
- */
311
- private function validateCheckbox( $id, $value ) {
312
- $settings = $this->get_settings();
313
-
314
- if ( $value == 'on' ) $value = true;
315
-
316
- if ( !is_bool($value) ) {
317
- $value = $settings[$id]['value'];
318
- $this->add_message('info', __('Unrecognized <b>'.$settings[$id]['label'].'</b>. The value was reset to default', 'wp-image-zoooom') );
319
- } else {
320
- }
321
- return $value;
322
- }
323
-
324
- /**
325
- * Helper to validate a color
326
- * @access private
327
- */
328
- private function validateColor( $id, $value ) {
329
- $settings = $this->get_settings();
330
-
331
- if ( !preg_match('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', $value) ) {
332
- $value = $settings[$id]['value'];
333
- $message = __('Unrecognized <b>%1$s</b>. The value was reset to <b>%2$s</b>', 'wp-image-zoooom');
334
- $message = wp_kses($message, array('b' => array()));
335
- $message = sprintf($message, $settings[$id]['label'], $settings[$id]['value']);
336
- $this->add_message('info', $message);
337
- }
338
- return $value;
339
- }
340
-
341
- /**
342
- * Helper to validate the value out of a set of values
343
- * @access private
344
- */
345
- private function validateValuesSet( $id, $value ) {
346
- $settings = $this->get_settings();
347
-
348
- if ( !array_key_exists($value, $settings[$id]['values']) ) {
349
- $value = $settings[$id]['value'];
350
- $message = __('Unrecognized <b>%1$s</b>. The value was reset to <b>%2$s</b>', 'wp-image-zoooom');
351
- $message = wp_kses($message, array('b' => array()));
352
- $message = sprintf($message, $settings[$id]['label'], $settings[$id]['value']);
353
- $this->add_message('info', $message);
354
- }
355
- return $value;
356
- }
357
-
358
- /**
359
- * Helper to validate an integer of a float
360
- * @access private
361
- */
362
- private function validateRange( $id, $value, $type, $min, $max ) {
363
- $settings = $this->get_settings();
364
-
365
- if ( $type == 'int' ) $new_value = (int)$value;
366
- if ( $type == 'float' ) $new_value = (float)$value;
367
-
368
- if ( !is_numeric($value) || $new_value < $min || $new_value > $max ) {
369
- $new_value = $settings[$id]['value'];
370
- $message = __('<b>%1$s</b> accepts values between %2$s and %3$s. Your value was reset to <b>%4$s</b>', 'wp-image-zoooom');
371
- $message = wp_kses($message, array('b' => array()));
372
- $message = sprintf($message, $settings[$id]['label'], $settings[$id]['value']);
373
- $this->add_message('info', $message);
374
- }
375
- return $new_value;
376
- }
377
-
378
-
379
- /**
380
- * Add a message to the $this->messages array
381
- * @type accepted types: success, error, info, block
382
- * @access private
383
- */
384
- private function add_message( $type = 'success', $text ) {
385
- global $comment;
386
- $messages = $this->messages;
387
- $messages[] = array('type' => $type, 'text' => $text);
388
- $comment[] = array('type' => $type, 'text' => $text);
389
- $this->messages = $messages;
390
- }
391
-
392
- /**
393
- * Output the form messages
394
- * @access public
395
- */
396
- public function show_messages() {
397
- global $comment;
398
- if ( !$comment || sizeof( $comment ) == 0 ) return;
399
- $output = '';
400
- foreach ( $comment as $message ) {
401
- $output .= '<div class="alert alert-'.$message['type'].'">
402
- <button type="button" class="close" data-dismiss="alert">&times;</button>
403
- '. $message['text'] .'</div>';
404
- }
405
- return $output;
406
- }
407
-
408
-
409
- /**
410
- * Add a button to the TinyMCE toolbar
411
- * @access public
412
- */
413
- function iz_add_tinymce_button() {
414
- global $typenow;
415
-
416
- if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) {
417
- return;
418
- }
419
-
420
- $allowed_types = array( 'post', 'page' );
421
-
422
- if ( defined('LEARNDASH_VERSION') ) {
423
- $learndash_types = array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz', 'sfwd-certificates', 'sfwd-assignment');
424
- $allowed_types = array_merge( $allowed_types, $learndash_types );
425
-
426
- }
427
- /*
428
- if( ! in_array( $typenow, $allowed_types ) )
429
- return;
430
- */
431
-
432
- if ( isset( $_GET['page'] ) && $_GET['page'] == 'wplister-templates' )
433
- return;
434
-
435
- if ( get_user_option('rich_editing') != 'true')
436
- return;
437
-
438
- add_filter('mce_external_plugins', array( $this, 'iz_add_tinymce_plugin' ) );
439
- add_filter('mce_buttons', array( $this, 'iz_register_tinymce_button' ) );
440
- }
441
-
442
- /**
443
- * Register the plugin with the TinyMCE plugins manager
444
- * @access public
445
- */
446
- function iz_add_tinymce_plugin($plugin_array) {
447
- $plugin_array['image_zoom_button'] = IMAGE_ZOOM_URL . 'assets/js/tinyMCE-button.js';
448
- return $plugin_array;
449
- }
450
-
451
- /**
452
- * Register the button with the TinyMCE manager
453
- */
454
- function iz_register_tinymce_button($buttons) {
455
- array_push($buttons, 'image_zoom_button');
456
- return $buttons;
457
- }
458
-
459
-
460
- /**
461
- * Image style in the Gutenberg editor
462
- */
463
- function gutenberg_style() {
464
- echo '<style type="text/css">
465
  .edit-post-layout__content figure.is-style-zoooom::before{
466
  content: "\f179 Zoom applied to the image. Check on the frontend";
467
  position: absolute;
@@ -476,126 +266,120 @@ class ImageZoooom_Admin {
476
  z-index: 20;
477
  }
478
  </style>';
479
- }
480
-
481
-
482
- /**
483
- * Show admin warnings
484
- */
485
- function warnings() {
486
-
487
- require_once( 'frm/warnings.php' );
488
-
489
- $allowed_actions = array(
490
- 'iz_dismiss_ajax_product_filters',
491
- 'iz_dismiss_jetpack',
492
- 'iz_dismiss_bwp_minify',
493
- 'iz_dismiss_avada',
494
- 'iz_dismiss_shopkeeper',
495
- 'iz_dismiss_bridge',
496
- 'iz_dismiss_wooswipe',
497
- 'iz_dismiss_avada_woo_gallery',
498
- );
499
-
500
- $w = new SilkyPress_Warnings($allowed_actions);
501
-
502
- if ( !$w->is_url('zoooom_settings') ) {
503
- return;
504
- }
505
-
506
- // Warning about AJAX product filter plugins
507
- $this->iz_dismiss_ajax_product_filters($w);
508
-
509
-
510
- // Check if Jetpack Photon module is active
511
- if ( defined('JETPACK__VERSION' ) && Jetpack::is_module_active( 'photon' ) ) {
512
- $message = __( 'WP Image Zoom plugin is not compatible with the <a href="admin.php?page=jetpack">Jetpack Photon</a> module. If you find that the zoom is not working, try to deactivate the Photon module and see if that solves it.', 'wp-image-zoooom-pro' );
513
- $w->add_notice( 'iz_dismiss_jetpack', $message );
514
- }
515
-
516
- // Warning about BWF settings
517
- if ( is_plugin_active( 'bwp-minify/bwp-minify.php' ) ) {
518
- $message = __( '<b>If the zoom does not show up</b> on your website, it could be because you need to add the “image_zoooom-init” and the “image_zoooom” to the “Scripts to NOT minify” option in the BWP Minify settings, as shown in <a href="https://www.silkypress.com/wp-content/uploads/2016/09/image-zoom-bwp.png" target="_blank">this screenshot</a>.', 'wp-image-zoooom-pro' );
519
- $w->add_notice( 'iz_dismiss_bwp_minify', $message );
520
- }
521
-
522
-
523
- // Check if the Avada theme is active
524
- if ( strpos( strtolower(get_template()), 'avada') !== false && is_plugin_active('woocommerce/woocommerce.php')) {
525
- $flexslider_url = 'https://woocommerce.com/flexslider/';
526
- $pro_url = 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner';
527
- $message = sprintf( __( 'The WP Image Zoom plugin <b>will not work</b> on the WooCommerce products gallery with the Avada theme. The Avada theme changes entirely the default WooCommerce gallery with the <a href="%1$s" target="_blank">Flexslider gallery</a> and the zoom plugin does not support the Flexslider gallery. Please check the <a href="%2$s" target="_blank">PRO version</a> of the plugin for compatibility with the Flexslider gallery.', 'wp-image-zoooom' ), $flexslider_url, $pro_url );
528
- $w->add_notice( 'iz_dismiss_avada', $message );
529
- }
530
-
531
-
532
- // Check if the Shopkeeper theme is active
533
- if ( strpos( strtolower(get_template()), 'shopkeeper') !== false && is_plugin_active('woocommerce/woocommerce.php')) {
534
- $pro_url = 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner';
535
- $message = sprintf( __( 'The WP Image Zoom plugin <b>will not work</b> on the WooCommerce products gallery with the Shopkeeper theme. The Shopkeeper theme changes entirely the default WooCommerce gallery with a custom made gallery not supported by the free version of the WP Image Zoom plugin. Please check the <a href="%1$s" target="_blank">PRO version</a> of the plugin for compatibility with the Shopkeeper\'s gallery.', 'wp-image-zoooom' ), $pro_url );
536
- $w->add_notice( 'iz_dismiss_shopkeeper', $message, 'updated settings-error notice is-dismissible' );
537
- }
538
-
539
-
540
- // Check if the Bridge theme is active
541
- if ( strpos( strtolower(get_template()), 'bridge') !== false && is_plugin_active('woocommerce/woocommerce.php')) {
542
- $message = __( 'The <b>Bridge</b> theme replaces the default WooCommerce product gallery with its own. The <b>WP Image Zoom</b> plugin will not work with this replaced gallery. But if you set the "Enable Default WooCommerce Product Gallery Features" option to "Yes" on the <a href="'.admin_url( 'admin.php?page=qode_theme_menu_tab_woocommerce' ).'">WP Admin -> Qode Options -> WooCommerce</a> page, then the zoom will work as expected on the product gallery.', 'wp-image-zoooom' );
543
- // Note: This works for Bridge 16.7, but not for Bridge 14.1
544
- $w->add_notice( 'iz_dismiss_bridge', $message, 'updated settings-error notice is-dismissible' );
545
- }
546
-
547
-
548
- // Warning about WooSwipe plugin
549
- if ( is_plugin_active( 'wooswipe/wooswipe.php' ) ) {
550
- $pro_url = 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner';
551
- $wooswipe_url = 'https://wordpress.org/plugins/wooswipe/';
552
- $message = sprintf( __( 'WP Image Zoom plugin is <b>not compatible with the <a href="%1$s">WooSwipe WooCommerce Gallery</a> plugin</b>. You can try the zoom plugin with the default WooCommerce gallery by deactivating the WooSwipe plugin. Alternatively, you can upgrade to the WP Image Zoom Pro version, where the issue with the WooSwipe plugin is fixed.' ), $wooswipe_url, $pro_url);
553
- $w->add_notice( 'iz_dismiss_wooswipe', $message );
554
- }
555
-
556
-
557
- // Check if the Avada theme is active and the WooCommerce plugin installed
558
- if ( strpos( strtolower(get_template()), 'avada') !== false && is_plugin_active('woocommerce/woocommerce.php')) {
559
- $avada_options = get_option('fusion_options');
560
- if ( isset($avada_options['disable_woo_gallery']) && $avada_options['disable_woo_gallery'] == '1') {
561
- $message = __( '<b>The zoom will work</b> on the WooCommerce products images only when having the <b>"Avada\'s WooCommerce Product Gallery Slider"</b> option <b>turned off</b> on the <a href="'.admin_url('themes.php?page=avada_options').'">WP Admin -> Avada -> Theme Options -> WooCommerce -> General WooCommerce</a> page');
562
- $w->add_notice( 'iz_dismiss_avada_woo_gallery', $message );
563
- }
564
- }
565
-
566
- $w->show_warnings();
567
- }
568
-
569
-
570
- /**
571
- * Warning about AJAX product filter plugins
572
- */
573
- function iz_dismiss_ajax_product_filters($w) {
574
- $continue = false;
575
-
576
- $general = get_option('zoooom_general');
577
- if ( isset($_POST['tab'] )) {
578
- $general['woo_cat'] = (isset($_POST['woo_cat'])) ? true : false;
579
- }
580
- if ( ! isset($general['woo_cat']) || $general['woo_cat'] != true ) return false;
581
-
582
- if ( is_plugin_active( 'woocommerce-ajax-filters/woocommerce-filters.php' ) ) $continue = true;
583
- if ( is_plugin_active( 'load-more-products-for-woocommerce/load-more-products.php' ) ) $continue = true;
584
- if ( is_plugin_active( 'wc-ajax-product-filter/wcapf.php' ) ) $continue = true;
585
-
586
- if ( !$continue ) return false;
587
-
588
- $article_url = 'https://www.silkypress.com/wp-image-zoom/zoom-woocommerce-category-page-ajax/';
589
- $message = sprintf(__( 'You are using the zoom on WooCommerce shop pages in combination with a plugin that loads more products with AJAX (a product filter plugin or a "load more" products plugin). You\'ll notice that the zoom isn\'t applied after new products are loaded with AJAX. Please read <a href="%1$s" target="_blank">this article for a solution</a>.', 'wp-image-zoooom' ), $article_url);
590
-
591
- $w->add_notice( 'iz_dismiss_ajax_product_filters', $message );
592
- }
593
-
594
-
595
-
596
-
597
-
598
  }
599
-
600
-
601
- return new ImageZoooom_Admin();
1
  <?php
2
+ /**
3
+ * Zoom admin settings page
4
+ */
5
+
6
+ defined( 'ABSPATH' ) || exit;
7
 
 
 
 
8
 
9
  /**
10
+ * ImageZoooom_Admin
11
  */
12
  class ImageZoooom_Admin {
13
 
14
+ /**
15
+ * Constructor
16
+ */
17
+ public function __construct() {
18
+
19
+ if ( ! function_exists( 'is_plugin_active' ) ) {
20
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
21
+ }
22
+
23
+ if ( strtolower( get_template() ) === 'enfold' ) {
24
+ add_theme_support( 'avia_template_builder_custom_css' );
25
+ }
26
+
27
+ require_once 'frm/class-form-fields.php';
28
+ require_once 'frm/premium-tooltips.php';
29
+ require_once 'frm/warnings.php';
30
+
31
+ add_action( 'admin_menu', 'ImageZoooom_Admin::admin_menu' );
32
+ add_action( 'admin_enqueue_scripts', 'ImageZoooom_Admin::admin_enqueue_scripts' );
33
+ add_action( 'admin_head', 'ImageZoooom_Admin::iz_add_tinymce_button' );
34
+ add_action( 'admin_head', 'ImageZoooom_Admin::gutenberg_style' );
35
+ add_action( 'enqueue_block_editor_assets', 'ImageZoooom_Admin::enqueue_block_editor_assets' );
36
+
37
+ self::warnings();
38
+ }
39
+
40
+ /**
41
+ * Add menu items
42
+ */
43
+ public static function admin_menu() {
44
+ add_menu_page(
45
+ __( 'WP Image Zoom', 'wp-image-zoooom' ),
46
+ __( 'WP Image Zoom', 'wp-image-zoooom' ),
47
+ 'administrator',
48
+ 'zoooom_settings',
49
+ 'ImageZoooom_Admin::admin_settings_page',
50
+ IMAGE_ZOOM_URL . 'assets/images/icon.svg'
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Load the javascript and css scripts
56
+ */
57
+ public static function admin_enqueue_scripts( $hook ) {
58
+ if ( 'toplevel_page_zoooom_settings' !== $hook ) {
59
+ return false;
60
+ }
61
+
62
+ $url = IMAGE_ZOOM_URL . 'assets/';
63
+ $frm_url = IMAGE_ZOOM_URL . 'includes/frm/assets/';
64
+ $v = IMAGE_ZOOM_VERSION;
65
+ $min = defined( SCRIPT_DEBUG ) && SCRIPT_DEBUG ? '' : '.min';
66
+
67
+ // Register the assets
68
+ wp_register_script( 'bootstrap', $frm_url . 'bootstrap.min.js', array( 'jquery' ), $v, true );
69
+ wp_register_script( 'image_zoooom', $url . 'js/jquery.image_zoom' . $min . '.js', array( 'jquery' ), $v, true );
70
+ wp_register_script( 'zoooom-settings', $url . 'js/image_zoom.settings.js', array( 'image_zoooom' ), $v, true );
71
+ wp_register_style( 'bootstrap', $frm_url . 'bootstrap.min.css', array(), $v );
72
+ wp_register_style( 'zoooom', $url . 'css/style' . $min . '.css', array(), $v );
73
+
74
+ // Enqueue the assets
75
+ wp_enqueue_script( 'bootstrap' );
76
+ wp_enqueue_script( 'image_zoooom' );
77
+ wp_enqueue_style( 'bootstrap' );
78
+ wp_enqueue_style( 'zoooom' );
79
+ if ( ! isset( $_GET['tab'] ) || 'settings' === $_GET['tab'] ) {
80
+ wp_enqueue_script( 'zoooom-settings' );
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Build an array with settings that will be used in the form
86
+ *
87
+ * @access public
88
+ */
89
+ public function get_settings( $id = '' ) {
90
+ $settings = wp_image_zoooom_settings( 'settings' );
91
+ $pro_fields = wp_image_zoooom_settings( 'pro_fields' );
92
+
93
+ $settings = array_merge( $settings, $pro_fields );
94
+
95
+ if ( isset( $settings[ $id ] ) ) {
96
+ $settings[ $id ]['name'] = $id;
97
+ return $settings[ $id ];
98
+ } elseif ( empty( $id ) ) {
99
+ return $settings;
100
+ }
101
+ return false;
102
+ }
103
+
104
+
105
+ /**
106
+ * Add "with Image Zoom" style for the Image block in Gutenberg
107
+ *
108
+ * @access public
109
+ */
110
+ public static function enqueue_block_editor_assets() {
111
+ wp_enqueue_script(
112
+ 'gutenberg-zoom-style',
113
+ IMAGE_ZOOM_URL . 'assets/js/gutenberg-zoom-style.js',
114
+ array( 'wp-blocks', 'wp-dom' ),
115
+ filemtime( IMAGE_ZOOM_PATH . '/assets/js/gutenberg-zoom-style.js' ),
116
+ true
117
+ );
118
+ }
119
+
120
+ /**
121
+ * Output the admin page
122
+ *
123
+ * @access public
124
+ */
125
+ public static function admin_settings_page() {
126
+
127
+ // Get the tabs.
128
+ $tabs = array(
129
+ 'general' => __( 'General Settings', 'wp-image-zoooom' ),
130
+ 'settings' => __( 'Zoom Settings', 'wp-image-zoooom' ),
131
+ );
132
+
133
+ $tab_current = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : 'settings';
134
+ $options_current = ( 'settings' === $tab_current ) ? 'zoooom_settings' : 'zoooom_general';
135
+
136
+ // Get the field settings.
137
+ $settings_all = wp_image_zoooom_settings( 'settings' );
138
+ $values_current = get_option( $options_current, array() );
139
+
140
+ // Filter settings only for this section.
141
+ foreach ( $settings_all as $_key => $_value ) {
142
+ if ( $_value['section'] !== $tab_current ) {
143
+ unset( $settings_all[ $_key ] );
144
+ }
145
+ }
146
+
147
+ if ( class_exists( 'woocommerce' ) && version_compare( WC_VERSION, '3.0', '>' ) ) {
148
+ unset( $settings_all['exchange_thumbnails'] );
149
+ }
150
+
151
+ // Configure the form class.
152
+ $form = new \SilkyPressFrm\Form_Fields( $settings_all );
153
+ $form->add_setting( 'tooltip_img', plugins_url( '/', IMAGE_ZOOM_FILE ) . 'assets/images/question_mark.svg' );
154
+ $form->add_setting( 'section', $tab_current );
155
+ $form->add_setting( 'label_class', 'settings' === $tab_current ? 'col-sm-5' : 'col-sm-6' );
156
+ $form->set_current_values( $values_current );
157
+
158
+ // The settings were saved.
159
+ if ( ! empty( $_POST ) ) {
160
+ check_admin_referer( $options_current );
161
+
162
+ if ( current_user_can( 'manage_woocommerce' ) ) {
163
+
164
+ $values_post_sanitized = $form->validate( $_POST );
165
+
166
+ $form->set_current_values( $values_post_sanitized );
167
+
168
+ if ( update_option( $options_current, $values_post_sanitized ) ) {
169
+ $form->add_message( 'success', '<b>' . __( 'Your settings have been saved.' ) . '</b>' );
170
+ }
171
+ }
172
+ }
173
+
174
+ // Premium tooltips.
175
+ $message = __( 'Only available in <a href="%1$s" target="_blank">PRO version</a>', 'wp-multi-step-checkout' );
176
+ $message = wp_kses(
177
+ $message,
178
+ array(
179
+ 'a' => array(
180
+ 'href' => array(),
181
+ 'target' => array(),
182
+ ),
183
+ )
184
+ );
185
+ $message = sprintf( $message, 'https://www.silkypress.com/woocommerce-multi-step-checkout-pro/?utm_source=wordpress&utm_campaign=wmsc_free&utm_medium=banner' );
186
+ new SilkyPress_PremiumTooltips( $message );
187
+
188
+ $messages = $form->render_messages();
189
+
190
+ include_once 'template-' . $tab_current . '.php';
191
+
192
+ include_once 'right_columns.php';
193
+ }
194
+
195
+ /**
196
+ * Add a button to the TinyMCE toolbar
197
+ *
198
+ * @access public
199
+ */
200
+ public static function iz_add_tinymce_button() {
201
+ global $typenow;
202
+
203
+ if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
204
+ return;
205
+ }
206
+
207
+ $allowed_types = array( 'post', 'page' );
208
+
209
+ if ( defined( 'LEARNDASH_VERSION' ) ) {
210
+ $learndash_types = array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz', 'sfwd-certificates', 'sfwd-assignment' );
211
+ $allowed_types = array_merge( $allowed_types, $learndash_types );
212
+
213
+ }
214
+ /*
215
+ if( ! in_array( $typenow, $allowed_types ) )
216
+ return;
217
+ */
218
+
219
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'wplister-templates' ) {
220
+ return;
221
+ }
222
+
223
+ if ( get_user_option( 'rich_editing' ) != 'true' ) {
224
+ return;
225
+ }
226
+
227
+ add_filter( 'mce_external_plugins', 'ImageZoooom_Admin::iz_add_tinymce_plugin' );
228
+ add_filter( 'mce_buttons', 'ImageZoooom_Admin::iz_register_tinymce_button' );
229
+ }
230
+
231
+ /**
232
+ * Register the plugin with the TinyMCE plugins manager
233
+ *
234
+ * @access public
235
+ */
236
+ public static function iz_add_tinymce_plugin( $plugin_array ) {
237
+ $plugin_array['image_zoom_button'] = IMAGE_ZOOM_URL . 'assets/js/tinyMCE-button.js';
238
+ return $plugin_array;
239
+ }
240
+
241
+ /**
242
+ * Register the button with the TinyMCE manager
243
+ */
244
+ public static function iz_register_tinymce_button( $buttons ) {
245
+ array_push( $buttons, 'image_zoom_button' );
246
+ return $buttons;
247
+ }
248
+
249
+
250
+ /**
251
+ * Image style in the Gutenberg editor
252
+ */
253
+ public static function gutenberg_style() {
254
+ echo '<style type="text/css">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  .edit-post-layout__content figure.is-style-zoooom::before{
256
  content: "\f179 Zoom applied to the image. Check on the frontend";
257
  position: absolute;
266
  z-index: 20;
267
  }
268
  </style>';
269
+ }
270
+
271
+
272
+ /**
273
+ * Show admin warnings
274
+ */
275
+ public static function warnings() {
276
+
277
+ $allowed_actions = array(
278
+ 'iz_dismiss_ajax_product_filters',
279
+ 'iz_dismiss_jetpack',
280
+ 'iz_dismiss_bwp_minify',
281
+ 'iz_dismiss_avada',
282
+ 'iz_dismiss_shopkeeper',
283
+ 'iz_dismiss_bridge',
284
+ 'iz_dismiss_wooswipe',
285
+ 'iz_dismiss_avada_woo_gallery',
286
+ );
287
+
288
+ $w = new SilkyPress_Warnings( $allowed_actions );
289
+
290
+ if ( ! $w->is_url( 'zoooom_settings' ) ) {
291
+ return;
292
+ }
293
+
294
+ // Warning about AJAX product filter plugins
295
+ self::iz_dismiss_ajax_product_filters( $w );
296
+
297
+ // Check if Jetpack Photon module is active
298
+ if ( defined( 'JETPACK__VERSION' ) && Jetpack::is_module_active( 'photon' ) ) {
299
+ $message = __( 'WP Image Zoom plugin is not compatible with the <a href="admin.php?page=jetpack">Jetpack Photon</a> module. If you find that the zoom is not working, try to deactivate the Photon module and see if that solves it.', 'wp-image-zoooom-pro' );
300
+ $w->add_notice( 'iz_dismiss_jetpack', $message );
301
+ }
302
+
303
+ // Warning about BWF settings
304
+ if ( is_plugin_active( 'bwp-minify/bwp-minify.php' ) ) {
305
+ $message = __( '<b>If the zoom does not show up</b> on your website, it could be because you need to add the “image_zoooom-init” and the “image_zoooom” to the “Scripts to NOT minify” option in the BWP Minify settings, as shown in <a href="https://www.silkypress.com/wp-content/uploads/2016/09/image-zoom-bwp.png" target="_blank">this screenshot</a>.', 'wp-image-zoooom-pro' );
306
+ $w->add_notice( 'iz_dismiss_bwp_minify', $message );
307
+ }
308
+
309
+ // Check if the Avada theme is active
310
+ if ( strpos( strtolower( get_template() ), 'avada' ) !== false && is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
311
+ $flexslider_url = 'https://woocommerce.com/flexslider/';
312
+ $pro_url = 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner';
313
+ $message = sprintf( __( 'The WP Image Zoom plugin <b>will not work</b> on the WooCommerce products gallery with the Avada theme. The Avada theme changes entirely the default WooCommerce gallery with the <a href="%1$s" target="_blank">Flexslider gallery</a> and the zoom plugin does not support the Flexslider gallery. Please check the <a href="%2$s" target="_blank">PRO version</a> of the plugin for compatibility with the Flexslider gallery.', 'wp-image-zoooom' ), $flexslider_url, $pro_url );
314
+ $w->add_notice( 'iz_dismiss_avada', $message );
315
+ }
316
+
317
+ // Check if the Shopkeeper theme is active
318
+ if ( strpos( strtolower( get_template() ), 'shopkeeper' ) !== false && is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
319
+ $pro_url = 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner';
320
+ $message = sprintf( __( 'The WP Image Zoom plugin <b>will not work</b> on the WooCommerce products gallery with the Shopkeeper theme. The Shopkeeper theme changes entirely the default WooCommerce gallery with a custom made gallery not supported by the free version of the WP Image Zoom plugin. Please check the <a href="%1$s" target="_blank">PRO version</a> of the plugin for compatibility with the Shopkeeper\'s gallery.', 'wp-image-zoooom' ), $pro_url );
321
+ $w->add_notice( 'iz_dismiss_shopkeeper', $message, 'updated settings-error notice is-dismissible' );
322
+ }
323
+
324
+ // Check if the Bridge theme is active
325
+ if ( strpos( strtolower( get_template() ), 'bridge' ) !== false && is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
326
+ $message = __( 'The <b>Bridge</b> theme replaces the default WooCommerce product gallery with its own. The <b>WP Image Zoom</b> plugin will not work with this replaced gallery. But if you set the "Enable Default WooCommerce Product Gallery Features" option to "Yes" on the <a href="' . admin_url( 'admin.php?page=qode_theme_menu_tab_woocommerce' ) . '">WP Admin -> Qode Options -> WooCommerce</a> page, then the zoom will work as expected on the product gallery.', 'wp-image-zoooom' );
327
+ // Note: This works for Bridge 16.7, but not for Bridge 14.1
328
+ $w->add_notice( 'iz_dismiss_bridge', $message, 'updated settings-error notice is-dismissible' );
329
+ }
330
+
331
+ // Warning about WooSwipe plugin
332
+ if ( is_plugin_active( 'wooswipe/wooswipe.php' ) ) {
333
+ $pro_url = 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner';
334
+ $wooswipe_url = 'https://wordpress.org/plugins/wooswipe/';
335
+ $message = sprintf( __( 'WP Image Zoom plugin is <b>not compatible with the <a href="%1$s">WooSwipe WooCommerce Gallery</a> plugin</b>. You can try the zoom plugin with the default WooCommerce gallery by deactivating the WooSwipe plugin. Alternatively, you can upgrade to the WP Image Zoom Pro version, where the issue with the WooSwipe plugin is fixed.' ), $wooswipe_url, $pro_url );
336
+ $w->add_notice( 'iz_dismiss_wooswipe', $message );
337
+ }
338
+
339
+ // Check if the Avada theme is active and the WooCommerce plugin installed
340
+ if ( strpos( strtolower( get_template() ), 'avada' ) !== false && is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
341
+ $avada_options = get_option( 'fusion_options' );
342
+ if ( isset( $avada_options['disable_woo_gallery'] ) && $avada_options['disable_woo_gallery'] == '1' ) {
343
+ $message = __( '<b>The zoom will work</b> on the WooCommerce products images only when having the <b>"Avada\'s WooCommerce Product Gallery Slider"</b> option <b>turned off</b> on the <a href="' . admin_url( 'themes.php?page=avada_options' ) . '">WP Admin -> Avada -> Theme Options -> WooCommerce -> General WooCommerce</a> page' );
344
+ $w->add_notice( 'iz_dismiss_avada_woo_gallery', $message );
345
+ }
346
+ }
347
+
348
+ $w->show_warnings();
349
+ }
350
+
351
+
352
+ /**
353
+ * Warning about AJAX product filter plugins
354
+ */
355
+ public static function iz_dismiss_ajax_product_filters( $w ) {
356
+ $continue = false;
357
+
358
+ $general = get_option( 'zoooom_general' );
359
+ if ( isset( $_POST['tab'] ) ) {
360
+ $general['woo_cat'] = ( isset( $_POST['woo_cat'] ) ) ? true : false;
361
+ }
362
+ if ( ! isset( $general['woo_cat'] ) || $general['woo_cat'] != true ) {
363
+ return false;
364
+ }
365
+
366
+ if ( is_plugin_active( 'woocommerce-ajax-filters/woocommerce-filters.php' ) ) {
367
+ $continue = true;
368
+ }
369
+ if ( is_plugin_active( 'load-more-products-for-woocommerce/load-more-products.php' ) ) {
370
+ $continue = true;
371
+ }
372
+ if ( is_plugin_active( 'wc-ajax-product-filter/wcapf.php' ) ) {
373
+ $continue = true;
374
+ }
375
+
376
+ if ( ! $continue ) {
377
+ return false;
378
+ }
379
+
380
+ $article_url = 'https://www.silkypress.com/wp-image-zoom/zoom-woocommerce-category-page-ajax/';
381
+ $message = sprintf( __( 'You are using the zoom on WooCommerce shop pages in combination with a plugin that loads more products with AJAX (a product filter plugin or a "load more" products plugin). You\'ll notice that the zoom isn\'t applied after new products are loaded with AJAX. Please read <a href="%1$s" target="_blank">this article for a solution</a>.', 'wp-image-zoooom' ), $article_url );
382
+
383
+ $w->add_notice( 'iz_dismiss_ajax_product_filters', $message );
384
+ }
 
 
 
385
  }
 
 
 
includes/frm/class-form-fields.php ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Form_Fields. Render form fields out of an array.
4
+ *
5
+ * @class Form_Fields
6
+ * @package SilkyPressFrm
7
+ */
8
+
9
+ namespace SilkyPressFrm;
10
+
11
+ defined( 'ABSPATH' ) || exit;
12
+
13
+ if ( ! class_exists( '\SilkyPressFrm\Form_Fields' ) ) {
14
+ /**
15
+ * Form_Fields class.
16
+ */
17
+ class Form_Fields {
18
+
19
+ /**
20
+ * Fields description.
21
+ *
22
+ * @var array
23
+ */
24
+ private $fields = array();
25
+
26
+ /**
27
+ * Current field values.
28
+ *
29
+ * @var array
30
+ */
31
+ private $current_values = array();
32
+
33
+ /**
34
+ * Additional attributes.
35
+ *
36
+ * @var array
37
+ */
38
+ private $atts = array();
39
+
40
+ /**
41
+ * Validation error/info messages.
42
+ *
43
+ * @var array
44
+ */
45
+ private $messages = array();
46
+
47
+ /**
48
+ * Constructor.
49
+ *
50
+ * @param array $fields The field description array.
51
+ */
52
+ public function __construct( $fields = array() ) {
53
+ $this->fields = $fields;
54
+
55
+ // Default attributes.
56
+ $this->atts = array(
57
+ 'tooltip_img' => '',
58
+ 'section' => '',
59
+ 'label-class' => '',
60
+ 'disable_pro' => true,
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Add settings.
66
+ *
67
+ * @param string $var Variable.
68
+ * @param string $value Value.
69
+ */
70
+ public function add_setting( $var = '', $value = '' ) {
71
+ $this->atts[ $var ] = $value;
72
+ }
73
+
74
+ /**
75
+ * Set the $this->current_values array.
76
+ *
77
+ * @param array $values Current values.
78
+ */
79
+ public function set_current_values( $values = array() ) {
80
+ $this->current_values = $values;
81
+ }
82
+
83
+ /**
84
+ * Render all the fields.
85
+ *
86
+ * @param array $fields The fields to be rendered.
87
+ *
88
+ * @return string The rendered fields.
89
+ */
90
+ public function render( $fields = null ) {
91
+
92
+ $content = '';
93
+
94
+ $fields = ( null === $fields ) ? $this->fields : array();
95
+
96
+ if ( count( $fields ) === 0 ) {
97
+ return '';
98
+ }
99
+
100
+ foreach ( $fields as $_key => $_field ) {
101
+ if ( isset( $this->atts['section'] ) && $_field['section'] !== $this->atts['section'] ) {
102
+ continue;
103
+ }
104
+ $content .= $this->render_field( $_key, $_field );
105
+ }
106
+
107
+ return $content;
108
+ }
109
+
110
+ /**
111
+ * Render one field
112
+ *
113
+ * @param string $_key The field's id.
114
+ * @param array $_field The fields' description.
115
+ *
116
+ * @return string The rendered field.
117
+ */
118
+ public function render_field( $_key, $_field ) {
119
+ $atts = '';
120
+ $description = '';
121
+ $label = '';
122
+ $input_values = '';
123
+ $add_label = true;
124
+ $group_wrap = true;
125
+
126
+ if ( 'header' === $_field['input_form'] || isset( $_field['no_wrap'] ) ) {
127
+ $add_label = true;
128
+ $group_wrap = false;
129
+ }
130
+
131
+ $_field['value'] = isset( $this->current_values[ $_key ] ) ? $this->current_values[ $_key ] : $_field['value'];
132
+
133
+ $_field['disabled'] = ( $this->atts['disable_pro'] && isset( $_field['pro'] ) && $_field['pro'] ) ? true : false;
134
+
135
+ $atts .= ( isset( $_field['disabled'] ) && $_field['disabled'] ) ? ' disabled' : '';
136
+
137
+ $atts .= ( 'checkbox' === $_field['input_form'] && true === (bool) $_field['value'] ) ? ' checked="checked"' : '';
138
+
139
+ // Radio templates.
140
+ if ( 'radio' === $_field['input_form'] ) {
141
+ foreach ( $_field['values'] as $__id => $__value ) {
142
+ $_style = isset( $_field['style'] ) && 'inline' === $_field['style'] ? '-inline' : '';
143
+ $input_atts = ( $__id === $_field['value'] ) ? $atts . ' checked=""' : $atts;
144
+ $input_values .= vsprintf(
145
+ '<div class="radio%s"%s><label><input type="radio" name="%s" id="%s" value="%s" %s />%s</label></div>',
146
+ array( $_style, $atts, $_key, $__id, $__id, $input_atts, $__value )
147
+ );
148
+ }
149
+ }
150
+
151
+ // Button templates.
152
+ if ( 'buttons' === $_field['input_form'] ) {
153
+ foreach ( $_field['values'] as $__id => $__value ) {
154
+ $toggle = ( ! empty( $__value[1] ) ) ? ' data-toggle="tooltip" data-placement="top" title="' . $__value[1] . '" data-original-title="' . $__value[1] . '"' : '';
155
+ $__atts = ( $__id === $_field['value'] ) ? ' active' : '';
156
+ $__atts .= ( $_field['disabled'] ) ? ' disabled' : '';
157
+
158
+ $input_values .= vsprintf(
159
+ '<label class="btn btn-default %s"><input type="radio" name="%s" id="%s" value="%s" %s /><div class="icon-in-label ndd-spot-icon icon-style-1"%s><div class="ndd-icon-main-element">%s</div></div></label>',
160
+ array( $__atts, $_key, $__id, $__id, $__id === $_field['value'] ? 'checked' : '', $toggle, $__value[0] )
161
+ );
162
+ }
163
+ }
164
+
165
+ // Input templates.
166
+ $templates = array(
167
+ 'text' => array( '%s', array( $_field['value'] ) ),
168
+ 'radio' => array( '%s', array( $input_values ) ),
169
+ 'buttons' => array( '<div class="btn-group%s" data-toggle="buttons" id="btn-group-style-circle">%s</div>', array( $atts, $input_values ) ),
170
+ 'input_color' => array(
171
+ '<input type="color" class="form-control" id="%s" name="%s" value="%s"%s /><span class="input-group-addon" id="color-text-color-hex">%s</span>',
172
+ array( $_key, $_key, esc_attr( $_field['value'] ), $atts, esc_attr( $_field['value'] ) ),
173
+ ),
174
+ 'input_text' => array(
175
+ '<input type="text" class="form-control" id="%s" name="%s" value="%s"%s />',
176
+ array( $_key, $_key, esc_attr( $_field['value'] ), $atts ),
177
+ ),
178
+ 'checkbox' => array(
179
+ '<input type="checkbox" id="%s" name="%s" value="1"%s />',
180
+ array( $_key, $_key, $atts ),
181
+ ),
182
+ 'header' => array(
183
+ '<h4 class="col-sm-5">%s</h4><div style="clear: both;"></div>',
184
+ array( $_field['label'] ),
185
+ ),
186
+ );
187
+
188
+ // The input.
189
+ $input = vsprintf(
190
+ $templates[ $_field['input_form'] ][0],
191
+ $templates[ $_field['input_form'] ][1]
192
+ );
193
+
194
+ // The description.
195
+ if ( isset( $_field['description'] ) && ! empty( $_field['description'] ) ) {
196
+ $description = vsprintf(
197
+ ' <img src="%s" data-toggle="tooltip" data-placement="top" title="%s" data-original-title="%s" />',
198
+ array( $this->atts['tooltip_img'], $_field['description'], $_field['description'] )
199
+ );
200
+ }
201
+
202
+ // The label.
203
+ $label_class = isset( $this->atts['label_class'] ) ? $this->atts['label_class'] : 'col-sm-6';
204
+ $label_class = isset( $_field['label_class'] ) ? $_field['label_class'] : $label_class;
205
+ if ( isset( $_field['label'] ) && $add_label ) {
206
+ $label = vsprintf(
207
+ '<label for="%s" class="%s">%s</label>',
208
+ array( $_key, 'control-label ' . $label_class, $_field['label'] . $description )
209
+ );
210
+ }
211
+
212
+ // The Bootstrap 4 form-group wrapper.
213
+ if ( $group_wrap ) {
214
+ $_field['disabled'] = ( $this->atts['disable_pro'] && isset( $_field['pro'] ) && $_field['pro'] ) ? true : false;
215
+ $class = ( isset( $_field['disabled'] ) && $_field['disabled'] ) ? ' disabled' : '';
216
+ $input = vsprintf(
217
+ '<div class="%s"%s>%s<div class="%s">%s</div></div>',
218
+ array( 'form-group' . $class, '', $label, 'input-group input-group-' . $_field['input_form'], $input )
219
+ );
220
+ }
221
+
222
+ return $input;
223
+ }
224
+
225
+ /**
226
+ * Validate the $_POST values.
227
+ *
228
+ * @param array $post The $_POST values.
229
+ */
230
+ public function validate( $post ) {
231
+
232
+ // Filter the $post array for allowed fields.
233
+ $post = array_intersect_key( $post, array_fill_keys( array_keys( $this->fields ), '' ) );
234
+
235
+ foreach ( $this->fields as $_key => $settings ) {
236
+
237
+ // Validate only fields from the current section.
238
+ if ( isset( $this->atts['section'] ) && $settings['section'] !== $this->atts['section'] ) {
239
+ if ( 'header' !== $settings['input_form'] && 'text' !== $settings['input_form'] && isset( $settings['value'] ) ) {
240
+ $post[ $_key ] = isset( $this->current_values[ $_key ] ) ? $this->current_values[ $_key ] : $settings['value'];
241
+ }
242
+ continue;
243
+ }
244
+
245
+ // Add the unchecked checkboxes.
246
+ if ( 'checkbox' === $settings['input_form'] ) {
247
+ $post[ $_key ] = isset( $post[ $_key ] ) ? true : false;
248
+ }
249
+
250
+ // Validate colors.
251
+ if ( 'input_color' === $settings['input_form'] && isset( $post[ $_key ] ) && ! preg_match( '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', $post[ $_key ] ) ) {
252
+ $reset = array(
253
+ /* translators: 1: field label 2: value */
254
+ __( 'Unrecognized %1$s. The value was reset to %2$s' ),
255
+ array( '<b>' . $settings['label'] . '</b>', '<b>' . $settings['value'] . '</b>' ),
256
+ );
257
+ }
258
+
259
+ // Sanitize text inputs.
260
+ if ( 'input_text' === $settings['input_form'] ) {
261
+ $post[ $_key ] = isset( $post[ $_key ] ) ? sanitize_text_field( $post[ $_key ] ) : $settings['value'];
262
+ }
263
+
264
+ // Validate button and radio inputs.
265
+ if ( in_array( $settings['input_form'], array( 'button', 'radio' ), true ) && isset( $post[ $_key ] ) && ! array_key_exists( $post[ $_key ], $settings['values'] ) ) {
266
+ $reset = array(
267
+ /* translators: 1: field label 2: value */
268
+ __( 'Unrecognized %1$s. The value was reset to %2$s' ),
269
+ array( '<b>' . $settings['label'] . '</b>', '<b>' . $settings['value'] . '</b>' ),
270
+ );
271
+ }
272
+
273
+ // Validate according to a rule.
274
+ if ( isset( $settings['validate'] ) && isset( $post[ $_key ] ) ) {
275
+ if ( 'int' === $settings['validate']['type'] ) {
276
+ $post[ $_key ] = (int) $post[ $_key ];
277
+ }
278
+ if ( 'float' === $settings['validate']['type'] ) {
279
+ $post[ $_key ] = (float) $post[ $_key ];
280
+ }
281
+
282
+ if ( ! is_numeric( $post[ $_key ] ) || $post[ $_key ] < $settings['validate']['range'][0] || $post[ $_key ] > $settings['validate']['range'][1] ) {
283
+ $reset = array(
284
+ /* translators: 1: field label 2: minimum value 3: maximum value 4: value */
285
+ __( '%1$s accepts values between %2$s and %3$s. Your value was reset to %4$s' ),
286
+ array( '<b>' . $settings['label'] . '</b>', $settings['validate']['range'][0], $settings['validate']['range'][1], '<b>' . $settings['value'] . '</b>' ),
287
+ );
288
+ }
289
+ }
290
+
291
+ // Reset the value and add the info message.
292
+ if ( isset( $reset ) ) {
293
+ $post[ $_key ] = $settings['value'];
294
+ $this->add_message( 'info', vsprintf( $reset[0] ), $reset[1] );
295
+ }
296
+ }
297
+ return $post;
298
+ }
299
+
300
+
301
+ /**
302
+ * Add messages.
303
+ *
304
+ * @param string $type The message type.
305
+ * @param string $message The message.
306
+ */
307
+ public function add_message( $type = '', $message ) {
308
+ $this->messages[] = array( $type, $message );
309
+ }
310
+
311
+ /**
312
+ * Render the messages.
313
+ *
314
+ * @return string Messages.
315
+ */
316
+ public function render_messages() {
317
+ if ( 0 === count( $this->messages ) ) {
318
+ return;
319
+ }
320
+
321
+ $output = '';
322
+ foreach ( $this->messages as $_message ) {
323
+ $output .= vsprintf(
324
+ '<div class="alert alert-%s"><button type="button" class="close" data-dismiss="alert">&times;</button>%s</div>',
325
+ array( $_message[0], $_message[1] )
326
+ );
327
+ }
328
+
329
+ $output = sprintf( '<div class="col-lg-12">%s</div>', $output );
330
+
331
+ return $output;
332
+ }
333
+ }
334
+ }
includes/frm/forms-helper.php DELETED
@@ -1,171 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit; // Exit if accessed directly
5
- }
6
-
7
- if ( !class_exists('SilkyPress_FormsHelper') ) {
8
- /**
9
- * SilkyPress_FormsHelper
10
- */
11
- class SilkyPress_FormsHelper {
12
-
13
- public $label_class = 'col-sm-3 control-label';
14
- public $non_label_class = 'col-sm-9';
15
- public $plugin_url = '';
16
-
17
- public function input( $type, $settings = array() ) {
18
- $allowed_types = array( 'text', 'radio', 'input_text', 'buttons', 'input_color', 'checkbox', 'header' );
19
-
20
- if ( ! in_array( $type, $allowed_types ) ) {
21
- return;
22
- }
23
- if ( !isset($settings['label'] )) return;
24
- if ( !isset($settings['name'] )) return;
25
- if ( isset($settings['disabled']) && $settings['disabled'] ) {
26
- $settings['disabled'] = ' disabled';
27
- } else {
28
- $settings['disabled'] = '';
29
- }
30
- call_user_func( array($this, $type), $settings );
31
- }
32
-
33
-
34
- public function text( $args = array() ) {
35
- if ( ! isset($args['value'] ) ) $args['value'] = '';
36
- if ( ! isset($args['description'] ) ) $args['description'] = '';
37
- ?>
38
- <div class="form-group<?php echo $args['disabled']; ?>">
39
- <?php echo $this->label( $args ); ?>
40
- <div class="input-group" style="width: auto;">
41
- <?php echo $args['value']; ?>
42
- </div>
43
- <?php $this->helpblock( $args ); ?>
44
- </div>
45
- <?php
46
- }
47
-
48
- public function radio($args = array(), $inline = false) {
49
- if ( !isset($args['values'] ) || count($args['values']) == 0 ) return;
50
- if ( !isset($args['value'] ) ) $args['value'] = '';
51
- if ( !isset($args['style'] ) ) $args['style'] = '';
52
- if ( !isset($args['active'] ) ) $args['active'] = '';
53
- ?>
54
- <div class="form-group<?php if(!empty($args['disabled'])) echo ' disabled-short'; ?>">
55
- <?php echo $this->label( $args ); ?>
56
- <div class="<?php echo $this->non_label_class; ?>">
57
- <?php foreach ($args['values'] as $_id => $_label) : ?>
58
- <div class="radio<?php if($args['style'] == 'inline') echo '-inline'; ?><?php echo $args['disabled'] ?>">
59
- <label>
60
- <input type="radio" name="<?php echo $args['name'] ?>" id="<?php echo $_id ?>" value="<?php echo $_id ?>" <?php echo ($_id == $args['value']) ? 'checked=""' : ''; echo $args['disabled']; ?>>
61
- <?php echo $_label ?>
62
- </label>
63
- </div>
64
- <?php endforeach; ?>
65
- <?php $this->helpblock( $args ); ?>
66
- </div>
67
- </div>
68
- <?php
69
- }
70
-
71
- public function input_text( $args = array() ) {
72
- if ( ! isset($args['value'] ) ) $args['value'] = '';
73
- if ( ! isset($args['description'] ) ) $args['description'] = '';
74
- ?>
75
- <div class="form-group<?php echo $args['disabled']; ?>">
76
- <?php echo $this->label( $args ); ?>
77
- <div class="input-group">
78
- <input type="text" class="form-control" id="<?php echo $args['name']?>" name="<?php echo $args['name'] ?>" value="<?php echo $args['value'] ?>"<?php echo $args['disabled']; ?> />
79
- <?php if (isset($args['post_input'])) : ?><span class="input-group-addon"><?php echo $args['post_input'] ?></span><?php endif; ?>
80
- </div>
81
- <?php $this->helpblock( $args ); ?>
82
- </div>
83
- <?php
84
- }
85
-
86
-
87
- public function input_color( $args = array() ) {
88
- if ( ! isset($args['value'] ) ) $args['value'] = '';
89
- ?>
90
- <div class="form-group<?php echo $args['disabled']; ?>">
91
- <?php echo $this->label( $args ); ?>
92
- <div class="input-group">
93
- <input type="color" class="form-control" id="<?php echo $args['name'] ?>" name="<?php echo $args['name'] ?>" value="<?php echo $args['value'] ?>"<?php echo $args['disabled']; ?> />
94
- <span class="input-group-addon" id="color-text-color-hex"><?php echo $args['value'] ?></span>
95
- </div>
96
- <?php $this->helpblock( $args ); ?>
97
- </div>
98
-
99
- <?php
100
- }
101
-
102
- public function checkbox( $args = array() ) {
103
- if ( ! isset($args['value'] ) ) $args['value'] = false;
104
- ?>
105
- <div class="form-group<?php echo $args['disabled']; ?>">
106
- <?php echo $this->label( $args ); ?>
107
- <div class="input-group">
108
- <label>
109
- <input type="checkbox" id="<?php echo $args['name'] ?>" name="<?php echo $args['name'] ?>" <?php echo ($args['value'] == true) ? 'checked=""' : '' ?><?php echo $args['disabled'] ?> />
110
- </label>
111
- </div>
112
- <?php $this->helpblock( $args ); ?>
113
- </div>
114
- <?php
115
- }
116
-
117
- public function header( $args = array() ) {
118
- ?>
119
- <h4 class="col-sm-5"><?php echo $args['label']; ?></h4><div style="clear: both;"></div>
120
- <?php
121
- }
122
-
123
- public function buttons( $args = array() ) {
124
- if ( ! isset($args['values'] ) || count($args['values']) == 0 ) return;
125
- if ( ! isset($args['value'] ) ) $args['value'] = '';
126
- if ( ! isset($args['style'] ) ) $args['style'] = '';
127
- ?>
128
- <div class="form-group<?php if(!empty($args['disabled'])) echo ' disabled-short'; ?>">
129
- <?php echo $this->label( $args ); ?>
130
- <div class="btn-group <?php echo $args['disabled'] ?>" data-toggle="buttons" id="btn-group-style-circle">
131
- <?php foreach( $args['values'] as $_id => $_value ) : ?>
132
- <?php $tooltip = (!empty($_value[1])) ? ' data-toggle="tooltip" data-placement="top" title="'.$_value[1].'" data-original-title="' . $_value[1] . '"' : ''; ?>
133
- <label class="btn btn-default<?php echo ($args['value'] == $_id) ? ' active' : '' ?> "<?php echo $args['disabled'] ?>>
134
- <input type="radio" name="<?php echo $args['name'] ?>" id="<?php echo $_id ?>" value="<?php echo $_id ?>" <?php echo ($args['value'] == $_id) ? 'checked' : '' ?> />
135
- <div class="icon-in-label ndd-spot-icon icon-style-1" <?php echo $tooltip; ?>>
136
- <div class="ndd-icon-main-element">
137
- <?php if($args['style'] == 'full') : ?>
138
- <?php echo $_value[0];?>
139
- <?php else : ?>
140
- <img src="<?php echo $this->plugin_url . 'assets' . $_value[0] ?>" />
141
- <?php endif; ?>
142
- </div>
143
- </div>
144
- </label>
145
- <?php endforeach; ?>
146
- <?php $this->helpblock( $args ); ?>
147
- </div>
148
- </div>
149
- <?php
150
- }
151
-
152
- public function label( $args = array() ) {
153
- $output = '<label for="'.$args['name'].'" class="'.$this->label_class.'">'.$args['label'];
154
- if ( isset ( $args['description'] ) && !empty( $args['description'] ) ) {
155
- $output .= ' <img src="'.$this->plugin_url.'assets/images/question_mark.svg" data-toggle="tooltip" data-placement="top" title="'.$args['description'].'" data-original-title="'.$args['description'].'" />';
156
- }
157
- $output .= '</label>' . "\n";
158
- return $output;
159
- }
160
-
161
- public function helpblock( $args = array() ) {
162
- return true;
163
- if ($args['disabled'] == ' disabled' && isset($args['description']) ) { ?>
164
- <span class="help-block"><?php echo $args['description'] ?></span>
165
- <?php }
166
- }
167
-
168
- }
169
- }
170
-
171
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/image-zoom-admin-general.php DELETED
@@ -1,132 +0,0 @@
1
- <?php
2
-
3
- require_once 'frm/forms-helper.php';
4
-
5
- $iz_admin = new ImageZoooom_Admin;
6
- $iz_forms_helper = new SilkyPress_FormsHelper;
7
- $iz_forms_helper->plugin_url = IMAGE_ZOOM_URL;
8
-
9
- $assets_url = IMAGE_ZOOM_URL . '/assets';
10
-
11
- $settings = get_option('zoooom_general');
12
- if ( $settings == false ) {
13
- $settings = $iz_admin->validate_general( null );
14
- }
15
-
16
- $messages = $iz_admin->show_messages();
17
-
18
- require_once( 'frm/premium-tooltips.php' );
19
- $message = __('Only available in <a href="%1$s" target="_blank">PRO version</a>', 'wp-image-zoooom');
20
- $message = wp_kses( $message, array('a' => array('href' => array(), 'target'=> array())));
21
- $message = sprintf( $message, 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner');
22
- new SilkyPress_PremiumTooltips($message);
23
-
24
- ?>
25
- <style type="text/css">
26
- .form-group { display:flex; align-items: center; }
27
- .control-label{ height: auto; }
28
- </style>
29
-
30
- <script type="text/javascript">
31
-
32
- jQuery(document).ready(function($) {
33
- $('[data-toggle="tooltip"]').tooltip();
34
- });
35
- </script>
36
-
37
- <?php add_thickbox(); ?>
38
- <div id="supported-lightboxes" style="display:none;">
39
- <p>
40
- The zoom is compatible with:
41
- <ul style="list-style: inside; padding-left: 20px;">
42
- <li>
43
- the lightbox created by the <a href="https://www.silkypress.com/i/wp-huge-it-gallery" target="_blank" rel="nofollow">Huge IT Gallery</a> plugin
44
- </li>
45
- <li>
46
- the lightbox created by the <a href="https://www.silkypress.com/i/wp-photo-gallery" target="_blank" rel="nofollow">Photo Gallery</a> plugin
47
- </li>
48
- <li>the iLightbox from the <a href="https://www.silkypress.com/i/avada-theme" target="_blank" rel="nofollow">Avada Theme</a></li>
49
- <li>the lightbox created by <a href="https://www.silkypress.com/i/jetpack-carousel" target="_blank" rel="nofollow">Carousel</a> from Jetpack</li>
50
- <li>the <a href="https://www.silkypress.com/i/js-prettyphoto" target="_blank" rel="nofollow">prettyPhoto</a> lightbox (also used by the <a href="https://www.silkypress.com/i/visual-composer" target="_blank" rel="nofollow">WPBakery</a> gallery)</li>
51
- <li>the <a href="https://www.silkypress.com/i/js-fancybox" target="_blank" rel="nofollow">fancyBox</a> lightbox (also used by the
52
- <a href="https://wordpress.org/plugins/easy-fancybox/" target="_blank" rel="nofollow">Easy Fancybox
53
- </a> or the <a href="https://wordpress.org/plugins/woocommerce-lightbox/" target="_blank" rel="nofollow">WooCommerce LightBox</a> plugin)</li>
54
- <li>the <a href="https://www.silkypress.com/i/js-featherlight" target="_blank" rel="nofollow">Featherlight.js</a> lightbox (also used by <a href="https://www.silkypress.com/i/wp-draw-attention" target="_blank" rel="nofollow">Draw Attention</a> plugin)</li>
55
- <li>the lightbox created by the Ultimate Product Catalogue by Etoile Web Design</li>
56
- <li>the <a href="http://dimsemenov.com/plugins/magnific-popup/" target="_blank" rel="nofollow">Magnific Popup</a> lightbox (also used by <a href="https://www.silkypress.com/i/enfold-theme" target="_blank" rel="nofollow">Enfold</a> portfolio items, the Divi gallery or the <a href="https://wordpress.org/plugins/beaver-builder-lite-version/" target="_blank">Beaver Builder</a>)</li>
57
- <li>the lightbox from the <a href="https://wordpress.org/plugins/elementor/" target="_blank" rel="nofollow">Elementor</a> Page Builder</li>
58
- <li>the lightbox from the <a href="https://lcweb.it/media-grid/bundle-pack" target="_blank" rel="nofollow">Media Grid - Bundle Pack</a></li>
59
- </ul>
60
- </p>
61
- </div>
62
-
63
-
64
- <?php $brand = '<img src="'. $assets_url.'/images/silkypress_logo.png" /> <a href="https://www.silkypress.com/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner" target="_blank">SilkyPress.com</a>';?>
65
- <h2><?php printf(esc_html__('WP Image Zoom by %1$s', 'wp-image-zoooom'), $brand); ?></h2>
66
-
67
- <div class="wrap">
68
-
69
-
70
- <h3 class="nav-tab-wrapper woo-nav-tab-wrapper">
71
-
72
- <a href="?page=zoooom_settings&tab=general" class="nav-tab nav-tab-active"><?php _e('General Settings', 'wp-image-zoooom'); ?></a>
73
-
74
- <a href="?page=zoooom_settings&tab=settings" class="nav-tab"><?php _e('Zoom Settings', 'wp-image-zoooom'); ?></a>
75
-
76
- </h3>
77
-
78
- <div class="panel panel-default">
79
- <div class="panel-body">
80
- <div class="row">
81
-
82
-
83
-
84
- <div class="col-lg-12">
85
- <?php echo $messages; ?>
86
- <div id="alert_messages">
87
- </div>
88
- </div>
89
-
90
-
91
-
92
-
93
- <form class="form-horizontal" method="post" action="" id="form_settings">
94
-
95
- <?php
96
- $iz_forms_helper->label_class = 'col-sm-6 control-label';
97
-
98
- $fields = array('enable_woocommerce', 'exchange_thumbnails', 'woo_cat', 'woo_variations', 'enable_mobile', 'remove_lightbox_thumbnails', 'remove_lightbox', 'force_attachments', 'custom_class', 'flexslider', 'owl', 'flickity', 'slick', 'huge_it_gallery', 'enable_lightbox_zoom' );
99
-
100
- if ( class_exists('woocommerce') && version_compare( WC_VERSION, '3.0', '>') ) {
101
- unset($fields[array_search('exchange_thumbnails', $fields)]);
102
- }
103
-
104
- foreach ( $fields as $_field ) {
105
- $this_settings = $iz_admin->get_settings( $_field);
106
- $this_settings['value'] = '';
107
- if ( isset( $settings[$_field] ) ) {
108
- $this_settings['value'] = $settings[$_field];
109
- }
110
- $iz_forms_helper->input($this_settings['input_form'], $this_settings);
111
- }
112
-
113
- ?>
114
-
115
- <div class="form-group">
116
- <div class="col-lg-6">
117
- <input type="hidden" name="tab" value="general" />
118
- <button type="submit" class="btn btn-primary"><?php _e('Save changes', 'wp-image-zoooom'); ?></button>
119
- </div>
120
- </div>
121
-
122
- <?php wp_nonce_field( 'iz_general' ); ?>
123
-
124
- </form>
125
-
126
-
127
- </div>
128
- </div>
129
- </div>
130
- </div>
131
-
132
- <?php include_once('right_columns.php'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/image-zoom-admin-template.php DELETED
@@ -1,205 +0,0 @@
1
- <?php
2
-
3
- require_once 'frm/forms-helper.php';
4
-
5
- $iz_admin = new ImageZoooom_Admin;
6
- $iz_forms_helper = new SilkyPress_FormsHelper;
7
- $iz_forms_helper->plugin_url = IMAGE_ZOOM_URL;
8
-
9
- $assets_url = IMAGE_ZOOM_URL . '/assets';
10
-
11
- $settings = get_option( 'zoooom_settings' );
12
- if ( $settings == false ) {
13
- $settings = $iz_admin->validate_settings( array() );
14
- }
15
- $messages = $iz_admin->show_messages();
16
-
17
- require_once( 'frm/premium-tooltips.php' );
18
- $message = __('Only available in <a href="%1$s" target="_blank">PRO version</a>', 'wp-image-zoooom');
19
- $message = wp_kses( $message, array('a' => array('href' => array(), 'target'=> array())));
20
- $message = sprintf( $message, 'https://www.silkypress.com/wp-image-zoom-plugin/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner');
21
- new SilkyPress_PremiumTooltips($message);
22
-
23
- ?>
24
-
25
- <?php $brand = '<img src="'. IMAGE_ZOOM_URL .'assets/images/silkypress_logo.png" /> <a href="https://www.silkypress.com/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner" target="_blank">SilkyPress.com</a>';?>
26
- <h2><?php printf(esc_html__('WP Image Zoom by %1$s', 'wp-image-zoooom'), $brand); ?></h2>
27
-
28
- <div class="wrap">
29
-
30
-
31
- <h3 class="nav-tab-wrapper woo-nav-tab-wrapper">
32
-
33
- <a href="?page=zoooom_settings&tab=general" class="nav-tab"><?php _e('General Settings', 'wp-image-zoooom'); ?></a>
34
-
35
- <a href="?page=zoooom_settings&tab=settings" class="nav-tab nav-tab-active"><?php _e('Zoom Settings', 'wp-image-zoooom'); ?></a>
36
-
37
- </h2>
38
-
39
- <div class="panel panel-default">
40
- <div class="panel-body">
41
- <div class="row">
42
-
43
-
44
- <?php echo $messages; ?>
45
- <div id="alert_messages">
46
- </div>
47
-
48
- <form class="form-horizontal" method="post" action="" id="form_settings">
49
-
50
- <div class="form-group">
51
- <?php echo load_steps(__('Step 1', 'wp-image-zoooom'), __('Choose the Lens Shape', 'wp-image-zoooom')); ?>
52
-
53
- <?php
54
- $lensShape = $iz_admin->get_settings( 'lensShape', $settings['lensShape']);
55
-
56
- $lensShape['value'] = $settings['lensShape'];
57
- if ( ! isset($lensShape['value'] ) ) $lensShape['value'] = '';
58
- ?>
59
- <div class="btn-group" data-toggle="buttons" id="btn-group-style-circle">
60
- <?php foreach( $lensShape['values'] as $_id => $_value ) : ?>
61
- <?php $toggle = ( ! empty($_value[1]) ) ? ' data-toggle="tooltip" data-placement="top" title="'.$_value[1].'" data-original-title="' . $_value[1] . '"' : ''; ?>
62
- <label class="btn btn-default<?php echo ($lensShape['value'] == $_id) ? ' active' : '' ?> ">
63
- <input type="radio" name="<?php echo $lensShape['name'] ?>" id="<?php echo $_id ?>" value="<?php echo $_id ?>" <?php echo ($lensShape['value'] == $_id) ? 'checked' : '' ?> />
64
- <div class="icon-in-label ndd-spot-icon icon-style-1"<?php echo $toggle; ?>>
65
- <div class="ndd-icon-main-element">
66
- <?php echo $_value[0]; ?>
67
- </div>
68
- </div>
69
- </label>
70
- <?php endforeach; ?>
71
- </div>
72
-
73
- <div style="clear: both; margin-bottom: 50px;"></div>
74
-
75
-
76
- <?php echo load_steps(__('Step 2', 'wp-image-zoooom'), __('Check your configuration changes on the image', 'wp-image-zoooom')); ?>
77
- <img id="demo" src="<?php echo $assets_url ?>/images/img1_medium.png" data-zoom-image="<?php echo $assets_url ?>/images/img1_large.png" width="300" />
78
-
79
-
80
- <div style="clear: both; margin-bottom: 50px;"></div>
81
-
82
- <?php echo load_steps(__('Step 3', 'wp-image-zoooom'), __('Make more fine-grained configurations on the zoom', 'wp-image-zoooom')); ?>
83
- <ul class="nav nav-tabs">
84
- <li class="" id="tab_padding" style="width: 40px;"> &nbsp; </li>
85
- <li class="active" id="tab_general">
86
- <a href="#general_settings" data-toggle="tab" aria-expanded="true"><?php _e('General', 'wp-image-zoooom'); ?></a>
87
- </li>
88
- <li class="" id="tab_lens">
89
- <a href="#lens_settings" data-toggle="tab" aria-expanded="false"><?php _e('Lens', 'wp-image-zoooom'); ?></a>
90
- </li>
91
- <li class="" id="tab_zoom_window">
92
- <a href="#zoom_window_settings" data-toggle="tab" aria-expanded="false"><?php _e('Zoom Window', 'wp-image-zoooom'); ?></a>
93
- </li>
94
- </ul>
95
-
96
- <div class="tab-content">
97
- <div class="tab-pane fade active in" id="general_settings">
98
- <?php
99
-
100
- foreach ( array('cursorType', 'zwEasing', 'onClick', 'ratio' ) as $_field ) {
101
- $this_settings = $iz_admin->get_settings( $_field);
102
- $this_settings['value'] = '';
103
- if ( isset( $settings[$_field] ) ) {
104
- $this_settings['value'] = $settings[$_field];
105
- }
106
- $iz_forms_helper->label_class = 'col-sm-4 control-label';
107
- $iz_forms_helper->non_label_class = 'col-sm-8';
108
- $iz_forms_helper->input($this_settings['input_form'], $this_settings);
109
- }
110
- ?>
111
-
112
- </div>
113
- <div class="tab-pane fade" id="lens_settings">
114
- <?php
115
-
116
- $fields = array(
117
- 'lensSize',
118
- 'lensColour',
119
- 'lensOverlay',
120
- 'borderThickness',
121
- 'borderColor',
122
- 'lensFade',
123
- 'tint',
124
- 'tintColor',
125
- 'tintOpacity',
126
- );
127
-
128
- foreach ( $fields as $_field ) {
129
- $this_settings = $iz_admin->get_settings( $_field);
130
- $this_settings['value'] = '';
131
- if ( isset( $settings[$_field] ) ) {
132
- $this_settings['value'] = $settings[$_field];
133
- }
134
- $iz_forms_helper->input($this_settings['input_form'], $this_settings);
135
- }
136
-
137
- ?>
138
- </div>
139
-
140
- <div class="tab-pane fade" id="zoom_window_settings">
141
- <?php
142
-
143
- $fields = array(
144
- 'zwWidth',
145
- 'zwHeight',
146
- 'zwResponsive',
147
- 'zwResponsiveThreshold',
148
- 'zwPositioning',
149
- 'zwPadding',
150
- 'zwBorderThickness',
151
- 'zwBorderColor',
152
- 'zwShadow',
153
- 'zwBorderRadius',
154
- 'mousewheelZoom',
155
- 'zwFade',
156
- );
157
-
158
- foreach ( $fields as $_field ) {
159
- $this_settings = $iz_admin->get_settings( $_field);
160
- $this_settings['value'] = '';
161
- if ( isset( $settings[$_field] ) ) {
162
- $this_settings['value'] = $settings[$_field];
163
- }
164
- $iz_forms_helper->input($this_settings['input_form'], $this_settings);
165
- }
166
-
167
- ?>
168
- </div>
169
-
170
- </div><!-- close "tab-content" -->
171
-
172
-
173
- <?php echo load_steps(__('Step 4', 'wp-image-zoooom'), __('Don\'t forget to save the changes in order to apply them on the website', 'wp-image-zoooom')); ?>
174
- <div class="form-group">
175
- <div class="col-lg-6">
176
- <button type="submit" class="btn btn-primary"><?php _e('Save changes', 'wp-image-zoooom'); ?></button>
177
- </div>
178
- </div>
179
-
180
- </div><!-- close "form-group" -->
181
-
182
- <?php wp_nonce_field( 'iz_template' ); ?>
183
- </form>
184
-
185
-
186
- </div>
187
- </div>
188
- </div>
189
-
190
-
191
- </div><!-- close wrap -->
192
-
193
-
194
- <?php include_once('right_columns.php'); ?>
195
-
196
- <?php
197
-
198
- function load_steps($step, $description) {
199
- return '<div class="steps">
200
- <span class="steps_nr">'. $step .':</span>
201
- <span class="steps_desc">' . $description . '</span>
202
- </div>' . "\n";
203
- }
204
-
205
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/settings.php CHANGED
@@ -1,383 +1,370 @@
1
  <?php
2
 
3
- if (!function_exists('wp_image_zoooom_settings')) {
4
- function wp_image_zoooom_settings($type) {
5
 
6
- $l = 'wp-image-zoooom';
 
7
 
8
- $plugin = array(
9
- 'plugin_name' => 'WP Image Zoom',
10
- 'plugin_file' => str_replace('includes/settings.php', 'image-zoooom.php', __FILE__),
11
- 'plugin_server' => 'https://www.silkypress.com',
12
- 'author' => 'Diana Burduja',
13
- 'testing' => false,
14
- );
15
- if ($type == 'plugin') return $plugin;
16
 
17
- $settings = array(
18
- 'lensShape' => array(
19
- 'label' => __('Lens Shape', $l),
20
- 'values' => array(
21
- 'none' => array('<i class="icon-lens_shape_none"></i>', __('No Lens', $l)),
22
- 'round' => array('<i class="icon-lens_shape_circle"></i>', __('Circle Lens', $l)),
23
- 'square' => array('<i class="icon-lens_shape_square"></i>', __('Square Lens', $l)),
24
- 'zoom_window' => array('<i class="icon-type_zoom_window"></i>', __('With Zoom Window', $l)),
25
- ),
26
- 'value' => 'zoom_window',
27
- 'input_form' => 'buttons',
28
- 'style' => 'full',
29
- ),
30
- 'cursorType' => array(
31
- 'label' => __('Cursor Type', $l),
32
- 'values' => array(
33
- 'default' => array('<i class="icon-cursor_type_default"></i>', __('Default', $l ) ),
34
- 'pointer' => array('<i class="icon-cursor_type_pointer"></i>', __('Pointer', $l ) ),
35
- 'crosshair' => array('<i class="icon-cursor_type_crosshair"></i>', __('Crosshair', $l ) ),
36
- 'zoom-in' => array('<i class="icon-zoom-in"></i>', __('Zoom', $l ) ),
37
- ),
38
- 'value' => 'default',
39
- 'input_form' => 'buttons',
40
- 'style' => 'full',
41
- ),
42
- 'zwEasing' => array(
43
- 'label' => __('Animation Easing Effect', $l ),
44
- 'value' => 12,
45
- 'description' => __('A number between 0 and 200 to represent the degree of the Animation Easing Effect', $l ),
46
- 'input_form' => 'input_text',
47
- ),
 
 
 
 
48
 
49
- 'lensSize' => array(
50
- 'label' => __('Lens Size', $l ),
51
- 'post_input' => 'px',
52
- 'value' => 200,
53
- 'description' => __('For Circle Lens it means the diameters, for Square Lens it means the width', $l ),
54
- 'input_form' => 'input_text',
55
- ),
56
- 'borderThickness' => array(
57
- 'label' => __('Border Thickness', $l ),
58
- 'post_input' => 'px',
59
- 'value' => 1,
60
- 'input_form' => 'input_text',
61
- ),
62
- 'borderColor' => array(
63
- 'label' => __('Border Color', $l ),
64
- 'value' => '#ffffff',
65
- 'input_form' => 'input_color',
66
- ),
67
- 'lensFade' => array(
68
- 'label' => __('Fade Time', $l ),
69
- 'post_input' => 'sec',
70
- 'value' => 0.5,
71
- 'description' => __('The amount of time it takes for the Lens to slowly appear or disappear', $l),
72
- 'input_form' => 'input_text',
73
- ),
74
- 'tint' => array(
75
- 'label' => __('Tint', $l),
76
- 'value' => true,
77
- 'description' => __('A color that will layed on top the of non-magnified image in order to emphasize the lens', $l),
78
- 'input_form' => 'checkbox',
79
- ),
80
- 'tintColor' =>array(
81
- 'label' => __('Tint Color', $l),
82
- 'value' => '#ffffff',
83
- 'input_form' => 'input_color',
84
- ),
85
- 'tintOpacity' => array(
86
- 'label' => __('Tint Opacity', $l),
87
- 'value' => '0.1',
88
- 'post_input' => '%',
89
- 'input_form' => 'input_text',
90
- ),
91
- 'zwWidth' => array(
92
- 'label' => __('Zoom Window Width', $l),
93
- 'post_input' => 'px',
94
- 'value' => 400,
95
- 'input_form' => 'input_text',
96
- ),
97
- 'zwHeight' => array(
98
- 'label' => __('Zoom Window Height', $l),
99
- 'post_input' => 'px',
100
- 'value' => 360,
101
- 'input_form' => 'input_text',
102
- ),
103
- 'zwPadding' => array(
104
- 'label' => __('Distance from the Main Image', $l),
105
- 'post_input' => 'px',
106
- 'value' => 10,
107
- 'input_form' => 'input_text',
108
- ),
109
- 'zwBorderThickness' => array(
110
- 'label' => __('Border Thickness', $l),
111
- 'post_input' => 'px',
112
- 'value' => 1,
113
- 'input_form' => 'input_text',
114
- ),
115
- 'zwShadow' => array(
116
- 'label' => __('Shadow Thickness', $l),
117
- 'post_input' => 'px',
118
- 'value' => 4,
119
- 'input_form' => 'input_text',
120
- 'description' => __('Use 0px to remove the shadow', $l),
121
- ),
122
- 'zwBorderColor' => array(
123
- 'label' => __('Border Color', $l),
124
- 'value' => '#888888',
125
- 'input_form' => 'input_color',
126
- ),
127
- 'zwBorderRadius' => array(
128
- 'label' => __('Rounded Corners', $l),
129
- 'post_input' => 'px',
130
- 'value' => 0,
131
- 'input_form' => 'input_text',
132
- ),
133
- 'zwFade' => array(
134
- 'label' => __('Fade Time', $l),
135
- 'post_input' => 'sec',
136
- 'value' => 0.5,
137
- 'description' => __('The amount of time it takes for the Zoom Window to slowly appear or disappear', $l),
138
- 'input_form' => 'input_text',
139
- ),
140
- 'enable_woocommerce' => array(
141
- 'label' => __('Enable the zoom on WooCommerce products', $l),
142
- 'value' => true,
143
- 'input_form' => 'checkbox',
144
- ),
145
- 'exchange_thumbnails' => array(
146
- 'label' => __('Exchange the thumbnail with main image on WooCommerce products', $l),
147
- 'value' => true,
148
- 'input_form' => 'checkbox',
149
- 'description' => __('On a WooCommerce gallery, when clicking on a thumbnail, not only the main image will be replaced with the thumbnail\'s image, but also the thumbnail will be replaced with the main image', $l),
150
- ),
151
- 'enable_mobile' => array(
152
- 'label' => __('Enable the zoom on mobile devices', $l),
153
- 'value' => false,
154
- 'input_form' => 'checkbox',
155
- 'description' => __('Tablets are also considered mobile devices'),
156
- ),
157
- 'woo_cat' => array(
158
- 'label' => __('Enable the zoom on WooCommerce category pages', $l),
159
- 'value' => false,
160
- 'input_form' => 'checkbox',
161
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
- 'force_woocommerce' => array(
164
- 'label' => __('Force it to work on WooCommerce', $l),
165
- 'value' => true,
166
- 'input_form' => 'checkbox',
167
- ),
168
- );
169
- if ($type == 'settings') return $settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
 
171
-
172
- $pro_fields = array(
173
- 'remove_lightbox_thumbnails' => array(
174
- 'label' => __('Remove the Lightbox on thumbnail images', $l),
175
- 'value' => false,
176
- 'pro' => true,
177
- 'input_form' => 'checkbox',
178
- 'description' => __('Some themes implement a Lightbox for WooCommerce galleris that opens on click. Enabling this checkbox will remove the Lightbox on thumbnail images and leave it only on the main image', 'wp-image-zoooom'),
179
- 'disabled' => true,
180
- ),
181
- 'remove_lightbox' => array(
182
- 'label' => __('Remove the Lightbox', $l),
183
- 'value' => false,
184
- 'pro' => true,
185
- 'input_form' => 'checkbox',
186
- 'description' => __('Some themes implement a Lightbox that opens on click on the image. Enabling this checkbox will remove the Lightbox'),
187
- 'disabled' => true,
188
- ),
189
- 'woo_variations' => array(
190
- 'label' => __('Enable on WooCommerce variation products', $l),
191
- 'value' => false,
192
- 'pro' => true,
193
- 'input_form' => 'checkbox',
194
- 'disabled' => true,
195
- ),
196
- 'force_attachments' => array(
197
- 'label' => __('Enable on attachments pages', $l),
198
- 'value' => false,
199
- 'pro' => true,
200
- 'input_form' => 'checkbox',
201
- 'disabled' => true,
202
- ),
203
- 'custom_class' => array(
204
- 'label' => __('Apply zoom on this particular image(s)', $l),
205
- 'value' => '',
206
- 'pro' => true,
207
- 'input_form' => 'input_text',
208
- 'description' => __('CSS style selector(s) for identifying the image(s) on which to apply the zoom.', $l ),
209
- 'disabled' => true,
210
- ),
211
- 'flexslider' => array(
212
- 'label' => __('FlexSlider container class', $l),
213
- 'value' => '',
214
- 'pro' => true,
215
- 'input_form' => 'input_text',
216
- 'disabled' => true,
217
- ),
218
- 'owl' => array(
219
- 'label' => __('<a href="https://www.silkypress.com/i/js-owl" target="_blank">Owl Carousel</a> container class', $l),
220
- 'value' => '',
221
- 'input_form' => 'input_text',
222
- 'pro' => true,
223
- 'description' => __('If the images are in a Owl Carousel gallery, then type in here the class of the div containing the Owl Carousel gallery', $l ),
224
- 'disabled' => true,
225
- ),
226
- 'flickity' => array(
227
- 'label' => __('<a href="https://flickity.metafizzy.co/" target="_blank">Flickity Carousel</a> container class', $l),
228
- 'value' => '',
229
- 'input_form' => 'input_text',
230
- 'pro' => true,
231
- 'description' => __('If the images are in a Flickity Carousel gallery, then type in here the class of the div containing the Flickity Carousel gallery', $l ),
232
- 'disabled' => true,
233
- ),
234
- 'slick' => array(
235
- 'label' => __('<a href="https://kenwheeler.github.io/slick/" target="_blank">Slick carousel</a> container class', $l),
236
- 'value' => '',
237
- 'input_form' => 'input_text',
238
- 'description' => __('If the images are in a Slick carousel gallery, then type in here the class of the div containing the Slick carousel gallery', $l ),
239
- 'pro' => true,
240
- 'disabled' => true,
241
- ),
242
- 'huge_it_gallery' => array(
243
- 'label' => __('<a href="https://www.silkypress.com/i/wp-huge-it-gallery" target="_blank">Huge IT Gallery</a> id', $l),
244
- 'value' => '',
245
- 'pro' => true,
246
- 'input_form' => 'input_text',
247
- 'disabled' => true,
248
- ),
249
- 'enable_lightbox_zoom' => array(
250
- 'label' => __('Enable inside a Lightbox. <a href="#TB_inline?width=600&height=400&inlineId=supported-lightboxes" class="thickbox">See supported lightboxes</a>', $l),
251
- 'value' => false,
252
- 'pro' => true,
253
- 'input_form' => 'checkbox',
254
- 'disabled' => true,
255
- ),
256
- 'onClick' => array(
257
- 'label' => __('Enable the zoom on ...', $l),
258
- 'values' => array(
259
- 'false' => 'mouse hover',
260
- 'true' => 'mouse click',
261
- ),
262
- 'value' => 'false',
263
- 'input_form' => 'radio',
264
- 'pro' => true,
265
- 'disabled' => true,
266
- ),
267
- 'ratio' => array(
268
- 'label' => __('Zoom Level', $l),
269
- 'values' => array(
270
- 'default' => array( '<i class="icon-zoom_level_default"></i>', __('Default', $l) ),
271
- '1.5' => array( '<i class="icon-zoom_level_15"></i>', __('1,5 times', $l) ),
272
- '2' => array( '<i class="icon-zoom_level_2"></i>', __('2 times', $l) ),
273
- '2.5' => array( '<i class="icon-zoom_level_25"></i>', __('2,5 times', $l) ),
274
- '3' => array( '<i class="icon-zoom_level_3"></i>', __('3 times', $l) ),
275
- ),
276
- 'value' => 'default',
277
- 'input_form' => 'buttons',
278
- 'pro' => true,
279
- 'style' => 'full',
280
- 'disabled' => true,
281
- ),
282
- 'lensColour' => array(
283
- 'label' => __('Lens Color', $l ),
284
- 'value' => '#ffffff',
285
- 'pro' => true,
286
- 'input_form' => 'input_color',
287
- 'disabled' => true,
288
- ),
289
- 'lensOverlay' => array(
290
- 'label' => __('Show as Grid', $l ),
291
- 'value' => false,
292
- 'pro' => true,
293
- 'input_form' => 'checkbox',
294
- 'disabled' => true,
295
- ),
296
- 'zwResponsive' => array(
297
- 'label' => __('Responsive', $l),
298
- 'input_form' => 'checkbox',
299
- 'pro' => true,
300
- 'value' => false,
301
- 'disabled' => true,
302
- ),
303
- 'zwResponsiveThreshold' => array(
304
- 'label' => __('Responsive Threshold', $l),
305
- 'pro' => true,
306
- 'post_input' => 'px',
307
- 'value' => '',
308
- 'input_form' => 'input_text',
309
- 'disabled' => true,
310
- ),
311
- 'zwPositioning' => array(
312
- 'label' => __('Positioning', $l),
313
- 'values' => array(
314
- 'right_top' => array('<i class="icon-type_zoom_window_right_top"></i>', __('Right Top', $l)),
315
- 'right_bottom' => array('<i class="icon-type_zoom_window_right_bottom"></i>', __('Right Bottom', $l)),
316
- 'right_center' => array('<i class="icon-type_zoom_window_right_center"></i>', __('Right Center', $l)),
317
- 'left_top' => array('<i class="icon-type_zoom_window_left_top"></i>', __('Left Top', $l)),
318
- 'left_bottom' => array('<i class="icon-type_zoom_window_left_bottom"></i>', __('Left Bottom', $l)),
319
- 'left_center' => array('<i class="icon-type_zoom_window_left_center"></i>', __('Left Center', $l)),
320
- ),
321
- 'pro' => true,
322
- 'value' => '',
323
- 'disabled' => true,
324
- 'input_form' => 'buttons',
325
- 'style' => 'full',
326
- 'disabled' => true,
327
- ),
328
- 'mousewheelZoom' => array(
329
- 'label' => __('Mousewheel Zoom', $l),
330
- 'value' => '',
331
- 'pro' => true,
332
- 'input_form' => 'checkbox',
333
- 'disabled' => true,
334
- ),
335
- /*
336
- 'customText' => array(
337
- 'label' => __('Text on the image', $l),
338
- 'value' => __('', $l),
339
- 'input_form' => 'input_text',
340
- 'pro' => true,
341
- 'disabled' => true,
342
- ),
343
- 'customTextSize' => array(
344
- 'label' => __('Text Size', $l),
345
- 'post_input' => 'px',
346
- 'value' => '',
347
- 'input_form' => 'input_text',
348
- 'pro' => true,
349
- 'disabled' => true,
350
- ),
351
- 'customTextColor' => array(
352
- 'label' => __('Text Color', $l),
353
- 'value' => '',
354
- 'input_form' => 'input_color',
355
- 'pro' => true,
356
- 'disabled' => true,
357
- ),
358
- 'customTextAlign' => array(
359
- 'label' => __('Text Align', $l),
360
- 'values' => array(
361
- 'top_left' => array('<i class="icon-text_align_top_left"></i>', __('Top Left', $l ) ),
362
- 'top_center' => array('<i class="icon-text_align_top_center"></i>', __('Top Center', $l ) ),
363
- 'top_right' => array('<i class="icon-text_align_top_right"></i>', __('Top Right', $l ) ),
364
- 'bottom_left' => array('<i class="icon-text_align_bottom_left"></i>', __('Bottom Left', $l ) ),
365
- 'bottom_center' => array('<i class="icon-text_align_bottom_center"></i>', __('Bottom Center', $l ) ),
366
- 'bottom_right' => array('<i class="icon-text_align_bottom_right"></i>', __('Bottom Right', $l ) ),
367
- ),
368
- 'value' => '',
369
- 'input_form' => 'buttons',
370
- 'pro' => true,
371
- 'style' => 'full',
372
- 'disabled' => true,
373
- ),
374
- */
375
-
376
-
377
- );
378
- if ($type == 'pro_fields') return $pro_fields;
379
-
380
- }
381
  }
382
-
383
- ?>
1
  <?php
2
 
3
+ defined( 'ABSPATH' ) || exit;
 
4
 
5
+ if ( ! function_exists( 'wp_image_zoooom_settings' ) ) {
6
+ function wp_image_zoooom_settings() {
7
 
8
+ $l = 'wp-image-zoooom';
 
 
 
 
 
 
 
9
 
10
+ $settings = array(
11
+ 'lensShape' => array(
12
+ 'label' => __( 'Lens Shape', $l ),
13
+ 'values' => array(
14
+ 'none' => array( '<i class="icon-lens_shape_none"></i>', __( 'No Lens', $l ) ),
15
+ 'round' => array( '<i class="icon-lens_shape_circle"></i>', __( 'Circle Lens', $l ) ),
16
+ 'square' => array( '<i class="icon-lens_shape_square"></i>', __( 'Square Lens', $l ) ),
17
+ 'zoom_window' => array( '<i class="icon-type_zoom_window"></i>', __( 'With Zoom Window', $l ) ),
18
+ ),
19
+ 'value' => 'zoom_window',
20
+ 'input_form' => 'buttons',
21
+ 'style' => 'full',
22
+ 'section' => 'settings',
23
+ 'no_wrap' => true,
24
+ ),
25
+ 'cursorType' => array(
26
+ 'label' => __( 'Cursor Type', $l ),
27
+ 'values' => array(
28
+ 'default' => array( '<i class="icon-cursor_type_default"></i>', __( 'Default', $l ) ),
29
+ 'pointer' => array( '<i class="icon-cursor_type_pointer"></i>', __( 'Pointer', $l ) ),
30
+ 'crosshair' => array( '<i class="icon-cursor_type_crosshair"></i>', __( 'Crosshair', $l ) ),
31
+ 'zoom-in' => array( '<i class="icon-zoom-in"></i>', __( 'Zoom', $l ) ),
32
+ ),
33
+ 'value' => 'default',
34
+ 'input_form' => 'buttons',
35
+ 'style' => 'full',
36
+ 'section' => 'settings',
37
+ ),
38
+ 'zwEasing' => array(
39
+ 'label' => __( 'Animation Easing Effect', $l ),
40
+ 'value' => 12,
41
+ 'description' => __( 'A number between 0 and 200 to represent the degree of the Animation Easing Effect', $l ),
42
+ 'input_form' => 'input_text',
43
+ 'section' => 'settings',
44
+ ),
45
 
46
+ 'lensSize' => array(
47
+ 'label' => __( 'Lens Size', $l ),
48
+ 'post_input' => 'px',
49
+ 'value' => 200,
50
+ 'description' => __( 'For Circle Lens it means the diameters, for Square Lens it means the width', $l ),
51
+ 'input_form' => 'input_text',
52
+ 'section' => 'settings',
53
+ ),
54
+ 'borderThickness' => array(
55
+ 'label' => __( 'Border Thickness', $l ),
56
+ 'post_input' => 'px',
57
+ 'value' => 1,
58
+ 'input_form' => 'input_text',
59
+ 'section' => 'settings',
60
+ ),
61
+ 'borderColor' => array(
62
+ 'label' => __( 'Border Color', $l ),
63
+ 'value' => '#ffffff',
64
+ 'input_form' => 'input_color',
65
+ 'section' => 'settings',
66
+ ),
67
+ 'lensFade' => array(
68
+ 'label' => __( 'Fade Time', $l ),
69
+ 'post_input' => 'sec',
70
+ 'value' => 0.5,
71
+ 'description' => __( 'The amount of time it takes for the Lens to slowly appear or disappear', $l ),
72
+ 'input_form' => 'input_text',
73
+ 'section' => 'settings',
74
+ ),
75
+ 'tint' => array(
76
+ 'label' => __( 'Tint', $l ),
77
+ 'value' => true,
78
+ 'description' => __( 'A color that will layed on top the of non-magnified image in order to emphasize the lens', $l ),
79
+ 'input_form' => 'checkbox',
80
+ 'section' => 'settings',
81
+ ),
82
+ 'tintColor' => array(
83
+ 'label' => __( 'Tint Color', $l ),
84
+ 'value' => '#ffffff',
85
+ 'input_form' => 'input_color',
86
+ 'section' => 'settings',
87
+ ),
88
+ 'tintOpacity' => array(
89
+ 'label' => __( 'Tint Opacity', $l ),
90
+ 'value' => '0.1',
91
+ 'post_input' => '%',
92
+ 'input_form' => 'input_text',
93
+ 'section' => 'settings',
94
+ ),
95
+ 'zwWidth' => array(
96
+ 'label' => __( 'Zoom Window Width', $l ),
97
+ 'post_input' => 'px',
98
+ 'value' => 400,
99
+ 'input_form' => 'input_text',
100
+ 'section' => 'settings',
101
+ ),
102
+ 'zwHeight' => array(
103
+ 'label' => __( 'Zoom Window Height', $l ),
104
+ 'post_input' => 'px',
105
+ 'value' => 360,
106
+ 'input_form' => 'input_text',
107
+ 'section' => 'settings',
108
+ ),
109
+ 'zwPadding' => array(
110
+ 'label' => __( 'Distance from the Main Image', $l ),
111
+ 'post_input' => 'px',
112
+ 'value' => 10,
113
+ 'input_form' => 'input_text',
114
+ 'section' => 'settings',
115
+ ),
116
+ 'zwBorderThickness' => array(
117
+ 'label' => __( 'Border Thickness', $l ),
118
+ 'post_input' => 'px',
119
+ 'value' => 1,
120
+ 'input_form' => 'input_text',
121
+ 'section' => 'settings',
122
+ ),
123
+ 'zwShadow' => array(
124
+ 'label' => __( 'Shadow Thickness', $l ),
125
+ 'post_input' => 'px',
126
+ 'value' => 4,
127
+ 'input_form' => 'input_text',
128
+ 'description' => __( 'Use 0px to remove the shadow', $l ),
129
+ 'section' => 'settings',
130
+ ),
131
+ 'zwBorderColor' => array(
132
+ 'label' => __( 'Border Color', $l ),
133
+ 'value' => '#888888',
134
+ 'input_form' => 'input_color',
135
+ 'section' => 'settings',
136
+ ),
137
+ 'zwBorderRadius' => array(
138
+ 'label' => __( 'Rounded Corners', $l ),
139
+ 'post_input' => 'px',
140
+ 'value' => 0,
141
+ 'input_form' => 'input_text',
142
+ 'section' => 'settings',
143
+ ),
144
+ 'zwFade' => array(
145
+ 'label' => __( 'Fade Time', $l ),
146
+ 'post_input' => 'sec',
147
+ 'value' => 0.5,
148
+ 'description' => __( 'The amount of time it takes for the Zoom Window to slowly appear or disappear', $l ),
149
+ 'input_form' => 'input_text',
150
+ 'section' => 'settings',
151
+ ),
152
+ 'enable_woocommerce' => array(
153
+ 'label' => __( 'Enable the zoom on WooCommerce products', $l ),
154
+ 'value' => true,
155
+ 'input_form' => 'checkbox',
156
+ 'section' => 'general',
157
+ ),
158
+ 'exchange_thumbnails' => array(
159
+ 'label' => __( 'Exchange the thumbnail with main image on WooCommerce products', $l ),
160
+ 'value' => true,
161
+ 'input_form' => 'checkbox',
162
+ 'description' => __( 'On a WooCommerce gallery, when clicking on a thumbnail, not only the main image will be replaced with the thumbnail\'s image, but also the thumbnail will be replaced with the main image', $l ),
163
+ 'section' => 'general',
164
+ ),
165
+ 'enable_mobile' => array(
166
+ 'label' => __( 'Enable the zoom on mobile devices', $l ),
167
+ 'value' => false,
168
+ 'input_form' => 'checkbox',
169
+ 'description' => __( 'Tablets are also considered mobile devices' ),
170
+ 'section' => 'general',
171
+ ),
172
+ 'woo_cat' => array(
173
+ 'label' => __( 'Enable the zoom on WooCommerce category pages', $l ),
174
+ 'value' => false,
175
+ 'input_form' => 'checkbox',
176
+ 'section' => 'general',
177
+ ),
178
 
179
+ 'force_woocommerce' => array(
180
+ 'label' => __( 'Force it to work on WooCommerce', $l ),
181
+ 'value' => true,
182
+ 'input_form' => 'checkbox',
183
+ 'section' => 'general',
184
+ ),
185
+ 'remove_lightbox_thumbnails' => array(
186
+ 'label' => __( 'Remove the Lightbox on thumbnail images', $l ),
187
+ 'value' => false,
188
+ 'pro' => true,
189
+ 'input_form' => 'checkbox',
190
+ 'description' => __( 'Some themes implement a Lightbox for WooCommerce galleris that opens on click. Enabling this checkbox will remove the Lightbox on thumbnail images and leave it only on the main image', 'wp-image-zoooom' ),
191
+ 'disabled' => true,
192
+ 'section' => 'general',
193
+ ),
194
+ 'remove_lightbox' => array(
195
+ 'label' => __( 'Remove the Lightbox', $l ),
196
+ 'value' => false,
197
+ 'pro' => true,
198
+ 'input_form' => 'checkbox',
199
+ 'description' => __( 'Some themes implement a Lightbox that opens on click on the image. Enabling this checkbox will remove the Lightbox' ),
200
+ 'disabled' => true,
201
+ 'section' => 'general',
202
+ ),
203
+ 'woo_variations' => array(
204
+ 'label' => __( 'Enable on WooCommerce variation products', $l ),
205
+ 'value' => false,
206
+ 'pro' => true,
207
+ 'input_form' => 'checkbox',
208
+ 'disabled' => true,
209
+ 'section' => 'general',
210
+ ),
211
+ 'force_attachments' => array(
212
+ 'label' => __( 'Enable on attachments pages', $l ),
213
+ 'value' => false,
214
+ 'pro' => true,
215
+ 'input_form' => 'checkbox',
216
+ 'disabled' => true,
217
+ 'section' => 'general',
218
+ ),
219
+ 'custom_class' => array(
220
+ 'label' => __( 'Apply zoom on this particular image(s)', $l ),
221
+ 'value' => '',
222
+ 'pro' => true,
223
+ 'input_form' => 'input_text',
224
+ 'description' => __( 'CSS style selector(s) for identifying the image(s) on which to apply the zoom.', $l ),
225
+ 'disabled' => true,
226
+ 'section' => 'general',
227
+ ),
228
+ 'flexslider' => array(
229
+ 'label' => __( 'FlexSlider container class', $l ),
230
+ 'value' => '',
231
+ 'pro' => true,
232
+ 'input_form' => 'input_text',
233
+ 'disabled' => true,
234
+ 'section' => 'general',
235
+ ),
236
+ 'owl' => array(
237
+ 'label' => __( '<a href="https://www.silkypress.com/i/js-owl" target="_blank">Owl Carousel</a> container class', $l ),
238
+ 'value' => '',
239
+ 'input_form' => 'input_text',
240
+ 'pro' => true,
241
+ 'description' => __( 'If the images are in a Owl Carousel gallery, then type in here the class of the div containing the Owl Carousel gallery', $l ),
242
+ 'disabled' => true,
243
+ 'section' => 'general',
244
+ ),
245
+ 'flickity' => array(
246
+ 'label' => __( '<a href="https://flickity.metafizzy.co/" target="_blank">Flickity Carousel</a> container class', $l ),
247
+ 'value' => '',
248
+ 'input_form' => 'input_text',
249
+ 'pro' => true,
250
+ 'description' => __( 'If the images are in a Flickity Carousel gallery, then type in here the class of the div containing the Flickity Carousel gallery', $l ),
251
+ 'disabled' => true,
252
+ 'section' => 'general',
253
+ ),
254
+ 'slick' => array(
255
+ 'label' => __( '<a href="https://kenwheeler.github.io/slick/" target="_blank">Slick carousel</a> container class', $l ),
256
+ 'value' => '',
257
+ 'input_form' => 'input_text',
258
+ 'description' => __( 'If the images are in a Slick carousel gallery, then type in here the class of the div containing the Slick carousel gallery', $l ),
259
+ 'pro' => true,
260
+ 'disabled' => true,
261
+ 'section' => 'general',
262
+ ),
263
+ 'huge_it_gallery' => array(
264
+ 'label' => __( '<a href="https://www.silkypress.com/i/wp-huge-it-gallery" target="_blank">Huge IT Gallery</a> id', $l ),
265
+ 'value' => '',
266
+ 'pro' => true,
267
+ 'input_form' => 'input_text',
268
+ 'disabled' => true,
269
+ 'section' => 'general',
270
+ ),
271
+ 'enable_lightbox_zoom' => array(
272
+ 'label' => __( 'Enable inside a Lightbox. <a href="#TB_inline?width=600&height=400&inlineId=supported-lightboxes" class="thickbox">See supported lightboxes</a>', $l ),
273
+ 'value' => false,
274
+ 'pro' => true,
275
+ 'input_form' => 'checkbox',
276
+ 'disabled' => true,
277
+ 'section' => 'general',
278
+ ),
279
+ 'onClick' => array(
280
+ 'label' => __( 'Enable the zoom on ...', $l ),
281
+ 'values' => array(
282
+ 'false' => 'mouse hover',
283
+ 'true' => 'mouse click',
284
+ ),
285
+ 'value' => 'false',
286
+ 'input_form' => 'radio',
287
+ 'pro' => true,
288
+ 'disabled' => true,
289
+ 'section' => 'settings',
290
+ ),
291
+ 'ratio' => array(
292
+ 'label' => __( 'Zoom Level', $l ),
293
+ 'values' => array(
294
+ 'default' => array( '<i class="icon-zoom_level_default"></i>', __( 'Default', $l ) ),
295
+ '1.5' => array( '<i class="icon-zoom_level_15"></i>', __( '1,5 times', $l ) ),
296
+ '2' => array( '<i class="icon-zoom_level_2"></i>', __( '2 times', $l ) ),
297
+ '2.5' => array( '<i class="icon-zoom_level_25"></i>', __( '2,5 times', $l ) ),
298
+ '3' => array( '<i class="icon-zoom_level_3"></i>', __( '3 times', $l ) ),
299
+ ),
300
+ 'value' => 'default',
301
+ 'input_form' => 'buttons',
302
+ 'pro' => true,
303
+ 'style' => 'full',
304
+ 'disabled' => true,
305
+ 'section' => 'settings',
306
+ ),
307
+ 'lensColour' => array(
308
+ 'label' => __( 'Lens Color', $l ),
309
+ 'value' => '#ffffff',
310
+ 'pro' => true,
311
+ 'input_form' => 'input_color',
312
+ 'disabled' => true,
313
+ 'section' => 'settings',
314
+ ),
315
+ 'lensOverlay' => array(
316
+ 'label' => __( 'Show as Grid', $l ),
317
+ 'value' => false,
318
+ 'pro' => true,
319
+ 'input_form' => 'checkbox',
320
+ 'disabled' => true,
321
+ 'section' => 'settings',
322
+ ),
323
+ 'zwResponsive' => array(
324
+ 'label' => __( 'Responsive', $l ),
325
+ 'input_form' => 'checkbox',
326
+ 'pro' => true,
327
+ 'value' => false,
328
+ 'disabled' => true,
329
+ 'section' => 'settings',
330
+ ),
331
+ 'zwResponsiveThreshold' => array(
332
+ 'label' => __( 'Responsive Threshold', $l ),
333
+ 'pro' => true,
334
+ 'post_input' => 'px',
335
+ 'value' => '',
336
+ 'input_form' => 'input_text',
337
+ 'disabled' => true,
338
+ 'section' => 'settings',
339
+ ),
340
+ 'zwPositioning' => array(
341
+ 'label' => __( 'Positioning', $l ),
342
+ 'values' => array(
343
+ 'right_top' => array( '<i class="icon-type_zoom_window_right_top"></i>', __( 'Right Top', $l ) ),
344
+ 'right_bottom' => array( '<i class="icon-type_zoom_window_right_bottom"></i>', __( 'Right Bottom', $l ) ),
345
+ 'right_center' => array( '<i class="icon-type_zoom_window_right_center"></i>', __( 'Right Center', $l ) ),
346
+ 'left_top' => array( '<i class="icon-type_zoom_window_left_top"></i>', __( 'Left Top', $l ) ),
347
+ 'left_bottom' => array( '<i class="icon-type_zoom_window_left_bottom"></i>', __( 'Left Bottom', $l ) ),
348
+ 'left_center' => array( '<i class="icon-type_zoom_window_left_center"></i>', __( 'Left Center', $l ) ),
349
+ ),
350
+ 'pro' => true,
351
+ 'value' => '',
352
+ 'disabled' => true,
353
+ 'input_form' => 'buttons',
354
+ 'style' => 'full',
355
+ 'disabled' => true,
356
+ 'section' => 'settings',
357
+ ),
358
+ 'mousewheelZoom' => array(
359
+ 'label' => __( 'Mousewheel Zoom', $l ),
360
+ 'value' => '',
361
+ 'pro' => true,
362
+ 'input_form' => 'checkbox',
363
+ 'disabled' => true,
364
+ 'section' => 'settings',
365
+ ),
366
+ );
367
 
368
+ return $settings;
369
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  }
 
 
includes/template-general.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zoom settings page
4
+ */
5
+
6
+ defined( 'ABSPATH' ) || exit;
7
+
8
+ $brand = vsprintf(
9
+ '<img src="%s" /> <a href="%s">%s</a>',
10
+ array(
11
+ IMAGE_ZOOM_URL . 'assets/images/silkypress_logo.png',
12
+ 'https://www.silkypress.com/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner',
13
+ 'SilkyPress.com',
14
+ )
15
+ );
16
+
17
+ ?>
18
+ <style type="text/css">
19
+ .form-group { display:flex; align-items: center; }
20
+ .control-label{ height: auto; }
21
+ </style>
22
+
23
+ <script type="text/javascript">
24
+ jQuery(document).ready(function($) {
25
+ $('[data-toggle="tooltip"]').tooltip();
26
+ });
27
+ </script>
28
+
29
+ <?php add_thickbox(); ?>
30
+ <div id="supported-lightboxes" style="display:none;">
31
+ <p>The zoom is compatible with:
32
+ <ul style="list-style: inside; padding-left: 20px;">
33
+ <li>the lightbox created by the <a href="https://www.silkypress.com/i/wp-huge-it-gallery" target="_blank" rel="nofollow">Huge IT Gallery</a> plugin</li>
34
+ <li>the lightbox created by the <a href="https://www.silkypress.com/i/wp-photo-gallery" target="_blank" rel="nofollow">Photo Gallery</a> plugin</li>
35
+ <li>the iLightbox from the <a href="https://www.silkypress.com/i/avada-theme" target="_blank" rel="nofollow">Avada Theme</a></li>
36
+ <li>the lightbox created by <a href="https://www.silkypress.com/i/jetpack-carousel" target="_blank" rel="nofollow">Carousel</a> from Jetpack</li>
37
+ <li>the <a href="https://www.silkypress.com/i/js-prettyphoto" target="_blank" rel="nofollow">prettyPhoto</a> lightbox (also used by the <a href="https://www.silkypress.com/i/visual-composer" target="_blank" rel="nofollow">WPBakery</a> gallery)</li>
38
+ <li>the <a href="https://www.silkypress.com/i/js-fancybox" target="_blank" rel="nofollow">fancyBox</a> lightbox (also used by the <a href="https://wordpress.org/plugins/easy-fancybox/" target="_blank" rel="nofollow">Easy Fancybox</a> or the <a href="https://wordpress.org/plugins/woocommerce-lightbox/" target="_blank" rel="nofollow">WooCommerce LightBox</a> plugin)</li>
39
+ <li>the <a href="https://www.silkypress.com/i/js-featherlight" target="_blank" rel="nofollow">Featherlight.js</a> lightbox (also used by <a href="https://www.silkypress.com/i/wp-draw-attention" target="_blank" rel="nofollow">Draw Attention</a> plugin)</li>
40
+ <li>the lightbox created by the Ultimate Product Catalogue by Etoile Web Design</li>
41
+ <li>the <a href="http://dimsemenov.com/plugins/magnific-popup/" target="_blank" rel="nofollow">Magnific Popup</a> lightbox (also used by <a href="https://www.silkypress.com/i/enfold-theme" target="_blank" rel="nofollow">Enfold</a> portfolio items, the Divi gallery or the <a href="https://wordpress.org/plugins/beaver-builder-lite-version/" target="_blank">Beaver Builder</a>)</li>
42
+ <li>the lightbox from the <a href="https://wordpress.org/plugins/elementor/" target="_blank" rel="nofollow">Elementor</a> Page Builder</li>
43
+ <li>the lightbox from the <a href="https://lcweb.it/media-grid/bundle-pack" target="_blank" rel="nofollow">Media Grid - Bundle Pack</a></li>
44
+ </ul>
45
+ </p>
46
+ </div>
47
+
48
+ <h2><?php printf( esc_html__( 'WP Image Zoom by %1$s', 'wp-image-zoooom' ), $brand ); ?></h2>
49
+
50
+ <div class="wrap">
51
+ <h3 class="nav-tab-wrapper woo-nav-tab-wrapper">
52
+ <a href="?page=zoooom_settings&tab=general" class="nav-tab nav-tab-active"><?php _e( 'General Settings', 'wp-image-zoooom' ); ?></a>
53
+ <a href="?page=zoooom_settings&tab=settings" class="nav-tab"><?php _e( 'Zoom Settings', 'wp-image-zoooom' ); ?></a>
54
+ </h3>
55
+ <div class="panel panel-default">
56
+ <div class="panel-body">
57
+ <div class="row">
58
+ <div id="alert_messages">
59
+ <?php echo $messages; ?>
60
+ </div>
61
+
62
+ <form class="form-horizontal" method="post" action="" id="form_settings">
63
+ <?php echo $form->render(); ?>
64
+
65
+ <div class="form-group">
66
+ <div class="col-lg-6">
67
+ <input type="hidden" name="tab" value="general" />
68
+ <button type="submit" class="btn btn-primary"><?php _e( 'Save changes', 'wp-image-zoooom' ); ?></button>
69
+ </div>
70
+ </div>
71
+ <?php wp_nonce_field( 'zoooom_general' ); ?>
72
+ </form>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </div>
includes/template-settings.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zoom settings page
4
+ */
5
+
6
+ defined( 'ABSPATH' ) || exit;
7
+
8
+ $brand = vsprintf(
9
+ '<img src="%s" /> <a href="%s">%s</a>',
10
+ array(
11
+ IMAGE_ZOOM_URL . 'assets/images/silkypress_logo.png',
12
+ 'https://www.silkypress.com/?utm_source=wordpress&utm_campaign=iz_free&utm_medium=banner',
13
+ 'SilkyPress.com',
14
+ )
15
+ );
16
+
17
+ if ( ! function_exists( 'iz_load_step' ) ) {
18
+ function iz_load_steps( $step, $description ) {
19
+ return sprintf( '<div class="steps"><span class="steps_nr">%s</span><span class="steps_desc">%s</span></div>', $step, $description );
20
+ }
21
+ }
22
+
23
+
24
+ ?>
25
+ <h2><?php printf( esc_html__( 'WP Image Zoom by %1$s', 'wp-image-zoooom' ), $brand ); ?></h2>
26
+
27
+ <div class="wrap">
28
+ <h3 class="nav-tab-wrapper woo-nav-tab-wrapper">
29
+ <a href="?page=zoooom_settings&tab=general" class="nav-tab"><?php _e( 'General Settings', 'wp-image-zoooom' ); ?></a>
30
+ <a href="?page=zoooom_settings&tab=settings" class="nav-tab nav-tab-active"><?php _e( 'Zoom Settings', 'wp-image-zoooom' ); ?></a>
31
+ </h3>
32
+ <div class="panel panel-default">
33
+ <div class="panel-body">
34
+ <div class="row">
35
+ <div id="alert_messages">
36
+ <?php echo $messages; ?>
37
+ </div>
38
+
39
+ <form class="form-horizontal" method="post" action="" id="form_settings">
40
+ <div class="form-group">
41
+ <?php echo iz_load_steps( __( 'Step 1', 'wp-image-zoooom' ), __( 'Choose the Lens Shape', 'wp-image-zoooom' ) ); ?>
42
+
43
+ <?php echo $form->render_field( 'lensShape', $settings_all['lensShape'] ); ?>
44
+
45
+ <div style="clear: both; margin-bottom: 50px;"></div>
46
+
47
+
48
+ <?php echo iz_load_steps( __( 'Step 2', 'wp-image-zoooom' ), __( 'Check your configuration changes on the image', 'wp-image-zoooom' ) ); ?>
49
+
50
+ <img id="demo" src="<?php echo IMAGE_ZOOM_URL; ?>/assets/images/img1_medium.png" data-zoom-image="<?php echo IMAGE_ZOOM_URL; ?>/assets/images/img1_large.png" width="300" />
51
+
52
+ <div style="clear: both; margin-bottom: 50px;"></div>
53
+
54
+
55
+ <?php echo iz_load_steps( __( 'Step 3', 'wp-image-zoooom' ), __( 'Make more fine-grained configurations on the zoom', 'wp-image-zoooom' ) ); ?>
56
+
57
+ <ul class="nav nav-tabs">
58
+ <li class="" id="tab_padding" style="width: 40px;"> &nbsp; </li>
59
+ <li class="active" id="tab_general">
60
+ <a href="#general_settings" data-toggle="tab" aria-expanded="true"><?php _e( 'General', 'wp-image-zoooom' ); ?></a>
61
+ </li>
62
+ <li class="" id="tab_lens">
63
+ <a href="#lens_settings" data-toggle="tab" aria-expanded="false"><?php _e( 'Lens', 'wp-image-zoooom' ); ?></a>
64
+ </li>
65
+ <li class="" id="tab_zoom_window">
66
+ <a href="#zoom_window_settings" data-toggle="tab" aria-expanded="false"><?php _e( 'Zoom Window', 'wp-image-zoooom' ); ?></a>
67
+ </li>
68
+ </ul>
69
+
70
+ <div class="tab-content">
71
+ <div class="tab-pane fade active in" id="general_settings">
72
+ <?php
73
+ foreach ( array( 'cursorType', 'zwEasing', 'onClick', 'ratio' ) as $_field ) {
74
+ echo $form->render_field( $_field, $settings_all[ $_field ] );
75
+ }
76
+ ?>
77
+ </div>
78
+ <div class="tab-pane fade" id="lens_settings">
79
+ <?php
80
+ $fields = array( 'lensSize', 'lensColour', 'lensOverlay', 'borderThickness', 'borderColor', 'lensFade', 'tint', 'tintColor', 'tintOpacity' );
81
+ foreach ( $fields as $_field ) {
82
+ echo $form->render_field( $_field, $settings_all[ $_field ] );
83
+ }
84
+ ?>
85
+ </div>
86
+
87
+ <div class="tab-pane fade" id="zoom_window_settings">
88
+ <?php
89
+ $fields = array( 'zwWidth', 'zwHeight', 'zwResponsive', 'zwResponsiveThreshold', 'zwPositioning', 'zwPadding', 'zwBorderThickness', 'zwBorderColor', 'zwShadow', 'zwBorderRadius', 'mousewheelZoom', 'zwFade' );
90
+
91
+ foreach ( $fields as $_field ) {
92
+ echo $form->render_field( $_field, $settings_all[ $_field ] );
93
+ }
94
+ ?>
95
+ </div>
96
+ </div>
97
+
98
+ <?php echo iz_load_steps( __( 'Step 4', 'wp-image-zoooom' ), __( 'Don\'t forget to save the changes in order to apply them on the website', 'wp-image-zoooom' ) ); ?>
99
+
100
+ <div class="form-group">
101
+ <div class="col-lg-6">
102
+ <button type="submit" class="btn btn-primary"><?php _e( 'Save changes', 'wp-image-zoooom' ); ?></button>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <?php wp_nonce_field( 'zoooom_settings' ); ?>
107
+ </form>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
readme.txt CHANGED
@@ -5,7 +5,7 @@ Email: diana@burduja.eu
5
  Tags: e-commerce, featured image, hover over image zoom, image, image zoom, image zoom plugin, image magnification, image magnifier, jquery picture zoom, magnifier, magnify image, magnifying glass, mouse over image zoom, panorama, picture zoom, product image, product zoom, product magnification, product magnifier, responsive, woocommerce product zoom, woocommerce zoom, woocommerce magnifying glass, zoom, zoom image, zoom plugin, woocommerce image zoom, woocommerce product image zoom, woocommerce zoom magnifier
6
  Requires at least: 3.0.1
7
  Tested up to: 5.3
8
- Stable tag: 1.38
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
@@ -152,6 +152,11 @@ Alternatively you can upgrade to the Pro version, as there the zoom lens is buil
152
 
153
  == Changelog ==
154
 
 
 
 
 
 
155
  = 1.38 =
156
  * 11/20/2019
157
  * Fix: product image gallery was broken on the Brooklyn theme
5
  Tags: e-commerce, featured image, hover over image zoom, image, image zoom, image zoom plugin, image magnification, image magnifier, jquery picture zoom, magnifier, magnify image, magnifying glass, mouse over image zoom, panorama, picture zoom, product image, product zoom, product magnification, product magnifier, responsive, woocommerce product zoom, woocommerce zoom, woocommerce magnifying glass, zoom, zoom image, zoom plugin, woocommerce image zoom, woocommerce product image zoom, woocommerce zoom magnifier
6
  Requires at least: 3.0.1
7
  Tested up to: 5.3
8
+ Stable tag: 1.39
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
152
 
153
  == Changelog ==
154
 
155
+ = 1.39
156
+ * 02/09/2019
157
+ * Fix: zoom was showing only in customizer if the Lazy Load option from Jetpack is enabled
158
+ * Declare compatibility with WooCommerce 3.9
159
+
160
  = 1.38 =
161
  * 11/20/2019
162
  * Fix: product image gallery was broken on the Brooklyn theme