← All changes
|
includes/Admin/Form/ScriptFilePriorityManager.php
+43
-1
-3.0.1
→
V3.3.2
View file →
| @@ -70,8 +70,13 @@ | ||
| 70 | 70 | 'password' => [ |
| 71 | 71 | ['priority' => 301, 'filename' => 'initPasswordStrengthHelper.min.js', 'path' => 'valid->validations'], |
| 72 | 72 | ['priority' => 301, 'filename' => 'bfTogglePasswordVisibility.min.js', 'path' => 'config->showPasswordIcon'], |
| 73 | 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 | + ], | |
| 74 | 79 | 'country' => [ |
| 75 | 80 | ['priority' => 101, 'filename' => 'observeElm.min.js'], |
| 76 | 81 | ['priority' => 301, 'filename' => 'bit-country-field.min.js'], |
| 77 | 82 | ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], |
| @@ -101,8 +106,12 @@ | ||
| 101 | 106 | ], |
| 102 | 107 | 'section' => [ |
| 103 | 108 | ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'], |
| 104 | 109 | ], |
| 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'], | |
| 113 | + ], | |
| 105 | 114 | 'repeater' => [ |
| 106 | 115 | ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'], |
| 107 | 116 | ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'], |
| 108 | 117 | ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'], |
| @@ -202,11 +211,25 @@ | ||
| 202 | 211 | 'multipleSelect' => ['path' => 'config->multipleSelect', 'val' => false], |
| 203 | 212 | 'showChip' => ['path' => 'config->showChip', 'val' => false], |
| 204 | 213 | 'selectedOptClearable' => ['path' => 'config->selectedOptClearable', 'val' => true], |
| 205 | 214 | 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true], |
| 215 | + 'showSearch' => ['path' => 'config->showSearch', 'val' => true], | |
| 206 | 216 | 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''], |
| 207 | 217 | 'activeList' => ['path' => 'config->activeList', 'val' => 0], |
| 208 | 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 | + ], | |
| 209 | 232 | 'country' => [ |
| 210 | 233 | 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough; |
| 211 | 234 | 'fieldKey' => ['var' => 'fieldKey'], |
| 212 | 235 | 'options' => ['path' => 'options'], |
| @@ -241,8 +264,10 @@ | ||
| 241 | 264 | 'contentId' => ['var' => 'contentId'], |
| 242 | 265 | 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true], |
| 243 | 266 | 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true], |
| 244 | 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' => ''], | |
| 245 | 270 | ], |
| 246 | 271 | 'file-up' => [ |
| 247 | 272 | 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough; |
| 248 | 273 | 'fieldKey' => ['var' => 'fieldKey'], |
| @@ -249,9 +274,9 @@ | ||
| 249 | 274 | 'formID' => ['var' => 'formId'], |
| 250 | 275 | 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']], |
| 251 | 276 | 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']], |
| 252 | 277 | 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']], |
| 253 | - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload/'], | |
| 278 | + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload'], | |
| 254 | 279 | 'classNames' => ['path' => 'customClasses'], |
| 255 | 280 | 'attributes' => ['path' => 'customAttributes'], |
| 256 | 281 | 'fieldName' => ['path' => 'fieldName'], |
| 257 | 282 | 'contentId' => ['var' => 'contentId'], |
| @@ -264,8 +289,10 @@ | ||
| 264 | 289 | 'minFile' => ['path' => 'config->minFile', 'val' => 0], |
| 265 | 290 | 'maxFile' => ['path' => 'config->maxFile', 'val' => 0], |
| 266 | 291 | 'showSelectStatus' => ['path' => 'config->showSelectStatus', 'val' => false], |
| 267 | 292 | 'fileSelectStatus' => ['path' => 'config->fileSelectStatus', 'val' => 'No File Selected'], |
| 293 | + 'oldFiles' => ['path' => 'config->oldFiles', 'val' => []], | |
| 294 | + 'baseDLURL' => ['path' => 'config->baseDLURL', 'val' => ''], | |
| 268 | 295 | 'fileExistMsg' => ['val' => 'A file already exist'], |
| 269 | 296 | 'showFileList' => ['path' => 'config->showFileList', 'val' => false], |
| 270 | 297 | 'showFilePreview' => ['path' => 'config->showFilePreview', 'val' => false], |
| 271 | 298 | 'showFileSize' => ['path' => 'config->showFileSize', 'val' => false], |
| @@ -340,10 +367,12 @@ | ||
| 340 | 367 | 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'], |
| 341 | 368 | 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'], |
| 342 | 369 | 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'], |
| 343 | 370 | 'currencyFldValidation' => ['priority' => 702, 'filename' => 'currencyFldValidation.min.js'], |
| 371 | + 'addressZipFldValidation' => ['priority' => 702, 'filename' => 'addressZipFldValidation.min.js'], | |
| 344 | 372 | 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'], |
| 345 | 373 | // 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'], |
| 374 | + 'nmbrBadInputValidation' => ['priority' => 702, 'filename' => 'nmbrBadInputValidation.min.js'], | |
| 346 | 375 | // 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation |
| 347 | 376 | 'inputMaskValidation' => ['priority' => 701, 'filename' => 'inputMaskValidation.min.js'], // load before generateBackslashPattern file, then load inputMaskValidation |
| 348 | 377 | 'bit-input-mask' => ['priority' => 701, 'filename' => 'bit-input-mask.min.js'], // load before generateBackslashPattern file, then load bit-input-mask |
| 349 | 378 | 'setBitInputMaskToInput' => ['priority' => 702, 'filename' => 'setBitInputMaskToInput.min.js'], // load before generateBackslashPattern file, then load setBitInputMaskToInput |
| @@ -363,8 +392,10 @@ | ||
| 363 | 392 | } |
| 364 | 393 | |
| 365 | 394 | public static function validationScriptFileMapping($fieldType) |
| 366 | 395 | { |
| 396 | + // Pro filter callbacks type-hint string; never let null/non-string through. | |
| 397 | + $fieldType = is_string($fieldType) ? $fieldType : ''; | |
| 367 | 398 | $textTypeField = ['text', 'password', 'username', 'color']; |
| 368 | 399 | if (in_array($fieldType, $textTypeField)) { |
| 369 | 400 | $fieldType = 'text'; |
| 370 | 401 | } |
| @@ -429,8 +460,11 @@ | ||
| 429 | 460 | ], |
| 430 | 461 | 'number' => [ |
| 431 | 462 | 'nmbrFldValidation' => [ |
| 432 | 463 | 'paths' => ['mn', 'mx'] |
| 464 | + ], | |
| 465 | + 'nmbrBadInputValidation' => [ | |
| 466 | + 'paths' => ['err->invalid->show'] | |
| 433 | 467 | ] |
| 434 | 468 | ], |
| 435 | 469 | 'range' => [ |
| 436 | 470 | 'checkMinMaxValue' => [ |
| @@ -478,8 +512,16 @@ | ||
| 478 | 512 | ], |
| 479 | 513 | 'phone-number' => [ |
| 480 | 514 | 'phoneNumberFldValidation' => [ |
| 481 | 515 | 'paths' => ['err->invalid->show'], |
| 516 | + ] | |
| 517 | + ], | |
| 518 | + 'address' => [ | |
| 519 | + 'addressZipFldValidation' => [ | |
| 520 | + 'paths' => ['config->zipValidation'], | |
| 521 | + 'dependencies' => [ | |
| 522 | + 'validation', | |
| 523 | + ] | |
| 482 | 524 | ] |
| 483 | 525 | ], |
| 484 | 526 | ]; |
| 485 | 527 | $mapping = isset($fields[$fieldType]) ? $fields[$fieldType] : []; |