PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.2.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.2.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 2.10.1 All 138 releases
bit-form / includes / Frontend / Form / View / Theme / Fields / RecaptchaV2Field.php

RecaptchaV2Field.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 3.2.2, at includes/Frontend/Form/View/Theme/Fields/RecaptchaV2Field.php

53 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Frontend\Form\View\Theme\Fields;
4
5 use BitCode\BitForm\Core\Integration\IntegrationHandler;
6 use BitCode\BitForm\Core\Util\Utilities;
7
8 class RecaptchaV2Field
9 {
10 public static function init($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
11 {
12 $integrationHandler = new IntegrationHandler(0);
13 $allFormIntegrations = $integrationHandler->getAllIntegration('app', 'gReCaptcha');
14 if (is_wp_error($allFormIntegrations)) {
15 return '';
16 }
17 $row = Utilities::firstRow($allFormIntegrations);
18 $siteKey = Utilities::jsonObj($row->integration_details ?? '')->siteKey ?? '';
19 return self::field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $siteKey, $error = null, $value = null);
20 }
21
22 private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $siteKey, $error = null, $value = null)
23 {
24 $fieldHelpers = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map);
25 $theme = $field->config->theme;
26 $size = $field->config->size;
27
28 return sprintf(
29 '<div
30 %1$s
31 class="%2$s %3$s"
32 >
33 <div class="%4$s-recaptcha-wrp">
34 <div
35 class="g-recaptcha"
36 data-theme="%5$s"
37 data-size="%6$s"
38 data-sitekey="%7$s"
39 >
40 </div>
41 </div>
42 </div>',
43 $fieldHelpers->getCustomAttributes('fld-wrp'),
44 $fieldHelpers->getAtomicCls('fld-wrp'),
45 $fieldHelpers->getCustomClasses('fld-wrp'),
46 $rowID,
47 $theme,
48 $size,
49 $fieldHelpers->esc_attr($siteKey)
50 );
51 }
52 }
53