PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.1.2
JetFormBuilder — Dynamic Blocks Form Builder v2.1.2
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 presets 3 years ago request 3 years ago rest-api 3 years ago shortcodes 3 years ago widgets 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
219 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\Manager as BlocksManager;
10 use Jet_Form_Builder\Form_Actions\Form_Actions_Manager;
11 use Jet_Form_Builder\Form_Messages;
12 use Jet_Form_Builder\Form_Patterns\Manager as PatternsManager;
13 use Jet_Form_Builder\Framework\CX_Loader;
14 use Jet_Form_Builder\Gateways\Gateway_Manager;
15 use Jet_Form_Builder\Integrations\Forms_Captcha;
16 use Jet_Form_Builder\Addons\Manager as AddonsManager;
17 use Jet_Form_Builder\Presets\Preset_Manager;
18 use Jet_Form_Builder\Widgets\Elementor_Controller;
19 use Jet_Form_Builder\Wp_Cli\Wp_Cli_Manager;
20 use Jet_Form_Builder\Migrations;
21
22 if ( ! defined( 'WPINC' ) ) {
23 die;
24 }
25
26 /**
27 * @property Post_Type $post_type
28 * @property BlocksManager $blocks
29 * @property ActionsManager $actions
30 * @property Form_Manager $form
31 * @property Form_Handler $form_handler
32 * @property Forms_Captcha $captcha
33 * @property Admin\Editor $editor
34 * @property AddonsManager $addons_manager
35 * @property \Jet_Admin_Bar $admin_bar
36 * @property Form_Messages\Msg_Router $msg_router
37 * Class Plugin
38 * @package Jet_Form_Builder
39 */
40 class Plugin {
41
42 public $post_type;
43 public $blocks;
44 public $actions;
45 public $form;
46 public $form_handler;
47 public $editor;
48 public $captcha;
49 public $allow_gateways;
50 public $framework;
51 public $addons_manager;
52 public $admin_bar;
53 public $msg_router;
54
55 public static $instance;
56
57 /**
58 * Instance.
59 *
60 * Ensures only one instance of the plugin class is loaded or can be loaded.
61 *
62 * @since 1.0.0
63 * @access public
64 * @static
65 */
66 public static function instance() {
67
68 if ( is_null( self::$instance ) ) {
69 self::$instance = new self();
70 }
71
72 return self::$instance;
73 }
74
75 public static function clear() {
76 self::$instance = null;
77 }
78
79 /**
80 * Register autoloader.
81 */
82 private function register_autoloader() {
83 require JET_FORM_BUILDER_PATH . 'includes' . DIRECTORY_SEPARATOR . 'autoloader.php';
84 Autoloader::run();
85 }
86
87 /**
88 * Initialize plugin parts
89 *
90 * @return void
91 */
92 public function init_components() {
93 $this->allow_gateways = apply_filters( 'jet-form-builder/allow-gateways', false );
94 $this->maybe_enable_gateways();
95
96 $this->admin_bar = \Jet_Admin_Bar::get_instance();
97 $this->msg_router = new Form_Messages\Msg_Router();
98 $this->post_type = new Post_Type();
99 $this->blocks = new Blocks\Manager();
100 $this->actions = new Actions\Manager();
101 $this->form = new Form_Manager();
102 $this->form_handler = new Form_Handler();
103 $this->captcha = new Forms_Captcha();
104 $this->addons_manager = new AddonsManager();
105
106 Dev_Mode\Manager::instance();
107 File_Upload::instance();
108 new Elementor_Controller();
109 ( new Migrations\Rest_Api\Controller() )->rest_api_init();
110
111 if ( is_admin() ) {
112 Preset_Manager::instance();
113
114 $this->editor = new Admin\Editor();
115 Pages_Manager::instance()->set_up();
116
117 new Form_Actions_Manager();
118 new PatternsManager();
119 } else {
120 $this->form_handler->call_form();
121 }
122 }
123
124 public function init_framework() {
125 require $this->plugin_dir( 'framework/loader.php' );
126
127 $this->framework = new CX_Loader(
128 array(
129 $this->plugin_dir( 'framework/vue-ui/cherry-x-vue-ui.php' ),
130 $this->plugin_dir( 'framework/admin-bar/jet-admin-bar.php' ),
131 )
132 );
133 }
134
135 public function maybe_enable_gateways() {
136 Tab_Handler_Manager::instance()->tab( 'payments-gateways' )->save_global_options();
137 $gateways = Tab_Handler_Manager::instance()->tab( 'payments-gateways' )->get_global_options();
138
139 if ( isset( $gateways['enable_test_mode'] ) ) {
140 add_filter(
141 'jet-form-builder/gateways/paypal/sandbox-mode',
142 function () use ( $gateways ) {
143 return $gateways['enable_test_mode'];
144 }
145 );
146 }
147
148 if ( isset( $gateways['use_gateways'] ) ) {
149 $this->allow_gateways = $gateways['use_gateways'];
150 }
151
152 Gateway_Manager::instance()->set_up();
153 }
154
155 /**
156 * Loads the translation files.
157 *
158 * @return void
159 * @since 1.0.0
160 * @access public
161 */
162 public function init_lang() {
163 load_plugin_textdomain(
164 'jet-form-builder',
165 false,
166 dirname( plugin_basename( JET_FORM_BUILDER__FILE__ ) ) . '/languages'
167 );
168 }
169
170 /**
171 * Returns url to file or dir inside plugin folder
172 *
173 * @param string $path Path inside plugin dir.
174 *
175 * @return string
176 */
177 public function plugin_url( $path = null ) {
178 return JET_FORM_BUILDER_URL . $path;
179 }
180
181 public function plugin_dir( $path = '' ) {
182 return JET_FORM_BUILDER_PATH . $path;
183 }
184
185 /**
186 * Returns plugin version
187 */
188 public function get_version() {
189 return JET_FORM_BUILDER_VERSION;
190 }
191
192 /**
193 * Plugin constructor.
194 */
195 private function __construct() {
196
197 $this->register_autoloader();
198 $this->init_lang();
199
200 add_action(
201 'after_setup_theme',
202 function () {
203 do_action( 'jet-form-builder/before-init' );
204
205 $this->init_components();
206
207 do_action( 'jet-form-builder/after-init' );
208 },
209 0
210 );
211
212 $this->init_framework();
213 Wp_Cli_Manager::register();
214 }
215
216 }
217
218 Plugin::instance();
219