PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | includes/Plugin.php +38 -3 2.10.03.3.1 View file →
@@ -1,8 +1,12 @@
1 1 <?php
2 2
3 3 namespace BitCode\BitForm;
4 4
5 +if (!defined('ABSPATH')) {
6 + exit;
7 +}
8 +
5 9 /**
6 10 * Main class for the plugin.
7 11 *
8 12 * @since 1.0.0-alpha
@@ -14,8 +18,9 @@
14 18 use BitCode\BitForm\Core\Hooks\Hooks;
15 19 use BitCode\BitForm\Core\Util\Activation;
16 20 use BitCode\BitForm\Core\Util\Deactivation;
17 21 use BitCode\BitForm\Core\Util\Uninstallation;
22 +use BitCode\BitForm\Widgets\RegisterBitFormElementorWidget;
18 23
19 24 final class Plugin
20 25 {
21 26 /**
@@ -33,8 +38,9 @@
33 38 */
34 39 public function register()
35 40 {
36 41 add_action('plugins_loaded', [$this, 'init_plugin']);
42 + add_action('init', [$this, 'localization_setup']);
37 43 (new Activation())->activate();
38 44 (new Deactivation())->register();
39 45 (new Uninstallation())->register();
40 46 }
@@ -102,9 +108,9 @@
102 108 return;
103 109 }
104 110
105 111 global $bitforms_db_version;
106 - $installed_db_version = get_site_option('bitforms_db_version');
112 + $installed_db_version = get_option('bitforms_db_version');
107 113 if ($installed_db_version !== $bitforms_db_version) {
108 114 DB::migrate();
109 115 }
110 116 }
@@ -117,8 +123,9 @@
117 123 * @return array
118 124 */
119 125 public function init_plugin()
120 126 {
127 + $this->update_tables();
121 128 $currentBitFormVersion = BITFORMS_VERSION;
122 129 $installedBitFormVersion = get_option('bitforms_version');
123 130 if ($currentBitFormVersion !== $installedBitFormVersion) {
124 131 (new FormFallback())->resetJsGeneratedPageIds();
@@ -123,9 +130,9 @@
123 130 if ($currentBitFormVersion !== $installedBitFormVersion) {
124 131 (new FormFallback())->resetJsGeneratedPageIds();
125 132 }
126 133 Hooks::init_hooks();
127 - $this->update_tables();
134 + $this->initWidgets();
128 135 do_action('bitform_loaded');
129 136 }
130 137
131 138 /**
@@ -141,9 +148,9 @@
141 148 }
142 149
143 150 public function plugin_action_links($links)
144 151 {
145 - $links[] = '<a href="https://docs.form.bitapps.pro" target="_blank">' . __('Docs') . '</a>';
152 + $links[] = '<a href="https://bitapps.pro/docs/bit-form/" target="_blank">' . __('Docs', 'bit-form') . '</a>';
146 153
147 154 return $links;
148 155 }
149 156
@@ -162,6 +169,34 @@
162 169
163 170 static::$instance = new static($main_file);
164 171 static::$instance->register();
165 172 return true;
173 + }
174 +
175 + private function initWidgets()
176 + {
177 + if (defined('ELEMENTOR_VERSION')) {
178 + new RegisterBitFormElementorWidget();
179 + }
180 + }
181 +
182 + /**
183 + * Registers the bundled translations directory for the `bit-form` text domain.
184 + */
185 + public function localization_setup()
186 + {
187 + /**
188 + * Filters whether Bit Form loads its bundled translations at all.
189 + *
190 + * Returning false leaves every Free string untranslated — the same filter gates
191 + * the React admin bundle in Admin_Bar. Pro has its own
192 + * `bitformpro_filter_allow_translation`.
193 + *
194 + * @param bool $allow Whether to load translations. Default true.
195 + */
196 + if (!apply_filters('bitform_filter_allow_translation', true)) {
197 + return;
198 + }
199 +
200 + load_plugin_textdomain('bit-form', false, \dirname(BITFORMS_PLUGIN_BASENAME) . '/languages');
166 201 }
167 202 }