PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.0.1.1
JetFormBuilder — Dynamic Blocks Form Builder v3.0.1.1
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / plugin.php
jetformbuilder / includes Last commit date
actions 3 years ago addons 3 years ago admin 3 years ago blocks 3 years ago classes 3 years ago compatibility 3 years ago db-queries 3 years ago dev-mode 3 years ago exceptions 3 years ago form-actions 3 years ago form-messages 3 years ago form-patterns 3 years ago form-response 3 years ago gateways 3 years ago generators 3 years ago integrations 3 years ago migrations 3 years ago post-meta 3 years ago presets 3 years ago request 3 years ago rest-api 3 years ago shortcodes 3 years ago wp-cli 3 years ago autoloader.php 3 years ago file-upload.php 3 years ago form-break.php 3 years ago form-handler.php 3 years ago form-manager.php 3 years ago live-form.php 3 years ago plugin.php 3 years ago post-type.php 3 years ago
plugin.php
257 lines
1 <?php
2
3 namespace Jet_Form_Builder;
4
5 // If this file is called directly, abort.
6 use Jet_Form_Builder\Actions\Manager as ActionsManager;
7 use Jet_Form_Builder\Admin\Pages\Pages_Manager;
8 use Jet_Form_Builder\Admin\Tabs_Handlers\Tab_Handler_Manager;
9 use Jet_Form_Builder\Blocks\Conditional_Block\Render_State;
10 use Jet_Form_Builder\Blocks\Dynamic_Value;
11 use Jet_Form_Builder\Blocks\Manager as BlocksManager;
12 use Jet_Form_Builder\Blocks\Switch_Page_On_Change;
13 use Jet_Form_Builder\Blocks\Validation;
14 use Jet_Form_Builder\Classes\Tools;
15 use Jet_Form_Builder\Compatibility\Deprecated;
16 use Jet_Form_Builder\Compatibility\Elementor\Elementor;
17 use Jet_Form_Builder\Compatibility\Jet_Appointment\Jet_Appointment;
18 use Jet_Form_Builder\Compatibility\Jet_Booking\Jet_Booking;
19 use Jet_Form_Builder\Compatibility\Jet_Engine\Jet_Engine;
20 use Jet_Form_Builder\Compatibility\Woocommerce\Woocommerce;
21 use Jet_Form_Builder\Form_Actions\Form_Actions_Manager;
22 use Jet_Form_Builder\Form_Messages;
23 use Jet_Form_Builder\Form_Patterns\Manager as PatternsManager;
24 use Jet_Form_Builder\Framework\CX_Loader;
25 use Jet_Form_Builder\Gateways\Gateway_Manager;
26 use Jet_Form_Builder\Integrations\Active_Campaign\Active_Campaign;
27 use Jet_Form_Builder\Integrations\Forms_Captcha;
28 use Jet_Form_Builder\Addons\Manager as AddonsManager;
29 use Jet_Form_Builder\Presets\Preset_Manager;
30 use Jet_Form_Builder\Wp_Cli\Wp_Cli_Manager;
31 use Jet_Form_Builder\Migrations;
32
33 if ( ! defined( 'WPINC' ) ) {
34 die;
35 }
36
37 /**
38 * @property Post_Type $post_type
39 * @property BlocksManager $blocks
40 * @property ActionsManager $actions
41 * @property Form_Manager $form
42 * @property Form_Handler $form_handler
43 * @property Forms_Captcha $captcha
44 * @property Admin\Editor $editor
45 * @property AddonsManager $addons_manager
46 * @property \Jet_Admin_Bar $admin_bar
47 * @property Form_Messages\Msg_Router $msg_router
48 * Class Plugin
49 * @package Jet_Form_Builder
50 */
51 class Plugin {
52
53 public $post_type;
54 public $blocks;
55 public $actions;
56 public $form;
57 public $form_handler;
58 public $editor;
59 public $captcha;
60 public $allow_gateways;
61 public $framework;
62 public $addons_manager;
63 public $admin_bar;
64 public $msg_router;
65
66 private $suffix;
67
68 public static $instance;
69
70 /**
71 * Instance.
72 *
73 * Ensures only one instance of the plugin class is loaded or can be loaded.
74 *
75 * @since 1.0.0
76 * @access public
77 * @static
78 */
79 public static function instance() {
80
81 if ( is_null( self::$instance ) ) {
82 self::$instance = new self();
83 }
84
85 return self::$instance;
86 }
87
88 public static function clear() {
89 self::$instance = null;
90 }
91
92 /**
93 * Register autoloader.
94 */
95 private function register_autoloader() {
96 require JET_FORM_BUILDER_PATH . 'includes' . DIRECTORY_SEPARATOR . 'autoloader.php';
97 Autoloader::run();
98 }
99
100 /**
101 * Initialize plugin parts
102 *
103 * @return void
104 */
105 public function init_components() {
106 $this->allow_gateways = apply_filters( 'jet-form-builder/allow-gateways', false );
107 $this->maybe_enable_gateways();
108
109 /**
110 * Compatibility & Integrations
111 */
112 Woocommerce::register();
113 Jet_Engine::register();
114 Active_Campaign::register();
115 Elementor::register();
116 Jet_Appointment::register();
117 Jet_Booking::register();
118 new Deprecated();
119
120 $this->admin_bar = \Jet_Admin_Bar::get_instance();
121 $this->msg_router = new Form_Messages\Msg_Router();
122 $this->post_type = new Post_Type();
123 $this->blocks = new Blocks\Manager();
124 $this->actions = new Actions\Manager();
125 $this->form = new Form_Manager();
126 $this->form_handler = new Form_Handler();
127 $this->captcha = new Forms_Captcha();
128 $this->addons_manager = new AddonsManager();
129
130 /**
131 * Modules & components
132 */
133 Dev_Mode\Manager::instance();
134 File_Upload::instance();
135 Validation::instance();
136 Render_State::instance();
137 new Dynamic_Value();
138 new Switch_Page_On_Change();
139
140 /**
141 * REST API
142 */
143 ( new Migrations\Rest_Api\Controller() )->rest_api_init();
144 ( new Blocks\Conditional_Block\Rest_Api\Rest_Api_Controller() )->rest_api_init();
145 ( new Blocks\Ssr_Validation\Rest_Controller() )->rest_api_init();
146
147 if ( is_admin() ) {
148 Preset_Manager::instance();
149
150 $this->editor = new Admin\Editor();
151 Pages_Manager::instance()->set_up();
152
153 new Form_Actions_Manager();
154 new PatternsManager();
155 } else {
156 $this->form_handler->call_form();
157 }
158 }
159
160 public function init_framework() {
161 require $this->plugin_dir( 'framework/loader.php' );
162
163 $this->framework = new CX_Loader(
164 array(
165 $this->plugin_dir( 'framework/vue-ui/cherry-x-vue-ui.php' ),
166 $this->plugin_dir( 'framework/admin-bar/jet-admin-bar.php' ),
167 )
168 );
169 }
170
171 public function maybe_enable_gateways() {
172 Tab_Handler_Manager::instance()->tab( 'payments-gateways' )->save_global_options();
173 $gateways = Tab_Handler_Manager::instance()->tab( 'payments-gateways' )->get_global_options();
174
175 if ( isset( $gateways['enable_test_mode'] ) ) {
176 add_filter(
177 'jet-form-builder/gateways/paypal/sandbox-mode',
178 function () use ( $gateways ) {
179 return $gateways['enable_test_mode'];
180 }
181 );
182 }
183
184 if ( isset( $gateways['use_gateways'] ) ) {
185 $this->allow_gateways = $gateways['use_gateways'];
186 }
187
188 Gateway_Manager::instance()->set_up();
189 }
190
191 /**
192 * Loads the translation files.
193 *
194 * @return void
195 * @since 1.0.0
196 * @access public
197 */
198 public function init_lang() {
199 load_plugin_textdomain(
200 'jet-form-builder',
201 false,
202 dirname( plugin_basename( JET_FORM_BUILDER__FILE__ ) ) . '/languages'
203 );
204 }
205
206 /**
207 * Returns url to file or dir inside plugin folder
208 *
209 * @param string $path Path inside plugin dir.
210 *
211 * @return string
212 */
213 public function plugin_url( string $path = '' ): string {
214 $path = str_replace( '{min}', Tools::get_suffix(), $path );
215
216 return JET_FORM_BUILDER_URL . $path;
217 }
218
219 public function plugin_dir( string $path = '' ): string {
220 return JET_FORM_BUILDER_PATH . $path;
221 }
222
223 /**
224 * Returns plugin version
225 */
226 public function get_version(): string {
227 return JET_FORM_BUILDER_VERSION;
228 }
229
230 /**
231 * Plugin constructor.
232 */
233 private function __construct() {
234
235 $this->register_autoloader();
236 $this->init_lang();
237
238 add_action(
239 'after_setup_theme',
240 function () {
241 do_action( 'jet-form-builder/before-init' );
242
243 $this->init_components();
244
245 do_action( 'jet-form-builder/after-init' );
246 },
247 0
248 );
249
250 $this->init_framework();
251 Wp_Cli_Manager::register();
252 }
253
254 }
255
256 Plugin::instance();
257