PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / admin / import-export / batch-processing / class-wpfnl-batch.php

class-wpfnl-batch.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 2.8.16, at admin/import-export/batch-processing/class-wpfnl-batch.php

129 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Batch processing
4 *
5 * @package WPFunnels\Batch\Elementor
6 */
7
8 namespace WPFunnels\Batch\Elementor;
9
10 use WPFunnels\Batch\Divi\Wpfnl_Divi_Source;
11 use WPFunnels\Batch\Gutenberg\Wpfnl_Gutenberg_Batch;
12 use WPFunnels\Batch\Gutenberg\Wpfnl_Gutenberg_Source;
13 use WPFunnels\Batch\Wpfnl_Divi_Batch;
14 use WPFunnels\Batch\Wpfnl_Elementor_Batch;
15 use WPFunnels\Traits\SingletonTrait;
16 use WPFunnels\Wpfnl_functions;
17 /**
18 * Batch processing
19 *
20 * @since 1.0.1
21 */
22 class Wpfnl_Batch {
23
24 use SingletonTrait;
25
26 /**
27 * Elementor batch instance
28 *
29 * @var Wpfnl_Elementor_Batch
30 */
31 protected $elementor_batch;
32
33 /**
34 * Elementor source object
35 *
36 * @var Wpfnl_Elementor_Source
37 */
38 protected $elementor_source;
39
40 /**
41 * Gutenberg batch instance
42 *
43 * @var Wpfnl_Gutenberg_Batch
44 */
45 protected $gutenberg_batch;
46
47 /**
48 * Gutenberg source object
49 *
50 * @var Wpfnl_Gutenberg_Source
51 */
52 protected $gutenberg_source;
53
54 /**
55 * Divi batch instance
56 *
57 * @var Wpfnl_Divi_Batch
58 */
59 protected $divi_batch;
60
61 /**
62 * Divi source object
63 *
64 * @var Wpfnl_Divi_Source
65 */
66 protected $divi_source;
67
68
69 /**
70 * Oxygen source object
71 *
72 * @var Oxygen source
73 */
74 protected $oxygen_source;
75
76 /**
77 * Class constructor.
78 *
79 * Initializes the appropriate batch object based on the page builder type.
80 * Sets up the 'wpfunnels_after_step_import' action hook for processing.
81 *
82 * @since 1.0.0
83 */
84 public function __construct() {
85 $page_builder = Wpfnl_functions::get_builder_type();
86
87 if ( 'elementor' === $page_builder ) {
88 $this->elementor_batch = new Wpfnl_Elementor_Batch();
89 }
90
91 if ( 'gutenberg' === $page_builder ) {
92 $this->gutenberg_batch = new Wpfnl_Gutenberg_Batch();
93 }
94
95 if ( 'divi-builder' === $page_builder ) {
96 $this->divi_batch = new Wpfnl_Divi_Batch();
97 }
98
99 add_action( 'wpfunnels_after_step_import', array( $this, 'start_processing' ), 10, 2 );
100 }
101
102 /**
103 * Start the batch import process
104 *
105 * @param int $step_id funnel step id.
106 * @param string $builder active page builder.
107 *
108 * @since 1.0.0
109 */
110 public function start_processing( $step_id = 0, $builder = 'elementor' ) {
111 if ( $step_id && !Wpfnl_functions::maybe_duplicate_step( $step_id ) ) {
112 if ( 'elementor' === $builder && class_exists( '\Elementor\Plugin' ) ) {
113 $this->elementor_batch->push_to_queue( $step_id );
114 $this->elementor_batch->save()->dispatch();
115 }
116
117 if ( 'gutenberg' === $builder ) {
118 $this->gutenberg_batch->push_to_queue( $step_id );
119 $this->gutenberg_batch->save()->dispatch();
120 }
121
122 if ( 'divi-builder' === $builder ) {
123 $this->divi_batch->push_to_queue( $step_id );
124 $this->divi_batch->save()->dispatch();
125 }
126 }
127 }
128 }
129