WooCommerce Checkout Manager - Version 6.1.9

Version Description

Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 6.1.9
Comparing to
See all releases

Code changes from version 6.1.8 to 6.1.9

includes/class-wooccm-compatibility.php DELETED
@@ -1,426 +0,0 @@
1
- <?php
2
-
3
- class WOOCCM_Field_Compatibility
4
- {
5
-
6
- protected $fields = null;
7
- protected $prefix = '';
8
- protected $table = '';
9
- protected $defaults = array();
10
- private $old_to_old_types = array(
11
- 'heading' => 'heading',
12
- 'text' => 'wooccmtext',
13
- 'textarea' => 'wooccmtextarea',
14
- 'password' => 'wooccmpassword',
15
- 'select' => 'wooccmselect',
16
- 'radio' => 'wooccmradio',
17
- 'checkbox' => 'checkbox_wccm',
18
- //'button' => esc_html__('Button', 'woocommerce-checkout-manager'),
19
- 'country' => 'wooccmcountry',
20
- 'state' => 'wooccmstate',
21
- 'multiselect' => 'multiselect',
22
- 'multicheckbox' => 'multicheckbox',
23
- 'datepicker' => 'datepicker',
24
- 'timepicker' => 'time',
25
- 'colorpicker' => 'colorpicker',
26
- 'file' => 'wooccmupload',
27
- );
28
- private $old_to_old_args = array(
29
- 'disabled' => null,
30
- 'order' => null,
31
- 'priority' => null,
32
- 'name' => 'cow',
33
- 'type' => null,
34
- 'label' => null,
35
- 'placeholder' => null,
36
- 'default' => 'force_title2',
37
- 'position' => null,
38
- 'clear' => 'clear_row',
39
- 'options' => 'option_array',
40
- 'required' => 'checkbox',
41
- // Display
42
- // -------------------------------------------------------------------
43
- 'show_role' => 'role_option',
44
- 'hide_role' => 'role_option2',
45
- 'more_product' => 'more_content',
46
- 'show_product' => 'single_px',
47
- 'hide_product' => 'single_p',
48
- 'show_product_cat' => 'single_px_cat',
49
- 'hide_product_cat' => 'single_p_cat',
50
- // Timing
51
- // -------------------------------------------------------------------
52
- 'time_limit_start' => 'start_hour',
53
- 'time_limit_end' => 'end_hour',
54
- 'time_limit_interval' => 'interval_min',
55
- 'manual_min' => null,
56
- 'date_limit' => 'date_limit',
57
- 'date_limit_variable_min' => 'min_before',
58
- 'date_limit_variable_max' => 'max_after',
59
- 'date_limit_fixed_min' => null,
60
- 'date_limit_fixed_max' => null,
61
- 'date_limit_days' => null,
62
- 'single_dd' => null,
63
- 'single_mm' => null,
64
- 'single_yy' => null,
65
- 'single_max_dd' => null,
66
- 'single_max_mm' => null,
67
- 'single_max_yy' => null,
68
- // Amount
69
- // -------------------------------------------------------------------
70
- 'add_price' => null,
71
- 'add_price_name' => 'fee_name',
72
- 'add_price_total' => 'add_price_field',
73
- 'add_price_type' => null,
74
- 'add_price_tax' => 'tax_remove',
75
- 'extra_class' => null,
76
- // Conditional
77
- // -------------------------------------------------------------------
78
- 'conditional' => 'conditional_parent_use',
79
- 'conditional_parent_key' => 'conditional_tie',
80
- 'conditional_parent_value' => 'chosen_valt',
81
- // Color
82
- // -------------------------------------------------------------------
83
- 'pickertype' => 'colorpickertype',
84
- // State
85
- // -------------------------------------------------------------------
86
- 'country' => null,
87
- // Upload
88
- // -------------------------------------------------------------------
89
- 'file_limit' => null,
90
- 'file_types' => null,
91
- // Listing
92
- // -------------------------------------------------------------------
93
- 'listable' => null,
94
- 'sortable' => null,
95
- 'filterable' => null,
96
- );
97
- private $old_args = array(
98
- 'disabled',
99
- 'order',
100
- 'priority',
101
- 'cow',
102
- 'type',
103
- 'label',
104
- 'placeholder',
105
- 'force_title2',
106
- 'position',
107
- 'clear_row',
108
- 'option_array',
109
- 'checkbox',
110
- 'role_option',
111
- 'role_option2',
112
- 'more_content',
113
- 'single_p',
114
- 'single_px',
115
- 'single_p_cat',
116
- 'single_px_cat',
117
- 'start_hour',
118
- 'end_hour',
119
- 'interval_min',
120
- 'manual_min',
121
- 'min_before',
122
- 'max_after',
123
- 'single_dd',
124
- 'single_mm',
125
- 'single_yy',
126
- 'single_max_dd',
127
- 'single_max_mm',
128
- 'single_max_yy',
129
- 'days_disabler',
130
- 'days_disabler0',
131
- 'days_disabler1',
132
- 'days_disabler2',
133
- 'days_disabler3',
134
- 'days_disabler4',
135
- 'days_disabler5',
136
- 'days_disabler6',
137
- 'add_amount',
138
- 'fee_name',
139
- 'add_amount_field',
140
- 'tax_remove',
141
- 'conditional_parent_use',
142
- 'conditional_tie',
143
- 'chosen_valt',
144
- 'extra_class',
145
- 'colorpickertype',
146
- 'colorpickerd',
147
- 'role_options',
148
- 'role_options2',
149
- 'changenamep',
150
- 'changename',
151
- // New
152
- // -----------------------------------------------------------------------
153
- 'country',
154
- 'file_limit',
155
- 'file_types',
156
- 'listable',
157
- 'sortable',
158
- 'filterable',
159
- );
160
- protected static $_instance;
161
-
162
- public function __construct()
163
- {
164
-
165
- if (false === get_option('wooccm_billing', false) && $fields = $this->get_fields_new('wccs_settings3', 'billing')) {
166
- update_option('wooccm_billing', $fields);
167
- }
168
-
169
- if (false === get_option('wooccm_shipping', false) && $fields = $this->get_fields_new('wccs_settings2', 'shipping')) {
170
- update_option('wooccm_shipping', $fields);
171
- }
172
-
173
- if (false === get_option('wooccm_additional', false) && $fields = $this->get_fields_new('wccs_settings', 'additional')) {
174
- update_option('wooccm_additional', $fields);
175
- }
176
- }
177
-
178
- public static function instance()
179
- {
180
-
181
- if (is_null(self::$_instance)) {
182
- self::$_instance = new self();
183
- }
184
- return self::$_instance;
185
- }
186
-
187
- function replace_keys($array = array(), $replace = array())
188
- {
189
-
190
- foreach ($array as $key => $value) {
191
-
192
- if (array_key_exists($key, $replace)) {
193
-
194
- $array[$replace[$key]] = $value;
195
-
196
- unset($array[$key]);
197
- }
198
- }
199
-
200
- return $array;
201
- }
202
-
203
- function replace_value($value = '', $replace = array())
204
- {
205
- if (array_key_exists($value, $replace)) {
206
- return $replace[$value];
207
- }
208
-
209
- return $value;
210
- }
211
-
212
- function string_to_array($value)
213
- {
214
-
215
- if (!empty($value) && !is_array($value)) {
216
- if (strpos($value, '||') !== false) {
217
- $value = explode('||', $value);
218
- } elseif (strpos($value, ',') !== false) {
219
- $value = explode(',', $value);
220
- } else {
221
- $value = (array) $value;
222
- }
223
- }
224
-
225
- return $value;
226
- }
227
-
228
- function array_to_string($value)
229
- {
230
-
231
- if (is_array($value)) {
232
- if (count($value)) {
233
- $value = implode('||', $value);
234
- } else {
235
- $value = @$value[0];
236
- }
237
- }
238
-
239
- return $value;
240
- }
241
-
242
- function get_new_args($field = array(), $prefix = '')
243
- {
244
-
245
- $replace = array_flip(array_filter($this->old_to_old_args));
246
-
247
- $field = $this->replace_keys($field, $replace);
248
-
249
- $field = wp_parse_args($field, WOOCCM()->$prefix->get_args());
250
-
251
- return $field;
252
- }
253
-
254
- function get_new_type($type = '')
255
- {
256
-
257
- $replace = array_flip(array_filter($this->old_to_old_types));
258
-
259
- $type = $this->replace_value($type, $replace);
260
-
261
- return $type;
262
- }
263
-
264
- function new_panel_compatibility($field_id, $field = array(), $fields = array(), $prefix = '')
265
- {
266
-
267
- $field = $this->get_new_args($field, $prefix);
268
-
269
- $field = WOOCCM()->$prefix->sanitize_field($field_id, $field, $fields);
270
-
271
- // options compatibility
272
- if (!empty($field['options']) && is_string($field['options'])) {
273
-
274
- if (strpos($field['options'], '||') !== false) {
275
-
276
- $options = explode('||', $field['options']);
277
-
278
- if (is_array($options)) {
279
-
280
- $field['options'] = array();
281
- // $i = 0;
282
- foreach ($options as $key => $label) {
283
- $field['options'][] = array(
284
- 'label' => $label,
285
- 'add_price_total' => 0,
286
- 'add_price_type' => 'fixed',
287
- 'add_price_tax' => 0,
288
- 'default' => ''
289
- );
290
-
291
- if (!empty($field['conditional_parent_value']) && $field['conditional_parent_value'] == $label) {
292
- $field['conditional_parent_value'] = $label;
293
- }
294
-
295
- // $i++;
296
- }
297
- }
298
- }
299
- } else {
300
- $field['options'] = array();
301
- }
302
-
303
- if (!empty($field['conditional_parent_key']) && isset($field['conditional_parent_value'])) {
304
- if ($parent_id = WOOCCM()->$prefix->get_field_id($fields, 'key', $field['conditional_parent_key'])) {
305
- if (isset($fields[$parent_id]) && !empty($fields[$parent_id]['options'])) {
306
- $labels = array_column($fields[$parent_id]['options'], 'label');
307
-
308
- if (isset($labels[$field['conditional_parent_value']])) {
309
-
310
- $field['conditional_parent_value'] = $labels[$field['conditional_parent_value']];
311
- }
312
- }
313
- }
314
- }
315
-
316
- if ($field['type'] == 'colorpicker' && !empty($field['colorpickerd'])) {
317
- $field['default'] = $field['colorpickerd'];
318
- }
319
-
320
- $field['type'] = $this->get_new_type($field['type']);
321
-
322
- $field['show_role'] = $this->string_to_array($field['show_role']);
323
- $field['hide_role'] = $this->string_to_array($field['hide_role']);
324
- $field['show_product'] = $this->string_to_array($field['show_product']);
325
- $field['hide_product'] = $this->string_to_array($field['hide_product']);
326
- $field['show_product_cat'] = $this->string_to_array($field['show_product_cat']);
327
- $field['hide_product_cat'] = $this->string_to_array($field['hide_product_cat']);
328
- $field['add_price_tax'] = !@$field['add_amount_tax'];
329
-
330
- // Days
331
- if (!empty($field['days_disabler'])) {
332
-
333
- $field['date_limit_days'] = array();
334
-
335
- for ($day_index = 0; $day_index <= 6; $day_index++) {
336
-
337
- if (!empty($field['days_disabler' . $day_index])) {
338
- $field['date_limit_days'][strval($day_index)] = strval($day_index);
339
- unset($field['days_disabler' . $day_index]);
340
- }
341
- }
342
- }
343
-
344
- // Dates
345
- if (!empty($field['single_yy']) && !empty($field['single_mm']) && !empty($field['single_dd'])) {
346
- $field['date_limit_fixed_min'] = $field['single_yy'] . '-' . $field['single_mm'] . '-' . $field['single_dd'];
347
- unset($field['single_yy']);
348
- unset($field['single_mm']);
349
- unset($field['single_dd']);
350
- } else {
351
- $field['date_limit_fixed_min'] = '';
352
- }
353
- if (!empty($field['single_max_yy']) && !empty($field['single_max_mm']) && !empty($field['single_max_dd'])) {
354
- $field['date_limit_fixed_max'] = $field['single_max_yy'] . '-' . $field['single_max_mm'] . '-' . $field['single_max_dd'];
355
- unset($field['single_max_yy']);
356
- unset($field['single_max_mm']);
357
- unset($field['single_max_dd']);
358
- } else {
359
- $field['date_limit_fixed_max'] = '';
360
- }
361
-
362
- return $field;
363
- //return WOOCCM()->$prefix->sanitize_field_data(array_intersect_key($field, array_flip(array_keys(WOOCCM()->$prefix->get_args()))));
364
- }
365
-
366
- protected function get_fields_new($name, $prefix = '')
367
- {
368
-
369
- if ($fields = $this->get_option_old($name, $prefix)) {
370
-
371
- //$defaults = WOOCCM()->$prefix->get_default_fields();
372
-
373
- //$defaults_keys = array_column($defaults, 'key');
374
-
375
- foreach ($fields as $field_id => $field) {
376
-
377
- $field = $this->new_panel_compatibility($field_id, $field, $fields, $prefix);
378
-
379
- // if (count($defaults) && $default_id = @max(array_keys(array_column($defaults, 'key'), $field['key']))) {
380
- /*if (count($defaults) && $default_id = WOOCCM()->$prefix->get_field_id($defaults, 'key', $field['key'])) {
381
-
382
- if (isset($defaults[$default_id])) {
383
-
384
- unset($field['type']);
385
-
386
- unset($field['class']);
387
-
388
- $field = wp_parse_args($field, $defaults[$default_id]);
389
- }
390
- }*/
391
-
392
- $fields[$field_id] = $field;
393
- }
394
-
395
- return $fields;
396
- }
397
-
398
- return false;
399
- }
400
-
401
- // Core
402
- // -------------------------------------------------------------------------
403
-
404
- protected function get_option_old($name, $prefix)
405
- {
406
-
407
- if ($fields = get_option($name)) {
408
-
409
- // Compatibility with 4.x
410
- // ---------------------------------------------------------------------
411
- if (array_key_exists("{$prefix}_buttons", $fields)) {
412
- $fields = $fields["{$prefix}_buttons"];
413
- }
414
-
415
- // Additional compatibility with 4.x
416
- // ---------------------------------------------------------------------
417
- if ('wccs_settings' == $name) {
418
- $fields = (array) @$fields['buttons'];
419
- }
420
- }
421
-
422
- return $fields;
423
- }
424
- }
425
-
426
- WOOCCM_Field_Compatibility::instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-wooccm.php CHANGED
@@ -1,160 +1,157 @@
1
  <?php
