PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.10.9
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.10.9
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 3.10.9, at admin/import-export/batch-processing/class-wpfnl-batch.php

153 lines 3.1 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\Batch\Wpfnl_Bricks_Batch;
16 use WPFunnels\Traits\SingletonTrait;
17 use WPFunnels\Wpfnl_functions;
18 /**
19 * Batch processing
20 *
21 * @since 1.0.1
22 */
23 class Wpfnl_Batch {
24
25 use SingletonTrait;
26
27 /**
28 * Elementor batch instance
29 *
30 * @var Wpfnl_Elementor_Batch
31 */
32 protected $elementor_batch;
33
34 /**
35 * Elementor source object
36 *
37 * @var Wpfnl_Elementor_Source
38 */
39 protected $elementor_source;
40
41 /**
42 * Gutenberg batch instance
43 *
44 * @var Wpfnl_Gutenberg_Batch
45 */
46 protected $gutenberg_batch;
47
48 /**
49 * Gutenberg source object
50 *
51 * @var Wpfnl_Gutenberg_Source
52 */
53 protected $gutenberg_source;
54
55 /**
56 * Divi batch instance
57 *
58 * @var Wpfnl_Divi_Batch
59 */
60 protected $divi_batch;
61
62 /**
63 * Bricks batch instance
64 *
65 * @var Wpfnl_Bricks_Batch
66 */
67 protected $bricks_batch;
68
69 /**
70 * Divi source object
71 *
72 * @var Wpfnl_Divi_Source
73 */
74 protected $divi_source;
75
76 /**
77 * Bricks source object
78 *
79 * @var Wpfnl_Bricks_Source
80 */
81 protected $bricks_source;
82
83
84 /**
85 * Oxygen source object
86 *
87 * @var Oxygen source
88 */
89 protected $oxygen_source;
90
91 /**
92 * Class constructor.
93 *
94 * Initializes the appropriate batch object based on the page builder type.
95 * Sets up the 'wpfunnels_after_step_import' action hook for processing.
96 *
97 * @since 1.0.0
98 */
99 public function __construct() {
100 $page_builder = Wpfnl_functions::get_builder_type();
101
102 if ( 'elementor' === $page_builder ) {
103 $this->elementor_batch = new Wpfnl_Elementor_Batch();
104 }
105
106 if ( 'gutenberg' === $page_builder ) {
107 $this->gutenberg_batch = new Wpfnl_Gutenberg_Batch();
108 }
109
110 if ( 'divi-builder' === $page_builder ) {
111 $this->divi_batch = new Wpfnl_Divi_Batch();
112 }
113
114 if ( 'bricks' === $page_builder ) {
115 $this->bricks_batch = new Wpfnl_Bricks_Batch();
116 }
117
118 add_action( 'wpfunnels_after_step_import', array( $this, 'start_processing' ), 10, 2 );
119 }
120
121 /**
122 * Start the batch import process
123 *
124 * @param int $step_id funnel step id.
125 * @param string $builder active page builder.
126 *
127 * @since 1.0.0
128 */
129 public function start_processing( $step_id = 0, $builder = 'elementor' ) {
130 if ( $step_id && !Wpfnl_functions::maybe_duplicate_step( $step_id ) ) {
131 if ( 'elementor' === $builder && class_exists( '\Elementor\Plugin' ) ) {
132 $this->elementor_batch->push_to_queue( $step_id );
133 $this->elementor_batch->save()->dispatch();
134 }
135
136 if ( 'gutenberg' === $builder ) {
137 $this->gutenberg_batch->push_to_queue( $step_id );
138 $this->gutenberg_batch->save()->dispatch();
139 }
140
141 if ( 'divi-builder' === $builder ) {
142 $this->divi_batch->push_to_queue( $step_id );
143 $this->divi_batch->save()->dispatch();
144 }
145
146 if ( 'bricks' === $builder ) {
147 $this->bricks_batch->push_to_queue( $step_id );
148 $this->bricks_batch->save()->dispatch();
149 }
150 }
151 }
152 }
153