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