2
 
3
- final class WOOCCM
4
- {
5
-
6
- protected static $_instance;
7
-
8
- public function __construct()
9
- {
10
-
11
- include_once(WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-install.php');
12
- include_once(WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-notices.php');
13
-
14
- register_activation_hook(WOOCCM_PLUGIN_FILE, array('WOOCCM_Install', 'install'));
15
-
16
- load_plugin_textdomain('woocommerce-checkout-manager', false, dirname(plugin_basename(__FILE__)) . '/languages/');
17
-
18
- add_action('woocommerce_init', array($this, 'init_session'));
19
- add_action('woocommerce_init', array($this, 'includes'));
20
- add_action('woocommerce_init', array($this, 'field'));
21
- add_action('woocommerce_checkout_order_processed', array($this, 'clear_session'), 150);
22
- }
23
-
24
- public static function instance()
25
- {
26
- if (is_null(self::$_instance)) {
27
- self::$_instance = new self();
28
- }
29
- return self::$_instance;
30
- }
31
-
32
- public function field()
33
- {
34
-
35
- $this->billing = WOOCCM_Field_Billing::instance();
36
- $this->shipping = WOOCCM_Field_Shipping::instance();
37
- $this->additional = WOOCCM_Field_Additional::instance();
38
-
39
- //1326
40
- // include_once(WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-compatibility.php');
41
- }
42
-
43
- public function includes()
44
- {
45
- include_once(WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-backend.php');
46
- include_once(WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-upload.php');
47
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-checkout.php');
48
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field.php');
49
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-order.php');
50
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-email.php');
51
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-advanced.php');
52
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-premium.php');
53
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-suggestions.php');
54
- }
55
-
56
- public function register_scripts()
57
- {
58
-
59
- global $wp_version;
60
-
61
- // Frontend
62
- // -----------------------------------------------------------------------
63
-
64
- $checkout = include(WOOCCM_PLUGIN_DIR . 'assets/frontend/js/checkout.asset.php');
65
-
66
- wp_register_style('wooccm-checkout-css', plugins_url('assets/frontend/css/checkout.css', WOOCCM_PLUGIN_FILE), false, WOOCCM_PLUGIN_VERSION, 'all');
67
-
68
- wp_register_script('wooccm-checkout-js', plugins_url('assets/frontend/js/checkout.js', WOOCCM_PLUGIN_FILE), $checkout['dependencies'], $checkout['version'], true);
69
-
70
- wp_localize_script('wooccm-checkout-js', 'wooccm_upload', array(
71
- 'ajax_url' => admin_url('admin-ajax.php'),
72
- 'nonce' => wp_create_nonce('wooccm_upload'),
73
- 'limit' => array(
74
- 'max_file_size' => wp_max_upload_size(),
75
- 'max_files' => 4,
76
- //'mime_types' => $this->get_mime_types(),
77
- ),
78
- 'icons' => array(
79
- 'interactive' => site_url('wp-includes/images/media/interactive.png'),
80
- 'spreadsheet' => site_url('wp-includes/images/media/spreadsheet.png'),
81
- 'archive' => site_url('wp-includes/images/media/archive.png'),
82
- 'audio' => site_url('wp-includes/images/media/audio.png'),
83
- 'text' => site_url('wp-includes/images/media/text.png'),
84
- 'video' => site_url('wp-includes/images/media/video.png')
85
- ),
86
- 'message' => array(
87
- 'uploading' => esc_html__('Uploading, please wait...', 'woocommerce-checkout-manager'),
88
- 'saving' => esc_html__('Saving, please wait...', 'woocommerce-checkout-manager'),
89
- 'success' => esc_html__('Files uploaded successfully.', 'woocommerce-checkout-manager'),
90
- 'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
91
- )
92
- ));
93
-
94
- // Colorpicker
95
- // ---------------------------------------------------------------------
96
- wp_register_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), $wp_version);
97
-
98
- wp_register_script('wp-color-picker', admin_url('js/color-picker.min.js'), array('iris', 'wp-i18n'), $wp_version);
99
-
100
- wp_localize_script('wp-color-picker', 'wpColorPickerL10n', array(
101
- 'clear' => esc_html__('Clear'),
102
- 'defaultString' => esc_html__('Default'),
103
- 'pick' => esc_html__('Select Color'),
104
- 'current' => esc_html__('Current Color'),
105
- ));
106
-
107
- wp_register_script('farbtastic', admin_url('js/farbtastic.js'), array('jquery'), $wp_version);
108
-
109
- // Admin
110
- // -------------------------------------------------------------------------
111
-
112
- $upload = include(WOOCCM_PLUGIN_DIR . 'assets/frontend/js/order-upload.asset.php');
113
-
114
- wp_register_script('wooccm-order-upload', plugins_url('assets/frontend/js/order-upload.js', WOOCCM_PLUGIN_FILE), $upload['dependencies'], $upload['version'], true);
115
-
116
- wp_localize_script('wooccm-order-upload', 'wooccm_upload', array(
117
- 'ajax_url' => admin_url('admin-ajax.php?metabox=' . is_admin()),
118
- 'nonce' => wp_create_nonce('wooccm_upload'),
119
- 'message' => array(
120
- 'uploading' => esc_html__('Uploading, please wait...', 'woocommerce-checkout-manager'),
121
- 'saving' => esc_html__('Saving, please wait...', 'woocommerce-checkout-manager'),
122
- 'success' => esc_html__('Files uploaded successfully.', 'woocommerce-checkout-manager'),
123
- 'deleted' => esc_html__('Deleted successfully.', 'woocommerce-checkout-manager'),
124
- ),
125
- 'icons' => array(
126
- 'interactive' => site_url('wp-includes/images/media/interactive.png'),
127
- 'spreadsheet' => site_url('wp-includes/images/media/spreadsheet.png'),
128
- 'archive' => site_url('wp-includes/images/media/archive.png'),
129
- 'audio' => site_url('wp-includes/images/media/audio.png'),
130
- 'text' => site_url('wp-includes/images/media/text.png'),
131
- 'video' => site_url('wp-includes/images/media/video.png')
132
- )
133
- ));
134
- }
135
-
136
- public function clear_session()
137
- {
138
- unset(WC()->session->wooccm);
139
- }
140
-
141
- public function init_session()
142
- {
143
-
144
- if (isset(WC()->session) && !WC()->session->wooccm) {
145
-
146
- WC()->session->wooccm = array(
147
- 'fields' => array(),
148
- 'fees' => array(),
149
- 'files' => array(),
150
- );
151
- }
152
- }
153
-
154
- public static function is_min()
155
- {
156
- if (!WOOCCM_DEVELOPER && (!defined('SCRIPT_DEBUG') || !SCRIPT_DEBUG)) {
157
- return '.min';
158
- }
159
- }
160
  }
1
  <?php
2
 
3
+ final class WOOCCM {
4
+
5
+
6
+ protected static $_instance;
7
+
8
+ public function __construct() {
9
+ include_once WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-install.php';
10
+ include_once WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-notices.php';
11
+
12
+ register_activation_hook( WOOCCM_PLUGIN_FILE, array( 'WOOCCM_Install', 'install' ) );
13
+
14
+ load_plugin_textdomain( 'woocommerce-checkout-manager', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
15
+
16
+ add_action( 'woocommerce_init', array( $this, 'init_session' ) );
17
+ add_action( 'woocommerce_init', array( $this, 'includes' ) );
18
+ add_action( 'woocommerce_init', array( $this, 'field' ) );
19
+ add_action( 'woocommerce_checkout_order_processed', array( $this, 'clear_session' ), 150 );
20
+ }
21
+
22
+ public static function instance() {
23
+ if ( is_null( self::$_instance ) ) {
24
+ self::$_instance = new self();
25
+ }
26
+ return self::$_instance;
27
+ }
28
+
29
+ public function field() {
30
+ $this->billing = WOOCCM_Field_Billing::instance();
31
+ $this->shipping = WOOCCM_Field_Shipping::instance();
32
+ $this->additional = WOOCCM_Field_Additional::instance();
33
+ }
34
+
35
+ public function includes() {
36
+ include_once WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-backend.php';
37
+ include_once WOOCCM_PLUGIN_DIR . 'includes/class-wooccm-upload.php';
38
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-checkout.php';
39
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field.php';
40
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-order.php';
41
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-email.php';
42
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-advanced.php';
43
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-premium.php';
44
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-suggestions.php';
45
+ }
46
+
47
+ public function register_scripts() {
48
+ global $wp_version;
49
+
50
+ // Frontend
51
+ // -----------------------------------------------------------------------
52
+
53
+ $checkout = include WOOCCM_PLUGIN_DIR . 'assets/frontend/js/checkout.asset.php';
54
+
55
+ wp_register_style( 'wooccm-checkout-css', plugins_url( 'assets/frontend/css/checkout.css', WOOCCM_PLUGIN_FILE ), false, WOOCCM_PLUGIN_VERSION, 'all' );
56
+
57
+ wp_register_script( 'wooccm-checkout-js', plugins_url( 'assets/frontend/js/checkout.js', WOOCCM_PLUGIN_FILE ), $checkout['dependencies'], $checkout['version'], true );
58
+
59
+ wp_localize_script(
60
+ 'wooccm-checkout-js',
61
+ 'wooccm_upload',
62
+ array(
63
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
64
+ 'nonce' => wp_create_nonce( 'wooccm_upload' ),
65
+ 'limit' => array(
66
+ 'max_file_size' => wp_max_upload_size(),
67
+ 'max_files' => 4,
68
+ // 'mime_types' => $this->get_mime_types(),
69
+ ),
70
+ 'icons' => array(
71
+ 'interactive' => site_url( 'wp-includes/images/media/interactive.png' ),
72
+ 'spreadsheet' => site_url( 'wp-includes/images/media/spreadsheet.png' ),
73
+ 'archive' => site_url( 'wp-includes/images/media/archive.png' ),
74
+ 'audio' => site_url( 'wp-includes/images/media/audio.png' ),
75
+ 'text' => site_url( 'wp-includes/images/media/text.png' ),
76
+ 'video' => site_url( 'wp-includes/images/media/video.png' ),
77
+ ),
78
+ 'message' => array(
79
+ 'uploading' => esc_html__( 'Uploading, please wait...', 'woocommerce-checkout-manager' ),
80
+ 'saving' => esc_html__( 'Saving, please wait...', 'woocommerce-checkout-manager' ),
81
+ 'success' => esc_html__( 'Files uploaded successfully.', 'woocommerce-checkout-manager' ),
82
+ 'deleted' => esc_html__( 'Deleted successfully.', 'woocommerce-checkout-manager' ),
83
+ ),
84
+ )
85
+ );
86
+
87
+ // Colorpicker
88
+ // ---------------------------------------------------------------------
89
+ wp_register_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), $wp_version );
90
+
91
+ wp_register_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris', 'wp-i18n' ), $wp_version );
92
+
93
+ wp_localize_script(
94
+ 'wp-color-picker',
95
+ 'wpColorPickerL10n',
96
+ array(
97
+ 'clear' => esc_html__( 'Clear' ),
98
+ 'defaultString' => esc_html__( 'Default' ),
99
+ 'pick' => esc_html__( 'Select Color' ),
100
+ 'current' => esc_html__( 'Current Color' ),
101
+ )
102
+ );
103
+
104
+ wp_register_script( 'farbtastic', admin_url( 'js/farbtastic.js' ), array( 'jquery' ), $wp_version );
105
+
106
+ // Admin
107
+ // -------------------------------------------------------------------------
108
+
109
+ $upload = include WOOCCM_PLUGIN_DIR . 'assets/frontend/js/order-upload.asset.php';
110
+
111
+ wp_register_script( 'wooccm-order-upload', plugins_url( 'assets/frontend/js/order-upload.js', WOOCCM_PLUGIN_FILE ), $upload['dependencies'], $upload['version'], true );
112
+
113
+ wp_localize_script(
114
+ 'wooccm-order-upload',
115
+ 'wooccm_upload',
116
+ array(
117
+ 'ajax_url' => admin_url( 'admin-ajax.php?metabox=' . is_admin() ),
118
+ 'nonce' => wp_create_nonce( 'wooccm_upload' ),
119
+ 'message' => array(
120
+ 'uploading' => esc_html__( 'Uploading, please wait...', 'woocommerce-checkout-manager' ),
121
+ 'saving' => esc_html__( 'Saving, please wait...', 'woocommerce-checkout-manager' ),
122
+ 'success' => esc_html__( 'Files uploaded successfully.', 'woocommerce-checkout-manager' ),
123
+ 'deleted' => esc_html__( 'Deleted successfully.', 'woocommerce-checkout-manager' ),
124
+ ),
125
+ 'icons' => array(
126
+ 'interactive' => site_url( 'wp-includes/images/media/interactive.png' ),
127
+ 'spreadsheet' => site_url( 'wp-includes/images/media/spreadsheet.png' ),
128
+ 'archive' => site_url( 'wp-includes/images/media/archive.png' ),
129
+ 'audio' => site_url( 'wp-includes/images/media/audio.png' ),
130
+ 'text' => site_url( 'wp-includes/images/media/text.png' ),
131
+ 'video' => site_url( 'wp-includes/images/media/video.png' ),
132
+ ),
133
+ )
134
+ );
135
+ }
136
+
137
+ public function clear_session() {
138
+ unset( WC()->session->wooccm );
139
+ }
140
+
141
+ public function init_session() {
142
+ if ( isset( WC()->session ) && ! WC()->session->wooccm ) {
143
+
144
+ WC()->session->wooccm = array(
145
+ 'fields' => array(),
146
+ 'fees' => array(),
147
+ 'files' => array(),
148
+ );
149
+ }
150
+ }
151
+
152
+ public static function is_min() {
153
+ if ( ! WOOCCM_DEVELOPER && ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) ) {
154
+ return '.min';
155
+ }
156
+ }
 
 
 
157
  }
