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