PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.17.6
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.17.6
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 +272 -285 3.2.22.17.6 View file →
@@ -42,14 +42,14 @@
42 42 submit js
43 43 custom js
44 44 */
45 45 $initSource = '\\BitCode\\BitForm\\Admin\\Form\\InitJs\\';
46 - $files = [
46 + $customSource = '\\BitCode\\BitForm\\Admin\\Form\\ExtraFieldJS\\';
47 + return [
47 48 'helperScript' => [
48 49 ['priority' => 101, 'filename' => 'bfSelect.min.js'],
49 50 ['priority' => 101, 'filename' => 'bfReset.min.js'],
50 51 ['priority' => 101, 'filename' => 'setBFMsg.min.js'],
51 - ['priority' => 101, 'filename' => 'bfSplit.min.js'],
52 52 ['priority' => 101, 'filename' => 'scrollToElm.min.js'],
53 53 ['priority' => 101, 'filename' => 'getFldKeyAndRowIndx.min.js'],
54 54 ['priority' => 101, 'filename' => 'moveToFirstErrFld.min.js'],
55 55 ['priority' => 101, 'filename' => 'bfValidationErrMsg.min.js'],
@@ -56,27 +56,11 @@
56 56 ['priority' => 101, 'filename' => 'setHiddenFld.min.js'],
57 57 ['priority' => 101, 'filename' => 'submit-form.min.js'],
58 58 ['priority' => 101, 'filename' => 'setStyleProperty.min.js']
59 59 ],
60 -
61 - 'text' => [
62 - ['priority' => 301, 'filename' => 'initTextLengthHelper.min.js', 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->maxword', 'valid->minword']],
63 - ],
64 - 'textarea' => [
65 - ['priority' => 301, 'filename' => 'initTextLengthHelper.min.js', 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->maxword', 'valid->minword']],
66 - ],
67 60 'range' => [
68 - ['priority' => 301, 'filename' => 'setSliderFieldValue.min.js', 'path' => 'showValue'],
61 + ['priority' => 301, 'filename' => 'SetSliderFieldValue', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'showValue'],
69 62 ],
70 - 'password' => [
71 - ['priority' => 301, 'filename' => 'initPasswordStrengthHelper.min.js', 'path' => 'valid->validations'],
72 - ['priority' => 301, 'filename' => 'bfTogglePasswordVisibility.min.js', 'path' => 'config->showPasswordIcon'],
73 - ],
74 - 'address' => [
75 - ['priority' => 101, 'filename' => 'observeElm.min.js'],
76 - ['priority' => 301, 'filename' => 'bit-address-field.min.js'],
77 - ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
78 - ],
79 63 'country' => [
80 64 ['priority' => 101, 'filename' => 'observeElm.min.js'],
81 65 ['priority' => 301, 'filename' => 'bit-country-field.min.js'],
82 66 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
@@ -93,8 +77,15 @@
93 77 ['priority' => 301, 'filename' => 'bit-select-field.min.js'],
94 78 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
95 79 ['priority' => 101, 'filename' => 'observeElm.min.js'],
96 80 ],
81 + 'advanced-file-up' => [
82 + ['priority' => 101, 'filename' => 'observeElm.min.js'],
83 + ['priority' => 202, 'filename' => 'bit-filepond.min.js'],
84 + ['priority' => 301, 'filename' => 'bit-advanced-file-up-field.min.js'],
85 + ['priority' => 101, 'filename' => 'advancedFileHandle.min.js'],
86 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
87 + ],
97 88 'file-up' => [
98 89 ['priority' => 301, 'filename' => 'bit-file-up-field.min.js'],
99 90 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
100 91 ],
@@ -101,15 +92,31 @@
101 92 'phone-number' => [
102 93 ['priority' => 101, 'filename' => 'observeElm.min.js'],
103 94 ['priority' => 301, 'filename' => 'bit-phone-number-field.min.js'],
104 95 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
105 - // ['priority' => 101, 'filename' => 'observeElm.min.js'],
96 + ['priority' => 101, 'filename' => 'observeElm.min.js'],
106 97 ],
107 - 'section' => [
108 - ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
98 + 'paypal' => [
99 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
100 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
101 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
102 + ['priority' => 301, 'filename' => 'bit-paypal-field.min.js'],
109 103 ],
104 + 'stripe' => [
105 + ['priority' => 201, 'filename' => 'bitsFetchFront.min.js'],
106 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
107 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
108 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
109 + ['priority' => 301, 'filename' => 'bit-stripe-field.min.js'],
110 + ],
111 + 'mollie' => [
112 + ['priority' => 201, 'filename' => 'bitsFetchFront.min.js'],
113 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
114 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
115 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
116 + ['priority' => 301, 'filename' => 'bit-mollie-field.min.js'],
117 + ],
110 118 'repeater' => [
111 - ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
112 119 ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'],
113 120 ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'],
114 121 ['priority' => 701, 'filename' => 'isRepeaterField.min.js'],
115 122 ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
@@ -115,22 +122,28 @@
115 122 ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
116 123 ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'],
117 124 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
118 125 ],
126 + 'razorpay' => [
127 + ['priority' => 201, 'filename' => 'replaceFieldAndSmartValues.min.js'],
128 + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
129 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
130 + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
131 + ['priority' => 301, 'filename' => 'bit-razorpay-field.min.js'],
132 + ],
133 + 'radio' => [
134 + ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'],
135 + ],
136 + 'check' => [
137 + ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'],
138 + ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'],
139 + ],
140 + 'image-select' => [
141 + ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'],
142 + ],
119 143 'recaptcha' => [
120 144 ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
121 - ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
122 - ['priority' => 303, 'filename' => 'initRecaptchaFld.min.js'],
123 145 ],
124 - 'hcaptcha' => [
125 - ['priority' => 301, 'filename' => 'bit-hcaptcha-field.min.js'],
126 - ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
127 - ['priority' => 303, 'filename' => 'initHCaptchaFld.min.js'],
128 - ],
129 - 'turnstile' => [
130 - ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
131 - ['priority' => 303, 'filename' => 'initTurnstileFld.min.js'],
132 - ],
133 146 'decision-box' => [
134 147 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
135 148 ],
136 149 'gdpr' => [
@@ -135,54 +148,36 @@
135 148 ],
136 149 'gdpr' => [
137 150 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
138 151 ],
152 + 'signature' => [
153 + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
154 + ['priority' => 301, 'filename' => 'bit-signature-field.min.js'],
155 + ],
139 156 'rating' => [
140 157 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
141 158 ['priority' => 301, 'filename' => 'bit-rating-field.min.js'],
142 159 ],
143 - 'date' => [
144 - ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
145 - ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
146 - ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
147 - ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
148 - ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
149 - ],
150 - 'datetime-local' => [
151 - ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
152 - ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
153 - ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
154 - ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
155 - ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
156 - ],
157 - 'time' => [
158 - ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
159 - ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
160 - ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
161 - ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
162 - ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
163 - ],
164 - 'month' => [
165 - ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
166 - ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
167 - ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
168 - ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
169 - ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
170 - ],
171 - 'week' => [
172 - ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
173 - ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
174 - ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
175 - ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
176 - ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
177 - ],
178 160 ];
161 + }
179 162
180 - /**
181 - * Allow add-on plugins (e.g. Pro) to register additional script files
182 - * without shipping those files/paths in the wp.org (free) package.
183 - */
184 - return apply_filters('bitform_script_file_priority_list', $files);
163 + public static function filePondPlugins($plugin)
164 + {
165 + $plugins = [
166 + 'allowFileSizeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-size.min.js'],
167 + 'allowFileTypeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-type.min.js'],
168 + 'allowImageCrop' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-crop.min.js'],
169 + 'allowImagePreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-preview.min.js'],
170 + 'allowImageResize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-resize.min.js'],
171 + 'allowImageTransform' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-transform.min.js'],
172 + 'allowImageValidateSize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-validate-size.min.js'],
173 + 'allowPreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-media-preview.min.js'],
174 + ];
175 + if (array_key_exists($plugin, $plugins)) {
176 + return $plugins[$plugin];
177 + }
178 +
179 + return false;
185 180 }
186 181
187 182 public static function getAllFldConfs()
188 183 {
@@ -193,130 +188,149 @@
193 188 // var is for variable value
194 189 // path is for field path [ for multiple paths]
195 190 // val is for static value
196 191 $configs = [
197 -
198 192 'select' => [
199 - 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
200 - 'fieldKey' => ['var' => 'fieldKey'],
201 - 'options' => ['path' => 'optionsList'],
202 - 'placeholder' => ['path' => 'ph'],
203 - 'classNames' => ['path' => 'customClasses'],
204 - 'attributes' => ['path' => 'customAttributes'],
205 - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
206 - 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
207 - 'multipleSelect' => ['path' => 'config->multipleSelect', 'val' => false],
208 - 'showChip' => ['path' => 'config->showChip', 'val' => false],
209 - 'selectedOptClearable' => ['path' => 'config->selectedOptClearable', 'val' => true],
210 - 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
211 - 'showSearch' => ['path' => 'config->showSearch', 'val' => true],
212 - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
213 - 'activeList' => ['path' => 'config->activeList', 'val' => 0],
193 + 'fieldKey' => ['var' => 'fieldKey'],
194 + 'options' => ['path' => 'optionsList'],
195 + 'placeholder' => ['path' => 'ph'],
196 + 'classNames' => ['path' => 'customClasses'],
197 + 'attributes' => ['path' => 'customAttributes'],
198 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
199 + 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
200 + 'mn' => ['path' => 'mn', 'val' => 0],
201 + 'mx' => ['path' => 'mx', 'val' => 0],
202 + 'disableOnMax' => ['path' => 'valid->disableOnMax', 'val' => false],
214 203 ],
215 - 'address' => [
216 - 'config' => (object) [],
217 - 'fieldKey' => ['var' => 'fieldKey'],
218 - 'contentId' => ['var' => 'contentId'],
219 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/address/'],
220 - 'fieldName' => ['path' => 'fieldName'],
221 - 'classNames' => ['path' => 'customClasses'],
222 - 'attributes' => ['path' => 'customAttributes'],
223 - 'defaultCountry' => ['path' => 'config->defaultCountry', 'val' => ''],
224 - 'zipValidation' => ['path' => 'config->zipValidation', 'val' => 'auto'],
225 - 'zipCustomRegex' => ['path' => 'config->zipCustomRegex', 'val' => ''],
226 -
227 - ],
228 204 'country' => [
229 - 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
230 - 'fieldKey' => ['var' => 'fieldKey'],
231 - 'options' => ['path' => 'options'],
232 - 'placeholder' => ['path' => 'ph'],
233 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
234 - 'classNames' => ['path' => 'customClasses'],
235 - 'attributes' => ['path' => 'customAttributes'],
236 - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
237 - 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
238 - 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
239 - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
205 + 'fieldKey' => ['var' => 'fieldKey'],
206 + 'options' => ['path' => 'options'],
207 + 'placeholder' => ['path' => 'ph'],
208 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
209 + 'classNames' => ['path' => 'customClasses'],
210 + 'attributes' => ['path' => 'customAttributes'],
211 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
240 212 ],
241 213 'currency' => [
242 - 'config' => (object) [], // sentinel: blocks raw fldData.config
243 - 'fieldKey' => ['var' => 'fieldKey'],
244 - 'options' => ['path' => 'options'],
245 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
246 - 'classNames' => ['path' => 'customClasses'],
247 - 'attributes' => ['path' => 'customAttributes'],
248 - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
249 - 'selectedCurrencyClearable' => ['path' => 'config->selectedCurrencyClearable', 'val' => true],
250 - 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
251 - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
214 + 'fieldKey' => ['var' => 'fieldKey'],
215 + 'options' => ['path' => 'options'],
216 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
217 + 'classNames' => ['path' => 'customClasses'],
218 + 'attributes' => ['path' => 'customAttributes'],
219 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
252 220 ],
253 221 'phone-number' => [
254 - 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
255 - 'fieldKey' => ['var' => 'fieldKey'],
256 - 'options' => ['path' => 'options'],
257 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
258 - 'classNames' => ['path' => 'customClasses'],
259 - 'attributes' => ['path' => 'customAttributes'],
260 - 'contentId' => ['var' => 'contentId'],
261 - 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
262 - 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
263 - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
222 + 'fieldKey' => ['var' => 'fieldKey'],
223 + 'options' => ['path' => 'options'],
224 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
225 + 'classNames' => ['path' => 'customClasses'],
226 + 'attributes' => ['path' => 'customAttributes']
264 227 ],
265 228 'file-up' => [
266 - 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
267 - 'fieldKey' => ['var' => 'fieldKey'],
268 - 'formID' => ['var' => 'formId'],
269 - 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']],
270 - 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']],
271 - 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']],
272 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload'],
273 - 'classNames' => ['path' => 'customClasses'],
274 - 'attributes' => ['path' => 'customAttributes'],
275 - 'fieldName' => ['path' => 'fieldName'],
276 - 'contentId' => ['var' => 'contentId'],
277 - 'multiple' => ['path' => 'config->multiple', 'val' => false],
278 - 'allowMaxSize' => ['path' => 'config->allowMaxSize', 'val' => false],
279 - 'maxSize' => ['path' => 'config->maxSize', 'val' => 0],
280 - 'sizeUnit' => ['path' => 'config->sizeUnit', 'val' => 'KB'],
281 - 'isItTotalMax' => ['path' => 'config->isItTotalMax', 'val' => false],
282 - 'allowedFileType' => ['path' => 'config->allowedFileType', 'val' => ''],
283 - 'minFile' => ['path' => 'config->minFile', 'val' => 0],
284 - 'maxFile' => ['path' => 'config->maxFile', 'val' => 0],
285 - 'showSelectStatus' => ['path' => 'config->showSelectStatus', 'val' => false],
286 - 'fileSelectStatus' => ['path' => 'config->fileSelectStatus', 'val' => 'No File Selected'],
287 - 'oldFiles' => ['path' => 'config->oldFiles', 'val' => []],
288 - 'baseDLURL' => ['path' => 'config->baseDLURL', 'val' => ''],
289 - 'fileExistMsg' => ['val' => 'A file already exist'],
290 - 'showFileList' => ['path' => 'config->showFileList', 'val' => false],
291 - 'showFilePreview' => ['path' => 'config->showFilePreview', 'val' => false],
292 - 'showFileSize' => ['path' => 'config->showFileSize', 'val' => false],
293 - 'fileExistMsg' => ['path' => 'config->fileExistMsg', 'val' => 'A file already exist'],
229 + 'fieldKey' => ['var' => 'fieldKey'],
230 + 'formID' => ['var' => 'formId'],
231 + 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']],
232 + 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']],
233 + 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']],
234 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload/'],
235 + 'classNames' => ['path' => 'customClasses'],
236 + 'attributes' => ['path' => 'customAttributes'],
237 + 'fieldName' => ['path' => 'fieldName'],
294 238 ],
239 + 'paypal' => [
240 + 'payIntegID' => ['path' => 'payIntegID'],
241 + 'style' => ['path' => 'style'],
242 + 'currency' => ['path' => 'currency', 'val' => 'USD'],
243 + 'amount' => ['path' => 'amount', 'val' => 0],
244 + 'amountFld' => ['path' => 'amountFld', 'val' => ''],
245 + 'shipping' => ['path' => 'shipping', 'val' => 0],
246 + 'shippingVal' => ['path' => 'shippingFld', 'val' => ''],
247 + 'tax' => ['path' => 'tax', 'val' => 0],
248 + 'taxVal' => ['path' => 'taxFld', 'val' => ''],
249 + 'description' => ['path' => 'description', 'val' => ''],
250 + 'descFld' => ['path' => 'descFld', 'val' => ''],
251 + 'payType' => ['path' => 'payType', 'val' => 'payment'],
252 + 'planId' => ['path' => 'planId', 'val' => ''],
253 + 'locale' => ['path' => 'locale', 'val' => 'en_US'],
254 + 'disableFunding' => ['path' => 'disableFunding', 'val' => ''],
255 + 'fieldKey' => ['var' => 'fieldKey'],
256 + 'clientId' => ['path' => 'clientId'],
257 + 'contentId' => ['var' => 'contentId'],
258 + 'namespace' => ['val' => 'bit-paypal-__$contentId__'],
259 + ],
260 + 'stripe' => [
261 + 'payIntegID' => ['path' => 'payIntegID'],
262 + 'locale' => ['path' => 'config->options->locale', 'val' => 'en'],
263 + 'amountType' => ['path' => 'config->amountType', 'val'=> 'fixed'],
264 + 'fieldKey' => ['var' => 'fieldKey'],
265 + 'contentId' => ['var' => 'contentId'],
266 + 'publishableKey' => ['path' => 'publishableKey'],
267 + ],
268 + 'mollie' => [
269 + 'payIntegID' => ['path' => 'payIntegID'],
270 + 'locale' => ['path' => 'config->locale', 'val' => 'en'],
271 + 'amountType' => ['path' => 'config->amountType', 'val'=> 'fixed'],
272 + 'fieldKey' => ['var' => 'fieldKey'],
273 + 'contentId' => ['var' => 'contentId'],
274 + 'apiKey' => ['path' => 'apiKey'],
275 + 'payment_method' => ['path' => 'config->payment_method', 'val' => ['creditcard']],
276 + 'description' => ['path' => 'config->description', 'val' => ''],
277 + 'amount' => ['path' => 'config->amount', 'val' => 0],
278 + 'currency' => ['path' => 'config->currency', 'val' => 'EUR'],
279 + ],
280 + 'advanced-file-up' => [
281 + 'fieldKey' => ['var' => 'fieldKey'],
282 + 'formID' => ['var' => 'formId'],
283 + 'configSetting' => ['path' => 'config'],
284 + 'ajaxURL' => ['val' => admin_url('admin-ajax.php')],
285 + 'nonce' => ['val' => wp_create_nonce('bitforms_save')],
286 + 'uploadFileToServer' => ['val' => 1],
287 + 'fieldName' => ['path' => 'fieldName'],
288 + 'contentId' => ['var' => 'contentId'],
289 + ],
290 + 'razorpay' => [
291 + 'fieldKey' => ['var' => 'fieldKey'],
292 + 'options' => ['path' => 'options'],
293 + 'payIntegID' => ['path' => 'payIntegID'],
294 + 'payType' => ['path' =>'payType', 'val' => ''],
295 + 'clientId' => ['path' => 'clientId'],
296 + 'contentId' => ['var' => 'contentId'],
297 + 'includeOrderId' => ['path' => 'includeOrderId', 'val' => false],
298 + 'newOrderId' => ['path' => 'newOrderId', 'val' => false],
299 + 'orderIdFld' => ['path' => 'orderIdFld', 'val' => ''],
300 + ],
295 301 'repeater' => [
296 - 'config' => (object) [],
297 - 'fieldKey' => ['var' => 'fieldKey'],
298 - 'fieldName' => ['path' => 'fieldName'],
299 - 'contentId' => ['var' => 'contentId'],
300 - 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
301 - 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
302 - 'defaultValue' => ['path' => 'val', 'val' => ''],
302 + 'fieldKey' => ['var' => 'fieldKey'],
303 + 'fieldName' => ['path' => 'fieldName'],
304 + 'contentId' => ['var' => 'contentId'],
305 + 'defaultRow' => ['path' => 'defaultRow', 'val' => 1],
306 + 'minimumRow' => ['path' => 'minRow', 'val' => 1],
307 + 'maximumRow' => ['path' => 'maxRow', 'val' => 0],
308 + 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
309 + 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
310 + 'defaultValue' => ['path' => 'val', 'val' => ''],
303 311 ],
312 + 'signature' => [
313 + 'fieldKey' => ['var' => 'fieldKey'],
314 + 'contentId' => ['var' => 'contentId'],
315 + 'maxWidth' => ['path' => 'config->maxWidth', 'val' => '1'],
316 + 'penColor' => ['path' => 'config->penColor', 'val'=> '#000000'],
317 + 'backgroundColor' => ['path' => 'config->backgroundColor', 'val' => '#ffffff'],
318 + 'imgTyp' => ['path' => 'config->imgTyp', 'val' => 'image/png'],
319 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/signature/']
320 + ],
304 321 'rating' => [
305 322 'fieldKey' => ['var' => 'fieldKey'],
306 323 'contentId' => ['var' => 'contentId'],
307 324 'options' => ['path' => 'opt'],
325 + 'showReviewLblOnHover' => ['path' => 'showReviewLblOnHover'],
326 + 'showReviewLblOnSelect' => ['path' => 'showReviewLblOnSelect'],
308 327 'selectedRating' => ['path' => 'selectedRating'],
309 328 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
310 - ],
311 - 'hcaptcha'=> [
312 - 'fieldKey' => ['var'=>'fieldKey']
313 - ],
329 + ]
314 330 ];
315 - /**
316 - * Allow add-on plugins to extend field config mappings.
317 - */
318 - return apply_filters('bitform_field_config_paths', $configs);
331 +
332 + return $configs;
319 333 }
320 334
321 335 public static function multiStepFiles()
322 336 {
@@ -346,50 +360,33 @@
346 360 }
347 361
348 362 public static function validationAndOtherScriptFile()
349 363 {
350 - $files = [
351 - 'confirmFldMatch' => ['priority' => 701, 'filename' => 'confirmFldMatch.min.js'],
352 - 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
353 - // 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
354 - // 'bfDatetimeFldValidation' => ['priority' => 702, 'filename' => 'bfDatetimeFldValidation.min.js'],
355 - 'bfParseDateTime' => ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
356 - 'checkMinMaxValue' => ['priority' => 702, 'filename' => 'checkMinMaxValue.min.js'],
357 - 'textLengthValidation' => ['priority' => 702, 'filename' => 'textLengthValidation.min.js'],
358 - 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
359 - 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'],
360 - 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'],
361 - 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'],
362 - 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'],
363 - 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'],
364 - 'currencyFldValidation' => ['priority' => 702, 'filename' => 'currencyFldValidation.min.js'],
365 - 'addressZipFldValidation' => ['priority' => 702, 'filename' => 'addressZipFldValidation.min.js'],
366 - 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'],
367 - // 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'],
368 - // 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation
369 - 'inputMaskValidation' => ['priority' => 701, 'filename' => 'inputMaskValidation.min.js'], // load before generateBackslashPattern file, then load inputMaskValidation
370 - 'bit-input-mask' => ['priority' => 701, 'filename' => 'bit-input-mask.min.js'], // load before generateBackslashPattern file, then load bit-input-mask
371 - 'setBitInputMaskToInput' => ['priority' => 702, 'filename' => 'setBitInputMaskToInput.min.js'], // load before generateBackslashPattern file, then load setBitInputMaskToInput
372 - 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'],
373 - 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'],
374 - 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script
375 - 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script
376 - 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'],
377 - 'bfResetDefaultValue' => ['priority' => 201, 'filename' => 'bfResetDefaultValue.min.js'],
378 - 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
364 + return [
365 + 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
366 + 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
367 + 'checkMinMaxValue' => ['priority' => 702, 'filename' => 'checkMinMaxValue.min.js'],
368 + 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
369 + 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'],
370 + 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'],
371 + 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'],
372 + 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'],
373 + 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'],
374 + 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'],
375 + 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'],
376 + 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation
377 + 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'],
378 + 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'],
379 + 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script
380 + 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script
381 + 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'],
382 + 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
379 383 ];
380 -
381 - /**
382 - * Allow add-on plugins to register additional validation scripts.
383 - */
384 - return apply_filters('bitform_validation_and_other_script_files', $files);
385 384 }
386 385
387 386 public static function validationScriptFileMapping($fieldType)
388 387 {
389 - // Pro filter callbacks type-hint string; never let null/non-string through.
390 - $fieldType = is_string($fieldType) ? $fieldType : '';
391 - $textTypeField = ['text', 'password', 'username', 'color'];
388 + $textTypeField = ['text', 'password', 'username', 'date', 'datetime-local', 'time', 'month', 'week', 'color'];
392 389 if (in_array($fieldType, $textTypeField)) {
393 390 $fieldType = 'text';
394 391 }
395 392 $fields =
@@ -394,69 +391,60 @@
394 391 }
395 392 $fields =
396 393 [
397 394 'text' => [
398 - 'bit-input-mask' => [
399 - 'paths' => ['valid->inputMask'],
400 - ],
401 - 'inputMaskValidation' => [
402 - 'paths' => ['valid->inputMask'],
395 + 'regexPatternValidation' => [
396 + 'paths' => ['valid->regexr'],
403 397 'dependencies' => [
404 - 'generateBackslashPattern',
405 - 'validation',
398 + 'generateBackslashPattern'
406 399 ]
407 - ],
408 - 'setBitInputMaskToInput' => [
409 - 'paths' => ['valid->inputMask'],
400 + ]
401 + ],
402 + 'email' => [
403 + 'emailFldValidation' => [
404 + 'paths' => ['err->invalid->show'],
410 405 'dependencies' => [
411 - 'bit-input-mask'
406 + 'generateBackslashPattern'
412 407 ]
413 408 ],
414 - 'textLengthValidation' => [
415 - 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
416 - ],
417 - 'confirmFldMatch' => [
418 - 'paths' => ['parentFieldKey'],
409 + ],
410 + 'number' => [
411 + 'nmbrFldValidation' => [
412 + 'paths' => ['mn', 'mx']
419 413 ]
420 -
421 414 ],
422 - 'textarea' => [
423 - 'bit-input-mask' => [
424 - 'paths' => ['valid->inputMask'],
425 - ],
426 - 'inputMaskValidation' => [
427 - 'paths' => ['valid->inputMask'],
415 + 'radio' => [
416 + 'customOptionValidation' => [
417 + 'paths' => ['valid->otherOptReq'],
418 + ]
419 + ],
420 + 'check' => [
421 + 'checkMinMaxOptions' => [
422 + 'paths' => ['mn', 'mx'],
428 423 'dependencies' => [
429 - 'generateBackslashPattern',
430 - 'validation',
424 + 'checkFldValidation'
431 425 ]
432 426 ],
433 - 'setBitInputMaskToInput' => [
434 - 'paths' => ['valid->inputMask'],
427 + 'customOptionValidation' => [
428 + 'paths' => ['valid->otherOptReq'],
429 + ]
430 + ],
431 + 'select' => [
432 + 'checkMinMaxOptions' => [
433 + 'paths' => ['mn', 'mx'],
435 434 'dependencies' => [
436 - 'bit-input-mask'
435 + 'checkFldValidation'
437 436 ]
438 437 ],
439 - 'textLengthValidation' => [
440 - 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
441 - ]
442 438 ],
443 - 'email' => [
444 - 'emailFldValidation' => [
445 - 'paths' => ['err->invalid->show'],
439 + 'image-select' => [
440 + 'checkMinMaxOptions' => [
441 + 'paths' => ['mn', 'mx'],
446 442 'dependencies' => [
447 - 'generateBackslashPattern'
443 + 'checkFldValidation'
448 444 ]
449 445 ],
450 - 'confirmFldMatch' => [
451 - 'paths' => ['parentFieldKey'],
452 - ]
453 446 ],
454 - 'number' => [
455 - 'nmbrFldValidation' => [
456 - 'paths' => ['mn', 'mx']
457 - ]
458 - ],
459 447 'range' => [
460 448 'checkMinMaxValue' => [
461 449 'paths' => ['mn', 'mx']
462 450 ]
@@ -461,29 +449,19 @@
461 449 'paths' => ['mn', 'mx']
462 450 ]
463 451 ],
464 452 'url' => [
465 - 'urlFldValidation' => [
466 - 'paths' => ['err->invalid->show'],
453 + 'regexPatternValidation' => [
454 + 'paths' => ['valid->regexr'],
467 455 'dependencies' => [
468 456 'generateBackslashPattern'
469 457 ]
470 458 ],
471 - 'bit-input-mask' => [
472 - 'paths' => ['valid->inputMask'],
473 - ],
474 - 'inputMaskValidation' => [
475 - 'paths' => ['valid->inputMask'],
459 + 'urlFldValidation' => [
460 + 'paths' => ['err->invalid->show'],
476 461 'dependencies' => [
477 - 'generateBackslashPattern',
478 - 'validation',
462 + 'generateBackslashPattern'
479 463 ]
480 - ],
481 - 'setBitInputMaskToInput' => [
482 - 'paths' => ['valid->inputMask'],
483 - 'dependencies' => [
484 - 'bit-input-mask'
485 - ]
486 464 ]
487 465 ],
488 466 'decision-box' => [
489 467 'dcsnbxFldValidation' => [
@@ -499,26 +477,35 @@
499 477 'fileupFldValidation' => [
500 478 'paths' => ['valid->req']
501 479 ]
502 480 ],
481 + 'advanced-file-up' => [
482 + 'advanceFileupFldValidation' => [
483 + 'paths' => ['valid->req']
484 + ]
485 + ],
503 486 'phone-number' => [
504 487 'phoneNumberFldValidation' => [
505 488 'paths' => ['err->invalid->show'],
506 489 ]
507 490 ],
508 - 'address' => [
509 - 'addressZipFldValidation' => [
510 - 'paths' => ['config->zipValidation'],
511 - 'dependencies' => [
512 - 'validation',
513 - ]
514 - ]
515 - ],
516 491 ];
517 - $mapping = isset($fields[$fieldType]) ? $fields[$fieldType] : [];
492 + return isset($fields[$fieldType]) ? $fields[$fieldType] : [];
493 + }
518 494
519 - /**
520 - * Allow pro add-ons to extend/override mapping per field type.
521 - */
522 - return apply_filters('bitform_field_validation_script_file_mapping', $mapping, $fieldType);
495 + public static function formAbandonmentNeededFiles($abandonType = null)
496 + {
497 + $files = [
498 + 'autoSave' => [
499 + ['priority' => 201, 'filename' => 'bit-page-lifecycle.min.js'],
500 + ['priority' => 402, 'filename' => 'autoSavePartial.min.js'],
501 + ]
502 + ];
503 +
504 + $required = [
505 + ['priority' => 402, 'filename' => 'bit-form-abandonment.min.js'],
506 + ['priority' => 401, 'filename' => 'saveFormProgress.min.js'],
507 + ['priority' => 701, 'filename' => 'setFieldValues.min.js'],
508 + ];
509 + return isset($files[$abandonType]) ? array_merge($files[$abandonType], $required) : $required;
523 510 }
524 511 }