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/Admin/Form/ScriptFilePriorityManager.php +297 -243 2.10.13.3.1 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 - $customSource = '\\BitCode\\BitForm\\Admin\\Form\\ExtraFieldJS\\';
47 - return [
46 + $files = [
48 47 'helperScript' => [
49 48 ['priority' => 101, 'filename' => 'bfSelect.min.js'],
50 49 ['priority' => 101, 'filename' => 'bfReset.min.js'],
51 50 ['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,8 +56,27 @@
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 + 'range' => [
68 + ['priority' => 301, 'filename' => 'setSliderFieldValue.min.js', 'path' => 'showValue'],
69 + ],
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 + ],
60 79 'country' => [
61 80 ['priority' => 101, 'filename' => 'observeElm.min.js'],
62 81 ['priority' => 301, 'filename' => 'bit-country-field.min.js'],
63 82 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
@@ -74,15 +93,8 @@
74 93 ['priority' => 301, 'filename' => 'bit-select-field.min.js'],
75 94 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
76 95 ['priority' => 101, 'filename' => 'observeElm.min.js'],
77 96 ],
78 - 'advanced-file-up' => [
79 - ['priority' => 101, 'filename' => 'observeElm.min.js'],
80 - ['priority' => 202, 'filename' => 'bit-filepond.min.js'],
81 - ['priority' => 301, 'filename' => 'bit-advanced-file-up-field.min.js'],
82 - ['priority' => 101, 'filename' => 'advancedFileHandle.min.js'],
83 - ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
84 - ],
85 97 'file-up' => [
86 98 ['priority' => 301, 'filename' => 'bit-file-up-field.min.js'],
87 99 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
88 100 ],
@@ -89,80 +101,88 @@
89 101 'phone-number' => [
90 102 ['priority' => 101, 'filename' => 'observeElm.min.js'],
91 103 ['priority' => 301, 'filename' => 'bit-phone-number-field.min.js'],
92 104 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
93 - ['priority' => 101, 'filename' => 'observeElm.min.js'],
105 + // ['priority' => 101, 'filename' => 'observeElm.min.js'],
94 106 ],
95 - 'paypal' => [
96 - ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
97 - ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
98 - ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
99 - ['priority' => 301, 'filename' => 'bit-paypal-field.min.js'],
107 + 'section' => [
108 + ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
100 109 ],
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 110 'repeater' => [
109 - ['priority' => 301, 'filename' => 'bit-repeater-field.min.js'],
111 + ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
112 + ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'],
110 113 ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'],
114 + ['priority' => 701, 'filename' => 'isRepeaterField.min.js'],
111 115 ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
112 116 ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'],
113 117 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
114 118 ],
115 - 'razorpay' => [
116 - ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
117 - ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
118 - ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
119 - ['priority' => 301, 'filename' => 'bit-razorpay-field.min.js'],
119 + 'recaptcha' => [
120 + ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
121 + ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
122 + ['priority' => 303, 'filename' => 'initRecaptchaFld.min.js'],
120 123 ],
121 - 'radio' => [
122 - ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'],
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'],
123 128 ],
124 - 'check' => [
125 - ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'],
126 - ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'],
129 + 'turnstile' => [
130 + ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
131 + ['priority' => 303, 'filename' => 'initTurnstileFld.min.js'],
127 132 ],
128 - 'image-select' => [
129 - ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'],
130 - ],
131 - 'recaptcha' => [
132 - ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
133 - ],
134 133 'decision-box' => [
135 134 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
136 135 ],
137 - 'signature' => [
138 - ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
139 - ['priority' => 301, 'filename' => 'bit-signature-field.min.js'],
136 + 'gdpr' => [
137 + ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
140 138 ],
141 139 'rating' => [
142 140 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
143 141 ['priority' => 301, 'filename' => 'bit-rating-field.min.js'],
144 142 ],
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 + ],
145 178 ];
146 - }
147 179
148 - public static function filePondPlugins($plugin)
149 - {
150 - $plugins = [
151 - 'allowFileSizeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-size.min.js'],
152 - 'allowFileTypeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-type.min.js'],
153 - 'allowImageCrop' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-crop.min.js'],
154 - 'allowImagePreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-preview.min.js'],
155 - 'allowImageResize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-resize.min.js'],
156 - 'allowImageTransform' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-transform.min.js'],
157 - 'allowImageValidateSize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-validate-size.min.js'],
158 - 'allowPreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-media-preview.min.js'],
159 - ];
160 - if (array_key_exists($plugin, $plugins)) {
161 - return $plugins[$plugin];
162 - }
163 -
164 - return false;
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);
165 185 }
166 186
167 187 public static function getAllFldConfs()
168 188 {
@@ -173,134 +193,130 @@
173 193 // var is for variable value
174 194 // path is for field path [ for multiple paths]
175 195 // val is for static value
176 196 $configs = [
197 +
177 198 'select' => [
178 - 'fieldKey' => ['var' => 'fieldKey'],
179 - 'options' => ['path' => 'optionsList'],
180 - 'placeholder' => ['path' => 'ph'],
181 - 'classNames' => ['path' => 'customClasses'],
182 - 'attributes' => ['path' => 'customAttributes'],
183 - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
184 - 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
185 - 'mn' => ['path' => 'mn', 'val' => 0],
186 - 'mx' => ['path' => 'mx', 'val' => 0],
187 - 'disableOnMax' => ['path' => 'valid->disableOnMax', 'val' => false],
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],
188 214 ],
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 + ],
189 228 'country' => [
190 - 'fieldKey' => ['var' => 'fieldKey'],
191 - 'options' => ['path' => 'options'],
192 - 'placeholder' => ['path' => 'ph'],
193 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
194 - 'classNames' => ['path' => 'customClasses'],
195 - 'attributes' => ['path' => 'customAttributes'],
196 - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
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' => ''],
197 240 ],
198 241 'currency' => [
199 - 'fieldKey' => ['var' => 'fieldKey'],
200 - 'options' => ['path' => 'options'],
201 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
202 - 'classNames' => ['path' => 'customClasses'],
203 - 'attributes' => ['path' => 'customAttributes'],
204 - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
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' => ''],
205 252 ],
206 253 'phone-number' => [
207 - 'fieldKey' => ['var' => 'fieldKey'],
208 - 'options' => ['path' => 'options'],
209 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
210 - 'classNames' => ['path' => 'customClasses'],
211 - 'attributes' => ['path' => 'customAttributes']
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' => ''],
212 264 ],
213 265 'file-up' => [
214 - 'fieldKey' => ['var' => 'fieldKey'],
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']],
219 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload/'],
220 - 'classNames' => ['path' => 'customClasses'],
221 - 'attributes' => ['path' => 'customAttributes'],
222 - 'fieldName' => ['path' => 'fieldName'],
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'],
223 294 ],
224 - 'paypal' => [
225 - 'payIntegID' => ['path' => 'payIntegID'],
226 - 'style' => ['path' => 'style'],
227 - 'currency' => ['path' => 'currency', 'val' => 'USD'],
228 - 'amount' => ['path' => 'amount', 'val' => 0],
229 - 'amountFld' => ['path' => 'amountFld', 'val' => ''],
230 - 'shipping' => ['path' => 'shipping', 'val' => 0],
231 - 'shippingVal' => ['path' => 'shippingFld', 'val' => ''],
232 - 'tax' => ['path' => 'tax', 'val' => 0],
233 - 'taxVal' => ['path' => 'taxFld', 'val' => ''],
234 - 'description' => ['path' => 'description', 'val' => ''],
235 - 'descFld' => ['path' => 'descFld', 'val' => ''],
236 - 'payType' => ['path' => 'payType', 'val' => 'payment'],
237 - 'planId' => ['path' => 'planId', 'val' => ''],
238 - 'locale' => ['path' => 'locale', 'val' => 'en_US'],
239 - 'disableFunding' => ['path' => 'disableFunding', 'val' => ''],
240 - 'fieldKey' => ['var' => 'fieldKey'],
241 - 'clientId' => ['path' => 'clientId'],
242 - 'contentId' => ['var' => 'contentId'],
243 - 'namespace' => ['val' => 'bit-paypal-__$contentId__'],
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 - ],
253 - 'advanced-file-up' => [
254 - 'fieldKey' => ['var' => 'fieldKey'],
255 - 'formID' => ['var' => 'formId'],
256 - 'configSetting' => ['path' => 'config'],
257 - 'ajaxURL' => ['val' => admin_url('admin-ajax.php')],
258 - 'nonce' => ['val' => wp_create_nonce('bitforms_save')],
259 - 'uploadFileToServer' => ['val' => 1],
260 - 'fieldName' => ['path' => 'fieldName'],
261 - 'contentId' => ['var' => 'contentId'],
262 - ],
263 - 'razorpay' => [
264 - 'fieldKey' => ['var' => 'fieldKey'],
265 - 'options' => ['path' => 'options'],
266 - 'payIntegID' => ['path' => 'payIntegID'],
267 - 'payType' => ['path' =>'payType', 'val' => ''],
268 - 'clientId' => ['path' => 'clientId'],
269 - 'contentId' => ['var' => 'contentId'],
270 - ],
271 295 'repeater' => [
272 - 'fieldKey' => ['var' => 'fieldKey'],
273 - 'fieldName' => ['path' => 'fieldName'],
274 - 'contentId' => ['var' => 'contentId'],
275 - 'defaultRow' => ['path' => 'defaultRow', 'val' => 1],
276 - 'minimumRow' => ['path' => 'minRow', 'val' => 1],
277 - 'maximumRow' => ['path' => 'maxRow', 'val' => 0],
278 - 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
279 - 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
280 - 'defaultValue' => ['path' => 'val', 'val' => ''],
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' => ''],
281 303 ],
282 - 'signature' => [
283 - 'fieldKey' => ['var' => 'fieldKey'],
284 - 'contentId' => ['var' => 'contentId'],
285 - 'maxWidth' => ['path' => 'config->maxWidth', 'val' => '1'],
286 - 'penColor' => ['path' => 'config->penColor', 'val'=> '#000000'],
287 - 'backgroundColor' => ['path' => 'config->backgroundColor', 'val' => '#ffffff'],
288 - 'imgTyp' => ['path' => 'config->imgTyp', 'val' => 'image/png'],
289 - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/signature/']
290 - ],
291 304 'rating' => [
292 305 'fieldKey' => ['var' => 'fieldKey'],
293 306 'contentId' => ['var' => 'contentId'],
294 307 'options' => ['path' => 'opt'],
295 - 'showReviewLblOnHover' => ['path' => 'showReviewLblOnHover'],
296 - 'showReviewLblOnSelect' => ['path' => 'showReviewLblOnSelect'],
297 308 'selectedRating' => ['path' => 'selectedRating'],
298 309 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
299 - ]
310 + ],
311 + 'hcaptcha'=> [
312 + 'fieldKey' => ['var'=>'fieldKey']
313 + ],
300 314 ];
301 -
302 - return $configs;
315 + /**
316 + * Allow add-on plugins to extend field config mappings.
317 + */
318 + return apply_filters('bitform_field_config_paths', $configs);
303 319 }
304 320
305 321 public static function multiStepFiles()
306 322 {
@@ -330,32 +346,50 @@
330 346 }
331 347
332 348 public static function validationAndOtherScriptFile()
333 349 {
334 - return [
335 - 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
336 - 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
337 - 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
338 - 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'],
339 - 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'],
340 - 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'],
341 - 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'],
342 - 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'],
343 - 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'],
344 - 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'],
345 - 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation
346 - 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'],
347 - 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'],
348 - 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script
349 - 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script
350 - 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'],
351 - 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
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
352 379 ];
380 +
381 + /**
382 + * Allow add-on plugins to register additional validation scripts.
383 + */
384 + return apply_filters('bitform_validation_and_other_script_files', $files);
353 385 }
354 386
355 387 public static function validationScriptFileMapping($fieldType)
356 388 {
357 - $textTypeField = ['text', 'password', 'username', 'date', 'datetime-local', 'time', 'month', 'week', 'color'];
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'];
358 392 if (in_array($fieldType, $textTypeField)) {
359 393 $fieldType = 'text';
360 394 }
361 395 $fields =
@@ -360,15 +394,53 @@
360 394 }
361 395 $fields =
362 396 [
363 397 'text' => [
364 - 'regexPatternValidation' => [
365 - 'paths' => ['valid->regexr'],
398 + 'bit-input-mask' => [
399 + 'paths' => ['valid->inputMask'],
400 + ],
401 + 'inputMaskValidation' => [
402 + 'paths' => ['valid->inputMask'],
366 403 'dependencies' => [
367 - 'generateBackslashPattern'
404 + 'generateBackslashPattern',
405 + 'validation',
368 406 ]
407 + ],
408 + 'setBitInputMaskToInput' => [
409 + 'paths' => ['valid->inputMask'],
410 + 'dependencies' => [
411 + 'bit-input-mask'
412 + ]
413 + ],
414 + 'textLengthValidation' => [
415 + 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
416 + ],
417 + 'confirmFldMatch' => [
418 + 'paths' => ['parentFieldKey'],
369 419 ]
420 +
370 421 ],
422 + 'textarea' => [
423 + 'bit-input-mask' => [
424 + 'paths' => ['valid->inputMask'],
425 + ],
426 + 'inputMaskValidation' => [
427 + 'paths' => ['valid->inputMask'],
428 + 'dependencies' => [
429 + 'generateBackslashPattern',
430 + 'validation',
431 + ]
432 + ],
433 + 'setBitInputMaskToInput' => [
434 + 'paths' => ['valid->inputMask'],
435 + 'dependencies' => [
436 + 'bit-input-mask'
437 + ]
438 + ],
439 + 'textLengthValidation' => [
440 + 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
441 + ]
442 + ],
371 443 'email' => [
372 444 'emailFldValidation' => [
373 445 'paths' => ['err->invalid->show'],
374 446 'dependencies' => [
@@ -374,8 +446,11 @@
374 446 'dependencies' => [
375 447 'generateBackslashPattern'
376 448 ]
377 449 ],
450 + 'confirmFldMatch' => [
451 + 'paths' => ['parentFieldKey'],
452 + ]
378 453 ],
379 454 'number' => [
380 455 'nmbrFldValidation' => [
381 456 'paths' => ['mn', 'mx']
@@ -380,52 +455,35 @@
380 455 'nmbrFldValidation' => [
381 456 'paths' => ['mn', 'mx']
382 457 ]
383 458 ],
384 - 'radio' => [
385 - 'customOptionValidation' => [
386 - 'paths' => ['valid->otherOptReq'],
459 + 'range' => [
460 + 'checkMinMaxValue' => [
461 + 'paths' => ['mn', 'mx']
387 462 ]
388 463 ],
389 - 'check' => [
390 - 'checkMinMaxOptions' => [
391 - 'paths' => ['mn', 'mx'],
464 + 'url' => [
465 + 'urlFldValidation' => [
466 + 'paths' => ['err->invalid->show'],
392 467 'dependencies' => [
393 - 'checkFldValidation'
468 + 'generateBackslashPattern'
394 469 ]
395 470 ],
396 - 'customOptionValidation' => [
397 - 'paths' => ['valid->otherOptReq'],
398 - ]
399 - ],
400 - 'select' => [
401 - 'checkMinMaxOptions' => [
402 - 'paths' => ['mn', 'mx'],
403 - 'dependencies' => [
404 - 'checkFldValidation'
405 - ]
471 + 'bit-input-mask' => [
472 + 'paths' => ['valid->inputMask'],
406 473 ],
407 - ],
408 - 'image-select' => [
409 - 'checkMinMaxOptions' => [
410 - 'paths' => ['mn', 'mx'],
474 + 'inputMaskValidation' => [
475 + 'paths' => ['valid->inputMask'],
411 476 'dependencies' => [
412 - 'checkFldValidation'
477 + 'generateBackslashPattern',
478 + 'validation',
413 479 ]
414 480 ],
415 - ],
416 - 'url' => [
417 - 'regexPatternValidation' => [
418 - 'paths' => ['valid->regexr'],
481 + 'setBitInputMaskToInput' => [
482 + 'paths' => ['valid->inputMask'],
419 483 'dependencies' => [
420 - 'generateBackslashPattern'
484 + 'bit-input-mask'
421 485 ]
422 - ],
423 - 'urlFldValidation' => [
424 - 'paths' => ['err->invalid->show'],
425 - 'dependencies' => [
426 - 'generateBackslashPattern'
427 - ]
428 486 ]
429 487 ],
430 488 'decision-box' => [
431 489 'dcsnbxFldValidation' => [
@@ -431,15 +489,15 @@
431 489 'dcsnbxFldValidation' => [
432 490 'paths' => ['valid->req']
433 491 ]
434 492 ],
435 - 'file-up' => [
436 - 'fileupFldValidation' => [
493 + 'gdpr' => [
494 + 'dcsnbxFldValidation' => [
437 495 'paths' => ['valid->req']
438 496 ]
439 497 ],
440 - 'advanced-file-up' => [
441 - 'advanceFileupFldValidation' => [
498 + 'file-up' => [
499 + 'fileupFldValidation' => [
442 500 'paths' => ['valid->req']
443 501 ]
444 502 ],
445 503 'phone-number' => [
@@ -446,25 +504,21 @@
446 504 'phoneNumberFldValidation' => [
447 505 'paths' => ['err->invalid->show'],
448 506 ]
449 507 ],
508 + 'address' => [
509 + 'addressZipFldValidation' => [
510 + 'paths' => ['config->zipValidation'],
511 + 'dependencies' => [
512 + 'validation',
513 + ]
514 + ]
515 + ],
450 516 ];
451 - return isset($fields[$fieldType]) ? $fields[$fieldType] : [];
452 - }
517 + $mapping = isset($fields[$fieldType]) ? $fields[$fieldType] : [];
453 518
454 - public static function formAbandonmentNeededFiles($abandonType = null)
455 - {
456 - $files = [
457 - 'autoSave' => [
458 - ['priority' => 201, 'filename' => 'bit-page-lifecycle.min.js'],
459 - ['priority' => 402, 'filename' => 'autoSavePartial.min.js'],
460 - ]
461 - ];
462 -
463 - $required = [
464 - ['priority' => 402, 'filename' => 'bit-form-abandonment.min.js'],
465 - ['priority' => 401, 'filename' => 'saveFormProgress.min.js'],
466 - ['priority' => 701, 'filename' => 'setFieldValues.min.js'],
467 - ];
468 - return isset($files[$abandonType]) ? array_merge($files[$abandonType], $required) : $required;
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);
469 523 }
470 524 }