-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
155 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of PHPDevsr/recaptcha-codeigniter4. | ||
* | ||
* (c) 2023 Denny Septian Panggabean <xamidimura@gmail.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PHPDevsr\Recaptcha\Config; | ||
|
||
use CodeIgniter\Config\BaseService; | ||
use PHPDevsr\Recaptcha\Recaptcha; | ||
|
||
class Services extends BaseService | ||
{ | ||
public static function recaptcha(bool $getShared = true): Recaptcha | ||
{ | ||
if ($getShared) { | ||
return self::getSharedInstance('recaptcha'); | ||
} | ||
|
||
return new Recaptcha(config('Recaptcha')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of PHPDevsr/recaptcha-codeigniter4. | ||
* | ||
* (c) 2023 Denny Septian Panggabean <xamidimura@gmail.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
if (! function_exists('getWidget')) { | ||
/** | ||
* Render reCAPTCHA Widget | ||
* | ||
* @param array $parameters Attribute | ||
*/ | ||
function getWidget(array $parameters = []): string | ||
{ | ||
$recaptcha = service('recaptcha'); | ||
|
||
return $recaptcha->getWidget($parameters); | ||
} | ||
} | ||
|
||
if (! function_exists('getScriptTag')) { | ||
/** | ||
* Render Script Tag | ||
* | ||
* @param array $parameters Attribute | ||
*/ | ||
function getScriptTag(array $parameters = []): string | ||
{ | ||
$recaptcha = service('recaptcha'); | ||
|
||
return $recaptcha->getScriptTag($parameters); | ||
} | ||
} | ||
|
||
if (! function_exists('verifyResponse')) { | ||
/** | ||
* Verify Response | ||
* | ||
* @param string $response response string from Recaptcha Verification | ||
*/ | ||
function verifyResponse($response): array | ||
{ | ||
$recaptcha = service('recaptcha'); | ||
|
||
return $recaptcha->verifyResponse($response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters