@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | public function boot() { |
| 33 | 33 | |
| 34 | 34 | $this->addValidationRule(); |
| 35 | - $this->loadRoutesFrom(__DIR__ . '/routes/routes.php'); |
|
| 35 | + $this->loadRoutesFrom(__DIR__.'/routes/routes.php'); |
|
| 36 | 36 | |
| 37 | 37 | $this->publishes([ |
| 38 | - __DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'), |
|
| 38 | + __DIR__.'/../config/recaptcha.php' => config_path('recaptcha.php'), |
|
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function addValidationRule() { |
| 47 | 47 | |
| 48 | - Validator::extendImplicit('recaptcha', function ($attribute, $value, $parameters, $validator) { |
|
| 48 | + Validator::extendImplicit('recaptcha', function($attribute, $value, $parameters, $validator) { |
|
| 49 | 49 | |
| 50 | 50 | return app('recaptcha')->validate($value); |
| 51 | 51 | }, trans('validation.recaptcha')); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function register() { |
| 60 | 60 | |
| 61 | 61 | $this->mergeConfigFrom( |
| 62 | - __DIR__ . '/../config/recaptcha.php', 'recaptcha' |
|
| 62 | + __DIR__.'/../config/recaptcha.php', 'recaptcha' |
|
| 63 | 63 | ); |
| 64 | 64 | |
| 65 | 65 | $this->registerReCaptchaBuilder(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | protected function registerReCaptchaBuilder() { |
| 74 | 74 | |
| 75 | - $this->app->singleton('recaptcha', function ($app) { |
|
| 75 | + $this->app->singleton('recaptcha', function($app) { |
|
| 76 | 76 | |
| 77 | 77 | $recaptcha_class = ''; |
| 78 | 78 | |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | * MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -Route::get(config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'), function () { |
|
| 11 | +Route::get(config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'), function() { |
|
| 12 | 12 | |
| 13 | 13 | $token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), ''); |
| 14 | 14 | $validation_response = recaptcha()->validate($token); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | $html .= '<script> |
| 147 | 147 | function biscolabLaravelReCaptcha(token) { |
| 148 | - document.getElementById("' . $formId . '").submit(); |
|
| 148 | + document.getElementById("' . $formId.'").submit(); |
|
| 149 | 149 | } |
| 150 | 150 | </script>'; |
| 151 | 151 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $js_custom_validation = array_get($configuration, 'custom_validation', ''); |
| 157 | 157 | |
| 158 | 158 | // Check if set custom_validation. That function will override default fetch validation function |
| 159 | - if($js_custom_validation) { |
|
| 159 | + if ($js_custom_validation) { |
|
| 160 | 160 | |
| 161 | 161 | $validate_function = ($js_custom_validation) ? "{$js_custom_validation}(token);" : ''; |
| 162 | 162 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $js_callback_catch = ($js_callback_catch) ? "{$js_callback_catch}(err)" : ''; |
| 170 | 170 | |
| 171 | 171 | $validate_function = " |
| 172 | - fetch('/" . config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate') . "?" . config('recaptcha.default_token_parameter_name', 'token') . "=' + token, { |
|
| 172 | + fetch('/" . config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate')."?".config('recaptcha.default_token_parameter_name', 'token')."=' + token, { |
|
| 173 | 173 | headers: { |
| 174 | 174 | \"X-Requested-With\": \"XMLHttpRequest\", |
| 175 | 175 | \"X-CSRF-TOKEN\": csrfToken.content |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | 'response' => $response, |
| 225 | 225 | ]); |
| 226 | 226 | |
| 227 | - $url = $this->api_url . '?' . $params; |
|
| 227 | + $url = $this->api_url.'?'.$params; |
|
| 228 | 228 | |
| 229 | 229 | if (function_exists('curl_version')) { |
| 230 | 230 | $curl = curl_init($url); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | $response = json_decode(trim($curl_response), true); |
| 243 | 243 | |
| 244 | - if($this->version == 'v3') { |
|
| 244 | + if ($this->version == 'v3') { |
|
| 245 | 245 | return $response; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -148,8 +148,7 @@ discard block |
||
| 148 | 148 | document.getElementById("' . $formId . '").submit(); |
| 149 | 149 | } |
| 150 | 150 | </script>'; |
| 151 | - } |
|
| 152 | - elseif ($this->version == 'v3') { |
|
| 151 | + } elseif ($this->version == 'v3') { |
|
| 153 | 152 | |
| 154 | 153 | $action = array_get($configuration, 'action', 'homepage'); |
| 155 | 154 | |
@@ -159,8 +158,7 @@ discard block |
||
| 159 | 158 | if($js_custom_validation) { |
| 160 | 159 | |
| 161 | 160 | $validate_function = ($js_custom_validation) ? "{$js_custom_validation}(token);" : ''; |
| 162 | - } |
|
| 163 | - else { |
|
| 161 | + } else { |
|
| 164 | 162 | |
| 165 | 163 | $js_then_callback = array_get($configuration, 'callback_then', ''); |
| 166 | 164 | $js_callback_catch = array_get($configuration, 'callback_catch', ''); |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function htmlFormSnippet(): string { |
| 35 | 35 | |
| 36 | - return ($this->version == 'v2') ? '<div class="g-recaptcha" data-sitekey="' . $this->api_site_key . '"></div>' : ''; |
|
| 36 | + return ($this->version == 'v2') ? '<div class="g-recaptcha" data-sitekey="'.$this->api_site_key.'"></div>' : ''; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function htmlFormButton($buttonInnerHTML = 'Submit'): string { |
| 38 | 38 | |
| 39 | - return ($this->version == 'invisible') ? '<button class="g-recaptcha" data-sitekey="' . $this->api_site_key . '" data-callback="biscolabLaravelReCaptcha">' . $buttonInnerHTML . '</button>' : ''; |
|
| 39 | + return ($this->version == 'invisible') ? '<button class="g-recaptcha" data-sitekey="'.$this->api_site_key.'" data-callback="biscolabLaravelReCaptcha">'.$buttonInnerHTML.'</button>' : ''; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | \ No newline at end of file |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ReCaptchaV3Test extends TestCase { |
| 20 | 20 | |
| 21 | - protected $recaptcha_v3 = null; |
|
| 21 | + protected $recaptcha_v3 = null; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @test |