PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 1.1.17
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v1.1.17
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / modules / checkout / classes / class-cartflows-checkout-meta.php

class-cartflows-checkout-meta.php in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 1.1.17, at modules/checkout/classes/class-cartflows-checkout-meta.php

773 lines 20.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Checkout post meta
4 *
5 * @package CartFlows
6 */
7
8 /**
9 * Meta Boxes setup
10 */
11 class Cartflows_Checkout_Meta extends Cartflows_Meta {
12
13 /**
14 * Instance
15 *
16 * @var $instance
17 */
18 private static $instance;
19
20 /**
21 * Meta Option
22 *
23 * @var $meta_option
24 */
25 private static $meta_option = null;
26
27 /**
28 * Initiator
29 */
30 public static function get_instance() {
31 if ( ! isset( self::$instance ) ) {
32 self::$instance = new self;
33 }
34
35 return self::$instance;
36 }
37
38 /**
39 * Constructor
40 */
41 public function __construct() {
42
43 /* Init Metabox */
44 add_action( 'load-post.php', array( $this, 'init_metabox' ) );
45 add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
46 }
47
48 /**
49 * Init Metabox
50 */
51 public function init_metabox() {
52
53 add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
54 add_action( 'save_post', array( $this, 'save_meta_box' ) );
55 }
56
57 /**
58 * Setup Metabox
59 */
60 function setup_meta_box() {
61
62 // Get all posts.
63 $post_types = get_post_types();
64
65 if ( _is_wcf_checkout_type() ) {
66 add_meta_box(
67 'wcf-checkout-settings', // Id.
68 __( 'Checkout Layout', 'cartflows' ), // Title.
69 array( $this, 'markup_meta_box' ), // Callback.
70 wcf()->utils->get_step_post_type(), // Post_type.
71 'normal', // Context.
72 'high' // Priority.
73 );
74 }
75 }
76
77 /**
78 * Metabox Markup
79 *
80 * @param object $post Post object.
81 * @return void
82 */
83 function markup_meta_box( $post ) {
84
85 wp_nonce_field( 'save-nonce-checkout-step-meta', 'nonce-checkout-step-meta' );
86
87 $stored = get_post_meta( $post->ID );
88
89 $checkout_meta = self::get_meta_option( $post->ID );
90
91 // Set stored and override defaults.
92 foreach ( $stored as $key => $value ) {
93 if ( array_key_exists( $key, $checkout_meta ) ) {
94 self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
95 } else {
96 self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
97 }
98 }
99
100 // Get defaults.
101 $meta = self::get_meta_option( $post->ID );
102 $checkout_data = array();
103
104 foreach ( $meta as $key => $value ) {
105
106 $checkout_data[ $key ] = $meta[ $key ]['default'];
107 }
108
109 /*
110 $billing_fields = Cartflows_Helper::get_checkout_fields( 'billing', $post->ID );
111
112 foreach ( $billing_fields as $key => $value ) {
113
114 $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
115 }
116
117 $shipping_fields = Cartflows_Helper::get_checkout_fields( 'shipping', $post->ID );
118
119 foreach ( $shipping_fields as $key => $value ) {
120
121 $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
122 }
123
124 $additional_fields = Cartflows_Helper::get_checkout_fields( 'additional', $post->ID );
125
126 foreach ( $additional_fields as $key => $value ) {
127
128 $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
129 }
130 */
131
132 do_action( 'wcf_checkout_settings_markup_before' );
133 $this->tabs_markup( $checkout_data, $post->ID );
134 do_action( 'wcf_checkout_settings_markup_after' );
135 }
136
137 /**
138 * Page Header Tabs
139 *
140 * @param array $options options.
141 * @param int $post_id post ID.
142 */
143 function tabs_markup( $options, $post_id ) {
144
145 $active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
146
147 if ( empty( $active_tab ) ) {
148 $active_tab = 'wcf-checkout-shortcodes';
149 }
150
151 $tabs = apply_filters(
152 'cartflows_checkout_tabs',
153 array(
154 array(
155 'title' => __( 'Shortcodes', 'cartflows' ),
156 'id' => 'wcf-checkout-shortcodes',
157 'class' => 'wcf-checkout-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
158 'icon' => 'dashicons-editor-code',
159 ),
160 array(
161 'title' => __( 'Select Product', 'cartflows' ),
162 'id' => 'wcf-checkout-general',
163 'class' => 'wcf-checkout-general' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
164 'icon' => 'dashicons-info',
165 ),
166 array(
167 'title' => __( 'Order Bump', 'cartflows' ),
168 'id' => 'wcf-product-order-bump',
169 'class' => 'wcf-product-order-bump' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
170 'icon' => 'dashicons-cart',
171 ),
172 array(
173 'title' => __( 'Checkout Design', 'cartflows' ),
174 'id' => 'wcf-checkout-style',
175 'class' => 'wcf-checkout-style' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
176 'icon' => 'dashicons-admin-customizer',
177 ),
178 array(
179 'title' => __( 'Checkout Fields', 'cartflows' ),
180 'id' => 'wcf-checkout-custom-fields',
181 'class' => 'wcf-checkout-custom-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
182 'icon' => 'dashicons-welcome-widgets-menus',
183 ),
184 array(
185 'title' => __( 'Logo (Optional)', 'cartflows' ),
186 'id' => 'wcf-checkout-header',
187 'class' => 'wcf-checkout-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
188 'icon' => 'dashicons-format-image',
189 ),
190 array(
191 'title' => __( 'Custom Script', 'cartflows' ),
192 'id' => 'wcf-checkout-custom-script-header',
193 'class' => 'wcf-checkout-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
194 'icon' => 'dashicons-format-aside',
195 ),
196 ),
197 $active_tab
198 );
199
200 ?>
201 <div class="wcf-checkout-table wcf-metabox-wrap widefat">
202 <div class="wcf-table-container">
203 <div class="wcf-column-left">
204 <div class="wcf-tab-wrapper">
205
206 <?php foreach ( $tabs as $key => $tab ) { ?>
207 <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
208 <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
209 <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
210 </div>
211 <?php } ?>
212
213 <input type="hidden" id="wcf-active-tab" name="wcf-active-tab" value="<?php echo esc_attr( $active_tab ); ?>" />
214 </div>
215 </div>
216 <div class="wcf-column-right">
217 <?php $this->tab_shortcodes( $options, $post_id ); ?>
218 <?php $this->tab_general( $options, $post_id ); ?>
219 <?php $this->tab_style( $options, $post_id ); ?>
220 <?php $this->tab_product_bump( $options, $post_id ); ?>
221 <?php $this->tab_custom_fields( $options, $post_id ); ?>
222 <?php $this->tab_header_content( $options, $post_id ); ?>
223 <?php $this->tab_custom_script( $options, $post_id ); ?>
224 <?php do_action( 'cartflows_checkout_tabs_content', $options, $post_id ); ?>
225 <?php $this->right_column_footer( $options, $post_id ); ?>
226 </div>
227 </div>
228 </div>
229
230 <?php
231 }
232
233 /**
234 * Shortcodes tab
235 *
236 * @param array $options options.
237 * @param int $post_id post ID.
238 */
239 function tab_shortcodes( $options, $post_id ) {
240 ?>
241 <div class="wcf-checkout-shortcodes wcf-tab-content widefat">
242
243 <?php
244
245 echo wcf()->meta->get_shortcode_field(
246 array(
247 'label' => 'Checkout Page',
248 'name' => 'wcf-checkout-shortcode',
249 'content' => '[cartflows_checkout]',
250 'help' => __( 'Add this shortcode to your checkout page', 'cartflows' ),
251 )
252 );
253 ?>
254 </div>
255 <?php
256 }
257
258
259 /**
260 * General tab
261 *
262 * @param array $options options.
263 * @param int $post_id post ID.
264 */
265 function tab_general( $options, $post_id ) {
266 ?>
267 <div class="wcf-checkout-general wcf-tab-content widefat">
268
269 <?php
270
271 echo wcf()->meta->get_product_selection_repeater(
272 array(
273 'name' => 'wcf-checkout-products',
274 'value' => $options['wcf-checkout-products'],
275 'allow_clear' => true,
276 )
277 );
278
279 do_action( 'cartflows_checkout_general_tab_content', $options, $post_id );
280
281 ?>
282 </div>
283 <?php
284 }
285
286 /**
287 * Product bump tab
288 *
289 * @param array $options options.
290 * @param int $post_id post ID.
291 */
292 function tab_product_bump( $options, $post_id ) {
293 ?>
294 <div class="wcf-product-order-bump wcf-tab-content widefat">
295 <?php
296 if ( ! _is_cartflows_pro() ) {
297
298 echo wcf()->meta->get_description_field(
299 array(
300 'name' => 'wcf-upgrade-to-pro',
301 /* translators: %s: link */
302 'content' => '<i>' . sprintf( __( 'Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
303 )
304 );
305 }
306 ?>
307
308 <?php do_action( 'cartflows_order_bump_tab_content', $options, $post_id ); ?>
309 </div>
310 <?php
311 }
312 /**
313 * Tab custom fields
314 *
315 * @param array $options options.
316 * @param int $post_id post ID.
317 */
318 function tab_custom_fields( $options, $post_id ) {
319 ?>
320 <div class="wcf-checkout-custom-fields wcf-tab-content widefat">
321 <?php
322 /* Custom Checkout Fields Section */
323
324 if ( ! _is_cartflows_pro() ) {
325
326 echo wcf()->meta->get_description_field(
327 array(
328 'name' => 'wcf-upgrade-to-pro',
329 /* translators: %s: link */
330 'content' => '<i>' . sprintf( __( 'Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
331 )
332 );
333 }
334 ?>
335 <?php do_action( 'cartflows_custom_fields_tab_content', $options, $post_id ); ?>
336 </div>
337 <?php
338 }
339
340 /**
341 * Tab style
342 *
343 * @param array $options options.
344 * @param int $post_id post ID.
345 */
346 function tab_style( $options, $post_id ) {
347 ?>
348
349 <div class="wcf-checkout-style wcf-tab-content widefat">
350 <div class="wcf-cs-fields">
351 <div class="wcf-cs-checkbox-field">
352 <?php
353
354 $layout_pro_option = array();
355
356 if ( ! _is_cartflows_pro() ) {
357 $layout_pro_option = array(
358 'one-column' => __( 'One Column (Available in CartFlows Pro) ', 'cartflows' ),
359 'two-step' => __( 'Two Step (Available in CartFlows Pro) ', 'cartflows' ),
360 );
361 }
362
363 echo wcf()->meta->get_select_field(
364 array(
365 'label' => __( 'Checkout Skin', 'cartflows' ),
366 'name' => 'wcf-checkout-layout',
367 'value' => $options['wcf-checkout-layout'],
368 'options' => array(
369 'one-column' => __( 'One Column', 'cartflows' ),
370 'two-column' => __( 'Two Column', 'cartflows' ),
371 'two-step' => __( 'Two Step', 'cartflows' ),
372 ),
373 'pro-options' => $layout_pro_option,
374
375 )
376 );
377
378 echo wcf()->meta->get_color_picker_field(
379 array(
380 'label' => __( 'Primary Color', 'cartflows' ),
381 'name' => 'wcf-primary-color',
382 'value' => $options['wcf-primary-color'],
383 )
384 );
385
386 echo wcf()->meta->get_font_family_field(
387 array(
388 'for' => 'wcf-base',
389 'label' => __( 'Font Family', 'cartflows' ),
390 'name' => 'wcf-base-font-family',
391 'value' => $options['wcf-base-font-family'],
392 )
393 );
394
395 echo wcf()->meta->get_checkbox_field(
396 array(
397 'label' => __( 'Advance Options', 'cartflows' ),
398 'name' => 'wcf-advance-options-fields',
399 'value' => $options['wcf-advance-options-fields'],
400 'after' => 'Enable',
401 )
402 );
403 ?>
404 </div>
405 <div class="wcf-cs-fields-options">
406 <?php
407 echo wcf()->meta->get_section(
408 array(
409 'label' => __( 'Heading', 'cartflows' ),
410 )
411 );
412
413 echo wcf()->meta->get_color_picker_field(
414 array(
415 'label' => __( 'Heading Color', 'cartflows' ),
416 'name' => 'wcf-heading-color',
417 'value' => $options['wcf-heading-color'],
418 )
419 );
420
421 echo wcf()->meta->get_font_family_field(
422 array(
423 'for' => 'wcf-heading',
424 'label' => __( 'Font Family', 'cartflows' ),
425 'name' => 'wcf-heading-font-family',
426 'value' => $options['wcf-heading-font-family'],
427 )
428 );
429
430 echo wcf()->meta->get_font_weight_field(
431 array(
432 'for' => 'wcf-heading',
433 'label' => __( 'Font Weight', 'cartflows' ),
434 'name' => 'wcf-heading-font-weight',
435 'value' => $options['wcf-heading-font-weight'],
436 )
437 );
438
439 echo wcf()->meta->get_section(
440 array(
441 'label' => __( 'Input Fields', 'cartflows' ),
442 )
443 );
444
445 $fields_skin_pro_option = array();
446
447 if ( ! _is_cartflows_pro() ) {
448 $fields_skin_pro_option = array(
449 'skin-one' => __( 'Floating Labels (Available in CartFlows Pro)', 'cartflows' ),
450 );
451 }
452
453 echo wcf()->meta->get_select_field(
454 array(
455 'label' => __( 'Style', 'cartflows' ),
456 'name' => 'wcf-fields-skins',
457 'value' => $options['wcf-fields-skins'],
458 'options' => array(
459 'default' => __( 'Default', 'cartflows' ),
460 'style-one' => __( 'Floating Labels', 'cartflows' ),
461 ),
462 'pro-options' => $fields_skin_pro_option,
463
464 )
465 );
466
467 echo wcf()->meta->get_font_family_field(
468 array(
469 'for' => 'wcf-input',
470 'label' => __( 'Font Family', 'cartflows' ),
471 'name' => 'wcf-input-font-family',
472 'value' => $options['wcf-input-font-family'],
473 )
474 );
475
476 echo wcf()->meta->get_font_weight_field(
477 array(
478 'for' => 'wcf-input',
479 'label' => __( 'Font Weight', 'cartflows' ),
480 'name' => 'wcf-input-font-weight',
481 'value' => $options['wcf-input-font-weight'],
482 )
483 );
484
485 echo wcf()->meta->get_select_field(
486 array(
487 'label' => __( 'Size', 'cartflows' ),
488 'name' => 'wcf-input-field-size',
489 'value' => $options['wcf-input-field-size'],
490 'options' => array(
491 '33px' => __( 'Extra Small', 'cartflows' ),
492 '38px' => __( 'Small', 'cartflows' ),
493 '44px' => __( 'Medium', 'cartflows' ),
494 '58px' => __( 'Large', 'cartflows' ),
495 '68px' => __( 'Extra Large', 'cartflows' ),
496 'custom' => __( 'Custom', 'cartflows' ),
497 ),
498 )
499 );
500
501 echo wcf()->meta->get_number_field(
502 array(
503 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
504 'name' => 'wcf-field-tb-padding',
505 'value' => $options['wcf-field-tb-padding'],
506 )
507 );
508
509 echo wcf()->meta->get_number_field(
510 array(
511 'label' => __( 'Left Right Spacing', 'cartflows' ),
512 'name' => 'wcf-field-lr-padding',
513 'value' => $options['wcf-field-lr-padding'],
514 )
515 );
516
517 echo wcf()->meta->get_color_picker_field(
518 array(
519 'label' => __( 'Text / Placeholder Color', 'cartflows' ),
520 'name' => 'wcf-field-color',
521 'value' => $options['wcf-field-color'],
522 )
523 );
524
525 echo wcf()->meta->get_color_picker_field(
526 array(
527 'label' => __( 'Background Color', 'cartflows' ),
528 'name' => 'wcf-field-bg-color',
529 'value' => $options['wcf-field-bg-color'],
530 )
531 );
532
533 echo wcf()->meta->get_color_picker_field(
534 array(
535 'label' => __( 'Border Color', 'cartflows' ),
536 'name' => 'wcf-field-border-color',
537 'value' => $options['wcf-field-border-color'],
538 )
539 );
540 echo wcf()->meta->get_color_picker_field(
541 array(
542 'label' => __( 'Label Color', 'cartflows' ),
543 'name' => 'wcf-field-label-color',
544 'value' => $options['wcf-field-label-color'],
545 )
546 );
547
548 ?>
549 </div>
550 <div class="wcf-cs-button-options">
551 <?php
552
553 echo wcf()->meta->get_section(
554 array(
555 'label' => __( 'Buttons', 'cartflows' ),
556 )
557 );
558
559 echo wcf()->meta->get_font_family_field(
560 array(
561 'for' => 'wcf-button',
562 'label' => __( 'Font Family', 'cartflows' ),
563 'name' => 'wcf-button-font-family',
564 'value' => $options['wcf-button-font-family'],
565 )
566 );
567
568 echo wcf()->meta->get_font_weight_field(
569 array(
570 'for' => 'wcf-button',
571 'label' => __( 'Font Weight', 'cartflows' ),
572 'name' => 'wcf-button-font-weight',
573 'value' => $options['wcf-button-font-weight'],
574 )
575 );
576
577 echo wcf()->meta->get_select_field(
578 array(
579 'label' => __( 'Size', 'cartflows' ),
580 'name' => 'wcf-input-button-size',
581 'value' => $options['wcf-input-button-size'],
582 'options' => array(
583 '33px' => __( 'Extra Small', 'cartflows' ),
584 '38px' => __( 'Small', 'cartflows' ),
585 '44px' => __( 'Medium', 'cartflows' ),
586 '58px' => __( 'Large', 'cartflows' ),
587 '68px' => __( 'Extra Large', 'cartflows' ),
588 'custom' => __( 'Custom', 'cartflows' ),
589 ),
590 )
591 );
592
593 echo wcf()->meta->get_number_field(
594 array(
595 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
596 'name' => 'wcf-submit-tb-padding',
597 'value' => $options['wcf-submit-tb-padding'],
598 )
599 );
600
601 echo wcf()->meta->get_number_field(
602 array(
603 'label' => __( 'Left Right Spacing', 'cartflows' ),
604 'name' => 'wcf-submit-lr-padding',
605 'value' => $options['wcf-submit-lr-padding'],
606 )
607 );
608
609 echo wcf()->meta->get_color_picker_field(
610 array(
611 'label' => __( 'Text Color', 'cartflows' ),
612 'name' => 'wcf-submit-color',
613 'value' => $options['wcf-submit-color'],
614 )
615 );
616
617 echo wcf()->meta->get_color_picker_field(
618 array(
619 'label' => __( 'Text Hover Color', 'cartflows' ),
620 'name' => 'wcf-submit-hover-color',
621 'value' => $options['wcf-submit-hover-color'],
622 )
623 );
624
625 echo wcf()->meta->get_color_picker_field(
626 array(
627 'label' => __( 'Background Color', 'cartflows' ),
628 'name' => 'wcf-submit-bg-color',
629 'value' => $options['wcf-submit-bg-color'],
630 )
631 );
632
633 echo wcf()->meta->get_color_picker_field(
634 array(
635 'label' => __( 'Background Hover Color', 'cartflows' ),
636 'name' => 'wcf-submit-bg-hover-color',
637 'value' => $options['wcf-submit-bg-hover-color'],
638 )
639 );
640
641 echo wcf()->meta->get_color_picker_field(
642 array(
643 'label' => __( 'Border Color', 'cartflows' ),
644 'name' => 'wcf-submit-border-color',
645 'value' => $options['wcf-submit-border-color'],
646 )
647 );
648
649 echo wcf()->meta->get_color_picker_field(
650 array(
651 'label' => __( 'Border Hover Color', 'cartflows' ),
652 'name' => 'wcf-submit-border-hover-color',
653 'value' => $options['wcf-submit-border-hover-color'],
654 )
655 );
656
657 ?>
658 </div>
659 <div class="wcf-cs-section-options">
660 <?php
661
662 echo wcf()->meta->get_section(
663 array(
664 'label' => __( 'Sections', 'cartflows' ),
665 )
666 );
667
668 echo wcf()->meta->get_color_picker_field(
669 array(
670 'label' => __( 'Highlight Area Background Color', 'cartflows' ),
671 'name' => 'wcf-hl-bg-color',
672 'value' => $options['wcf-hl-bg-color'],
673 )
674 );
675
676 echo wcf()->meta->get_hidden_field(
677 array(
678 'name' => 'wcf-field-google-font-url',
679 'value' => $options['wcf-field-google-font-url'],
680 )
681 );
682 ?>
683 </div>
684 <?php do_action( 'cartflows_checkout_style_tab_content', $options, $post_id ); ?>
685 </div>
686 </div>
687 <?php
688 }
689
690
691 /**
692 * Tab Header (Used for add logo into header)
693 *
694 * @param array $options options.
695 * @param int $post_id post ID.
696 */
697 function tab_header_content( $options, $post_id ) {
698 ?>
699
700 <div class="wcf-checkout-header wcf-tab-content widefat">
701 <?php
702
703 $layout_pro_option = array();
704
705 echo wcf()->meta->get_image_field(
706 array(
707 'name' => 'wcf-header-logo-image',
708 'value' => $options['wcf-header-logo-image'],
709 'label' => __( 'Header Logo', 'cartflows' ),
710 )
711 );
712
713 echo wcf()->meta->get_number_field(
714 array(
715 'name' => 'wcf-header-logo-width',
716 'value' => $options['wcf-header-logo-width'],
717 'label' => __( 'Logo Width (In px)', 'cartflows' ),
718 )
719 );
720 ?>
721 <?php do_action( 'cartflows_checkout_header_tab_content', $options, $post_id ); ?>
722 </div>
723 <?php
724 }
725 /**
726 * Get metabox options
727 *
728 * @param int $post_id post ID.
729 */
730 public static function get_meta_option( $post_id ) {
731
732 if ( null === self::$meta_option ) {
733
734 /**
735 * Set metabox options
736 *
737 * @see http://php.net/manual/en/filter.filters.sanitize.php
738 */
739 self::$meta_option = wcf()->options->get_checkout_fields( $post_id );
740 }
741
742 return self::$meta_option;
743 }
744
745 /**
746 * Metabox Save
747 *
748 * @param number $post_id Post ID.
749 * @return void
750 */
751 function save_meta_box( $post_id ) {
752
753 // Checks save status.
754 $is_autosave = wp_is_post_autosave( $post_id );
755 $is_revision = wp_is_post_revision( $post_id );
756
757 $is_valid_nonce = ( isset( $_POST['nonce-checkout-step-meta'] ) && wp_verify_nonce( $_POST['nonce-checkout-step-meta'], 'save-nonce-checkout-step-meta' ) ) ? true : false;
758
759 // Exits script depending on save status.
760 if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
761 return;
762 }
763
764 wcf()->options->save_checkout_fields( $post_id );
765 }
766
767 }
768
769 /**
770 * Kicking this off by calling 'get_instance()' method
771 */
772 Cartflows_Checkout_Meta::get_instance();
773