Woocommerce Products Slider - Version 1.13.24

Version Description

  • 2021-04-20 FIX - Minor security issue updated
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Woocommerce Products Slider
Version 1.13.24
Comparing to
See all releases

Code changes from version 1.13.22 to 1.13.24

assets/settings-tabs/settings-tabs.js CHANGED
@@ -145,6 +145,8 @@ jQuery(document).ready(function($){
145
  side_uploader.open();
146
 
147
  })
 
 
148
  $(document).on('click','.settings-tabs .field-media-url-wrapper .clear',function(e){
149
  $(this).parent().children('.media-preview-wrap').children('img').attr('src','');
150
  $(this).parent().children('input').val('');
@@ -185,7 +187,6 @@ jQuery(document).ready(function($){
185
  })
186
 
187
 
188
-
189
  jQuery(document).on("click", ".settings-tabs .field-repeatable-wrapper .collapsible .header .title-text", function() {
190
  if(jQuery(this).parent().parent().hasClass("active")){
191
  jQuery(this).parent().parent().removeClass("active");
@@ -294,10 +295,22 @@ jQuery(document).ready(function($){
294
 
295
  })
296
 
 
297
 
 
 
 
 
298
 
 
 
 
 
 
 
 
 
299
 
300
 
301
-
302
 
303
  });
145
  side_uploader.open();
146
 
147
  })
148
+
149
+
150
  $(document).on('click','.settings-tabs .field-media-url-wrapper .clear',function(e){
151
  $(this).parent().children('.media-preview-wrap').children('img').attr('src','');
152
  $(this).parent().children('input').val('');
187
  })
188
 
189
 
 
190
  jQuery(document).on("click", ".settings-tabs .field-repeatable-wrapper .collapsible .header .title-text", function() {
191
  if(jQuery(this).parent().parent().hasClass("active")){
192
  jQuery(this).parent().parent().removeClass("active");
295
 
296
  })
297
 
298
+ // radio-img
299
 
300
+ $(document).on("click", ".radio-img label", function () {
301
+ if($(this).hasClass('disabled')){
302
+ return;
303
+ }
304
 
305
+ $(this).parent().children("label").removeClass("active");
306
+ $(this).addClass("active");
307
+
308
+ })
309
+
310
+ $(function() {
311
+ $('.lazy').Lazy();
312
+ });
313
 
314
 
 
315
 
316
  });
