11
11
use Biscolab \ReCaptcha \Facades \ReCaptcha ;
12
12
13
13
if (!function_exists ('recaptcha ' )) {
14
- /**
15
- * @return Biscolab\ReCaptcha\ReCaptchaBuilder
16
- */
17
- function recaptcha ()
18
- {
19
-
20
- return app ('recaptcha ' );
21
- }
14
+ /**
15
+ * @return Biscolab\ReCaptcha\ReCaptchaBuilder|\Biscolab\ReCaptcha\ReCaptchaBuilderV2|\Biscolab\ReCaptcha\ReCaptchaBuilderInvisible|\Biscolab\ReCaptcha\ReCaptchaBuilderV3
16
+ */
17
+ function recaptcha (): \ Biscolab \ ReCaptcha \ ReCaptchaBuilder
18
+ {
19
+
20
+ return app ('recaptcha ' );
21
+ }
22
22
}
23
23
24
24
/**
25
25
* call ReCaptcha::htmlScriptTagJsApi()
26
26
* Write script HTML tag in you HTML code
27
27
* Insert before </head> tag
28
28
*
29
- * @param $formId required if you are using invisible ReCaptcha
29
+ * @param $config ['form_id'] required if you are using invisible ReCaptcha
30
30
*/
31
31
if (!function_exists ('htmlScriptTagJsApi ' )) {
32
32
33
- /**
34
- * @param string $formId
35
- *
36
- * @return string
37
- */
38
- function htmlScriptTagJsApi ($ formId = '' ): string
39
- {
33
+ /**
34
+ * @param array|null $config
35
+ *
36
+ * @return string
37
+ */
38
+ function htmlScriptTagJsApi (? array $ config = [] ): string
39
+ {
40
40
41
- return ReCaptcha::htmlScriptTagJsApi ($ formId );
42
- }
41
+ return ReCaptcha::htmlScriptTagJsApi ($ config );
42
+ }
43
43
}
44
44
45
45
/**
46
46
* call ReCaptcha::htmlScriptTagJsApi()
47
47
* Write script HTML tag in you HTML code
48
48
* Insert before </head> tag
49
49
*
50
- * @param $formId required if you are using invisible ReCaptcha
51
50
*/
52
51
if (!function_exists ('htmlScriptTagJsApiV3 ' )) {
53
52
54
- /**
55
- * @param array $config
56
- *
57
- * @return string
58
- */
59
- function htmlScriptTagJsApiV3 ($ config = []): string
60
- {
61
-
62
- return ReCaptcha::htmlScriptTagJsApiV3 ($ config );
63
- }
53
+ /**
54
+ * @param array $config
55
+ *
56
+ * @return string
57
+ * @deprecated
58
+ */
59
+ function htmlScriptTagJsApiV3 (?array $ config = []): string
60
+ {
61
+
62
+ return ReCaptcha::htmlScriptTagJsApiV3 ($ config );
63
+ }
64
64
}
65
65
66
66
/**
@@ -74,16 +74,17 @@ function htmlScriptTagJsApiV3($config = []): string
74
74
*/
75
75
if (!function_exists ('htmlFormButton ' )) {
76
76
77
- /**
78
- * @param null|string $buttonInnerHTML
79
- *
80
- * @return string
81
- */
82
- function htmlFormButton (?string $ buttonInnerHTML = 'Submit ' ): string
83
- {
84
-
85
- return ReCaptcha::htmlFormButton ($ buttonInnerHTML );
86
- }
77
+ /**
78
+ * @param null|string $button_label
79
+ * @param array|null $properties
80
+ *
81
+ * @return string
82
+ */
83
+ function htmlFormButton (?string $ button_label = 'Submit ' , ?array $ properties = []): string
84
+ {
85
+
86
+ return ReCaptcha::htmlFormButton ($ button_label , $ properties );
87
+ }
87
88
}
88
89
89
90
/**
@@ -95,13 +96,62 @@ function htmlFormButton(?string $buttonInnerHTML = 'Submit'): string
95
96
*/
96
97
if (!function_exists ('htmlFormSnippet ' )) {
97
98
98
- /**
99
- * @return string
100
- */
101
- function htmlFormSnippet (): string
102
- {
99
+ /**
100
+ * @return string
101
+ */
102
+ function htmlFormSnippet (): string
103
+ {
104
+
105
+ return ReCaptcha::htmlFormSnippet ();
106
+ }
107
+ }
108
+
109
+ /**
110
+ * call ReCaptcha::getFormId()
111
+ * return the form ID
112
+ * Warning! Using only with ReCAPTCHA invisible
113
+ */
114
+ if (!function_exists ('getFormId ' )) {
115
+
116
+ /**
117
+ * @return string
118
+ */
119
+ function getFormId (): string
120
+ {
121
+
122
+ return ReCaptcha::getFormId ();
123
+ }
124
+ }
125
+
126
+ /**
127
+ * return ReCaptchaBuilder::DEFAULT_RECAPTCHA_RULE_NAME value ("recaptcha")
128
+ * Use V2 (checkbox and invisible)
129
+ */
130
+ if (!function_exists ('recaptchaRuleName ' )) {
131
+
132
+ /**
133
+ * @return string
134
+ */
135
+ function recaptchaRuleName (): string
136
+ {
137
+
138
+ return \Biscolab \ReCaptcha \ReCaptchaBuilder::DEFAULT_RECAPTCHA_RULE_NAME ;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * return ReCaptchaBuilder::DEFAULT_RECAPTCHA_FIELD_NAME value "g-recaptcha-response"
144
+ * Use V2 (checkbox and invisible)
145
+ */
146
+ if (!function_exists ('recaptchaFieldName ' )) {
147
+
148
+ /**
149
+ * @return string
150
+ */
151
+ function recaptchaFieldName (): string
152
+ {
103
153
104
- return ReCaptcha:: htmlFormSnippet () ;
105
- }
154
+ return \ Biscolab \ ReCaptcha \ReCaptchaBuilder:: DEFAULT_RECAPTCHA_FIELD_NAME ;
155
+ }
106
156
}
107
157
0 commit comments