includes/view/frontend/class-wooccm-fields-i18n.php CHANGED
@@ -65,6 +65,9 @@ class WOOCCM_Fields_i18n {
65
  if ( isset( $field['description'] ) && $field['description'] != '' ) {
66
  pll_register_string( $field['description'], $field['description'], $name );
67
  }
 
 
 
68
 
69
  if ( isset( $field['options'] ) ) {
70
  foreach ( $field['options'] as $option_data ) {
@@ -96,10 +99,12 @@ class WOOCCM_Fields_i18n {
96
  if ( isset( $field['description'] ) && $field['description'] != '' ) {
97
  icl_register_string( 'woocommerce-checkout-manager', $field['description'], $field['description'], false, $icl_language_code );
98
  }
 
 
 
99
  if ( isset( $field['options'] ) ) {
100
  foreach ( $field['options'] as $option_data ) {
101
  if ( isset( $option_data['label'] ) ) {
102
- // 1326
103
  icl_register_string( 'woocommerce-checkout-manager', $option_data['label'], $option_data['label'], false, $icl_language_code );
104
  }
105
  }
65
  if ( isset( $field['description'] ) && $field['description'] != '' ) {
66
  pll_register_string( $field['description'], $field['description'], $name );
67
  }
68
+ if ( isset( $field['conditional_parent_value'] ) && $field['conditional_parent_value'] != '' ) {
69
+ pll_register_string( $field['conditional_parent_value'], $field['conditional_parent_value'], $name );
70
+ }
71
 
72
  if ( isset( $field['options'] ) ) {
73
  foreach ( $field['options'] as $option_data ) {
99
  if ( isset( $field['description'] ) && $field['description'] != '' ) {
100
  icl_register_string( 'woocommerce-checkout-manager', $field['description'], $field['description'], false, $icl_language_code );
101
  }
102
+ if ( isset( $field['conditional_parent_value'] ) && $field['conditional_parent_value'] != '' ) {
103
+ icl_register_string( 'woocommerce-checkout-manager', $field['conditional_parent_value'], $field['conditional_parent_value'], false, $icl_language_code );
104
+ }
105
  if ( isset( $field['options'] ) ) {
106
  foreach ( $field['options'] as $option_data ) {
107
  if ( isset( $option_data['label'] ) ) {
 
108
  icl_register_string( 'woocommerce-checkout-manager', $option_data['label'], $option_data['label'], false, $icl_language_code );
109
  }
110
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: checkout field editor, woocommerce checkout field editor, checkout manager
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
- Stable tag: 6.1.8
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.8
11
  License: GPLv3
@@ -149,6 +149,10 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
149
 
150
  == Changelog ==
151
 
 
 
 
 
152
  = 6.1.8
153
  * Fix. WooCommerce 6.8 compatibility
154
 
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
+ Stable tag: 6.1.9
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.8
11
  License: GPLv3
149
 
150
  == Changelog ==
151
 
152
+ = 6.1.9
153
+ * Fix. WooCommerce Checkout WPML compatibility
154
+ * Fix. WooCommerce Checkout Polylang compatibility
155
+
156
  = 6.1.8
157
  * Fix. WooCommerce 6.8 compatibility
158
 
woocommerce-checkout-manager.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
- * Version: 6.1.8
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -20,7 +20,7 @@ if ( ! defined( 'WOOCCM_PLUGIN_NAME' ) ) {
20
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
21
  }
22
  if ( ! defined( 'WOOCCM_PLUGIN_VERSION' ) ) {
23
- define( 'WOOCCM_PLUGIN_VERSION', '6.1.8' );
24
  }
25
  if ( ! defined( 'WOOCCM_PLUGIN_FILE' ) ) {
26
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
+ * Version: 6.1.9
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
20
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
21
  }
22
  if ( ! defined( 'WOOCCM_PLUGIN_VERSION' ) ) {
23
+ define( 'WOOCCM_PLUGIN_VERSION', '6.1.9' );
24
  }
25
  if ( ! defined( 'WOOCCM_PLUGIN_FILE' ) ) {
26
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );