Mass update

This commit is contained in:
2022-12-30 21:03:37 +02:00
parent 7a5dfd22a7
commit e9ec7eb2f2
172 changed files with 14838 additions and 35914 deletions
+9 -10
View File
@@ -41,18 +41,18 @@ class ReCaptchaResponse
class ReCaptcha
{
private static $_signupUrl = "https://www.google.com/recaptcha/admin";
private static $_siteVerifyUrl =
private static string $_signupUrl = "https://www.google.com/recaptcha/admin";
private static string $_siteVerifyUrl =
"https://www.google.com/recaptcha/api/siteverify?";
private $_secret;
private static $_version = "php_1.0";
private string $_secret;
private static string $_version = "php_1.0";
/**
* Constructor.
*
* @param string $secret shared secret between site and ReCAPTCHA server.
*/
function __construct($secret)
function __construct(string $secret)
{
if ($secret == null || $secret == "") {
die(
@@ -70,15 +70,14 @@ class ReCaptcha
*
* @return string - encoded request.
*/
private function _encodeQS($data)
private function _encodeQS(array $data): string
{
$req = "";
foreach ($data as $key => $value) {
$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
}
// Cut the last '&'
$req = substr($req, 0, strlen($req) - 1);
return $req;
return substr($req, 0, strlen($req) - 1);
}
/**
@@ -89,7 +88,7 @@ class ReCaptcha
*
* @return array response
*/
private function _submitHTTPGet($path, $data)
private function _submitHTTPGet(string $path, array $data): array
{
$req = $this->_encodeQS($data);
return file_get_contents($path . $req);
@@ -104,7 +103,7 @@ class ReCaptcha
*
* @return ReCaptchaResponse
*/
public function verifyResponse($remoteIp, $response)
public function verifyResponse(string $remoteIp, string $response): ReCaptchaResponse
{
// Discard empty solution submissions
if ($response == null || strlen($response) == 0) {