-
Notifications
You must be signed in to change notification settings - Fork 59
/
ReCaptchaBuilderInvisible.php
44 lines (37 loc) · 1.24 KB
/
ReCaptchaBuilderInvisible.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Copyright (c) 2017 - present
* LaravelGoogleRecaptcha - ReCaptchaBuilderInvisible.php
* author: Roberto Belotti - roby.belotti@gmail.com
* web : robertobelotti.com, github.com/biscolab
* Initial version created on: 12/9/2018
* MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE
*/
namespace Biscolab\ReCaptcha;
/**
* Class ReCaptchaBuilderInvisible
* @package Biscolab\ReCaptcha
*/
class ReCaptchaBuilderInvisible extends ReCaptchaBuilder {
/**
* ReCaptchaBuilderInvisible constructor.
*
* @param string $api_site_key
* @param string $api_secret_key
* @param int|null $curl_timeout
*/
public function __construct(string $api_site_key, string $api_secret_key, ?int $curl_timeout = null) {
parent::__construct($api_site_key, $api_secret_key, 'invisible', $curl_timeout);
}
/**
* Write HTML <button> tag in your HTML code
* Insert before </form> tag
*
* @param string $buttonInnerHTML
*
* @return string
*/
public function htmlFormButton($buttonInnerHTML = 'Submit'): string {
return ($this->version == 'invisible') ? '<button class="g-recaptcha" data-sitekey="' . $this->api_site_key . '" data-callback="biscolabLaravelReCaptcha">' . $buttonInnerHTML . '</button>' : '';
}
}