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