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/Core/Migration/MigrationHelper.php +71 -1 2.10.13.3.1 View file →
@@ -74,8 +74,13 @@
74 74
75 75 foreach ($fieldsArray as $fieldKey => $field) {
76 76 // print_r(gettype($field));
77 77 $convertFormate = $conversionFormate->getFormate($field->typ);
78 + // Unknown field type: keep the field as-is instead of fataling the migration
79 + if (empty($convertFormate)) {
80 + $newFieldsArray[$fieldKey] = $field;
81 + continue;
82 + }
78 83 $newFieldProperty = [];
79 84
80 85 // convert unchange property
81 86 foreach ($convertFormate['unchangeProperty'] as $property) {
@@ -195,12 +200,40 @@
195 200 }
196 201 return $newSuccessMessageArr;
197 202 }
198 203
204 + public static function convertWebHooksToIntegrations($formSettingsV1)
205 + {
206 + $webHooks = $formSettingsV1->confirmation->type->webHooks;
207 + $integrations = $formSettingsV1->integrations;
208 + foreach ($webHooks as $webHook) {
209 + $webHook->type = 'Web Hooks';
210 + $webHook->name = $webHook->title;
211 + $integrations[] = $webHook;
212 + }
213 + return $integrations;
214 + }
215 +
216 + public static function duplicateV1StyleFiles()
217 + {
218 + $source = BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles';
219 + $destination = BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles-v1';
220 + if (!file_exists(BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles-v1')) {
221 + wp_mkdir_p(BITFORMS_CONTENT_DIR . DIRECTORY_SEPARATOR . 'form-styles-v1');
222 + }
223 + self::recursiveCopyFiles($source, $destination);
224 + self::recursiveDeleteFiles($source);
225 + }
226 +
227 + public static function getBitformDefaultStyleClass()
228 + {
229 + return self::arrayToCssString(BitformDefaultStyle::commonStyleClasses());
230 + }
231 +
199 232 public static function recursiveDeleteFiles($src)
200 233 {
201 234 if (is_file($src)) {
202 - return unlink($src);
235 + return wp_delete_file($src);
203 236 } elseif (is_dir($src)) {
204 237 $scan = glob(rtrim($src, '/') . '/*');
205 238 foreach ($scan as $path) {
206 239 self::recursiveDeleteFiles($path);
@@ -217,6 +250,43 @@
217 250 foreach ($scan as $path) {
218 251 self::recursiveCopyFiles($path, $dst . '/' . basename($path));
219 252 }
220 253 }
254 + }
255 +
256 + public static function arrayToCssString($array)
257 + {
258 + $cssString = '';
259 +
260 + foreach ($array as $selector => $properties) {
261 + $cssString .= $selector . ' {';
262 +
263 + foreach ($properties as $property => $value) {
264 + $cssString .= $property . ': ' . $value . '; ';
265 + }
266 +
267 + // Remove the trailing space and add closing brace
268 + $cssString = rtrim($cssString, ' ') . '}';
269 + }
270 +
271 + return $cssString;
272 + }
273 +
274 + public static function formatFormData($formData)
275 + {
276 + $newFormData = json_decode(wp_json_encode($formData));
277 +
278 + $formContent = json_decode(wp_json_encode($formData->form_content));
279 +
280 + $newFormData->fields = $formContent->fields;
281 + $newFormData->layout = $formContent->layout;
282 + $newFormData->nestedLayouts = $formContent->nestedLayout;
283 + $newFormData->formInfo = $formContent->formInfo;
284 +
285 + if (is_array($formData->reports) && count($formData->reports) > 0) {
286 + $newFormData->currentReport = $formData->reports[0];
287 + $newFormData->report_id = $formData->reports[0]->id;
288 + }
289 +
290 + return $newFormData;
221 291 }
222 292 }