| @@ -8,8 +8,9 @@ | ||
| 8 | 8 | use BitCode\BitForm\Admin\Form\InitJs\RecaptchaV3; |
| 9 | 9 | use BitCode\BitForm\Admin\Form\InitJs\ScriptLoader; |
| 10 | 10 | use BitCode\BitForm\Admin\Form\InitJs\Stripe; |
| 11 | 11 | use BitCode\BitForm\Admin\Form\InitJs\Turnstile; |
| 12 | +use BitCode\BitForm\Core\Util\FileHandler; | |
| 12 | 13 | use BitCode\BitForm\Core\Util\Log; |
| 13 | 14 | use BitCode\BitForm\Core\Util\Utilities; |
| 14 | 15 | use BitCode\BitForm\Core\WorkFlow\WorkFlowHandler; |
| 15 | 16 | use BitCode\BitFormPro\Admin\FormSettings\FormAbandonment; |
| @@ -319,13 +320,15 @@ | ||
| 319 | 320 | } |
| 320 | 321 | |
| 321 | 322 | private static function getCustomJsCodes($contentIds = []) |
| 322 | 323 | { |
| 323 | - $script = 'let bfContentId = "", bfVars= "";'; | |
| 324 | + $script = 'let bfContentId = "", bfSlNo = "1", bfVars= "";'; | |
| 324 | 325 | foreach ($contentIds as $contentId) { |
| 325 | - $jsCode = self::getCustomCodes(explode('_', $contentId)[1])['JavaScript']; | |
| 326 | + $contentIdArr = explode('_', $contentId); | |
| 327 | + $jsCode = self::getCustomCodes($contentIdArr[1])['JavaScript']; | |
| 328 | + $bfSlNo = array_key_exists(3, $contentIdArr) ? $contentIdArr[3] : '1'; | |
| 326 | 329 | if (!empty($jsCode)) { |
| 327 | - $script .= " if(bfSelect('#{$contentId}')){ bfContentId = '{$contentId}'; bfVars = window.bf_globals.{$contentId}.smartTags; {$jsCode}}"; | |
| 330 | + $script .= " if(bfSelect('#{$contentId}')){ bfContentId = '{$contentId}'; bfSlNo = '{$bfSlNo}'; bfVars = window.bf_globals.{$contentId}.smartTags; {$jsCode}}"; | |
| 328 | 331 | } |
| 329 | 332 | } |
| 330 | 333 | |
| 331 | 334 | return $script; |
| @@ -372,11 +375,9 @@ | ||
| 372 | 375 | Helpers::saveFile($path, $fileName, $script, 'w'); |
| 373 | 376 | } else { |
| 374 | 377 | $uploadPath = "$path/$fileName"; |
| 375 | 378 | $uploadFilePath = Helpers::generatePathDirOrFile($uploadPath); |
| 376 | - if (file_exists($uploadFilePath)) { | |
| 377 | - unlink($uploadFilePath); | |
| 378 | - } | |
| 379 | + FileHandler::deleteIsFileExists($uploadFilePath); | |
| 379 | 380 | } |
| 380 | 381 | return true; |
| 381 | 382 | } |
| 382 | 383 | |
| @@ -402,8 +403,9 @@ | ||
| 402 | 403 | 'paypal' => '.__$fk__-paypal-wrp', |
| 403 | 404 | 'razorpay' => '.__$fk__-razorpay-wrp', |
| 404 | 405 | 'recaptcha' => '.__$fk__-recaptcha-wrp', |
| 405 | 406 | 'stripe' => '.__$fk__-stripe-fld', |
| 407 | + 'mollie' => '.__$fk__-mollie-wrp', | |
| 406 | 408 | 'repeater' => '.__$fk__-rpt-fld-wrp', |
| 407 | 409 | 'signature' => '.__$fk__-inp-fld-wrp', |
| 408 | 410 | 'rating' => '.__$fk__-inp-fld-wrp', |
| 409 | 411 | ]; |
| @@ -409,9 +411,9 @@ | ||
| 409 | 411 | ]; |
| 410 | 412 | |
| 411 | 413 | private function generateFieldConfigsJs() |
| 412 | 414 | { |
| 413 | - $customFlds = ['select', 'country', 'currency', 'phone-number', 'file-up', 'advanced-file-up', 'paypal', 'razorpay', 'stripe', 'recaptcha', 'repeater', 'signature', 'rating', 'turnstile']; | |
| 415 | + $customFlds = ['select', 'country', 'currency', 'phone-number', 'file-up', 'advanced-file-up', 'paypal', 'razorpay', 'stripe', 'mollie', 'recaptcha', 'repeater', 'signature', 'rating', 'turnstile']; | |
| 414 | 416 | $allFieldTypes = array_keys($this->_fields); |
| 415 | 417 | $customFldsInForms = array_intersect($allFieldTypes, $customFlds); |
| 416 | 418 | $formContents = $this->_formContents; |
| 417 | 419 | $recaptchaV3Enabled = false; |
| @@ -471,8 +473,14 @@ | ||
| 471 | 473 | } else { |
| 472 | 474 | $stripeInitJs = ''; |
| 473 | 475 | } |
| 474 | 476 | |
| 477 | + if (in_array('mollie', $customFldsInForms)) { | |
| 478 | + $mollieInitJs = Stripe::init(); | |
| 479 | + } else { | |
| 480 | + $mollieInitJs = ''; | |
| 481 | + } | |
| 482 | + | |
| 475 | 483 | if (in_array('recaptcha', $customFldsInForms)) { |
| 476 | 484 | $recaptchaInitJs = Recaptcha::init(); |
| 477 | 485 | } else { |
| 478 | 486 | $recaptchaInitJs = ''; |
| @@ -499,9 +507,9 @@ | ||
| 499 | 507 | function initAllCustomFlds (formContentId = null) { |
| 500 | 508 | const allContendIds = formContentId ? [formContentId] : Object.keys(bf_globals); |
| 501 | 509 | allContendIds.forEach((contentId) => { |
| 502 | 510 | const contentData = bf_globals[contentId]; |
| 503 | - const flds = bf_globals[contentId].fields; | |
| 511 | + const flds = bf_globals[contentId]?.fields || {}; | |
| 504 | 512 | const fldKeys = Object.keys(flds).reverse(); |
| 505 | 513 | fldKeys.forEach((fldKey) => { |
| 506 | 514 | const fldData = flds[fldKey]; |
| 507 | 515 | const fldType = fldData.typ; |