PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.7.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.7.0
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 2.10.2 All 137 releases
← All changes | includes/Admin/Form/ScriptFilePriorityManager.php +162 -58 2.02.7.0 View file →
@@ -1,10 +1,12 @@
1 1 <?php
2 2
3 3 namespace BitCode\BitForm\Admin\Form;
4 4
5 -class ScriptFilePriorityManager {
6 - public static function jsFile() {
5 +class ScriptFilePriorityManager
6 +{
7 + public static function jsFile()
8 + {
7 9 /**
8 10 * file load priority
9 11 * first priority status code 100
10 12 * sub status code link 101,102
@@ -46,9 +48,11 @@
46 48 'helperScript' => [
47 49 ['priority' => 101, 'filename' => 'bfSelect.min.js'],
48 50 ['priority' => 101, 'filename' => 'bfReset.min.js'],
49 51 ['priority' => 101, 'filename' => 'setBFMsg.min.js'],
50 - ['priority' => 101, 'filename' => 'scrollToFld.min.js'],
52 + ['priority' => 101, 'filename' => 'scrollToElm.min.js'],
53 + ['priority' => 101, 'filename' => 'getFldKeyAndRowIndx.min.js'],
54 + ['priority' => 101, 'filename' => 'moveToFirstErrFld.min.js'],
51 55 ['priority' => 101, 'filename' => 'bfValidationErrMsg.min.js'],
52 56 ['priority' => 101, 'filename' => 'setHiddenFld.min.js'],
53 57 ['priority' => 101, 'filename' => 'submit-form.min.js'],
54 58 ['priority' => 101, 'filename' => 'setStyleProperty.min.js']
@@ -54,26 +58,21 @@
54 58 ['priority' => 101, 'filename' => 'setStyleProperty.min.js']
55 59 ],
56 60 'country' => [
57 61 ['priority' => 101, 'filename' => 'observeElm.min.js'],
58 - ['priority' => 201, 'filename' => 'bit-virtualized-list.min.js'],
59 62 ['priority' => 301, 'filename' => 'bit-country-field.min.js'],
60 - ['priority' => 501, 'filename' => 'Country', 'scriptTyp' => 'init', 'source' => $initSource],
61 63 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
62 64 ['priority' => 101, 'filename' => 'observeElm.min.js'],
63 65 ],
64 66 'currency' => [
65 67 ['priority' => 101, 'filename' => 'observeElm.min.js'],
66 - ['priority' => 201, 'filename' => 'bit-virtualized-list.min.js'],
67 68 ['priority' => 301, 'filename' => 'bit-currency-field.min.js'],
68 - ['priority' => 501, 'filename' => 'Currency', 'scriptTyp' => 'init', 'source' => $initSource],
69 69 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
70 70 ['priority' => 101, 'filename' => 'observeElm.min.js'],
71 71 ],
72 72 'select' => [
73 73 ['priority' => 101, 'filename' => 'observeElm.min.js'],
74 - ['priority' => 301, 'filename' => 'bit-dropdown-field.min.js'],
75 - ['priority' => 501, 'filename' => 'Select', 'scriptTyp' => 'init', 'source' => $initSource],
74 + ['priority' => 301, 'filename' => 'bit-select-field.min.js'],
76 75 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
77 76 ['priority' => 101, 'filename' => 'observeElm.min.js'],
78 77 ],
79 78 'advanced-file-up' => [
@@ -78,54 +77,77 @@
78 77 ],
79 78 'advanced-file-up' => [
80 79 ['priority' => 101, 'filename' => 'observeElm.min.js'],
81 80 ['priority' => 202, 'filename' => 'bit-filepond.min.js'],
82 - ['priority' => 301, 'filename' => 'bit-advance-file-upload-field.min.js'],
83 - ['priority' => 501, 'filename' => 'AdvancedFileUpload', 'scriptTyp' => 'init', 'source' => $initSource],
81 + ['priority' => 301, 'filename' => 'bit-advanced-file-up-field.min.js'],
84 82 ['priority' => 101, 'filename' => 'advancedFileHandle.min.js'],
85 83 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
86 84 ],
87 85 'file-up' => [
88 86 ['priority' => 301, 'filename' => 'bit-file-up-field.min.js'],
89 - ['priority' => 501, 'filename' => 'FileUpload', 'scriptTyp' => 'init', 'source' => $initSource],
90 87 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
91 88 ],
92 89 'phone-number' => [
93 90 ['priority' => 101, 'filename' => 'observeElm.min.js'],
94 - ['priority' => 201, 'filename' => 'bit-virtualized-list.min.js'],
95 91 ['priority' => 301, 'filename' => 'bit-phone-number-field.min.js'],
96 - ['priority' => 501, 'filename' => 'PhoneNumber', 'scriptTyp' => 'init', 'source' => $initSource],
97 92 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
98 93 ['priority' => 101, 'filename' => 'observeElm.min.js'],
99 94 ],
100 95 'paypal' => [
101 - ['priority' => 101, 'filename' => 'paymentSubmitResponse.min.js'],
96 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
97 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
98 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
102 99 ['priority' => 301, 'filename' => 'bit-paypal-field.min.js'],
103 - ['priority' => 601, 'filename' => 'Paypal', 'scriptTyp' => 'init', 'source' => $initSource],
104 100 ],
101 + 'stripe' => [
102 + ['priority' => 201, 'filename' => 'bitsFetchFront.min.js'],
103 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
104 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
105 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
106 + ['priority' => 301, 'filename' => 'bit-stripe-field.min.js'],
107 + ],
108 + 'repeater' => [
109 + ['priority' => 301, 'filename' => 'bit-repeater-field.min.js'],
110 + ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'],
111 + ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
112 + ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'],
113 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
114 + ],
105 115 'razorpay' => [
106 - ['priority' => 101, 'filename' => 'paymentSubmitResponse.min.js'],
116 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
117 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
118 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
107 119 ['priority' => 301, 'filename' => 'bit-razorpay-field.min.js'],
108 - ['priority' => 601, 'filename' => 'Razorpay', 'scriptTyp' => 'init', 'source' => $initSource],
109 120 ],
110 121 'radio' => [
111 - ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource],
122 + ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'],
112 123 ],
113 124 'check' => [
114 - ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource],
115 - ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource],
125 + ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'],
126 + ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'],
116 127 ],
128 + 'image-select' => [
129 + ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'],
130 + ],
117 131 'recaptcha' => [
118 132 ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
119 - ['priority' => 601, 'filename' => 'Recaptcha', 'scriptTyp' => 'init', 'source' => $initSource],
120 133 ],
121 134 'decision-box' => [
122 135 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
123 - ]
136 + ],
137 + 'signature' => [
138 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
139 + ['priority' => 301, 'filename' => 'bit-signature-field.min.js'],
140 + ],
141 + 'rating' => [
142 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
143 + ['priority' => 301, 'filename' => 'bit-rating-field.min.js'],
144 + ],
124 145 ];
125 146 }
126 147
127 - public static function filePondPlugins($plugin) {
148 + public static function filePondPlugins($plugin)
149 + {
128 150 $plugins = [
129 151 'allowFileSizeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-size.min.js'],
130 152 'allowFileTypeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-type.min.js'],
131 153 'allowImageCrop' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-crop.min.js'],
@@ -141,12 +163,16 @@
141 163
142 164 return false;
143 165 }
144 166
145 - public static function fieldMissingConfigsProps($fieldType, $field) {
167 + public static function getAllFldConfs()
168 + {
169 + // $contentId = $fieldData['contentId'];
170 + // $fieldKey = $fieldData['fk'];
171 + // $field = $fieldData['field'];
146 172 // key is config path, value is field path
147 173 // var is for variable value
148 - // path is for field path
174 + // path is for field path [ for multiple paths]
149 175 // val is for static value
150 176 $configs = [
151 177 'select' => [
152 178 'fieldKey' => ['var' => 'fieldKey'],
@@ -153,9 +179,9 @@
153 179 'options' => ['path' => 'optionsList'],
154 180 'placeholder' => ['path' => 'ph'],
155 181 'classNames' => ['path' => 'customClasses'],
156 182 'attributes' => ['path' => 'customAttributes'],
157 - 'defaultValue' => ['path' => 'val', 'val' => isset($field->config->defaultValue) ? $field->config->defaultValue : ''],
183 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
158 184 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
159 185 'mn' => ['path' => 'mn', 'val' => 0],
160 186 'mx' => ['path' => 'mx', 'val' => 0],
161 187 'disableOnMax' => ['path' => 'valid->disableOnMax', 'val' => false],
@@ -166,9 +192,9 @@
166 192 'placeholder' => ['path' => 'ph'],
167 193 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
168 194 'classNames' => ['path' => 'customClasses'],
169 195 'attributes' => ['path' => 'customAttributes'],
170 - 'defaultValue' => ['path' => 'val', 'val' => isset($field->config->defaultValue) ? $field->config->defaultValue : ''],
196 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
171 197 ],
172 198 'currency' => [
173 199 'fieldKey' => ['var' => 'fieldKey'],
174 200 'options' => ['path' => 'options'],
@@ -174,9 +200,9 @@
174 200 'options' => ['path' => 'options'],
175 201 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
176 202 'classNames' => ['path' => 'customClasses'],
177 203 'attributes' => ['path' => 'customAttributes'],
178 - 'defaultValue' => ['path' => 'val', 'val' => isset($field->config->defaultValue) ? $field->config->defaultValue : ''],
204 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
179 205 ],
180 206 'phone-number' => [
181 207 'fieldKey' => ['var' => 'fieldKey'],
182 208 'options' => ['path' => 'options'],
@@ -185,14 +211,16 @@
185 211 'attributes' => ['path' => 'customAttributes']
186 212 ],
187 213 'file-up' => [
188 214 'fieldKey' => ['var' => 'fieldKey'],
189 - 'maxSizeErrMsg' => ['path' => isset($field->err->maxSize->msg) ? 'err->maxSize->msg' : 'err->maxSize->dflt'],
190 - 'minFileErrMsg' => ['path' => isset($field->err->minFile->msg) ? 'err->minFile->msg' : 'err->minFile->dflt'],
191 - 'maxFileErrMsg' => ['path' => isset($field->err->maxFile->msg) ? 'err->maxFile->msg' : 'err->maxFile->dflt'],
215 + 'formID' => ['var' => 'formId'],
216 + 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']],
217 + 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']],
218 + 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']],
192 219 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload/'],
193 220 'classNames' => ['path' => 'customClasses'],
194 - 'attributes' => ['path' => 'customAttributes']
221 + 'attributes' => ['path' => 'customAttributes'],
222 + 'fieldName' => ['path' => 'fieldName'],
195 223 ],
196 224 'paypal' => [
197 225 'payIntegID' => ['path' => 'payIntegID'],
198 226 'style' => ['path' => 'style'],
@@ -208,36 +236,92 @@
208 236 'payType' => ['path' => 'payType', 'val' => 'payment'],
209 237 'planId' => ['path' => 'planId', 'val' => ''],
210 238 'locale' => ['path' => 'locale', 'val' => 'en_US'],
211 239 'disableFunding' => ['path' => 'disableFunding', 'val' => ''],
240 + 'fieldKey' => ['var' => 'fieldKey'],
241 + 'clientId' => ['path' => 'clientId'],
242 + 'contentId' => ['var' => 'contentId'],
243 + 'namespace' => ['val' => 'bit-paypal-__$contentId__'],
212 244 ],
245 + 'stripe' => [
246 + 'payIntegID' => ['path' => 'payIntegID'],
247 + 'locale' => ['path' => 'config->options->locale', 'val' => 'en'],
248 + 'amountType' => ['path' => 'config->amountType', 'val'=> 'fixed'],
249 + 'fieldKey' => ['var' => 'fieldKey'],
250 + 'contentId' => ['var' => 'contentId'],
251 + 'publishableKey' => ['path' => 'publishableKey'],
252 + ],
213 253 'advanced-file-up' => [
214 254 'fieldKey' => ['var' => 'fieldKey'],
215 - 'formID' => ['var' => 'formID'],
255 + 'formID' => ['var' => 'formId'],
216 256 'configSetting' => ['path' => 'config'],
217 257 'ajaxURL' => ['val' => admin_url('admin-ajax.php')],
218 258 'nonce' => ['val' => wp_create_nonce('bitforms_save')],
219 259 'uploadFileToServer' => ['val' => 1],
260 + 'fieldName' => ['path' => 'fieldName'],
220 261 ],
221 262 'razorpay' => [
222 - 'fieldKey' => ['var' => 'fieldKey'],
223 - 'options' => ['path' => 'options'],
224 - 'payIntegID' => ['path' => 'payIntegID'],
225 - 'payType' => ['path' =>'payType', 'val' => ''],
263 + 'fieldKey' => ['var' => 'fieldKey'],
264 + 'options' => ['path' => 'options'],
265 + 'payIntegID' => ['path' => 'payIntegID'],
266 + 'payType' => ['path' =>'payType', 'val' => ''],
267 + 'clientId' => ['path' => 'clientId'],
268 + 'contentId' => ['var' => 'contentId'],
226 269 ],
270 + 'repeater' => [
271 + 'fieldKey' => ['var' => 'fieldKey'],
272 + 'fieldName' => ['path' => 'fieldName'],
273 + 'contentId' => ['var' => 'contentId'],
274 + 'defaultRow' => ['path' => 'defaultRow', 'val' => 1],
275 + 'minimumRow' => ['path' => 'minRow', 'val' => 1],
276 + 'maximumRow' => ['path' => 'maxRow', 'val' => 0],
277 + 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
278 + 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
279 + 'defaultValue' => ['path' => 'val', 'val' => ''],
280 + ],
281 + 'signature' => [
282 + 'fieldKey' => ['var' => 'fieldKey'],
283 + 'contentId' => ['var' => 'contentId'],
284 + 'maxWidth' => ['path' => 'config->maxWidth', 'val' => '1'],
285 + 'penColor' => ['path' => 'config->penColor', 'val'=> '#000000'],
286 + 'backgroundColor' => ['path' => 'config->backgroundColor', 'val' => '#ffffff'],
287 + 'imgTyp' => ['path' => 'config->imgTyp', 'val' => 'image/png'],
288 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/signature/']
289 + ],
290 + 'rating' => [
291 + 'fieldKey' => ['var' => 'fieldKey'],
292 + 'contentId' => ['var' => 'contentId'],
293 + 'options' => ['path' => 'opt'],
294 + 'showReviewLblOnHover' => ['path' => 'showReviewLblOnHover'],
295 + 'showReviewLblOnSelect' => ['path' => 'showReviewLblOnSelect'],
296 + 'selectedRating' => ['path' => 'selectedRating'],
297 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
298 + ]
227 299 ];
228 300
229 - return isset($configs[$fieldType]) ? $configs[$fieldType] : [];
301 + return $configs;
230 302 }
231 303
232 - public static function frontendScriptFile() {
304 + public static function multiStepFiles()
305 + {
233 306 return [
307 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
308 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
309 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
310 + ['priority' => 700, 'filename' => 'bit-multi-step-form.min.js'],
311 + ];
312 + }
313 +
314 + public static function frontendScriptFile()
315 + {
316 + return [
234 317 'observeElm' => ['priority' => 101, 'filename' => 'observeElm.min.js'],
235 318 'hidden-token-field' => ['priority' => 300, 'filename' => 'hidden-token-field.min.js'],
236 319 ];
237 320 }
238 321
239 - public static function validationScriptFile() {
322 + public static function validationScriptFile()
323 + {
240 324 return [
241 325 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
242 326 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
243 327 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
@@ -256,25 +340,11 @@
256 340 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
257 341 ];
258 342 }
259 343
260 - public static function validationCommonFunction() {
261 - $commonFunctions = [
262 - 'requiredFldValidation' => [
263 - 'fields' => ['text', 'email'] // string { all} or array {field name} of field types
264 - ],
265 - 'commonFuncion2' => [
266 - 'notFields' => ['text', 'email'],
267 - 'dependencies' => ['someDependsOnThisField'],
268 - 'paths' => ['path1', 'path2'],
269 - ],
270 - ];
271 -
272 - return $commonFunctions;
273 - }
274 -
275 - public static function validationScriptFileMapping($fieldType) {
276 - $textTypeField = ['text', 'password', 'username', 'url', 'date', 'datetime-local', 'time', 'month', 'week', 'color'];
344 + public static function validationScriptFileMapping($fieldType)
345 + {
346 + $textTypeField = ['text', 'password', 'username', 'date', 'datetime-local', 'time', 'month', 'week', 'color'];
277 347 if (in_array($fieldType, $textTypeField)) {
278 348 $fieldType = 'text';
279 349 }
280 350 $fields =
@@ -323,9 +393,23 @@
323 393 'checkFldValidation'
324 394 ]
325 395 ],
326 396 ],
397 + 'image-select' => [
398 + 'checkMinMaxOptions' => [
399 + 'paths' => ['mn', 'mx'],
400 + 'dependencies' => [
401 + 'checkFldValidation'
402 + ]
403 + ],
404 + ],
327 405 'url' => [
406 + 'regexPatternValidation' => [
407 + 'paths' => ['valid->regexr'],
408 + 'dependencies' => [
409 + 'generateBackslashPattern'
410 + ]
411 + ],
328 412 'urlFldValidation' => [
329 413 'paths' => ['err->invalid->show'],
330 414 'dependencies' => [
331 415 'generateBackslashPattern'
@@ -353,6 +437,26 @@
353 437 ]
354 438 ],
355 439 ];
356 440 return isset($fields[$fieldType]) ? $fields[$fieldType] : [];
441 + }
442 +
443 + public static function formAbandonmentNeededFiles($abandonType = null)
444 + {
445 + $files = [
446 + 'draftButton' => [
447 + ['priority' => 401, 'filename' => 'saveDraftButtonEvent.js']
448 + ],
449 + 'autoSave' => [
450 + ['priority' => 201, 'filename' => 'bit-page-lifecycle.min.js'],
451 + ['priority' => 402, 'filename' => 'autoSavePartial.min.js'],
452 + ]
453 + ];
454 +
455 + $required = [
456 + ['priority' => 402, 'filename' => 'bit-form-abandonment.min.js'],
457 + ['priority' => 401, 'filename' => 'saveFormProgress.min.js'],
458 + ['priority' => 701, 'filename' => 'setFieldValues.min.js'],
459 + ];
460 + return isset($files[$abandonType]) ? array_merge($files[$abandonType], $required) : $required;
357 461 }
358 462 }