includes/class-metabox-wcps-hook.php CHANGED
@@ -515,7 +515,7 @@ function wcps_metabox_content_layouts($post_id){
515
  $product_thumb_url = isset($product_thumb['0']) ? esc_url_raw($product_thumb['0']) : '';
516
 
517
  $layout_options = get_post_meta($post_id,'layout_options', true);
518
- $layout_preview_img = !empty($layout_options['layout_preview_img']) ? $layout_options['layout_preview_img'] : 'https://i.imgur.com/JyurCtY.jpg';
519
 
520
  $product_thumb_url = !empty( $product_thumb_url ) ? $product_thumb_url : $layout_preview_img;
521
 
@@ -2536,7 +2536,7 @@ add_action('wcps_metabox_save','wcps_metabox_save');
2536
 
2537
  function wcps_metabox_save($job_id){
2538
 
2539
- $wcps_options = isset($_POST['wcps_options']) ? stripslashes_deep($_POST['wcps_options']) : '';
2540
  update_post_meta($job_id, 'wcps_options', $wcps_options);
2541
 
2542
  }
515
  $product_thumb_url = isset($product_thumb['0']) ? esc_url_raw($product_thumb['0']) : '';
516
 
517
  $layout_options = get_post_meta($post_id,'layout_options', true);
518
+ $layout_preview_img = !empty($layout_options['layout_preview_img']) ? $layout_options['layout_preview_img'] : wcps_plugin_url.'assets/front/images/no-thumb.png';
519
 
520
  $product_thumb_url = !empty( $product_thumb_url ) ? $product_thumb_url : $layout_preview_img;
521
 
2536
 
2537
  function wcps_metabox_save($job_id){
2538
 
2539
+ $wcps_options = isset($_POST['wcps_options']) ? wcps_recursive_sanitize_arr($_POST['wcps_options']) : '';
2540
  update_post_meta($job_id, 'wcps_options', $wcps_options);
2541
 
2542
  }
includes/class-metabox-wcps-layout-hook.php CHANGED
@@ -398,13 +398,13 @@ add_action('wcps_layout_metabox_save','wcps_layout_metabox_save');
398
 
399
  function wcps_layout_metabox_save($job_id){
400
 
401
- $layout_options = isset($_POST['layout_options']) ? stripslashes_deep($_POST['layout_options']) : '';
402
  update_post_meta($job_id, 'layout_options', $layout_options);
403
 
404
- $layout_elements_data = isset($_POST['layout_elements_data']) ? stripslashes_deep($_POST['layout_elements_data']) : '';
405
  update_post_meta($job_id, 'layout_elements_data', $layout_elements_data);
406
 
407
- $custom_scripts = isset($_POST['custom_scripts']) ? stripslashes_deep($_POST['custom_scripts']) : '';
408
  update_post_meta($job_id, 'custom_scripts', $custom_scripts);
409
 
410
  }
398
 
399
  function wcps_layout_metabox_save($job_id){
400
 
401
+ $layout_options = isset($_POST['layout_options']) ? wcps_recursive_sanitize_arr($_POST['layout_options']) : '';
402
  update_post_meta($job_id, 'layout_options', $layout_options);
403
 
404
+ $layout_elements_data = isset($_POST['layout_elements_data']) ? wcps_recursive_sanitize_arr($_POST['layout_elements_data']) : '';
405
  update_post_meta($job_id, 'layout_elements_data', $layout_elements_data);
406
 
407
+ $custom_scripts = isset($_POST['custom_scripts']) ? wcps_recursive_sanitize_arr($_POST['custom_scripts']) : '';
408
  update_post_meta($job_id, 'custom_scripts', $custom_scripts);
409
 
410
  }
includes/class-settings-tabs-old.php DELETED
@@ -1,1752 +0,0 @@
1
- <?php
2
- if ( ! defined('ABSPATH')) exit; // if direct access
3
-
4
- if( ! class_exists( 'settings_tabs_field' ) ) {
5
- class settings_tabs_field{
6
-
7
- // public $asset_dir_url = '';
8
- public $textdomain = 'settings-tabs';
9
-
10
- public function __construct(){
11
-
12
- // $this->asset_dir_url = isset($args['asset_dir_url']) ? $args['asset_dir_url'] : '';
13
- // $this->textdomain = isset($args['textdomain']) ? $args['textdomain'] : '';
14
-
15
- }
16
-
17
-
18
- function admin_scripts(){
19
-
20
-
21
- wp_enqueue_script('jquery');
22
- wp_enqueue_script('jquery-ui-sortable');
23
- wp_enqueue_script( 'jquery-ui-core' );
24
- wp_enqueue_script('jquery-ui-accordion');
25
- wp_enqueue_style( 'jquery-ui');
26
-
27
- wp_enqueue_script('wp-color-picker');
28
- wp_enqueue_style( 'wp-color-picker' );
29
-
30
-
31
- wp_enqueue_style( 'font-awesome-5' );
32
-
33
- wp_enqueue_style( 'settings-tabs' );
34
- wp_enqueue_script( 'settings-tabs' );
35
-
36
- wp_enqueue_script( 'code-editor' );
37
- wp_enqueue_style( 'code-editor' );
38
-
39
- wp_enqueue_editor();
40
- }
41
-
42
- function field_template($option){
43
-
44
- $id = isset( $option['id'] ) ? $option['id'] : "";
45
- $is_error = isset( $option['is_error'] ) ? $option['is_error'] : false;
46
- $error_details = isset( $option['error_details'] ) ? $option['error_details'] : '';
47
-
48
- ob_start();
49
-
50
- ?>
51
- <div class="setting-field <?php if($is_error) echo 'field-error'; ?>">
52
- <div class="field-lable">%s</div>
53
- <div class="field-input">%s
54
- <p class="description">%s</p>
55
- <?php if($is_error && !empty($error_details)): ?>
56
- <p class="error-details"><i class="fas fa-exclamation-circle"></i> <?php echo $error_details; ?></p>
57
- <?php endif; ?>
58
-
59
- </div>
60
- </div>
61
- <?php
62
-
63
- return ob_get_clean();
64
-
65
- }
66
-
67
-
68
-
69
-
70
-
71
-
72
- function generate_field($option){
73
-
74
- $id = isset( $option['id'] ) ? $option['id'] : "";
75
- $type = isset( $option['type'] ) ? $option['type'] : "";
76
- $details = isset( $option['details'] ) ? $option['details'] : "";
77
-
78
-
79
-
80
-
81
-
82
-
83
- if( empty( $id ) ) return;
84
-
85
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
86
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
87
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
88
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
89
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
90
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
91
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
92
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
93
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
94
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
95
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
96
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
97
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
98
-
99
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
100
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
101
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
102
-
103
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
104
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
105
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
106
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
107
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
108
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
109
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
110
-
111
- elseif( isset($option['type']) && $option['type'] === 'option_group') $this->field_option_group( $option );
112
- elseif( isset($option['type']) && $option['type'] === 'option_group_accordion') $this->field_option_group_accordion( $option );
113
- elseif( isset($option['type']) && $option['type'] === 'wp_editor') $this->field_wp_editor( $option );
114
- elseif( isset($option['type']) && $option['type'] === 'textarea_editor') $this->field_textarea_editor( $option );
115
-
116
-
117
-
118
- elseif( isset($option['type']) && $option['type'] === $type ) do_action( "settings_tabs_field_$type", $option );
119
-
120
-
121
- //if( !empty( $details ) ) echo "<p class='description'>$details</p>";
122
-
123
-
124
-
125
-
126
-
127
- }
128
-
129
-
130
- public function field_option_group_accordion( $option ){
131
-
132
- $id = isset( $option['id'] ) ? $option['id'] : "";
133
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
134
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : false;
135
-
136
- $args_index = isset( $option['args_index'] ) ? $option['args_index'] : array();
137
- $args_index_default = isset( $option['args_index_default'] ) ? $option['args_index_default'] : array();
138
- $args_index_hide = isset( $option['args_index_hide'] ) ? $option['args_index_hide'] : array();
139
-
140
- $args_index = !empty($args_index) ? $args_index : $args_index_default;
141
-
142
- $args = isset( $option['args'] ) ? $option['args'] : array();
143
-
144
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
145
-
146
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
147
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
148
-
149
-
150
- $title = isset( $option['title'] ) ? $option['title'] : "";
151
- $group_details = isset( $option['details'] ) ? $option['details'] : "";
152
-
153
- if($is_pro == true){
154
- $group_details = '<span class="pro-feature">'.$pro_text.'</span> '.$group_details;
155
- }
156
-
157
-
158
- ob_start();
159
- ?>
160
- <div class="option-group-accordion-wrap" id="<?php echo $css_id; ?>">
161
- <div sortable="<?php echo ($sortable) ? 'true': 'false'; ?>" class='option-group-accordion accordion'>
162
- <?php
163
-
164
- if(!empty($args_index))
165
- foreach( $args_index as $index ):
166
-
167
- //foreach( $args as $key => $value ):
168
-
169
- $group_title = isset($args[$index]['title']) ? $args[$index]['title'] : '';
170
- $is_hide = isset($args_index_hide[$index]) ? $args_index_hide[$index] : false;
171
-
172
-
173
- //$link = $value['link'];
174
- $options = isset($args[$index]['options']) ? $args[$index]['options'] : array();
175
-
176
- ?>
177
- <div class="group">
178
- <h3 class="accordion-title">
179
-
180
-
181
- <?php if($sortable): ?>
182
- <span class="sort"><i class="fas fa-sort"></i></span>
183
- <?php endif; ?>
184
-
185
- <span class="title-text"><?php echo $group_title; ?></span>
186
- </h3>
187
- <div class="accordion-content">
188
-
189
- <?php
190
-
191
- if(!empty($options)):
192
- foreach ($options as $option):
193
-
194
- $id = isset( $option['id'] ) ? $option['id'] : "";
195
- $type = isset( $option['type'] ) ? $option['type'] : "";
196
- $details = isset( $option['details'] ) ? $option['details'] : "";
197
-
198
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
199
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
200
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
201
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
202
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
203
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
204
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
205
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
206
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
207
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
208
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
209
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
210
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
211
-
212
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
213
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
214
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
215
-
216
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
217
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
218
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
219
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
220
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
221
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
222
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
223
-
224
- endforeach;
225
- endif;
226
- ?>
227
- </div> <!-- ..accordion-content -->
228
- </div><!-- .group -->
229
-
230
-
231
- <?php
232
- //endforeach;
233
-
234
- endforeach;
235
-
236
-
237
- ?>
238
- </div> <!-- .option-group-accordion -->
239
- </div><!-- .option-group-accordion-wrap -->
240
-
241
- <?php
242
-
243
- $input_html = ob_get_clean();
244
-
245
- echo sprintf($field_template, $title, $input_html, $group_details);
246
-
247
-
248
- }
249
-
250
-
251
- public function field_option_group( $option ){
252
-
253
- $id = isset( $option['id'] ) ? $option['id'] : "";
254
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
255
- $options = isset( $option['options'] ) ? $option['options'] : array();
256
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
257
-
258
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
259
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
260
-
261
-
262
- $title = isset( $option['title'] ) ? $option['title'] : "";
263
- $group_details = isset( $option['details'] ) ? $option['details'] : "";
264
-
265
- if($is_pro == true){
266
- $group_details = '<span class="pro-feature">'.$pro_text.'</span> '.$group_details;
267
- }
268
-
269
-
270
- ob_start();
271
- ?>
272
- <div id="<?php echo $css_id; ?>">
273
- <?php
274
-
275
- if(!empty($options)):
276
- foreach ($options as $option):
277
-
278
- $id = isset( $option['id'] ) ? $option['id'] : "";
279
- $type = isset( $option['type'] ) ? $option['type'] : "";
280
- $details = isset( $option['details'] ) ? $option['details'] : "";
281
-
282
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
283
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
284
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
285
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
286
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
287
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
288
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
289
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
290
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
291
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
292
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
293
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
294
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
295
-
296
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
297
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
298
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
299
-
300
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
301
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
302
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
303
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
304
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
305
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
306
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
307
-
308
- endforeach;
309
- endif;
310
- ?>
311
- </div>
312
- <?php
313
-
314
- $input_html = ob_get_clean();
315
-
316
- echo sprintf($field_template, $title, $input_html, $group_details);
317
-
318
-
319
- }
320
-
321
-
322
- public function field_media( $option ){
323
-
324
-
325
-
326
- $id = isset( $option['id'] ) ? $option['id'] : "";
327
- if(empty($id)) return;
328
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
329
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
330
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
331
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
332
- $title = isset( $option['title'] ) ? $option['title'] : "";
333
- $details = isset( $option['details'] ) ? $option['details'] : "";
334
-
335
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
336
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
337
-
338
- $default = isset( $option['default'] ) ? $option['default'] : '';
339
- $value = isset( $option['value'] ) ? $option['value'] : '';
340
- $value = !empty($value) ? $value : $default;
341
-
342
- $media_url = wp_get_attachment_url( $value );
343
- $media_type = get_post_mime_type( $value );
344
- $media_title = !empty($value) ? get_the_title( $value ) : __('Placeholder.jpg', $this->textdomain);
345
-
346
-
347
- $media_url = !empty($media_url) ? $media_url : $default;
348
-
349
- $placeholder = 'https://i.imgur.com/qOPTTdQ.jpg';
350
- $media_url = !empty($media_url) ? $media_url : $placeholder;
351
- $media_basename = wp_basename($media_type);
352
-
353
- $field_name = !empty( $field_name ) ? $field_name : $id;
354
- $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
355
-
356
-
357
-
358
-
359
- ob_start();
360
- //wp_enqueue_media();
361
-
362
- ?>
363
- <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-wrapper
364
- field-media-wrapper-<?php echo $css_id; ?>">
365
- <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;word-break: break-all;">
366
- <?php
367
-
368
- //var_dump($media_type);
369
-
370
- if( "audio/mpeg" == $media_type ){
371
- ?>
372
- <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
373
- <div class="media-title"><?php echo $media_title; ?></div>
374
- <?php
375
- }elseif( "images/png" == $media_type ||
376
- "image/png" == $media_type ||
377
- "images/gif" == $media_type ||
378
- "image/gif" == $media_type ||
379
- "images/jpeg" == $media_type ||
380
- "image/jpeg" == $media_type ||
381
- "images/jpg" == $media_type ||
382
- "image/jpg" == $media_type ||
383
- "images/ico" == $media_type||
384
- "image/ico" == $media_type
385
- ){
386
- ?>
387
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
388
- <div class="media-title"><?php echo $media_title; ?></div>
389
- <?php
390
- }else {
391
- ?>
392
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
393
- <div class="media-title"><?php echo $media_title; ?></div>
394
-
395
- <?php
396
- }
397
- ?>
398
- </div>
399
- <input class="media-input-value" type="hidden" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
400
- <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain);?></div>
401
- <div placeholder="<?php echo $placeholder; ?>" class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear', $this->textdomain);?></div>
402
- <div class="error-mgs"></div>
403
- </div>
404
-
405
- <?php
406
-
407
-
408
- $input_html = ob_get_clean();
409
-
410
- echo sprintf($field_template, $title, $input_html, $details);
411
-
412
- }
413
-
414
-
415
-
416
-
417
- public function field_media_url( $option ){
418
-
419
-
420
-
421
- $id = isset( $option['id'] ) ? $option['id'] : "";
422
- if(empty($id)) return;
423
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
424
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
425
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
426
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
427
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
428
- $title = isset( $option['title'] ) ? $option['title'] : "";
429
- $details = isset( $option['details'] ) ? $option['details'] : "";
430
-
431
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
432
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
433
-
434
- $default = isset( $option['default'] ) ? $option['default'] : '';
435
- $value = isset( $option['value'] ) ? $option['value'] : '';
436
- $value = !empty($value) ? $value : $default;
437
-
438
- $media_url = $value;
439
- $media_type = get_post_mime_type( $value );
440
- $media_title= get_the_title( $value );
441
- $media_url = !empty($media_url) ? $media_url : '';
442
-
443
- $field_name = !empty( $field_name ) ? $field_name : $id;
444
- $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
445
-
446
-
447
- wp_enqueue_media();
448
- ob_start();
449
-
450
-
451
- ?>
452
- <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-url-wrapper
453
- field-media-wrapper-<?php echo $css_id; ?>">
454
- <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;">
455
- <?php
456
-
457
- if( "audio/mpeg" == $media_type ){
458
- ?>
459
- <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
460
-
461
- <?php
462
- }
463
- elseif( "images/png" == $media_type || "images/jpg" == $media_type || "images/jpeg" == $media_type ||
464
- "images/gif" == $media_type ||
465
- "images/ico" == $media_type){
466
- ?>
467
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
468
-
469
- <?php
470
- }
471
-
472
- else {
473
- ?>
474
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
475
-
476
- <?php
477
- }
478
- ?>
479
- </div>
480
- <input type="text" placeholder="<?php echo $placeholder; ?>" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
481
- <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain);?></div>
482
- <div class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear','woocommerce-products-slider');?></div>
483
- <div class="error-mgs"></div>
484
- </div>
485
-
486
- <?php
487
-
488
-
489
- $input_html = ob_get_clean();
490
-
491
- echo sprintf($field_template, $title, $input_html, $details);
492
-
493
- }
494
-
495
-
496
-
497
- public function field_repeatable( $option ){
498
-
499
- $id = isset( $option['id'] ) ? $option['id'] : "";
500
- if(empty($id)) return;
501
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
502
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
503
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
504
- $field_name = !empty( $parent ) ? $parent.'['.$field_name.']' : $field_name;
505
-
506
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : true;
507
- $collapsible = isset( $option['collapsible'] ) ? $option['collapsible'] : true;
508
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
509
- $values = isset( $option['value'] ) ? $option['value'] : array();
510
- $fields = isset( $option['fields'] ) ? $option['fields'] : array();
511
- $title_field = isset( $option['title_field'] ) ? $option['title_field'] : '';
512
- $remove_text = isset( $option['remove_text'] ) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
513
- $limit = isset( $option['limit'] ) ? $option['limit'] : '';
514
-
515
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
516
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
517
-
518
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
519
- $title = isset( $option['title'] ) ? $option['title'] : "";
520
- $details = isset( $option['details'] ) ? $option['details'] : "";
521
-
522
- $settings_tabs_field = new settings_tabs_field();
523
-
524
- ob_start();
525
- ?>
526
- <script>
527
- jQuery(document).ready(function($) {
528
- jQuery(document).on("click", ".field-repeatable-wrapper-<?php echo $css_id; ?> .add-repeat-field", function() {
529
-
530
-
531
- now = jQuery.now();
532
- fields_arr = <?php echo json_encode($fields); ?>;
533
- html = '<div class="item-wrap collapsible"><div class="header"><span class="remove" ' +
534
- 'onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span> ';
535
- <?php if($sortable):?>
536
- html += '<span class="sort" ><i class="fas fa-arrows-alt"></i></span>';
537
- <?php endif; ?>
538
- html += ' <span class="title-text">#'+now+'</span></div>';
539
-
540
- <?php
541
-
542
- $fieldHtml = '';
543
-
544
- if(!empty($fields)):
545
- foreach ($fields as $field):
546
-
547
- $fieldType = isset($field['type']) ? $field['type'] : '';
548
- $field['parent'] = $field_name.'[TIMEINDEX]';
549
-
550
- ob_start();
551
- ?>
552
- <div class="item">
553
- <?php if($collapsible):?>
554
- <div class="content">
555
- <?php endif; ?>
556
-
557
- <?php
558
- $settings_tabs_field->generate_field($field);
559
- ?>
560
- <?php if($collapsible):?>
561
- </div>
562
- <?php endif; ?>
563
-
564
- </div>
565
- <?php
566
- $fieldHtml .= ob_get_clean();
567
- endforeach;
568
- endif;
569
-
570
-
571
- $string = str_replace("\n", "", $fieldHtml);
572
- $fieldHtml = str_replace("\r", "", $string);
573
-
574
-
575
- ?>
576
-
577
- fieldHtml = '<?php echo $fieldHtml; ?>';
578
- html+= fieldHtml.replace(/TIMEINDEX/g, now);
579
- html+='</div>';
580
-
581
- jQuery('.<?php echo 'field-repeatable-wrapper-'.$css_id; ?> .repeatable-field-list').append(html);
582
-
583
- })
584
- });
585
- </script>
586
- <div id="input-wrapper-<?php echo $css_id; ?>" class=" input-wrapper field-repeatable-wrapper
587
- field-repeatable-wrapper-<?php echo $css_id; ?>">
588
- <div class="add-repeat-field"><i class="far fa-plus-square"></i> <?php _e('Add','woocommerce-products-slider'); ?></div>
589
- <div class="repeatable-field-list sortable" id="<?php echo $css_id; ?>">
590
- <?php
591
- if(!empty($values)):
592
- $count = 1;
593
- foreach ($values as $index=>$val):
594
- $title_field_val = !empty($val[$title_field]) ? $val[$title_field] : '#'.$count;
595
-
596
- //var_dump($index);
597
-
598
- ?>
599
- <div class="item-wrap <?php if($collapsible) echo 'collapsible'; ?>" index="<?php echo $index; ?>">
600
- <?php if($collapsible):?>
601
- <div class="header">
602
- <?php endif; ?>
603
- <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span>
604
- <?php if($sortable):?>
605
- <span class="sort"><i class="fas fa-arrows-alt"></i></span>
606
- <?php endif; ?>
607
-
608
- <span class="title-text"><?php echo $title_field_val; ?></span>
609
- <?php if($collapsible):?>
610
- </div>
611
- <?php endif; ?>
612
- <?php
613
-
614
-
615
-
616
- foreach ($fields as $field_index => $field):
617
- $fieldId = $field['id'];
618
- $field_css_id = isset($field['css_id']) ? str_replace('TIMEINDEX', $index, $field['css_id']) : '';
619
-
620
- //var_dump($field_css_id);
621
-
622
- $title_field_class = ($title_field == $field_index) ? 'title-field':'';
623
- ?>
624
- <div class="item <?php echo $title_field_class; ?>">
625
- <?php if($collapsible):?>
626
- <div class="content">
627
- <?php endif; ?>
628
-
629
- <?php
630
- $field['parent'] = $field_name.'['.$index.']';
631
- $field['css_id'] = $field_css_id;
632
-
633
- $field['value'] = isset($val[$fieldId]) ? $val[$fieldId] : '';
634
-
635
- $settings_tabs_field->generate_field($field);
636
-
637
-
638
- if($collapsible):?>
639
- </div>
640
- <?php endif; ?>
641
- </div>
642
- <?php
643
-
644
- endforeach; ?>
645
- </div>
646
- <?php
647
- $count++;
648
- endforeach;
649
- else:
650
- ?>
651
- <?php
652
- endif;
653
- ?>
654
- </div>
655
- <div class="error-mgs"></div>
656
- </div>
657
-
658
- <?php
659
-
660
- $input_html = ob_get_clean();
661
-
662
- echo sprintf($field_template, $title, $input_html, $details);
663
-
664
-
665
-
666
- }
667
-
668
-
669
-
670
-
671
-
672
-
673
-
674
-
675
- public function field_select( $option ){
676
-
677
- $id = isset( $option['id'] ) ? $option['id'] : "";
678
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
679
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
680
- $args = isset( $option['args'] ) ? $option['args'] : array();
681
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
682
- $multiple = isset( $option['multiple'] ) ? $option['multiple'] : false;
683
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
684
-
685
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
686
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
687
-
688
-
689
- $title = isset( $option['title'] ) ? $option['title'] : "";
690
- $details = isset( $option['details'] ) ? $option['details'] : "";
691
-
692
- if($is_pro == true){
693
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
694
- }
695
-
696
-
697
- if($multiple){
698
- $value = isset( $option['value'] ) ? $option['value'] : array();
699
- $field_name = !empty($parent) ? $parent.'['.$id.'][]' : $id.'[]';
700
- $default = isset( $option['default'] ) ? $option['default'] : array();
701
- }else{
702
- $value = isset( $option['value'] ) ? $option['value'] : '';
703
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
704
- $default = isset( $option['default'] ) ? $option['default'] : '';
705
- }
706
-
707
-
708
- $value = !empty($value) ? $value : $default;
709
-
710
-
711
-
712
-
713
- ob_start();
714
- ?>
715
-
716
- <select <?php if($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
717
- <?php
718
- foreach( $args as $key => $name ):
719
- if($multiple){
720
- $selected = in_array($key, $value) ? "selected" : "";
721
- }else{
722
- $selected = $value == $key ? "selected" : "";
723
- }
724
-
725
-
726
- ?>
727
- <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
728
- <?php
729
- endforeach;
730
- ?>
731
- </select>
732
- <?php
733
- if($multiple):
734
- ?>
735
- <div class="button select-reset">Reset</div><br>
736
- <?php
737
- endif;
738
- ?>
739
-
740
- <?php
741
-
742
- $input_html = ob_get_clean();
743
-
744
- echo sprintf($field_template, $title, $input_html, $details);
745
-
746
-
747
- }
748
-
749
- public function field_select2( $option ){
750
-
751
- $id = isset( $option['id'] ) ? $option['id'] : "";
752
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
753
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
754
- $args = isset( $option['args'] ) ? $option['args'] : array();
755
- $multiple = isset( $option['multiple'] ) ? $option['multiple'] : "";
756
- $attributes = isset( $option['attributes'] ) ? $option['attributes'] : array();
757
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
758
-
759
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
760
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
761
-
762
-
763
- var_dump($css_id);
764
-
765
- if($multiple){
766
- $value = isset( $option['value'] ) ? $option['value'] : array();
767
- $field_name = !empty($parent) ? $parent.'['.$id.'][]' : $id.'[]';
768
- $default = isset( $option['default'] ) ? $option['default'] : array();
769
- }else{
770
- $value = isset( $option['value'] ) ? $option['value'] : '';
771
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
772
- $default = isset( $option['default'] ) ? $option['default'] : '';
773
- }
774
-
775
- $value = !empty($value) ? $value : $default;
776
-
777
- //$value = get_post_meta( $post_id, $id, true );
778
- $title = isset( $option['title'] ) ? $option['title'] : "";
779
- $details = isset( $option['details'] ) ? $option['details'] : "";
780
-
781
- $attributes_html = '';
782
-
783
- foreach ($attributes as $attributeId=>$attribute):
784
-
785
- $attributes_html = $attributeId.'='.$attribute.' ';
786
-
787
- endforeach;
788
-
789
-
790
- ob_start();
791
- ?>
792
- <select <?php echo $attributes_html; ?> class="select2" <?php if($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
793
- <?php
794
- foreach( $args as $key => $name ):
795
-
796
- if($multiple){
797
- $selected = in_array($key, $value) ? "selected" : "";
798
- }else{
799
- $selected = ($key == $value) ? "selected" : "";
800
- }
801
-
802
- ?>
803
- <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
804
- <?php
805
- endforeach;
806
- ?>
807
- </select>
808
- <?php
809
-
810
- $input_html = ob_get_clean();
811
-
812
- echo sprintf($field_template, $title, $input_html, $details);
813
-
814
-
815
-
816
-
817
-
818
- }
819
-
820
-
821
-
822
-
823
-
824
- public function field_text_multi( $option ){
825
-
826
- $id = isset( $option['id'] ) ? $option['id'] : "";
827
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
828
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
829
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
830
-
831
- $default = isset( $option['default'] ) ? $option['default'] : array();
832
- $values = isset( $option['value'] ) ? $option['value'] : $default;
833
-
834
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
835
-
836
- $remove_text = isset( $option['remove_text'] ) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
837
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : true;
838
- $allow_clone = isset( $option['allow_clone'] ) ? $option['allow_clone'] : false;
839
-
840
-
841
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
842
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
843
-
844
-
845
- $title = isset( $option['title'] ) ? $option['title'] : "";
846
- $details = isset( $option['details'] ) ? $option['details'] : "";
847
-
848
- if($is_pro == true){
849
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
850
- }
851
-
852
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
853
-
854
-
855
- ob_start();
856
- ?>
857
- <div id="input-wrapper-<?php echo $id; ?>" class="input-wrapper input-text-multi-wrapper
858
- input-text-multi-wrapper-<?php echo $css_id; ?>">
859
- <span data-placeholder="<?php echo esc_attr($placeholder); ?>" data-sort="<?php echo $sortable; ?>" data-clone="<?php echo $allow_clone; ?>" data-name="<?php echo $field_name; ?>[]" class="button add-item"><?php echo __('Add', $this->textdomain); ?></span>
860
- <div class="field-list <?php if($sortable){ echo 'sortable'; }?>" id="<?php echo $css_id; ?>">
861
- <?php
862
- if(!empty($values)):
863
- foreach ($values as $value):
864
- ?>
865
- <div class="item">
866
- <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
867
- echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
868
-
869
- <?php if($allow_clone):?>
870
- <span class="button clone"><i class="far fa-clone"></i></span>
871
- <?php endif; ?>
872
-
873
-
874
- <?php if($sortable):?>
875
- <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
876
- <?php endif; ?>
877
-
878
- <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
879
- </div>
880
- <?php
881
- endforeach;
882
-
883
- else:
884
-
885
- ?>
886
- <div class="item">
887
- <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
888
- echo esc_attr($placeholder); ?>" value="" />
889
-
890
- <?php if($allow_clone):?>
891
- <span class="button clone"><i class="far fa-clone"></i></span>
892
- <?php endif; ?>
893
-
894
-
895
- <?php if($sortable):?>
896
- <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
897
- <?php endif; ?>
898
-
899
- <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
900
- </div>
901
- <?php
902
-
903
- endif;
904
- ?>
905
- </div>
906
- <div class="error-mgs"></div>
907
-
908
-
909
- </div>
910
-
911
- <?php
912
-
913
- $input_html = ob_get_clean();
914
-
915
- echo sprintf($field_template, $title, $input_html, $details);
916
-
917
- }
918
-
919
- public function field_hidden( $option ){
920
-
921
- $id = isset( $option['id'] ) ? $option['id'] : "";
922
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
923
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
924
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
925
- $value = isset( $option['value'] ) ? $option['value'] : '';
926
- $default = isset( $option['default'] ) ? $option['default'] : '';
927
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
928
-
929
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
930
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
931
-
932
- $value = !empty($value) ? $value : $default;
933
-
934
- $title = isset( $option['title'] ) ? $option['title'] : "";
935
- $details = isset( $option['details'] ) ? $option['details'] : "";
936
-
937
- if($is_pro == true){
938
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
939
- }
940
-
941
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
942
-
943
-
944
- ob_start();
945
- ?>
946
- <input type="hidden" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo esc_attr($value); ?>" />
947
- <?php
948
-
949
- $input_html = ob_get_clean();
950
-
951
- echo sprintf($field_template, $title, $input_html, $details);
952
-
953
- }
954
-
955
-
956
- public function field_text( $option ){
957
-
958
- $id = isset( $option['id'] ) ? $option['id'] : "";
959
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
960
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
961
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
962
- $value = isset( $option['value'] ) ? $option['value'] : '';
963
- $default = isset( $option['default'] ) ? $option['default'] : '';
964
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
965
-
966
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
967
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
968
-
969
- $value = !empty($value) ? $value : $default;
970
-
971
- $title = isset( $option['title'] ) ? $option['title'] : "";
972
- $details = isset( $option['details'] ) ? $option['details'] : "";
973
-
974
- if($is_pro == true){
975
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
976
- }
977
-
978
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
979
-
980
-
981
- ob_start();
982
- ?>
983
- <input type="text" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo esc_attr($value); ?>" />
984
- <?php
985
-
986
- $input_html = ob_get_clean();
987
-
988
- echo sprintf($field_template, $title, $input_html, $details);
989
-
990
- }
991
-
992
-
993
-
994
- public function field_wp_editor( $option ){
995
-
996
- $id = isset( $option['id'] ) ? $option['id'] : "";
997
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
998
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
999
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1000
- $value = isset( $option['value'] ) ? $option['value'] : '';
1001
- $default = isset( $option['default'] ) ? $option['default'] : '';
1002
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1003
-
1004
-
1005
-
1006
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1007
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1008
-
1009
- $value = !empty($value) ? $value : $default;
1010
-
1011
- $title = isset( $option['title'] ) ? $option['title'] : "";
1012
- $details = isset( $option['details'] ) ? $option['details'] : "";
1013
-
1014
- if($is_pro == true){
1015
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1016
- }
1017
-
1018
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1019
-
1020
- $editor_settings= isset( $option['editor_settings'] ) ? $option['editor_settings'] : array('textarea_name'=>$field_name, 'teeny' => true, 'textarea_rows' => 15, );
1021
-
1022
- ob_start();
1023
-
1024
- ?>
1025
- <div id="field-wrapper-<?php echo $id; ?>" class="<?php if(!empty($depends)) echo 'dependency-field'; ?> field-wrapper field-wp_editor-wrapper
1026
- field-wp_editor-wrapper-<?php echo $id; ?>">
1027
- <?php
1028
- wp_editor( $value, $css_id, $editor_settings);
1029
- ?>
1030
- <div class="error-mgs"></div>
1031
- </div>
1032
-
1033
- <?php
1034
-
1035
-
1036
-
1037
-
1038
- $input_html = ob_get_clean();
1039
-
1040
- echo sprintf($field_template, $title, $input_html, $details);
1041
-
1042
- }
1043
-
1044
-
1045
-
1046
-
1047
-
1048
-
1049
- public function field_text_icon( $option ){
1050
-
1051
- $id = isset( $option['id'] ) ? $option['id'] : "";
1052
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1053
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1054
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1055
- $value = isset( $option['value'] ) ? $option['value'] : '';
1056
- $default = isset( $option['default'] ) ? $option['default'] : '';
1057
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1058
-
1059
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1060
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1061
-
1062
- $title = isset( $option['title'] ) ? $option['title'] : "";
1063
- $details = isset( $option['details'] ) ? $option['details'] : "";
1064
-
1065
- $option_value = empty($value) ? $default : $value;
1066
-
1067
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1068
-
1069
-
1070
-
1071
-
1072
- ob_start();
1073
- ?>
1074
- <div class="text-icon">
1075
- <span class="icon"><?php echo $option_value; ?></span><input type="text" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($option_value); ?>" />
1076
- </div>
1077
- <style type="text/css">
1078
- .text-icon{}
1079
- .text-icon .icon{
1080
- /* width: 30px; */
1081
- background: #ddd;
1082
- /* height: 28px; */
1083
- display: inline-block;
1084
- vertical-align: top;
1085
- text-align: center;
1086
- font-size: 14px;
1087
- padding: 5px 10px;
1088
- line-height: normal;
1089
- }
1090
- </style>
1091
- <script>
1092
- jQuery(document).ready(function($){
1093
- $(document).on("keyup", ".text-icon input", function () {
1094
- val = $(this).val();
1095
- if(val){
1096
- $(this).parent().children(".icon").html(val);
1097
- }
1098
- })
1099
- })
1100
- </script>
1101
- <?php
1102
-
1103
- $input_html = ob_get_clean();
1104
-
1105
- echo sprintf($field_template, $title, $input_html, $details);
1106
-
1107
- }
1108
-
1109
-
1110
-
1111
- public function field_range( $option ){
1112
-
1113
- $id = isset( $option['id'] ) ? $option['id'] : "";
1114
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1115
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1116
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1117
-
1118
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1119
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1120
-
1121
- $value = isset( $option['value'] ) ? $option['value'] : '';
1122
- $default = isset( $option['default'] ) ? $option['default'] : '';
1123
- $value = !empty($value) ? $value : $default;
1124
-
1125
- $args = isset( $option['args'] ) ? $option['args'] : "";
1126
-
1127
- $min = isset($args['min']) ? $args['min'] : '';
1128
- $max = isset($args['max']) ? $args['max'] : '';
1129
- $step = isset($args['step']) ? $args['step'] : '';
1130
-
1131
- $title = isset( $option['title'] ) ? $option['title'] : "";
1132
- $details = isset( $option['details'] ) ? $option['details'] : "";
1133
-
1134
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1135
-
1136
-
1137
- ob_start();
1138
- ?>
1139
- <div class="range-input">
1140
- <span class="range-value"><?php echo $value; ?></span><input type="range" min="<?php if($min) echo $min; ?>" max="<?php if($max) echo $max; ?>" step="<?php if($step) echo $step; ?>" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
1141
- </div>
1142
-
1143
- <script>
1144
- jQuery(document).ready(function($){
1145
- $(document).on("change", "#<?php echo $css_id; ?>", function () {
1146
- val = $(this).val();
1147
- if(val){
1148
- $(this).parent().children(".range-value").html(val);
1149
- }
1150
- })
1151
- })
1152
- </script>
1153
-
1154
- <style type="text/css">
1155
- .range-input{}
1156
- .range-input .range-value{
1157
- display: inline-block;
1158
- vertical-align: top;
1159
- margin: 0 0;
1160
- padding: 4px 10px;
1161
- background: #eee;
1162
- }
1163
- </style>
1164
- <?php
1165
-
1166
- $input_html = ob_get_clean();
1167
- echo sprintf($field_template, $title, $input_html, $details);
1168
- }
1169
-
1170
-
1171
-
1172
- public function field_textarea( $option ){
1173
-
1174
- $id = isset( $option['id'] ) ? $option['id'] : "";
1175
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1176
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1177
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1178
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1179
- $value = isset( $option['value'] ) ? $option['value'] : '';
1180
- $default = isset( $option['default'] ) ? $option['default'] : '';
1181
- $value = !empty($value) ? $value : $default;
1182
-
1183
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1184
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1185
-
1186
- $title = isset( $option['title'] ) ? $option['title'] : "";
1187
- $details = isset( $option['details'] ) ? $option['details'] : "";
1188
-
1189
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1190
-
1191
- if($is_pro == true){
1192
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1193
- }
1194
-
1195
-
1196
- ob_start();
1197
- ?>
1198
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1199
- <?php
1200
-
1201
- $input_html = ob_get_clean();
1202
-
1203
- echo sprintf($field_template, $title, $input_html, $details);
1204
-
1205
- }
1206
-
1207
-
1208
-
1209
- public function field_textarea_editor( $option ){
1210
-
1211
- $id = isset( $option['id'] ) ? $option['id'] : "";
1212
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1213
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1214
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1215
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1216
- $value = isset( $option['value'] ) ? $option['value'] : '';
1217
- $default = isset( $option['default'] ) ? $option['default'] : '';
1218
- $value = !empty($value) ? $value : $default;
1219
-
1220
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1221
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1222
-
1223
- $title = isset( $option['title'] ) ? $option['title'] : "";
1224
- $details = isset( $option['details'] ) ? $option['details'] : "";
1225
-
1226
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1227
-
1228
- if($is_pro == true){
1229
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1230
- }
1231
-
1232
-
1233
- ob_start();
1234
- ?>
1235
- <textarea editor_enabled="no" class="textarea-editor" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1236
- <?php
1237
-
1238
- $input_html = ob_get_clean();
1239
-
1240
- echo sprintf($field_template, $title, $input_html, $details);
1241
-
1242
- }
1243
-
1244
-
1245
-
1246
- public function field_scripts_js( $option ){
1247
-
1248
- $id = isset( $option['id'] ) ? $option['id'] : "";
1249
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1250
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1251
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1252
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1253
- $value = isset( $option['value'] ) ? $option['value'] : '';
1254
- $default = isset( $option['default'] ) ? $option['default'] : '';
1255
- $value = !empty($value) ? $value : $default;
1256
-
1257
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1258
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1259
-
1260
- $title = isset( $option['title'] ) ? $option['title'] : "";
1261
- $details = isset( $option['details'] ) ? $option['details'] : "";
1262
-
1263
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1264
-
1265
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/javascript' ) );
1266
- $code_editor = wp_json_encode( $settings );
1267
-
1268
-
1269
- ob_start();
1270
- ?>
1271
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1272
-
1273
- <script>
1274
- jQuery(document).ready(function($){
1275
- wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1276
- })
1277
- </script>
1278
- <?php
1279
-
1280
- $input_html = ob_get_clean();
1281
-
1282
- echo sprintf($field_template, $title, $input_html, $details);
1283
-
1284
-
1285
-
1286
-
1287
- }
1288
-
1289
-
1290
- public function field_scripts_css( $option ){
1291
-
1292
- $id = isset( $option['id'] ) ? $option['id'] : "";
1293
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1294
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1295
-
1296
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1297
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1298
- $value = isset( $option['value'] ) ? $option['value'] : '';
1299
- $default = isset( $option['default'] ) ? $option['default'] : '';
1300
- $value = !empty($value) ? $value : $default;
1301
-
1302
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1303
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1304
-
1305
- $title = isset( $option['title'] ) ? $option['title'] : "";
1306
- $details = isset( $option['details'] ) ? $option['details'] : "";
1307
-
1308
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
1309
- $code_editor = wp_json_encode( $settings );
1310
-
1311
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1312
- ?>
1313
-
1314
- <?php
1315
-
1316
- ob_start();
1317
- ?>
1318
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1319
- <script>
1320
-
1321
-
1322
- jQuery(document).ready(function($){
1323
-
1324
- wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1325
-
1326
-
1327
- })
1328
-
1329
-
1330
-
1331
-
1332
- </script>
1333
- <?php
1334
-
1335
- $input_html = ob_get_clean();
1336
-
1337
- echo sprintf($field_template, $title, $input_html, $details);
1338
-
1339
- }
1340
-
1341
-
1342
-
1343
-
1344
-
1345
- public function field_checkbox( $option ){
1346
-
1347
- $id = isset( $option['id'] ) ? $option['id'] : "";
1348
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1349
- $title = isset( $option['title'] ) ? $option['title'] : "";
1350
- $details = isset( $option['details'] ) ? $option['details'] : "";
1351
- $for = isset( $option['for'] ) ? $option['for'] : "";
1352
- $args = isset( $option['args'] ) ? $option['args'] : array();
1353
-
1354
- $style = isset( $option['style'] ) ? $option['style'] : array();
1355
- $style_inline = isset( $style['inline'] ) ? $style['inline'] : true;
1356
-
1357
-
1358
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1359
- $default = isset( $option['default'] ) ? $option['default'] : '';
1360
- $option_value = !empty($option_value) ? $option_value : $default;
1361
-
1362
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1363
-
1364
-
1365
-
1366
- ?>
1367
- <div class="setting-field">
1368
- <div class="field-lable"><?php if(!empty($title)) echo $title; ?></div>
1369
- <div class="field-input">
1370
- <?php
1371
-
1372
-
1373
-
1374
- if(!empty($args))
1375
- foreach( $args as $key => $value ):
1376
-
1377
-
1378
- //$checked = ( $key == $option_value ) ? "checked" : "";
1379
- $checked = in_array($key, $option_value) ? "checked" : "";
1380
-
1381
- $for = !empty($for) ? $for.'-'.$id."-".$key : $id."-".$key;
1382
-
1383
-
1384
- ?>
1385
- <label for='<?php echo $for;?>'><input name='<?php echo $field_name; ?>[]' type='checkbox' id='<?php echo $for; ?>' value='<?php echo $key;?>' <?php echo $checked;?>><span><?php echo $value;?></span></label>
1386
-
1387
- <?php
1388
-
1389
- if(!$style_inline){
1390
- ?>
1391
- <br>
1392
- <?php
1393
- }
1394
-
1395
- endforeach;
1396
-
1397
- ?>
1398
- <p class="description"><?php if(!empty($details)) echo $details; ?></p>
1399
- </div>
1400
- </div>
1401
- <?php
1402
-
1403
-
1404
- }
1405
-
1406
-
1407
-
1408
- public function field_radio( $option ){
1409
-
1410
- $id = isset( $option['id'] ) ? $option['id'] : "";
1411
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1412
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1413
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1414
- $title = isset( $option['title'] ) ? $option['title'] : "";
1415
- $details = isset( $option['details'] ) ? $option['details'] : "";
1416
- $for = isset( $option['for'] ) ? $option['for'] : "";
1417
- $args = isset( $option['args'] ) ? $option['args'] : array();
1418
-
1419
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1420
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1421
-
1422
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1423
- $default = isset( $option['default'] ) ? $option['default'] : '';
1424
- $option_value = !empty($option_value) ? $option_value : $default;
1425
-
1426
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1427
-
1428
-
1429
- ob_start();
1430
-
1431
- if(!empty($args))
1432
- foreach( $args as $key => $value ):
1433
- $checked = ( $key == $option_value ) ? "checked" : "";
1434
- $for = !empty($for) ? $for.'-'.$css_id."-".$key : $css_id."-".$key;
1435
- ?>
1436
- <label for="<?php echo $for;?>"><input name="<?php echo $field_name; ?>" type="radio" id="<?php echo $for; ?>" value="<?php echo $key;?>" <?php echo $checked;?>><span><?php echo $value;?></span></label>
1437
-
1438
- <?php
1439
- endforeach;
1440
-
1441
- $input_html = ob_get_clean();
1442
-
1443
- echo sprintf($field_template, $title, $input_html, $details);
1444
-
1445
-
1446
- }
1447
-
1448
-
1449
-
1450
- public function field_radio_image( $option ){
1451
-
1452
- $id = isset( $option['id'] ) ? $option['id'] : "";
1453
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1454
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1455
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1456
- $args = isset( $option['args'] ) ? $option['args'] : array();
1457
- //$args = is_array( $args ) ? $args : $this->generate_args_from_string( $args );
1458
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1459
- $default = isset( $option['default'] ) ? $option['default'] : '';
1460
-
1461
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1462
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1463
-
1464
- $title = isset( $option['title'] ) ? $option['title'] : "";
1465
- $details = isset( $option['details'] ) ? $option['details'] : "";
1466
- $width = isset( $option['width'] ) ? $option['width'] : "250px";
1467
-
1468
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1469
-
1470
- //var_dump($option_value);
1471
-
1472
- $option_value = empty($option_value) ? $default : $option_value;
1473
-
1474
-
1475
-
1476
- ob_start();
1477
- ?>
1478
- <div class="radio-img">
1479
- <?php
1480
- foreach( $args as $key => $value ):
1481
-
1482
- $name = $value['name'];
1483
- $thumb = $value['thumb'];
1484
- $disabled = isset($value['disabled']) ? $value['disabled'] : '';
1485
- $pro_msg = isset($value['pro_msg']) ? $value['pro_msg'] : '';
1486
- $link = isset($value['link']) ? $value['link'] : '';
1487
- $link_text = isset($value['link_text']) ? $value['link_text'] : 'Go';
1488
-
1489
- $checked = ($key == $option_value) ? "checked" : "";
1490
-
1491
- //var_dump($checked);
1492
-
1493
- ?>
1494
- <label title="<?php echo $name; ?>" class="<?php if($checked =='checked') echo 'active';?> <?php if($disabled == true) echo 'disabled';?>">
1495
- <input <?php if($disabled) echo 'disabled'; ?> name="<?php echo $field_name; ?>" type="radio" id="<?php echo $css_id; ?>-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?>>
1496
-
1497
- <?php
1498
- if(!empty($thumb)):
1499
- ?>
1500
- <img style="width: <?php echo $width; ?>;" alt="<?php echo $name; ?>" src="<?php echo $thumb; ?>">
1501
- <div style="padding: 5px;" class="name"><?php echo $name; ?></div>
1502
-
1503
- <?php
1504
- else:
1505
- echo $name;
1506
- endif;
1507
- ?>
1508
-
1509
- <?php if($disabled == true):?>
1510
- <span class="pro-msg"><?php echo $pro_msg; ?></span>
1511
- <?php endif; ?>
1512
- <?php if(!empty($link)):?>
1513
- <a target="_blank" class="link" href="<?php echo $link; ?>"><?php echo $link_text; ?></a>
1514
- <?php endif; ?>
1515
-
1516
- </label>
1517
- <?php
1518
-
1519
- endforeach;
1520
- ?>
1521
- </div>
1522
- <script>
1523
- jQuery(document).ready(function($){
1524
- $(document).on("click", ".radio-img label", function () {
1525
- if($(this).hasClass('disabled')){
1526
- return;
1527
- }
1528
-
1529
- $(this).parent().children("label").removeClass("active");
1530
- $(this).addClass("active");
1531
-
1532
- })
1533
- })
1534
- </script>
1535
-
1536
- <style type="text/css">
1537
- .radio-img{}
1538
- .radio-img label{
1539
- display: inline-block;
1540
- vertical-align: top;
1541
- margin: 5px;
1542
- padding: 2px;
1543
- background: #eee;
1544
- position: relative;
1545
- }
1546
-
1547
- .radio-img label.active{
1548
- background: #fd730d;
1549
- }
1550
-
1551
- .radio-img label.disabled{
1552
- background: #e2e2e2;
1553
-
1554
- }
1555
- .radio-img label.disabled img{
1556
- background: #e2e2e2;
1557
- opacity: .3;
1558
- }
1559
-
1560
- .radio-img label.disabled .pro-msg{
1561
- background: #ffd87f;
1562
- position: absolute;
1563
- top: 50%;
1564
- left: 50%;
1565
- transform: translate(-50%,-50%);
1566
- padding: 0 10px;
1567
-
1568
- }
1569
-
1570
- .radio-img label .link{
1571
- background: hsl(200, 7%, 42%);
1572
- position: absolute;
1573
- top: 2px;
1574
- /* transform: translate(0%,-50%); */
1575
- padding: 3px 14px;
1576
- text-decoration: none;
1577
- font-size: 14px;
1578
- color: #fff;
1579
- right: 2px;
1580
-
1581
- }
1582
-
1583
-
1584
- .radio-img input[type=radio]{
1585
- display: none;
1586
- }
1587
- .radio-img img{
1588
-
1589
- vertical-align: top;
1590
- }
1591
-
1592
- </style>
1593
- <?php
1594
-
1595
- $input_html = ob_get_clean();
1596
-
1597
- echo sprintf($field_template, $title, $input_html, $details);
1598
-
1599
-
1600
- }
1601
-
1602
- public function field_datepicker( $option ){
1603
-
1604
- $id = isset( $option['id'] ) ? $option['id'] : "";
1605
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1606
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1607
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1608
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1609
- $format = isset( $option['format'] ) ? $option['format'] : "";
1610
-
1611
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1612
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1613
-
1614
- $value = isset( $option['value'] ) ? $option['value'] : '';
1615
- $default = isset( $option['default'] ) ? $option['default'] : '';
1616
- $value = !empty($value) ? $value : $default;
1617
-
1618
- $title = isset( $option['title'] ) ? $option['title'] : "";
1619
- $details = isset( $option['details'] ) ? $option['details'] : "";
1620
-
1621
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1622
-
1623
-
1624
- wp_enqueue_script('jquery-ui-datepicker');
1625
- wp_enqueue_style( 'jquery-ui');
1626
-
1627
- ob_start();
1628
- ?>
1629
- <input type="text" autocomplete="off" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo $value; ?>" />
1630
- <script>jQuery(document).ready(function($) { $("#<?php echo $css_id; ?>").datepicker({ dateFormat: "<?php echo $format; ?>" });});</script>
1631
- <?php
1632
-
1633
- $input_html = ob_get_clean();
1634
-
1635
- echo sprintf($field_template, $title, $input_html, $details);
1636
- }
1637
-
1638
-
1639
-
1640
- public function field_colorpicker( $option ){
1641
-
1642
- $id = isset( $option['id'] ) ? $option['id'] : "";
1643
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1644
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1645
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1646
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1647
-
1648
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1649
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1650
-
1651
- $value = isset( $option['value'] ) ? $option['value'] : '';
1652
- $default = isset( $option['default'] ) ? $option['default'] : '';
1653
- $value = !empty($value) ? $value : $default;
1654
-
1655
- $title = isset( $option['title'] ) ? $option['title'] : "";
1656
- $details = isset( $option['details'] ) ? $option['details'] : "";
1657
-
1658
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1659
-
1660
- ob_start();
1661
- ?>
1662
- <input colorPicker="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1663
- <?php
1664
-
1665
- $input_html = ob_get_clean();
1666
-
1667
- echo sprintf($field_template, $title, $input_html, $details);
1668
- }
1669
-
1670
-
1671
- public function field_colorpicker_multi( $option ){
1672
-
1673
- $id = isset( $option['id'] ) ? $option['id'] : "";
1674
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1675
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1676
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1677
- $args = isset( $option['args'] ) ? $option['args'] : "";
1678
-
1679
-
1680
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1681
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1682
-
1683
- $value = isset( $option['value'] ) ? $option['value'] : '';
1684
- $default = isset( $option['default'] ) ? $option['default'] : '';
1685
- $value = !empty($value) ? $value : $default;
1686
-
1687
- $title = isset( $option['title'] ) ? $option['title'] : "";
1688
- $details = isset( $option['details'] ) ? $option['details'] : "";
1689
-
1690
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1691
-
1692
-
1693
-
1694
- //echo '<pre>'.var_export($args, true).'</pre>';
1695
-
1696
- ob_start();
1697
-
1698
- if(!empty($args)):
1699
-
1700
- foreach ($args as $arg_key => $arg):
1701
-
1702
- $item_value = isset($value[$arg_key]) ? $value[$arg_key] : $arg;
1703
-
1704
-
1705
- ?>
1706
- <div class="">
1707
- <span><?php echo $arg_key; ?></span>
1708
- <input name="<?php echo $field_name; ?>[<?php echo $arg_key; ?>]" id="<?php echo $arg_key.'-'.$css_id; ?>" value="<?php echo $item_value; ?>" />
1709
- <script>jQuery(document).ready(function($) { $("#<?php echo $arg_key.'-'.$css_id; ?>").wpColorPicker();});</script>
1710
- </div>
1711
-
1712
- <?php
1713
- endforeach;
1714
-
1715
- endif;
1716
-
1717
-
1718
- $input_html = ob_get_clean();
1719
-
1720
- echo sprintf($field_template, $title, $input_html, $details);
1721
- }
1722
-
1723
-
1724
-
1725
- public function field_custom_html( $option ){
1726
-
1727
- $id = isset( $option['id'] ) ? $option['id'] : "";
1728
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1729
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1730
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1731
- $html = isset( $option['html'] ) ? $option['html'] : "";
1732
-
1733
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1734
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1735
-
1736
- $title = isset( $option['title'] ) ? $option['title'] : "";
1737
- $details = isset( $option['details'] ) ? $option['details'] : "";
1738
-
1739
-
1740
- echo sprintf($field_template, $title, $html, $details);
1741
-
1742
-
1743
-
1744
-
1745
-
1746
-
1747
-
1748
- }
1749
-
1750
-
1751
-
1752
- }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-settings-tabs.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined('ABSPATH')) exit; // if direct access
4
  if( ! class_exists( 'settings_tabs_field' ) ) {
5
  class settings_tabs_field{
6
 
7
- // public $asset_dir_url = '';
8
  public $textdomain = 'settings-tabs';
9
 
10
  public function __construct(){
@@ -36,7 +36,13 @@ class settings_tabs_field{
36
  wp_enqueue_script( 'code-editor' );
37
  wp_enqueue_style( 'code-editor' );
38
 
39
- wp_enqueue_editor();
 
 
 
 
 
 
40
  }
41
 
42
  function field_template($option){
@@ -418,6 +424,8 @@ class settings_tabs_field{
418
  $parent = isset( $option['parent'] ) ? $option['parent'] : "";
419
  $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
420
  $title = isset( $option['title'] ) ? $option['title'] : "";
 
 
421
  $details = isset( $option['details'] ) ? $option['details'] : "";
422
 
423
  $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
@@ -433,8 +441,6 @@ class settings_tabs_field{
433
 
434
 
435
  $media_url = !empty($media_url) ? $media_url : $default;
436
-
437
- $placeholder = 'https://i.imgur.com/qOPTTdQ.jpg';
438
  $media_url = !empty($media_url) ? $media_url : $placeholder;
439
  $media_basename = wp_basename($media_type);
440
 
@@ -443,7 +449,6 @@ class settings_tabs_field{
443
 
444
 
445
 
446
-
447
  ob_start();
448
  //wp_enqueue_media();
449
 
@@ -512,6 +517,8 @@ class settings_tabs_field{
512
  $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
513
  $parent = isset( $option['parent'] ) ? $option['parent'] : "";
514
  $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
 
 
515
  $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
516
  $title = isset( $option['title'] ) ? $option['title'] : "";
517
  $details = isset( $option['details'] ) ? $option['details'] : "";
@@ -527,6 +534,7 @@ class settings_tabs_field{
527
  $media_type = get_post_mime_type( $value );
528
  $media_title= get_the_title( $value );
529
  $media_url = !empty($media_url) ? $media_url : '';
 
530
 
531
  $field_name = !empty( $field_name ) ? $field_name : $id;
532
  $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
@@ -567,7 +575,7 @@ class settings_tabs_field{
567
  </div>
568
  <input type="text" placeholder="<?php echo $placeholder; ?>" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
569
  <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain);?></div>
570
- <div class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear','woocommerce-products-slider');?></div>
571
  <div class="error-mgs"></div>
572
  </div>
573
 
@@ -668,7 +676,7 @@ class settings_tabs_field{
668
 
669
  <div id="input-wrapper-<?php echo $css_id; ?>" class=" input-wrapper field-repeatable-wrapper
670
  field-repeatable-wrapper-<?php echo $css_id; ?>">
671
- <div add_html="<?php echo esc_attr($fieldHtml); ?>" class="add-repeat-field"><i class="far fa-plus-square"></i> <?php _e('Add','woocommerce-products-slider'); ?></div>
672
  <div class="repeatable-field-list sortable" id="<?php echo $css_id; ?>">
673
  <?php
674
  if(!empty($values)):
@@ -1540,6 +1548,7 @@ class settings_tabs_field{
1540
  //$args = is_array( $args ) ? $args : $this->generate_args_from_string( $args );
1541
  $option_value = isset( $option['value'] ) ? $option['value'] : '';
1542
  $default = isset( $option['default'] ) ? $option['default'] : '';
 
1543
 
1544
  $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1545
  $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
@@ -1581,7 +1590,7 @@ class settings_tabs_field{
1581
  if(!empty($thumb)):
1582
 
1583
  ?>
1584
- <img alt="<?php echo $name; ?>" src="<?php echo $thumb; ?>">
1585
  <div style="padding: 5px;" class="name"><?php echo $name; ?></div>
1586
 
1587
  <?php
@@ -1603,19 +1612,6 @@ class settings_tabs_field{
1603
  endforeach;
1604
  ?>
1605
  </div>
1606
- <script>
1607
- jQuery(document).ready(function($){
1608
- $(document).on("click", ".radio-img label", function () {
1609
- if($(this).hasClass('disabled')){
1610
- return;
1611
- }
1612
-
1613
- $(this).parent().children("label").removeClass("active");
1614
- $(this).addClass("active");
1615
-
1616
- })
1617
- })
1618
- </script>
1619
 
1620
  <style type="text/css">
1621
  .radio-img{}
4
  if( ! class_exists( 'settings_tabs_field' ) ) {
5
  class settings_tabs_field{
6
 
7
+ //public $asset_dir_url = '';
8
  public $textdomain = 'settings-tabs';
9
 
10
  public function __construct(){
36
  wp_enqueue_script( 'code-editor' );
37
  wp_enqueue_style( 'code-editor' );
38
 
39
+ wp_enqueue_script( 'jquery.lazy' );
40
+
41
+ if (function_exists('wp_enqueue_editor')) {
42
+ wp_enqueue_editor();
43
+ }
44
+
45
+
46
  }
47
 
48
  function field_template($option){
424
  $parent = isset( $option['parent'] ) ? $option['parent'] : "";
425
  $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
426
  $title = isset( $option['title'] ) ? $option['title'] : "";
427
+ $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
428
+
429
  $details = isset( $option['details'] ) ? $option['details'] : "";
430
 
431
  $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
441
 
442
 
443
  $media_url = !empty($media_url) ? $media_url : $default;
 
 
444
  $media_url = !empty($media_url) ? $media_url : $placeholder;
445
  $media_basename = wp_basename($media_type);
446
 
449
 
450
 
451
 
 
452
  ob_start();
453
  //wp_enqueue_media();
454
 
517
  $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
518
  $parent = isset( $option['parent'] ) ? $option['parent'] : "";
519
  $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
520
+ $placeholder_img = isset( $option['placeholder_img'] ) ? $option['placeholder_img'] : "";
521
+
522
  $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
523
  $title = isset( $option['title'] ) ? $option['title'] : "";
524
  $details = isset( $option['details'] ) ? $option['details'] : "";
534
  $media_type = get_post_mime_type( $value );
535
  $media_title= get_the_title( $value );
536
  $media_url = !empty($media_url) ? $media_url : '';
537
+ $media_url = !empty($media_url) ? $media_url : $placeholder_img;
538
 
539
  $field_name = !empty( $field_name ) ? $field_name : $id;
540
  $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
575
  </div>
576
  <input type="text" placeholder="<?php echo $placeholder; ?>" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
577
  <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain);?></div>
578
+ <div class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear','post-grid');?></div>
579
  <div class="error-mgs"></div>
580
  </div>
581
 
676
 
677
  <div id="input-wrapper-<?php echo $css_id; ?>" class=" input-wrapper field-repeatable-wrapper
678
  field-repeatable-wrapper-<?php echo $css_id; ?>">
679
+ <div add_html="<?php echo esc_attr($fieldHtml); ?>" class="add-repeat-field"><i class="far fa-plus-square"></i> <?php _e('Add','post-grid'); ?></div>
680
  <div class="repeatable-field-list sortable" id="<?php echo $css_id; ?>">
681
  <?php
682
  if(!empty($values)):
1548
  //$args = is_array( $args ) ? $args : $this->generate_args_from_string( $args );
1549
  $option_value = isset( $option['value'] ) ? $option['value'] : '';
1550
  $default = isset( $option['default'] ) ? $option['default'] : '';
1551
+ $lazy_load_img = isset( $option['lazy_load_img'] ) ? $option['lazy_load_img'] : '';
1552
 
1553
  $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1554
  $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1590
  if(!empty($thumb)):
1591
 
1592
  ?>
1593
+ <img class="lazy" alt="<?php echo $name; ?>" data-src="<?php echo $thumb; ?>" src="<?php echo $lazy_load_img; ?>">
1594
  <div style="padding: 5px;" class="name"><?php echo $name; ?></div>
1595
 
1596
  <?php
1612
  endforeach;
1613
  ?>
1614
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
1615
 
1616
  <style type="text/css">
1617
  .radio-img{}
includes/class-settings.php CHANGED
@@ -14,19 +14,9 @@ class wcps_class_settings{
14
 
15
  public function admin_menu() {
16
 
17
- $wcps_plugin_info = get_option('wcps_plugin_info');
18
- $wcps_upgrade = isset($wcps_plugin_info['wcps_upgrade']) ? $wcps_plugin_info['wcps_upgrade'] : '';
19
-
20
  add_submenu_page( 'edit.php?post_type=wcps', __( 'Settings', 'woocommerce-products-slider' ), __( 'Settings', 'woocommerce-products-slider' ), 'manage_options', 'settings', array( $this, 'settings' ) );
21
  add_submenu_page( 'edit.php?post_type=wcps', __( 'Import layouts', 'woocommerce-products-slider' ), __( 'Import layouts', 'woocommerce-products-slider' ), 'manage_options', 'import_layouts', array( $this, 'import_layouts' ) );
22
 
23
- if($wcps_upgrade != 'done')
24
- add_submenu_page( 'edit.php?post_type=wcps', __( 'Upgrade status', 'woocommerce-products-slider' ), __( 'Upgrade status', 'woocommerce-products-slider' ), 'manage_options', 'upgrade_status', array( $this, 'upgrade_status' ) );
25
-
26
-
27
-
28
-
29
-
30
 
31
 
32
  }
@@ -38,12 +28,6 @@ class wcps_class_settings{
38
 
39
  }
40
 
41
-
42
- public function upgrade_status(){
43
- include( 'menu/upgrade-status.php' );
44
-
45
- }
46
-
47
  public function import_layouts(){
48
  include( 'menu/import-layouts.php' );
49
 
14
 
15
  public function admin_menu() {
16
 
 
 
 
17
  add_submenu_page( 'edit.php?post_type=wcps', __( 'Settings', 'woocommerce-products-slider' ), __( 'Settings', 'woocommerce-products-slider' ), 'manage_options', 'settings', array( $this, 'settings' ) );
18
  add_submenu_page( 'edit.php?post_type=wcps', __( 'Import layouts', 'woocommerce-products-slider' ), __( 'Import layouts', 'woocommerce-products-slider' ), 'manage_options', 'import_layouts', array( $this, 'import_layouts' ) );
19
 
 
 
 
 
 
 
 
20
 
21
 
22
  }
28
 
29
  }
30
 
 
 
 
 
 
 
31
  public function import_layouts(){
32
  include( 'menu/import-layouts.php' );
33
 
includes/class-update.php DELETED
@@ -1,115 +0,0 @@
1
- <?php
2
-
3
-
4
-
5
- if ( ! defined('ABSPATH')) exit; // if direct access
6
-
7
- if( ! class_exists( 'class_wcps_udpate' ) ) {
8
- class class_wcps_udpate
9
- {
10
-
11
-
12
- public function __construct()
13
- {
14
-
15
- //add_action( 'admin_notices', array( $this, 'wcps_plugin_version_upgrade_notice' ) );
16
- add_action('wcps_action_install', array($this, 'wcps_update_2_1_13'));
17
-
18
- }
19
-
20
-
21
- function wcps_plugin_version_upgrade_notice()
22
- {
23
- $wcps_upgrade = get_option('wcps_upgrade');
24
-
25
-
26
- $html = '';
27
-
28
- if ($wcps_upgrade == 'done') {
29
-
30
- } else {
31
- $html .= '<div class="update-nag">';
32
- $html .= 'Data update required for <b>Woocommerce Products Slider</b> latest version. <span id="wcps-upgrade">Click to update</span>';
33
- $html .= '</div>';
34
- }
35
-
36
-
37
- echo $html;
38
- }
39
-
40
-
41
- public function wcps_update_2_1_13()
42
- {
43
-
44
-
45
- $wp_query = new WP_Query(
46
- array(
47
- 'post_type' => 'wcps',
48
- 'post_status' => 'publish',
49
- 'post_per_page' => -1,
50
-
51
- ));
52
-
53
-
54
- if ($wp_query->have_posts()) :
55
- while ($wp_query->have_posts()) : $wp_query->the_post();
56
-
57
- $wcps_themes = get_post_meta(get_the_ID(), 'wcps_themes', true);
58
-
59
- if ($wcps_themes == 'theme12') {
60
-
61
- $wcps_themes = 'halfthumbright';
62
- } elseif ($wcps_themes == 'theme11') {
63
-
64
- $wcps_themes = 'halfthumbleft';
65
- } elseif ($wcps_themes == 'theme10') {
66
-
67
- $wcps_themes = 'contentbottom';
68
- } elseif ($wcps_themes == 'theme9') {
69
-
70
- $wcps_themes = 'contentinright';
71
- } elseif ($wcps_themes == 'theme8') {
72
-
73
- $wcps_themes = 'contentinleft';
74
- } elseif ($wcps_themes == 'theme7') {
75
-
76
- $wcps_themes = 'contentinbottom';
77
- } elseif ($wcps_themes == 'theme6') {
78
-
79
- $wcps_themes = 'zoomin';
80
- } elseif ($wcps_themes == 'theme5') {
81
-
82
- $wcps_themes = 'flat';
83
- } elseif ($wcps_themes == 'theme4') {
84
-
85
- $wcps_themes = 'flat';
86
- } elseif ($wcps_themes == 'theme3') {
87
-
88
- $wcps_themes = 'zoomin';
89
- } elseif ($wcps_themes == 'theme2') {
90
-
91
- $wcps_themes = 'flat';
92
- } elseif ($wcps_themes == 'theme1') {
93
-
94
- $wcps_themes = 'flat';
95
- } else {
96
- $wcps_themes = $wcps_themes;
97
- }
98
-
99
-
100
- update_post_meta(get_the_ID(), 'wcps_themes', $wcps_themes);
101
-
102
-
103
- endwhile;
104
- wp_reset_query();
105
-
106
-
107
- endif;
108
-
109
-
110
- }
111
-
112
-
113
- }
114
- }
115
- new class_wcps_udpate();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions-data-upgrade.php DELETED
@@ -1,594 +0,0 @@
1
- <?php
2
- if ( ! defined('ABSPATH')) exit; // if direct access
3
-
4
-
5
-
6
- add_shortcode('wcps_cron_upgrade_settings', 'wcps_cron_upgrade_settings');
7
- add_action('wcps_cron_upgrade_settings', 'wcps_cron_upgrade_settings');
8
-
9
- function wcps_cron_upgrade_settings(){
10
-
11
- $wcps_settings = get_option( 'wcps_settings', array() );
12
-
13
- $wcps_track_product_view = get_option( 'wcps_track_product_view' );
14
- $wcps_settings['track_product_view'] = $wcps_track_product_view;
15
-
16
- $wcps_license = get_option( 'wcps_license' );
17
- $license_key = isset($wcps_license['license_key']) ? $wcps_license['license_key'] : '';
18
-
19
- $wcps_settings['license_key'] = $license_key;
20
- $wcps_settings['font_aw_version'] = 'v_5';
21
-
22
-
23
- $social_fields_new = array();
24
- $social_fields_new[] = array('name'=> 'Email', 'media_id'=> 'email', 'icon'=> 'https://i.imgur.com/OS2saH8.png','font_icon'=> '', 'visibility'=> 1, 'share_url'=>'mailto:?subject=TITLE&body=URL' );
25
- $social_fields_new[] = array('name'=> 'Facebook', 'media_id'=> 'facebook', 'icon'=> 'https://i.imgur.com/IftZ9Ng.png','font_icon'=> '', 'visibility'=> 1, 'share_url'=>'https://www.facebook.com/sharer/sharer.php?u=URL' );
26
- $social_fields_new[] = array('name'=> 'Twitter', 'media_id'=> 'twitter', 'icon'=> 'https://i.imgur.com/JZDm0R5.png','font_icon'=> '', 'visibility'=> 1,'share_url'=>'https://twitter.com/intent/tweet?url=URL&text=TITLE' );
27
- $social_fields_new[] = array('name'=> 'Pinterest', 'media_id'=> 'pinterest', 'icon'=> 'https://i.imgur.com/VxUWxZC.png','font_icon'=> '', 'visibility'=> 0, 'share_url'=>'http://pinterest.com/pin/create/button/?url=URL&media=&description=TITLE' );
28
- $social_fields_new[] = array('name'=> 'Linkedin', 'media_id'=> 'linkedin', 'icon'=> 'https://i.imgur.com/8kuHCtD.png','font_icon'=> '', 'visibility'=> 0,'share_url'=>'https://www.linkedin.com/shareArticle?url=URL&title=TITLE&summary=&source=' );
29
-
30
- $wcps_settings['social_media_sites'] = $social_fields_new;
31
-
32
-
33
- update_option('wcps_settings', $wcps_settings);
34
-
35
- wp_clear_scheduled_hook('wcps_cron_upgrade_settings');
36
- wp_schedule_event(time(), '1minute', 'wcps_cron_upgrade_wcps');
37
-
38
- $wcps_plugin_info = get_option('wcps_plugin_info');
39
- $wcps_plugin_info['settings_upgrade'] = 'done';
40
-
41
- update_option('wcps_plugin_info', $wcps_plugin_info);
42
-
43
- }
44
-
45
-
46
-
47
-
48
-
49
- add_shortcode('wcps_cron_upgrade_wcps', 'wcps_cron_upgrade_wcps');
50
- add_action('wcps_cron_upgrade_wcps', 'wcps_cron_upgrade_wcps');
51
-
52
-
53
- function wcps_cron_upgrade_wcps(){
54
-
55
- $meta_query = array();
56
-
57
- $meta_query[] = array(
58
- 'key' => 'wcps_upgrade_status',
59
- 'compare' => 'NOT EXISTS'
60
- );
61
-
62
- $args = array(
63
- 'post_type'=>'wcps',
64
- 'post_status'=>'any',
65
- 'posts_per_page'=> 5,
66
- 'meta_query'=> $meta_query,
67
-
68
- );
69
-
70
-
71
-
72
- $wp_query = new WP_Query($args);
73
-
74
-
75
- if ( $wp_query->have_posts() ) :
76
- while ( $wp_query->have_posts() ) : $wp_query->the_post();
77
-
78
- $wcps_id = get_the_id();
79
- $wcps_title = get_the_title();
80
- $wcps_options = array();
81
-
82
- //echo $wcps_title.'<br/>';
83
-
84
-
85
- // Product Query options
86
- $wcps_total_items = get_post_meta( $wcps_id, 'wcps_total_items', true );
87
- $wcps_options['query']['post_per_page'] = $wcps_total_items;
88
-
89
- $wcps_product_categories = get_post_meta( $wcps_id, 'wcps_product_categories', true );
90
- $wcps_options['query']['taxonomy_terms'] = $wcps_product_categories;
91
-
92
- $wcps_meta_query = get_post_meta( $wcps_id, 'wcps_meta_query', true );
93
- $wcps_options['query']['meta_query_args'] = $wcps_meta_query;
94
-
95
- $wcps_meta_query_relation = get_post_meta( $wcps_id, 'wcps_meta_query_relation', true );
96
- $wcps_options['query']['meta_query_relation'] = $wcps_meta_query_relation;
97
-
98
- $wcps_query_order = get_post_meta( $wcps_id, 'wcps_query_order', true );
99
- $wcps_options['query']['order'] = $wcps_query_order;
100
-
101
- $wcps_query_orderby = get_post_meta( $wcps_id, 'wcps_query_orderby', true );
102
- $wcps_options['query']['orderby'] = is_array($wcps_query_orderby) ? $wcps_query_orderby : array($wcps_query_orderby);
103
-
104
- $wcps_more_query = get_post_meta( $wcps_id, 'wcps_more_query', true );
105
- $wcps_options['query']['more_query_args'] = $wcps_more_query;
106
-
107
- $wcps_hide_out_of_stock = get_post_meta( $wcps_id, 'wcps_hide_out_of_stock', true );
108
- $wcps_hide_out_of_stock = ($wcps_hide_out_of_stock =='yes') ? 'yes' : 'no';
109
- $wcps_options['query']['hide_out_of_stock'] = $wcps_hide_out_of_stock;
110
-
111
- $wcps_product_featured = get_post_meta( $wcps_id, 'wcps_product_featured', true );
112
- $wcps_product_featured = ($wcps_product_featured =='yes') ? 'yes' : 'no';
113
- $wcps_options['query']['featured'] = $wcps_product_featured;
114
-
115
- $wcps_product_on_sale = get_post_meta( $wcps_id, 'wcps_product_on_sale', true );
116
- $wcps_options['query']['on_sale'] = $wcps_product_on_sale;
117
-
118
- $wcps_product_only_discounted = get_post_meta( $wcps_id, 'wcps_product_only_discounted', true );
119
- $wcps_options['query']['only_discounted'] = $wcps_product_only_discounted;
120
-
121
-
122
-
123
- $wcps_product_best_selling = get_post_meta( $wcps_id, 'wcps_product_best_selling', true );
124
- $wcps_product_filter_by = get_post_meta( $wcps_id, 'wcps_product_filter_by', true );
125
- $wcps_product_filter_by = ($wcps_product_best_selling == 'yes') ? $wcps_product_best_selling : $wcps_product_filter_by;
126
-
127
- $wcps_options['query']['filter_by'] = $wcps_product_filter_by;
128
-
129
- $featured_first = ($wcps_product_filter_by == 'featured_first') ? 'yes':'no';
130
- $wcps_options['query']['featured_first'] = $featured_first;
131
-
132
-
133
-
134
- $wcps_product_ids = get_post_meta( $wcps_id, 'wcps_product_ids', true );
135
- $wcps_options['query']['product_ids'] = $wcps_product_ids;
136
-
137
-
138
- $wcps_product_sku = get_post_meta( $wcps_id, 'wcps_product_sku', true );
139
- $wcps_options['query']['product_sku'] = $wcps_product_sku;
140
-
141
- $wcps_upsells_crosssells = get_post_meta( $wcps_id, 'wcps_upsells_crosssells', true );
142
- $wcps_options['query']['upsells_crosssells'] = $wcps_upsells_crosssells;
143
-
144
- $wcps_related_product_query = get_post_meta( $wcps_id, 'wcps_related_product_query', true );
145
- $wcps_options['query']['related_product_query'] = $wcps_related_product_query;
146
-
147
- $wcps_related_product_query_by = get_post_meta( $wcps_id, 'wcps_related_product_query_by', true );
148
- $wcps_options['query']['related_product_query_by'] = $wcps_related_product_query_by;
149
-
150
-
151
- //Slider options
152
- $wcps_column_number = get_post_meta( $wcps_id, 'wcps_column_number', true );
153
- $wcps_options['slider']['column_large'] = $wcps_column_number;
154
-
155
- $wcps_column_number_tablet = get_post_meta( $wcps_id, 'wcps_column_number_tablet', true );
156
- $wcps_options['slider']['column_medium'] = $wcps_column_number_tablet;
157
-
158
- $wcps_column_number_mobile = get_post_meta( $wcps_id, 'wcps_column_number_mobile', true );
159
- $wcps_options['slider']['column_small'] = $wcps_column_number_mobile;
160
-
161
- $wcps_rows_enable = get_post_meta( $wcps_id, 'wcps_rows_enable', true );
162
- $wcps_options['slider']['rows_enable'] = $wcps_rows_enable;
163
-
164
- $wcps_rows_desktop = get_post_meta( $wcps_id, 'wcps_rows_desktop', true );
165
- $wcps_options['slider']['row_large'] = $wcps_rows_desktop;
166
-
167
- $wcps_rows_tablet = get_post_meta( $wcps_id, 'wcps_rows_tablet', true );
168
- $wcps_options['slider']['row_medium'] = $wcps_rows_tablet;
169
-
170
- $wcps_rows_mobile = get_post_meta( $wcps_id, 'wcps_rows_mobile', true );
171
- $wcps_options['slider']['row_small'] = $wcps_rows_mobile;
172
-
173
- $wcps_auto_play = get_post_meta( $wcps_id, 'wcps_auto_play', true );
174
- $wcps_options['slider']['auto_play'] = $wcps_auto_play;
175
-
176
- $wcps_auto_play_speed = get_post_meta( $wcps_id, 'wcps_auto_play_speed', true );
177
- $wcps_options['slider']['auto_play_speed'] = $wcps_auto_play_speed;
178
-
179
- $wcps_auto_play_timeout = get_post_meta( $wcps_id, 'wcps_auto_play_timeout', true );
180
- $wcps_options['slider']['auto_play_timeout'] = $wcps_auto_play_timeout;
181
-
182
- $wcps_slide_speed = get_post_meta( $wcps_id, 'wcps_slide_speed', true );
183
- $wcps_options['slider']['slide_speed'] = $wcps_slide_speed;
184
-
185
- $wcps_slideBy = get_post_meta( $wcps_id, 'wcps_slideBy', true );
186
- $wcps_options['slider']['slide_by_count'] = $wcps_slideBy;
187
-
188
- $wcps_rewind = get_post_meta( $wcps_id, 'wcps_rewind', true );
189
- $wcps_options['slider']['rewind'] = $wcps_rewind;
190
-
191
- $wcps_loop = get_post_meta( $wcps_id, 'wcps_loop', true );
192
- $wcps_options['slider']['loop'] = $wcps_loop;
193
-
194
- $wcps_center = get_post_meta( $wcps_id, 'wcps_center', true );
195
- $wcps_options['slider']['center'] = $wcps_center;
196
-
197
- $wcps_stop_on_hover = get_post_meta( $wcps_id, 'wcps_stop_on_hover', true );
198
- $wcps_options['slider']['stop_on_hover'] = $wcps_stop_on_hover;
199
-
200
- $wcps_slider_navigation_position = get_post_meta( $wcps_id, 'wcps_slider_navigation_position', true );
201
- $wcps_options['slider']['navigation_position'] = !empty($wcps_slider_navigation_position) ? $wcps_slider_navigation_position : 'topright';
202
-
203
- $wcps_options['slider']['navigation_background_color'] = '';
204
-
205
- $navigation_style = ($wcps_slider_navigation_position == 'middle' || $wcps_slider_navigation_position == 'middle-fixed') ? 'round' : 'flat';
206
-
207
- $wcps_options['slider']['navigation_style'] = $navigation_style;
208
- $wcps_options['slider']['navigation_color'] = '';
209
-
210
- $wcps_slider_pagination = get_post_meta( $wcps_id, 'wcps_slider_pagination', true );
211
- $wcps_options['slider']['pagination'] = $wcps_slider_pagination;
212
-
213
- $wcps_pagination_slide_speed = get_post_meta( $wcps_id, 'wcps_pagination_slide_speed', true );
214
- $wcps_options['slider']['pagination_speed'] = $wcps_pagination_slide_speed;
215
-
216
- $wcps_slider_pagination_bg = get_post_meta( $wcps_id, 'wcps_slider_pagination_bg', true );
217
- $wcps_options['slider']['pagination_background_color'] = $wcps_slider_pagination_bg;
218
-
219
- $wcps_slider_pagination_text_color = get_post_meta( $wcps_id, 'wcps_slider_pagination_text_color', true );
220
- $wcps_options['slider']['pagination_background_text_color'] = $wcps_slider_pagination_text_color;
221
-
222
- $wcps_slider_pagination_count = get_post_meta( $wcps_id, 'wcps_slider_pagination_count', true );
223
- $wcps_options['slider']['pagination_count'] = $wcps_slider_pagination_count;
224
-
225
- $wcps_slider_rtl = get_post_meta( $wcps_id, 'wcps_slider_rtl', true );
226
- $wcps_options['slider']['rtl'] = $wcps_slider_rtl;
227
-
228
- $wcps_slider_mouse_drag = get_post_meta( $wcps_id, 'wcps_slider_mouse_drag', true );
229
- $wcps_options['slider']['mouse_drag'] = $wcps_slider_mouse_drag;
230
-
231
- $wcps_slider_touch_drag = get_post_meta( $wcps_id, 'wcps_slider_touch_drag', true );
232
- $wcps_options['slider']['touch_drag'] = $wcps_slider_touch_drag;
233
-
234
- $wcps_slider_animateout = get_post_meta( $wcps_id, 'wcps_slider_animateout', true );
235
- $wcps_options['slider']['animate_out'] = $wcps_slider_animateout;
236
-
237
- $wcps_slider_animatein = get_post_meta( $wcps_id, 'wcps_slider_animatein', true );
238
- $wcps_options['slider']['animate_in'] = $wcps_slider_animatein;
239
-
240
-
241
- $wcps_themes = get_post_meta( $wcps_id, 'wcps_themes', true );
242
-
243
- // Ribbon options
244
- $wcps_ribbon_name = get_post_meta( $wcps_id, 'wcps_ribbon_name', true );
245
- $wcps_ribbon_custom = get_post_meta( $wcps_id, 'wcps_ribbon_custom', true );
246
-
247
- $wcps_options['ribbon']['text'] = '';
248
- $wcps_options['ribbon']['background_color'] = '';
249
-
250
- if($wcps_ribbon_name == 'custom'){
251
- $ribbon_url = $wcps_ribbon_custom;
252
-
253
- }elseif ($wcps_ribbon_name == 'none'){
254
- $ribbon_url = '';
255
- }else{
256
- $ribbon_url = wcps_plugin_url.'assets/front/images/ribbons/'.$wcps_ribbon_name.'.png';
257
- }
258
-
259
-
260
- $wcps_options['ribbon']['background_img'] = $ribbon_url;
261
-
262
- $wcps_options['ribbon']['text_color'] = '#ffffff';
263
- $wcps_options['ribbon']['width'] = '90px';
264
- $wcps_options['ribbon']['height'] = '24px';
265
-
266
-
267
- $ribbon_position = ($wcps_ribbon_name == 'none' || empty($wcps_ribbon_name)) ? 'none' : 'topleft';
268
- $wcps_options['ribbon']['position'] = $ribbon_position;
269
-
270
-
271
-
272
- // Item options
273
- $wcps_items_padding = get_post_meta( $wcps_id, 'wcps_items_padding', true );
274
- $wcps_options['item_style']['padding'] = $wcps_items_padding;
275
-
276
- $wcps_items_bg_color = get_post_meta( $wcps_id, 'wcps_items_bg_color', true );
277
- $wcps_options['item_style']['background_color'] = $wcps_items_bg_color;
278
- $wcps_options['item_style']['margin'] = '0 10px';
279
-
280
-
281
-
282
- //Container options
283
- $wcps_container_padding = get_post_meta( $wcps_id, 'wcps_container_padding', true );
284
- $wcps_options['container']['padding'] = $wcps_container_padding;
285
-
286
- $wcps_container_bg_color = get_post_meta( $wcps_id, 'wcps_container_bg_color', true );
287
- $wcps_options['container']['background_color'] = $wcps_container_bg_color;
288
-
289
- $wcps_bg_img = get_post_meta( $wcps_id, 'wcps_bg_img', true );
290
- $wcps_options['container']['background_img_url'] = $wcps_bg_img;
291
-
292
- $wcps_options['container']['margin'] = '';
293
-
294
-
295
- // Custom Scripts
296
- $wcps_items_custom_css = get_post_meta( $wcps_id, 'wcps_items_custom_css', true );
297
- $wcps_options['custom_scripts']['custom_css'] = $wcps_items_custom_css;
298
-
299
- $wcps_options['custom_scripts']['custom_js'] = '';
300
-
301
-
302
-
303
-
304
-
305
- // Create layout from wcps settings.
306
- $wcps_grid_items = get_post_meta( $wcps_id, 'wcps_grid_items', true );
307
- $wcps_grid_items_hide = get_post_meta( $wcps_id, 'wcps_grid_items_hide', true );
308
-
309
- //echo '<pre>'.var_export($wcps_grid_items_hide, true).'</pre>';
310
- //echo '<pre>'.var_export($wcps_grid_items, true).'</pre>';
311
-
312
-
313
- $layout_elements_data = array();
314
-
315
- $layout_elements_data[0]['wrapper_start']['wrapper_id'] = '';
316
- $layout_elements_data[0]['wrapper_start']['wrapper_class'] = 'layer-media';
317
- $layout_elements_data[0]['wrapper_start']['css_idle'] = '';
318
-
319
- $wcps_items_thumb_size = get_post_meta( $wcps_id, 'wcps_items_thumb_size', true );
320
- $wcps_items_thumb_link_to = get_post_meta( $wcps_id, 'wcps_items_thumb_link_to', true );
321
- $wcps_items_thumb_link_to_meta_value = get_post_meta( $wcps_id, 'wcps_items_thumb_link_to_meta_value', true );
322
- $wcps_items_thumb_link_target = get_post_meta( $wcps_id, 'wcps_items_thumb_link_target', true );
323
- $wcps_items_thumb_max_hieght = get_post_meta( $wcps_id, 'wcps_items_thumb_max_hieght', true );
324
- $wcps_items_empty_thumb = get_post_meta( $wcps_id, 'wcps_items_empty_thumb', true );
325
-
326
- $layout_elements_data[1]['thumbnail']['thumb_size'] = $wcps_items_thumb_size;
327
- $layout_elements_data[1]['thumbnail']['link_to'] = $wcps_items_thumb_link_to;
328
- $layout_elements_data[1]['thumbnail']['link_to_meta_key'] = $wcps_items_thumb_link_to_meta_value;
329
- $layout_elements_data[1]['thumbnail']['link_target'] = $wcps_items_thumb_link_target;
330
- $layout_elements_data[1]['thumbnail']['thumb_height']['large'] = $wcps_items_thumb_max_hieght;
331
- $layout_elements_data[1]['thumbnail']['thumb_height']['medium'] = '';
332
- $layout_elements_data[1]['thumbnail']['thumb_height']['small'] = '';
333
- $layout_elements_data[1]['thumbnail']['default_thumb_src'] = $wcps_items_empty_thumb;
334
-
335
-
336
- $layout_elements_data[2]['wrapper_end']['wrapper_id'] = '';
337
-
338
-
339
- $layout_elements_data[3]['wrapper_start']['wrapper_id'] = '';
340
- $layout_elements_data[3]['wrapper_start']['wrapper_class'] = 'layer-content';
341
- $layout_elements_data[3]['wrapper_start']['css_idle'] = '';
342
-
343
-
344
-
345
- $item_count = 4;
346
-
347
- if(!empty($wcps_grid_items))
348
- foreach ($wcps_grid_items as $itemIndex => $item){
349
-
350
- if(array_key_exists($itemIndex, $wcps_grid_items_hide)) continue;
351
-
352
- if($itemIndex == 'thumbnail'){
353
-
354
- }elseif($itemIndex == 'title'){
355
- $wcps_items_title_font_size = get_post_meta( $wcps_id, 'wcps_items_title_font_size', true );
356
- $wcps_items_title_color = get_post_meta( $wcps_id, 'wcps_items_title_color', true );
357
- $wcps_items_title_text_align = get_post_meta( $wcps_id, 'wcps_items_title_text_align', true );
358
-
359
-
360
- $layout_elements_data[$item_count]['post_title']['color'] = $wcps_items_title_color;
361
- $layout_elements_data[$item_count]['post_title']['font_size'] = $wcps_items_title_font_size;
362
- $layout_elements_data[$item_count]['post_title']['font_family'] = '';
363
- $layout_elements_data[$item_count]['post_title']['margin'] = '5px 0';
364
- $layout_elements_data[$item_count]['post_title']['text_align'] = $wcps_items_title_text_align;
365
-
366
-
367
- }elseif($itemIndex == 'category'){
368
- $wcps_items_cat_font_size = get_post_meta( $wcps_id, 'wcps_items_cat_font_size', true );
369
- $wcps_items_cat_font_color = get_post_meta( $wcps_id, 'wcps_items_cat_font_color', true );
370
- $wcps_items_cat_text_align = get_post_meta( $wcps_id, 'wcps_items_cat_text_align', true );
371
- $wcps_items_cat_separator = get_post_meta( $wcps_id, 'wcps_items_cat_separator', true );
372
-
373
- $layout_elements_data[$item_count]['product_category']['font_size'] = $wcps_items_cat_font_size;
374
- $layout_elements_data[$item_count]['product_category']['text_align'] = $wcps_items_cat_text_align;
375
- $layout_elements_data[$item_count]['product_category']['margin'] = '5px 0';
376
- $layout_elements_data[$item_count]['product_category']['separator'] = $wcps_items_cat_separator;
377
- $layout_elements_data[$item_count]['product_category']['max_count'] = 3;
378
- $layout_elements_data[$item_count]['product_category']['wrapper_html'] = '';
379
- $layout_elements_data[$item_count]['product_category']['link_color'] = $wcps_items_cat_font_color;
380
-
381
-
382
- }elseif($itemIndex == 'tag'){
383
- $wcps_items_tag_font_size = get_post_meta( $wcps_id, 'wcps_items_tag_font_size', true );
384
- $wcps_items_tag_font_color = get_post_meta( $wcps_id, 'wcps_items_tag_font_color', true );
385
- $wcps_items_tag_text_align = get_post_meta( $wcps_id, 'wcps_items_tag_text_align', true );
386
- $wcps_items_cat_separator = get_post_meta( $wcps_id, 'wcps_items_cat_separator', true );
387
-
388
- $layout_elements_data[$item_count]['product_tag']['font_size'] = $wcps_items_tag_font_size;
389
- $layout_elements_data[$item_count]['product_tag']['font_family'] = '';
390
-
391
- $layout_elements_data[$item_count]['product_tag']['text_align'] = $wcps_items_tag_text_align;
392
- $layout_elements_data[$item_count]['product_tag']['wrapper_margin'] = '5px 0';
393
- $layout_elements_data[$item_count]['product_tag']['separator'] = $wcps_items_cat_separator;
394
- $layout_elements_data[$item_count]['product_tag']['max_count'] = 3;
395
- $layout_elements_data[$item_count]['product_tag']['wrapper_html'] = '';
396
- $layout_elements_data[$item_count]['product_tag']['link_color'] = $wcps_items_tag_font_color;
397
-
398
-
399
- }
400
-
401
- elseif($itemIndex == 'price'){
402
- $wcps_total_items_price_format = get_post_meta( $wcps_id, 'wcps_total_items_price_format', true );
403
- $wcps_items_price_color = get_post_meta( $wcps_id, 'wcps_items_price_color', true );
404
- $wcps_items_price_font_size = get_post_meta( $wcps_id, 'wcps_items_price_font_size', true );
405
- $wcps_items_price_text_align = get_post_meta( $wcps_id, 'wcps_items_price_text_align', true );
406
-
407
-
408
- $layout_elements_data[$item_count]['product_price']['color'] = $wcps_items_price_color;
409
- $layout_elements_data[$item_count]['product_price']['font_size'] = $wcps_items_price_font_size;
410
- $layout_elements_data[$item_count]['product_price']['text_align'] = $wcps_items_price_text_align;
411
- $layout_elements_data[$item_count]['product_price']['margin'] = '5px 0';
412
-
413
- $layout_elements_data[$item_count]['product_price']['price_type'] = $wcps_total_items_price_format;
414
- $layout_elements_data[$item_count]['product_price']['wrapper_html'] = '';
415
-
416
- }elseif($itemIndex == 'rating'){
417
- $wcps_total_items_price_format = get_post_meta( $wcps_id, 'wcps_total_items_price_format', true );
418
- $wcps_items_ratings_color = get_post_meta( $wcps_id, 'wcps_items_ratings_color', true );
419
- $wcps_items_ratings_font_size = get_post_meta( $wcps_id, 'wcps_items_ratings_font_size', true );
420
- $wcps_ratings_text_align = get_post_meta( $wcps_id, 'wcps_ratings_text_align', true );
421
-
422
-
423
- $layout_elements_data[$item_count]['rating']['color'] = $wcps_items_ratings_color;
424
- $layout_elements_data[$item_count]['rating']['font_size'] = $wcps_items_ratings_font_size;
425
- $layout_elements_data[$item_count]['rating']['text_align'] = $wcps_ratings_text_align;
426
- $layout_elements_data[$item_count]['rating']['margin'] = '5px 0';
427
-
428
- $layout_elements_data[$item_count]['rating']['rating_type'] = $wcps_total_items_price_format;
429
- $layout_elements_data[$item_count]['rating']['wrapper_html'] = '';
430
-
431
- }elseif($itemIndex == 'cart'){
432
- $wcps_cart_text = get_post_meta( $wcps_id, 'wcps_cart_text', true );
433
- $wcps_cart_bg = get_post_meta( $wcps_id, 'wcps_cart_bg', true );
434
- $wcps_cart_text_color = get_post_meta( $wcps_id, 'wcps_cart_text_color', true );
435
- $wcps_cart_text_align = get_post_meta( $wcps_id, 'wcps_cart_text_align', true );
436
- $wcps_cart_display_quantity = get_post_meta( $wcps_id, 'wcps_cart_display_quantity', true );
437
-
438
-
439
- $layout_elements_data[$item_count]['add_to_cart']['background_color'] = $wcps_cart_bg;
440
- $layout_elements_data[$item_count]['add_to_cart']['color'] = $wcps_cart_text_color;
441
- $layout_elements_data[$item_count]['add_to_cart']['text_align'] = $wcps_cart_text_align;
442
- $layout_elements_data[$item_count]['add_to_cart']['margin'] = '5px 0';
443
-
444
- $layout_elements_data[$item_count]['add_to_cart']['cart_text'] = $wcps_cart_text;
445
- $layout_elements_data[$item_count]['add_to_cart']['show_quantity'] = $wcps_cart_display_quantity;
446
-
447
- }elseif($itemIndex == 'sale'){
448
- $wcps_sale_icon_url = get_post_meta( $wcps_id, 'wcps_sale_icon_url', true );
449
-
450
- $layout_elements_data[$item_count]['on_sale_mark']['icon_img_src'] = $wcps_sale_icon_url;
451
- }elseif($itemIndex == 'featured'){
452
- $wcps_featured_icon_url = get_post_meta( $wcps_id, 'wcps_featured_icon_url', true );
453
-
454
- $layout_elements_data[$item_count]['featured_mark']['icon_img_src'] = $wcps_featured_icon_url;
455
- }elseif($itemIndex == 'sale_count'){
456
- $wcps_sale_count_text = get_post_meta( $wcps_id, 'wcps_sale_count_text', true );
457
-
458
- $layout_elements_data[$item_count]['sale_count']['wrapper_html'] = $wcps_sale_count_text;
459
- $layout_elements_data[$item_count]['sale_count']['margin'] = '5px 0';
460
-
461
- }elseif($itemIndex == 'excerpt'){
462
-
463
- $wcps_items_excerpt_count = get_post_meta( $wcps_id, 'wcps_items_excerpt_count', true );
464
- $wcps_items_excerpt_read_more = get_post_meta( $wcps_id, 'wcps_items_excerpt_read_more', true );
465
- $wcps_items_excerpt_font_color = get_post_meta( $wcps_id, 'wcps_items_excerpt_font_color', true );
466
- $wcps_items_excerpt_font_size = get_post_meta( $wcps_id, 'wcps_items_excerpt_font_size', true );
467
- $wcps_items_excerpt_text_align = get_post_meta( $wcps_id, 'wcps_items_excerpt_text_align', true );
468
-
469
- $layout_elements_data[$item_count]['content']['content_source'] = 'excerpt';
470
- $layout_elements_data[$item_count]['content']['word_count'] = $wcps_items_excerpt_count;
471
- $layout_elements_data[$item_count]['content']['read_more_text'] = $wcps_items_excerpt_read_more;
472
- $layout_elements_data[$item_count]['content']['read_more_color'] = $wcps_items_excerpt_font_color;
473
- $layout_elements_data[$item_count]['content']['color'] = $wcps_items_excerpt_font_color;
474
- $layout_elements_data[$item_count]['content']['font_size'] = $wcps_items_excerpt_font_size;
475
- $layout_elements_data[$item_count]['content']['text_align'] = $wcps_items_excerpt_text_align;
476
- $layout_elements_data[$item_count]['content']['font_family'] = '';
477
-
478
- $layout_elements_data[$item_count]['content']['margin'] = '5px 0';
479
-
480
- }
481
-
482
- $item_count++;
483
- }
484
-
485
- $layout_elements_data[$item_count]['wrapper_end']['wrapper_id'] = '';
486
-
487
-
488
- $wcps_layout_id = wp_insert_post(
489
- array(
490
- 'post_title' => $wcps_id.' - '.$wcps_title,
491
- 'post_content' => '',
492
- 'post_status' => 'publish',
493
- 'post_type' => 'wcps_layout',
494
- 'post_author' => 1,
495
- )
496
- );
497
-
498
-
499
- $wcps_options['item_layout_id'] = $wcps_layout_id;
500
-
501
- $layout_data = wcps_layout_data($wcps_themes);
502
-
503
- $layout_data_css = isset($layout_data['css']) ? $layout_data['css'] : '';
504
- $layout_preview_img = isset($layout_data['preview_img']) ? $layout_data['preview_img'] : '';
505
-
506
- //echo '<pre>'.var_export($layout_elements_data, true).'</pre>';
507
-
508
- $layout_scripts['custom_css'] = $layout_data_css;
509
- $layout_options['layout_preview_img'] = $layout_preview_img;
510
-
511
-
512
-
513
- update_post_meta($wcps_id, 'wcps_options', $wcps_options);
514
-
515
- update_post_meta($wcps_layout_id, 'custom_scripts', $layout_scripts);
516
- update_post_meta($wcps_layout_id, 'layout_options', $layout_options);
517
- update_post_meta($wcps_layout_id, 'layout_elements_data', $layout_elements_data);
518
-
519
- update_post_meta($wcps_id, 'wcps_upgrade_status', 'done');
520
-
521
-
522
-
523
- wp_reset_query();
524
- wp_reset_postdata();
525
- endwhile;
526
- else:
527
- wp_clear_scheduled_hook('wcps_cron_upgrade_wcps');
528
-
529
- $wcps_plugin_info = get_option('wcps_plugin_info');
530
- $wcps_plugin_info['wcps_upgrade'] = 'done';
531
- update_option('wcps_plugin_info', $wcps_plugin_info);
532
-
533
-
534
-
535
- endif;
536
-
537
-
538
- }
539
-
540
- add_shortcode('wcps_cron_reset_migrate', 'wcps_cron_reset_migrate');
541
-
542
- add_action('wcps_cron_reset_migrate','wcps_cron_reset_migrate');
543
-
544
- function wcps_cron_reset_migrate(){
545
-
546
- $wcps_plugin_info = get_option('wcps_plugin_info');
547
-
548
- delete_option('wcps_settings');
549
-
550
-
551
-
552
-
553
- $wcps_meta_query[] = array(
554
- 'key' => 'wcps_upgrade_status',
555
- 'compare' => '='
556
- );
557
-
558
- $wcps_args = array(
559
- 'post_type' => 'wcps',
560
- 'post_status' => 'any',
561
- 'posts_per_page' => -1,
562
- 'meta_query' => $wcps_meta_query,
563
- );
564
-
565
- $wcps_query = new WP_Query($wcps_args);
566
-
567
- if ($wcps_query->have_posts()) :
568
- while ($wcps_query->have_posts()) : $wcps_query->the_post();
569
- $post_id = get_the_id();
570
- delete_post_meta($post_id, 'wcps_upgrade_status');
571
- delete_post_meta($post_id, 'wcps_options');
572
-
573
- endwhile;
574
- wp_reset_postdata();
575
- wp_reset_query();
576
- endif;
577
-
578
-
579
-
580
-
581
- $wcps_plugin_info['settings_upgrade'] = '';
582
- $wcps_plugin_info['wcps_upgrade'] = '';
583
- $wcps_plugin_info['migration_reset'] = 'done';
584
- update_option('wcps_plugin_info', $wcps_plugin_info);
585
-
586
- wp_clear_scheduled_hook('wcps_cron_reset_migrate');
587
-
588
- }
589
-
590
-
591
-
592
-
593
-
594
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions-settings-hook.php CHANGED
@@ -770,6 +770,6 @@ add_action('wcps_settings_save', 'wcps_settings_save');
770
 
771
  function wcps_settings_save(){
772
 
773
- $wcps_settings = isset($_POST['wcps_settings']) ? stripslashes_deep($_POST['wcps_settings']) : array();
774
  update_option('wcps_settings', $wcps_settings);
775
  }
770
 
771
  function wcps_settings_save(){
772
 
773
+ $wcps_settings = isset($_POST['wcps_settings']) ? wcps_recursive_sanitize_arr($_POST['wcps_settings']) : array();
774
  update_option('wcps_settings', $wcps_settings);
775
  }
includes/functions.php CHANGED
@@ -225,66 +225,24 @@ function wcps_recently_viewed_products(){
225
  $viewed_products = ! empty( $_COOKIE['woocommerce_recently_viewed'] ) ? (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] ) : array();
226
  $viewed_products = array_filter( array_map( 'absint', $viewed_products ) );
227
 
 
228
 
229
  return $viewed_products;
230
  }
231
 
232
 
 
233
 
234
- function wcps_layout_data($layout){
235
-
236
- $layout_data = array();
237
-
238
- ob_start();
239
- ?>.__ID__ {vertical-align: top;}.__ID__ .layer-media{}.__ID__ .layer-content {padding: 5px 10px;}<?php
240
-
241
- $layout_data['flat']['css'] = ob_get_clean();
242
- $layout_data['flat']['preview_img'] = 'https://i.imgur.com/wLGFEu1.png';
243
-
244
-
245
- ob_start();
246
- ?>.__ID__ {overflow: hidden;position: relative;vertical-align: top;}.__ID__:hover .layer-media {-webkit-transform: scale(0);transform: scale(0);opacity: 0;-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";}.__ID__ .layer-media {-webkit-transition: all 1s ease 0s;transition: all 1s ease 0s;left: 0;top: 0;width: 100%;}.__ID__:hover .layer-content{opacity: 1;-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";}.__ID__ .layer-content {left: 0;opacity: 0;-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";position: absolute;top: 0;width: 100%;-webkit-transition: all 1s ease 0s;transition: all 1s ease 0s;}<?php
247
-
248
- $layout_data['zoomout']['css'] = ob_get_clean();
249
- $layout_data['zoomout']['preview_img'] = 'https://i.imgur.com/HmVriCY.gif';
250
-
251
-
252
-
253
-
254
- ob_start();
255
- ?>.__ID__{}.__ID__ .layer-media {background: rgb(255, 255, 255) none repeat scroll 0 0;border-radius: 50%;overflow: hidden;}.__ID__ .layer-media .thumb {height:240px;}.__ID__ .layer-content{}<?php
256
-
257
- $layout_data['thumbrounded']['css'] = ob_get_clean();
258
- $layout_data['thumbrounded']['preview_img'] = 'https://i.imgur.com/QlxfXdW.png';
259
-
260
-
261
- ob_start();
262
- ?>.__ID__{ overflow: hidden; position: relative; vertical-align: top; } .__ID__:hover .layer-media{ -webkit-transform: scale(1.5); transform: scale(1.5); opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; } .__ID__ .layer-media{ -webkit-transition: all 1s ease 0s; transition: all 1s ease 0s; left: 0; top: 0; width: 100%; } .__ID__:hover .layer-content{ opacity: 1; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } .__ID__ .layer-content{ opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; position: absolute; top: 0; width: 100%; -webkit-transition: all 1s ease 0s; transition: all 1s ease 0s; }<?php
263
-
264
- $layout_data['zoomin']['css'] = ob_get_clean();
265
- $layout_data['zoomin']['preview_img'] = 'https://i.imgur.com/v2wqjFi.gif';
266
-
267
-
268
-
269
- ob_start();
270
- ?>.__ID__{ overflow: hidden; position: relative; vertical-align: top; } .__ID__:hover .layer-media{ -webkit-transform: rotate(-30deg); transform: rotate(-30deg); opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; } .__ID__ .layer-media{ -webkit-transition: all 1s ease 0s; transition: all 1s ease 0s; left: 0; top: 0; width: 100%; } .__ID__:hover .layer-content{ opacity: 1; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } .__ID__ .layer-content{ left: 0; opacity: 0; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; position: absolute; top: 0; width: 100%; -webkit-transition: all 1s ease 0s; transition: all 1s ease 0s; }<?php
271
-
272
- $layout_data['spinleft']['css'] = ob_get_clean();
273
- $layout_data['spinleft']['preview_img'] = 'https://i.imgur.com/tBzV6di.gif';
274
-
275
- ob_start();
276
- ?>.__ID__{ overflow: hidden; position: relative; vertical-align: top; } .__ID__:hover .layer-media{ z-index:9; } .__ID__ .layer-media{ -webkit-transition: all 0.4s ease 0s; transition: all 0.4s ease 0s; left: 0; top: 0; width: 100%; } .__ID__:hover .layer-content{ } .__ID__ .layer-content{ background: rgba(33, 33, 33, 0.63) none repeat scroll 0 0; bottom: 0; color: rgb(255, 255, 255); left: 0; position: absolute; -webkit-transition: all 1s ease 0s; transition: all 1s ease 0s; width: 100%; padding: 10px 0; }<?php
277
-
278
- $layout_data['contentbottom']['css'] = ob_get_clean();
279
- $layout_data['contentbottom']['preview_img'] = 'https://i.imgur.com/sUfqp9d.png';
280
-
281
-
282
-
283
- $layout_data = apply_filters('wcps_layout_data', $layout_data);
284
-
285
-
286
- return isset($layout_data[$layout]) ? $layout_data[$layout] : array();
287
 
 
288
  }
289
 
290
 
@@ -305,6 +263,8 @@ function wcps_track_product_view() {
305
  else
306
  $viewed_products = (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] );
307
 
 
 
308
  if ( ! in_array( $post->ID, $viewed_products ) ) {
309
  $viewed_products[] = $post->ID;
310
  }
225
  $viewed_products = ! empty( $_COOKIE['woocommerce_recently_viewed'] ) ? (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] ) : array();
226
  $viewed_products = array_filter( array_map( 'absint', $viewed_products ) );
227
 
228
+ $viewed_products = wcps_recursive_sanitize_arr($viewed_products);
229
 
230
  return $viewed_products;
231
  }
232
 
233
 
234
+ function wcps_recursive_sanitize_arr($array) {
235
 
236
+ foreach ( $array as $key => &$value ) {
237
+ if ( is_array( $value ) ) {
238
+ $value = wcps_recursive_sanitize_arr($value);
239
+ }
240
+ else {
241
+ $value = sanitize_text_field( $value );
242
+ }
243
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
+ return $array;
246
  }
247
 
248
 
263
  else
264
  $viewed_products = (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] );
265
 
266
+ $viewed_products = wcps_recursive_sanitize_arr($viewed_products);
267
+
268
  if ( ! in_array( $post->ID, $viewed_products ) ) {
269
  $viewed_products[] = $post->ID;
270
  }
includes/menu/upgrade-status.php DELETED
@@ -1,117 +0,0 @@
1
- <?php
2
- if ( ! defined('ABSPATH')) exit; // if direct access
3
-
4
- $wcps_plugin_info = get_option('wcps_plugin_info');
5
- $wcps_settings_upgrade = isset($wcps_plugin_info['settings_upgrade']) ? $wcps_plugin_info['settings_upgrade'] : '';
6
- $wcps_upgrade = isset($wcps_plugin_info['wcps_upgrade']) ? $wcps_plugin_info['wcps_upgrade'] : '';
7
-
8
- //echo '<pre>'.var_export($wcps_upgrade, true).'</pre>';
9
-
10
-
11
- $url = admin_url().'edit.php?post_type=wcps&page=upgrade_status';
12
-
13
- ?>
14
- <?php
15
-
16
- ?>
17
- <div class="wrap">
18
- <div id="icon-tools" class="icon32"><br></div><h2><?php echo sprintf(__('%s Settings - Update', 'woocommerce-products-slider'), wcps_plugin_name)?></h2>
19
- <p>WCPS settings and WCPS options data should automatic upgrade. please wait until all update completed. each loop will take 1 minute to completed, based on your wcps it will take take few minutes to completed.</p>
20
- <p>If you have any issue please <a href="https://www.pickplugins.com/forum/">create support ticket</a> on our forum</p>
21
- <p>Don't panic while updating, your old data still saved on database and you can downgrade plugin any time, please <a href="https://wordpress.org/plugins/woocommerce-products-slider/advanced/#plugin-download-history-stats">download from here</a> old version and reinstall.</p>
22
-
23
-
24
- <script>
25
- setTimeout(function(){
26
- window.location.href = '<?php echo $url; ?>';
27
- }, 1000*80);
28
-
29
- </script>
30
-
31
- <h3>WCPS settings upgrade status</h3>
32
-
33
- <?php
34
-
35
- if(!empty($wcps_settings_upgrade)){
36
- ?>
37
- <p>Completed</p>
38
- <?php
39
- }else{
40
- ?>
41
- <p>Pending</p>
42
- <?php
43
- }
44
-
45
- ?>
46
-
47
-
48
-
49
-
50
- <h3>WCPS post data upgrade status</h3>
51
- <?php
52
-
53
- $meta_query = array();
54
-
55
- $meta_query[] = array(
56
- 'key' => 'wcps_upgrade_status',
57
- 'value' => 'done',
58
- 'compare' => '='
59
- );
60
-
61
- $args = array(
62
- 'post_type'=>'wcps',
63
- 'post_status'=>'any',
64
- 'posts_per_page'=> -1,
65
- 'meta_query'=> $meta_query,
66
-
67
- );
68
-
69
- $wp_query = new WP_Query($args);
70
-
71
- if ( $wp_query->have_posts() ) :
72
- ?>
73
- <ul>
74
- <?php
75
- while ( $wp_query->have_posts() ) : $wp_query->the_post();
76
-
77
- $wcps_id = get_the_id();
78
- $wcps_title = get_the_title();
79
- ?>
80
- <li><?php echo $wcps_title; ?> - Done</li>
81
- <?php
82
-
83
- endwhile;
84
- ?>
85
- </ul>
86
- <?php
87
-
88
- else:
89
- ?>
90
- <p>Pending</p>
91
- <?php
92
- endif;
93
-
94
-
95
- if($wcps_upgrade == 'done'){
96
- wp_safe_redirect(admin_url().'edit.php?post_type=wcps');
97
- }
98
-
99
-
100
- ?>
101
-
102
-
103
-
104
- <p><a class="button" href="<?php echo admin_url().'edit.php?post_type=wcps&page=upgrade_status'; ?>">Refresh</a> to check Migration stats.</p>
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,8 +3,8 @@
3
  Donate link: https://www.pickplugins.com/item/woocommerce-products-slider-for-wordpress/?ref=wordpress.org
4
  Tags: product slider, woocommerce slider, carousel slider, product category slider, woo slider, carousel slider, woocommerce product slider
5
  Requires at least: 3.8
6
- Tested up to: 5.7
7
- Stable tag: 1.13.22
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -141,6 +141,13 @@ then paste this shortcode anywhere in your page to display slider<br />
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
 
 
144
  = 1.13.22 =
145
  * 2021-04-13 fix - security issue fixed.
146
 
3
  Donate link: https://www.pickplugins.com/item/woocommerce-products-slider-for-wordpress/?ref=wordpress.org
4
  Tags: product slider, woocommerce slider, carousel slider, product category slider, woo slider, carousel slider, woocommerce product slider
5
  Requires at least: 3.8
6
+ Tested up to: 5.8
7
+ Stable tag: 1.13.24
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
141
 
142
  == Changelog ==
143
 
144
+ = 1.13.24 =
145
+ * 2021-04-20 FIX - Minor security issue updated
146
+
147
+ = 1.13.23 =
148
+ * 2021-04-15 remove - unnecessary file removed
149
+ * 2021-04-15 fix - minor security issue fixed.
150
+
151
  = 1.13.22 =
152
  * 2021-04-13 fix - security issue fixed.
153
 
woocommerce-products-slider.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: PickPlugins Product Slider for WooCommerce
4
  Plugin URI: http://pickplugins.com/items/woocommerce-product-slider-for-wordpress/
5
  Description: Fully responsive and mobile ready Carousel Slider for your WooCommerce product. unlimited slider anywhere via short-codes and easy admin setting.
6
- Version: 1.13.22
7
  WC requires at least: 3.0.0
8
  WC tested up to: 5.1
9
  Author: PickPlugins
@@ -23,7 +23,7 @@ class WoocommerceProductsSlider{
23
  define('wcps_plugin_url', plugins_url('/', __FILE__) );
24
  define('wcps_plugin_dir', plugin_dir_path( __FILE__ ) );
25
  define('wcps_plugin_name', 'PickPlugins Product Slider' );
26
- define('wcps_plugin_version', '1.13.22' );
27
  define('wcps_server_url', 'https://www.pickplugins.com/demo/woocommerce-products-slider/');
28
  //define('wcps_server_url', 'http://localhost/wp/');
29
 
@@ -42,7 +42,6 @@ class WoocommerceProductsSlider{
42
  require_once( wcps_plugin_dir . 'templates/wcps-slider/wcps-slider-hook.php');
43
 
44
  require_once( wcps_plugin_dir . 'includes/class-admin-notices.php');
45
- require_once( wcps_plugin_dir . 'includes/functions-data-upgrade.php');
46
  require_once( wcps_plugin_dir . 'includes/class-settings.php');
47
  require_once( wcps_plugin_dir . 'includes/functions-settings-hook.php');
48
 
@@ -52,7 +51,6 @@ class WoocommerceProductsSlider{
52
  require_once( plugin_dir_path( __FILE__ ) . 'includes/functions.php');
53
  require_once( plugin_dir_path( __FILE__ ) . 'includes/class-functions.php');
54
  require_once( plugin_dir_path( __FILE__ ) . 'includes/class-shortcodes.php');
55
- require_once( plugin_dir_path( __FILE__ ) . 'includes/class-update.php');
56
  require_once( plugin_dir_path( __FILE__ ) . 'includes/class-settings-tabs.php');
57
 
58
 
3
  Plugin Name: PickPlugins Product Slider for WooCommerce
4
  Plugin URI: http://pickplugins.com/items/woocommerce-product-slider-for-wordpress/
5
  Description: Fully responsive and mobile ready Carousel Slider for your WooCommerce product. unlimited slider anywhere via short-codes and easy admin setting.
6
+ Version: 1.13.24
7
  WC requires at least: 3.0.0
8
  WC tested up to: 5.1
9
  Author: PickPlugins
23
  define('wcps_plugin_url', plugins_url('/', __FILE__) );
24
  define('wcps_plugin_dir', plugin_dir_path( __FILE__ ) );
25
  define('wcps_plugin_name', 'PickPlugins Product Slider' );
26
+ define('wcps_plugin_version', '1.13.24' );
27
  define('wcps_server_url', 'https://www.pickplugins.com/demo/woocommerce-products-slider/');
28
  //define('wcps_server_url', 'http://localhost/wp/');
29
 
42
  require_once( wcps_plugin_dir . 'templates/wcps-slider/wcps-slider-hook.php');
43
 
44
  require_once( wcps_plugin_dir . 'includes/class-admin-notices.php');
 
45
  require_once( wcps_plugin_dir . 'includes/class-settings.php');
46
  require_once( wcps_plugin_dir . 'includes/functions-settings-hook.php');
47
 
51
  require_once( plugin_dir_path( __FILE__ ) . 'includes/functions.php');
52
  require_once( plugin_dir_path( __FILE__ ) . 'includes/class-functions.php');
53
  require_once( plugin_dir_path( __FILE__ ) . 'includes/class-shortcodes.php');
 
54
  require_once( plugin_dir_path( __FILE__ ) . 'includes/class-settings-tabs.php');
55
 
56