PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.15.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.15.3
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/Core/Migration/MigrationHelper.php +66 -1 2.10.02.15.3 View file →
@@ -195,12 +195,40 @@
195 195 }
196 196 return $newSuccessMessageArr;
197 197 }
198 198
199 + public static function convertWebHooksToIntegrations($formSettingsV1)
200 + {
201 + $webHooks = $formSettingsV1->confirmation->type->webHooks;
202 + $integrations = $formSettingsV1->integrations;
203 + foreach ($webHooks as $webHook) {
204 + $webHook->type = 'Web Hooks';
205 + $webHook->name = $webHook->title;
206 + $integrations[] = $webHook;
207 + }
208 + return $integrations;
209 + }
210 +
211 + public static function duplicateV1StyleFiles()
212 + {
213 + $source = BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles';
214 + $destination = BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles-v1';
215 + if (!file_exists(BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles-v1')) {
216 + wp_mkdir_p(BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles-v1');
217 + }
218 + self::recursiveCopyFiles($source, $destination);
219 + self::recursiveDeleteFiles($source);
220 + }
221 +
222 + public static function getBitformDefaultStyleClass()
223 + {
224 + return self::arrayToCssString(BitformDefaultStyle::commonStyleClasses());
225 + }
226 +
199 227 public static function recursiveDeleteFiles($src)
200 228 {
201 229 if (is_file($src)) {
202 - return unlink($src);
230 + return wp_delete_file($src);
203 231 } elseif (is_dir($src)) {
204 232 $scan = glob(rtrim($src, '/') . '/*');
205 233 foreach ($scan as $path) {
206 234 self::recursiveDeleteFiles($path);
@@ -217,6 +245,43 @@
217 245 foreach ($scan as $path) {
218 246 self::recursiveCopyFiles($path, $dst . '/' . basename($path));
219 247 }
220 248 }
249 + }
250 +
251 + public static function arrayToCssString($array)
252 + {
253 + $cssString = '';
254 +
255 + foreach ($array as $selector => $properties) {
256 + $cssString .= $selector . ' {';
257 +
258 + foreach ($properties as $property => $value) {
259 + $cssString .= $property . ': ' . $value . '; ';
260 + }
261 +
262 + // Remove the trailing space and add closing brace
263 + $cssString = rtrim($cssString, ' ') . '}';
264 + }
265 +
266 + return $cssString;
267 + }
268 +
269 + public static function formatFormData($formData)
270 + {
271 + $newFormData = json_decode(wp_json_encode($formData));
272 +
273 + $formContent = json_decode(wp_json_encode($formData->form_content));
274 +
275 + $newFormData->fields = $formContent->fields;
276 + $newFormData->layout = $formContent->layout;
277 + $newFormData->nestedLayouts = $formContent->nestedLayout;
278 + $newFormData->formInfo = $formContent->formInfo;
279 +
280 + if (is_array($formData->reports) && count($formData->reports) > 0) {
281 + $newFormData->currentReport = $formData->reports[0];
282 + $newFormData->report_id = $formData->reports[0]->id;
283 + }
284 +
285 + return $newFormData;
221 286 }
222 287 }