PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.2 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 All 139 releases
← All changes | includes/Admin/Form/ScriptFilePriorityManager.php +306 -242 2.10.0 → V3.3.2 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,92 @@
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'],
110 + // Fills field-value Smart Tags (e.g. ${b1-3}) in HTML elements as the visitor types
111 + 'html' => [
112 + ['priority' => 301, 'filename' => 'bfHtmlFieldValueTags.min.js'],
107 113 ],
108 114 'repeater' => [
109 - ['priority' => 301, 'filename' => 'bit-repeater-field.min.js'],
115 + ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
116 + ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'],
110 117 ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'],
118 + ['priority' => 701, 'filename' => 'isRepeaterField.min.js'],
111 119 ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
112 120 ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'],
113 121 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
114 122 ],
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'],
123 + 'recaptcha' => [
124 + ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
125 + ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
126 + ['priority' => 303, 'filename' => 'initRecaptchaFld.min.js'],
120 127 ],
121 - 'radio' => [
122 - ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'],
128 + 'hcaptcha' => [
129 + ['priority' => 301, 'filename' => 'bit-hcaptcha-field.min.js'],
130 + ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
131 + ['priority' => 303, 'filename' => 'initHCaptchaFld.min.js'],
123 132 ],
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'],
133 + 'turnstile' => [
134 + ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
135 + ['priority' => 303, 'filename' => 'initTurnstileFld.min.js'],
127 136 ],
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 137 'decision-box' => [
135 138 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
136 139 ],
137 - 'signature' => [
138 - ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
139 - ['priority' => 301, 'filename' => 'bit-signature-field.min.js'],
140 + 'gdpr' => [
141 + ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
140 142 ],
141 143 'rating' => [
142 144 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
143 145 ['priority' => 301, 'filename' => 'bit-rating-field.min.js'],
144 146 ],
147 + 'date' => [
148 + ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
149 + ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
150 + ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
151 + ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
152 + ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
153 + ],
154 + 'datetime-local' => [
155 + ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
156 + ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
157 + ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
158 + ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
159 + ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
160 + ],
161 + 'time' => [
162 + ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
163 + ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
164 + ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
165 + ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
166 + ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
167 + ],
168 + 'month' => [
169 + ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
170 + ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
171 + ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
172 + ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
173 + ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
174 + ],
175 + 'week' => [
176 + ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
177 + ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
178 + ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
179 + ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
180 + ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
181 + ],
145 182 ];
146 - }
147 183
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;
184 + /**
185 + * Allow add-on plugins (e.g. Pro) to register additional script files
186 + * without shipping those files/paths in the wp.org (free) package.
187 + */
188 + return apply_filters('bitform_script_file_priority_list', $files);
165 189 }
166 190
167 191 public static function getAllFldConfs()
168 192 {
@@ -173,134 +197,132 @@
173 197 // var is for variable value
174 198 // path is for field path [ for multiple paths]
175 199 // val is for static value
176 200 $configs = [
201 +
177 202 '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],
203 + 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
204 + 'fieldKey' => ['var' => 'fieldKey'],
205 + 'options' => ['path' => 'optionsList'],
206 + 'placeholder' => ['path' => 'ph'],
207 + 'classNames' => ['path' => 'customClasses'],
208 + 'attributes' => ['path' => 'customAttributes'],
209 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
210 + 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
211 + 'multipleSelect' => ['path' => 'config->multipleSelect', 'val' => false],
212 + 'showChip' => ['path' => 'config->showChip', 'val' => false],
213 + 'selectedOptClearable' => ['path' => 'config->selectedOptClearable', 'val' => true],
214 + 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
215 + 'showSearch' => ['path' => 'config->showSearch', 'val' => true],
216 + 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
217 + 'activeList' => ['path' => 'config->activeList', 'val' => 0],
188 218 ],
219 + 'address' => [
220 + 'config' => (object) [],
221 + 'fieldKey' => ['var' => 'fieldKey'],
222 + 'contentId' => ['var' => 'contentId'],
223 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/address/'],
224 + 'fieldName' => ['path' => 'fieldName'],
225 + 'classNames' => ['path' => 'customClasses'],
226 + 'attributes' => ['path' => 'customAttributes'],
227 + 'defaultCountry' => ['path' => 'config->defaultCountry', 'val' => ''],
228 + 'zipValidation' => ['path' => 'config->zipValidation', 'val' => 'auto'],
229 + 'zipCustomRegex' => ['path' => 'config->zipCustomRegex', 'val' => ''],
230 +
231 + ],
189 232 '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'=> ''],
233 + 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
234 + 'fieldKey' => ['var' => 'fieldKey'],
235 + 'options' => ['path' => 'options'],
236 + 'placeholder' => ['path' => 'ph'],
237 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
238 + 'classNames' => ['path' => 'customClasses'],
239 + 'attributes' => ['path' => 'customAttributes'],
240 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
241 + 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
242 + 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
243 + 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
197 244 ],
198 245 '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'=> ''],
246 + 'config' => (object) [], // sentinel: blocks raw fldData.config
247 + 'fieldKey' => ['var' => 'fieldKey'],
248 + 'options' => ['path' => 'options'],
249 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
250 + 'classNames' => ['path' => 'customClasses'],
251 + 'attributes' => ['path' => 'customAttributes'],
252 + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
253 + 'selectedCurrencyClearable' => ['path' => 'config->selectedCurrencyClearable', 'val' => true],
254 + 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
255 + 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
205 256 ],
206 257 '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']
258 + 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
259 + 'fieldKey' => ['var' => 'fieldKey'],
260 + 'options' => ['path' => 'options'],
261 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
262 + 'classNames' => ['path' => 'customClasses'],
263 + 'attributes' => ['path' => 'customAttributes'],
264 + 'contentId' => ['var' => 'contentId'],
265 + 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
266 + 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
267 + 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
268 + // v3 Edit Options saved the default country as config->defaultValue before it wrote defaultCountryKey.
269 + 'defaultCountryKey' => ['path' => ['config->defaultCountryKey', 'config->defaultValue'], 'val' => ''],
212 270 ],
213 271 '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'],
272 + 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
273 + 'fieldKey' => ['var' => 'fieldKey'],
274 + 'formID' => ['var' => 'formId'],
275 + 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']],
276 + 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']],
277 + 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']],
278 + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload'],
279 + 'classNames' => ['path' => 'customClasses'],
280 + 'attributes' => ['path' => 'customAttributes'],
281 + 'fieldName' => ['path' => 'fieldName'],
282 + 'contentId' => ['var' => 'contentId'],
283 + 'multiple' => ['path' => 'config->multiple', 'val' => false],
284 + 'allowMaxSize' => ['path' => 'config->allowMaxSize', 'val' => false],
285 + 'maxSize' => ['path' => 'config->maxSize', 'val' => 0],
286 + 'sizeUnit' => ['path' => 'config->sizeUnit', 'val' => 'KB'],
287 + 'isItTotalMax' => ['path' => 'config->isItTotalMax', 'val' => false],
288 + 'allowedFileType' => ['path' => 'config->allowedFileType', 'val' => ''],
289 + 'minFile' => ['path' => 'config->minFile', 'val' => 0],
290 + 'maxFile' => ['path' => 'config->maxFile', 'val' => 0],
291 + 'showSelectStatus' => ['path' => 'config->showSelectStatus', 'val' => false],
292 + 'fileSelectStatus' => ['path' => 'config->fileSelectStatus', 'val' => 'No File Selected'],
293 + 'oldFiles' => ['path' => 'config->oldFiles', 'val' => []],
294 + 'baseDLURL' => ['path' => 'config->baseDLURL', 'val' => ''],
295 + 'fileExistMsg' => ['val' => 'A file already exist'],
296 + 'showFileList' => ['path' => 'config->showFileList', 'val' => false],
297 + 'showFilePreview' => ['path' => 'config->showFilePreview', 'val' => false],
298 + 'showFileSize' => ['path' => 'config->showFileSize', 'val' => false],
299 + 'fileExistMsg' => ['path' => 'config->fileExistMsg', 'val' => 'A file already exist'],
223 300 ],
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 301 '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' => ''],
302 + 'config' => (object) [],
303 + 'fieldKey' => ['var' => 'fieldKey'],
304 + 'fieldName' => ['path' => 'fieldName'],
305 + 'contentId' => ['var' => 'contentId'],
306 + 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
307 + 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
308 + 'defaultValue' => ['path' => 'val', 'val' => ''],
281 309 ],
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 310 'rating' => [
292 311 'fieldKey' => ['var' => 'fieldKey'],
293 312 'contentId' => ['var' => 'contentId'],
294 313 'options' => ['path' => 'opt'],
295 - 'showReviewLblOnHover' => ['path' => 'showReviewLblOnHover'],
296 - 'showReviewLblOnSelect' => ['path' => 'showReviewLblOnSelect'],
297 314 'selectedRating' => ['path' => 'selectedRating'],
298 315 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
299 - ]
316 + ],
317 + 'hcaptcha'=> [
318 + 'fieldKey' => ['var'=>'fieldKey']
319 + ],
300 320 ];
301 -
302 - return $configs;
321 + /**
322 + * Allow add-on plugins to extend field config mappings.
323 + */
324 + return apply_filters('bitform_field_config_paths', $configs);
303 325 }
304 326
305 327 public static function multiStepFiles()
306 328 {
@@ -330,32 +352,51 @@
330 352 }
331 353
332 354 public static function validationAndOtherScriptFile()
333 355 {
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
356 + $files = [
357 + 'confirmFldMatch' => ['priority' => 701, 'filename' => 'confirmFldMatch.min.js'],
358 + 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
359 + // 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
360 + // 'bfDatetimeFldValidation' => ['priority' => 702, 'filename' => 'bfDatetimeFldValidation.min.js'],
361 + 'bfParseDateTime' => ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
362 + 'checkMinMaxValue' => ['priority' => 702, 'filename' => 'checkMinMaxValue.min.js'],
363 + 'textLengthValidation' => ['priority' => 702, 'filename' => 'textLengthValidation.min.js'],
364 + 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
365 + 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'],
366 + 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'],
367 + 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'],
368 + 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'],
369 + 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'],
370 + 'currencyFldValidation' => ['priority' => 702, 'filename' => 'currencyFldValidation.min.js'],
371 + 'addressZipFldValidation' => ['priority' => 702, 'filename' => 'addressZipFldValidation.min.js'],
372 + 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'],
373 + // 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'],
374 + 'nmbrBadInputValidation' => ['priority' => 702, 'filename' => 'nmbrBadInputValidation.min.js'],
375 + // 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation
376 + 'inputMaskValidation' => ['priority' => 701, 'filename' => 'inputMaskValidation.min.js'], // load before generateBackslashPattern file, then load inputMaskValidation
377 + 'bit-input-mask' => ['priority' => 701, 'filename' => 'bit-input-mask.min.js'], // load before generateBackslashPattern file, then load bit-input-mask
378 + 'setBitInputMaskToInput' => ['priority' => 702, 'filename' => 'setBitInputMaskToInput.min.js'], // load before generateBackslashPattern file, then load setBitInputMaskToInput
379 + 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'],
380 + 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'],
381 + 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script
382 + 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script
383 + 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'],
384 + 'bfResetDefaultValue' => ['priority' => 201, 'filename' => 'bfResetDefaultValue.min.js'],
385 + 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
352 386 ];
387 +
388 + /**
389 + * Allow add-on plugins to register additional validation scripts.
390 + */
391 + return apply_filters('bitform_validation_and_other_script_files', $files);
353 392 }
354 393
355 394 public static function validationScriptFileMapping($fieldType)
356 395 {
357 - $textTypeField = ['text', 'password', 'username', 'date', 'datetime-local', 'time', 'month', 'week', 'color'];
396 + // Pro filter callbacks type-hint string; never let null/non-string through.
397 + $fieldType = is_string($fieldType) ? $fieldType : '';
398 + $textTypeField = ['text', 'password', 'username', 'color'];
358 399 if (in_array($fieldType, $textTypeField)) {
359 400 $fieldType = 'text';
360 401 }
361 402 $fields =
@@ -360,15 +401,53 @@
360 401 }
361 402 $fields =
362 403 [
363 404 'text' => [
364 - 'regexPatternValidation' => [
365 - 'paths' => ['valid->regexr'],
405 + 'bit-input-mask' => [
406 + 'paths' => ['valid->inputMask'],
407 + ],
408 + 'inputMaskValidation' => [
409 + 'paths' => ['valid->inputMask'],
366 410 'dependencies' => [
367 - 'generateBackslashPattern'
411 + 'generateBackslashPattern',
412 + 'validation',
368 413 ]
414 + ],
415 + 'setBitInputMaskToInput' => [
416 + 'paths' => ['valid->inputMask'],
417 + 'dependencies' => [
418 + 'bit-input-mask'
419 + ]
420 + ],
421 + 'textLengthValidation' => [
422 + 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
423 + ],
424 + 'confirmFldMatch' => [
425 + 'paths' => ['parentFieldKey'],
369 426 ]
427 +
370 428 ],
429 + 'textarea' => [
430 + 'bit-input-mask' => [
431 + 'paths' => ['valid->inputMask'],
432 + ],
433 + 'inputMaskValidation' => [
434 + 'paths' => ['valid->inputMask'],
435 + 'dependencies' => [
436 + 'generateBackslashPattern',
437 + 'validation',
438 + ]
439 + ],
440 + 'setBitInputMaskToInput' => [
441 + 'paths' => ['valid->inputMask'],
442 + 'dependencies' => [
443 + 'bit-input-mask'
444 + ]
445 + ],
446 + 'textLengthValidation' => [
447 + 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
448 + ]
449 + ],
371 450 'email' => [
372 451 'emailFldValidation' => [
373 452 'paths' => ['err->invalid->show'],
374 453 'dependencies' => [
@@ -374,58 +453,47 @@
374 453 'dependencies' => [
375 454 'generateBackslashPattern'
376 455 ]
377 456 ],
457 + 'confirmFldMatch' => [
458 + 'paths' => ['parentFieldKey'],
459 + ]
378 460 ],
379 461 'number' => [
380 462 'nmbrFldValidation' => [
381 463 'paths' => ['mn', 'mx']
464 + ],
465 + 'nmbrBadInputValidation' => [
466 + 'paths' => ['err->invalid->show']
382 467 ]
383 468 ],
384 - 'radio' => [
385 - 'customOptionValidation' => [
386 - 'paths' => ['valid->otherOptReq'],
469 + 'range' => [
470 + 'checkMinMaxValue' => [
471 + 'paths' => ['mn', 'mx']
387 472 ]
388 473 ],
389 - 'check' => [
390 - 'checkMinMaxOptions' => [
391 - 'paths' => ['mn', 'mx'],
474 + 'url' => [
475 + 'urlFldValidation' => [
476 + 'paths' => ['err->invalid->show'],
392 477 'dependencies' => [
393 - 'checkFldValidation'
478 + 'generateBackslashPattern'
394 479 ]
395 480 ],
396 - 'customOptionValidation' => [
397 - 'paths' => ['valid->otherOptReq'],
398 - ]
399 - ],
400 - 'select' => [
401 - 'checkMinMaxOptions' => [
402 - 'paths' => ['mn', 'mx'],
403 - 'dependencies' => [
404 - 'checkFldValidation'
405 - ]
481 + 'bit-input-mask' => [
482 + 'paths' => ['valid->inputMask'],
406 483 ],
407 - ],
408 - 'image-select' => [
409 - 'checkMinMaxOptions' => [
410 - 'paths' => ['mn', 'mx'],
484 + 'inputMaskValidation' => [
485 + 'paths' => ['valid->inputMask'],
411 486 'dependencies' => [
412 - 'checkFldValidation'
487 + 'generateBackslashPattern',
488 + 'validation',
413 489 ]
414 490 ],
415 - ],
416 - 'url' => [
417 - 'regexPatternValidation' => [
418 - 'paths' => ['valid->regexr'],
491 + 'setBitInputMaskToInput' => [
492 + 'paths' => ['valid->inputMask'],
419 493 'dependencies' => [
420 - 'generateBackslashPattern'
494 + 'bit-input-mask'
421 495 ]
422 - ],
423 - 'urlFldValidation' => [
424 - 'paths' => ['err->invalid->show'],
425 - 'dependencies' => [
426 - 'generateBackslashPattern'
427 - ]
428 496 ]
429 497 ],
430 498 'decision-box' => [
431 499 'dcsnbxFldValidation' => [
@@ -431,15 +499,15 @@
431 499 'dcsnbxFldValidation' => [
432 500 'paths' => ['valid->req']
433 501 ]
434 502 ],
435 - 'file-up' => [
436 - 'fileupFldValidation' => [
503 + 'gdpr' => [
504 + 'dcsnbxFldValidation' => [
437 505 'paths' => ['valid->req']
438 506 ]
439 507 ],
440 - 'advanced-file-up' => [
441 - 'advanceFileupFldValidation' => [
508 + 'file-up' => [
509 + 'fileupFldValidation' => [
442 510 'paths' => ['valid->req']
443 511 ]
444 512 ],
445 513 'phone-number' => [
@@ -446,25 +514,21 @@
446 514 'phoneNumberFldValidation' => [
447 515 'paths' => ['err->invalid->show'],
448 516 ]
449 517 ],
518 + 'address' => [
519 + 'addressZipFldValidation' => [
520 + 'paths' => ['config->zipValidation'],
521 + 'dependencies' => [
522 + 'validation',
523 + ]
524 + ]
525 + ],
450 526 ];
451 - return isset($fields[$fieldType]) ? $fields[$fieldType] : [];
452 - }
527 + $mapping = isset($fields[$fieldType]) ? $fields[$fieldType] : [];
453 528
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;
529 + /**
530 + * Allow pro add-ons to extend/override mapping per field type.
531 + */
532 + return apply_filters('bitform_field_validation_script_file_mapping', $mapping, $fieldType);
469 533 }
470 534 }