From 8c9b0bd0037ff1405adcadb6c8558f6c623ac2cc Mon Sep 17 00:00:00 2001 From: Tobias Bossert Date: Fri, 25 Feb 2022 16:04:41 +0100 Subject: [PATCH] final namespace decision, small curl bug fix --- .gitattributes | 2 +- .gitignore | 2 +- Readme.md | 4 ++-- lang/de.yml | 2 +- lang/en.yml | 2 +- src/Froms/hCaptchaField.php | 14 +++++++------- templates/Oposs/hCaptcha/Forms/hCaptchaField.ss | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitattributes b/.gitattributes index b357255..29b8706 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ /.gitignore export-ignore -/img export-ignore \ No newline at end of file +/img export-ignore diff --git a/.gitignore b/.gitignore index 723ef36..485dee6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.idea \ No newline at end of file +.idea diff --git a/Readme.md b/Readme.md index 37e5a20..d8a6d89 100644 --- a/Readme.md +++ b/Readme.md @@ -12,7 +12,7 @@ Make sure you met the following requirements beforehand: - PHP CURL and JSON ``` -composer require oetiker/silverstripe-hcaptcha dev +composer require oposs/silverstripe-hcaptcha dev ``` And set hCaptcha as your default spamprotector: @@ -44,7 +44,7 @@ In php: ```injectablephp -use Oetiker\hCaptcha\hCaptchaProtector\Forms +use Oposs\hCaptcha\hCaptchaProtector\Forms new hCaptchaField('SpamProtection', 'SpamProtection', null); diff --git a/lang/de.yml b/lang/de.yml index 1facb81..9a8b0e3 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -1,5 +1,5 @@ en: - Oetiker\hCaptcha\Forms\hCaptchaField: + Oposs\hCaptcha\Forms\hCaptchaField: EMPTY: "Bitte captcha beantworten. Wenn nicht sichtbar, Javascript von js.hcaptcha.com erlauben" NOSCRIPT: "Javascript muss aktiv sein um dieses Formular absenden zu können" VALIDATE_ERROR: "Captcha konnte nicht verfiziert werden" diff --git a/lang/en.yml b/lang/en.yml index cc66d23..3430d9a 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -1,5 +1,5 @@ en: - Oetiker\hCaptcha\Forms\hCaptchaField: + Oposs\hCaptcha\Forms\hCaptchaField: EMPTY: "Please answer the captcha, if you do not see the captcha please enable JavaScript" NOSCRIPT: "You must enable JavaScript to submit this form" VALIDATE_ERROR: "Captcha could not be validated" diff --git a/src/Froms/hCaptchaField.php b/src/Froms/hCaptchaField.php index 77eba8c..0084d68 100644 --- a/src/Froms/hCaptchaField.php +++ b/src/Froms/hCaptchaField.php @@ -41,7 +41,7 @@ class hCaptchaField extends FormField public function __construct($name, $title = null, $value = null) { // Set default title - if ($title === null) $title = _t('Oetiker\hCaptcha\Forms\hCaptchaField.DEFAULT_TITLE', 'Spam protection'); + if ($title === null) $title = _t('Oposs\hCaptcha\Forms\hCaptchaField.DEFAULT_TITLE', 'Spam protection'); parent::__construct($name, $title, $value); } @@ -57,7 +57,7 @@ public function validate($validator): bool // Empty response if (!isset($captchaResponse)) { - $validator->validationError($this->name, _t('Oetiker\hCaptcha\Forms\hCaptchaField.EMPTY', '_Please answer the captcha, if you do not see the captcha you must enable JavaScript')); + $validator->validationError($this->name, _t('Oposs\hCaptcha\Forms\hCaptchaField.EMPTY', '_Please answer the captcha, if you do not see the captcha you must enable JavaScript')); return false; } @@ -71,10 +71,10 @@ public function validate($validator): bool if ($submit_remote_ip) $validatorRequest['remoteip'] = Controller::curr()->getRequest()->getIP(); $curlOptions = [ - 'CURLOPT_URL' => 'https://hcaptcha.com/siteverify', - 'CURLOPT_POST' => true, - 'CURLOPT_POSTFIELDS' => http_build_query($validatorRequest), - 'CURLOPT_RETURNTRANSFER' => true, + CURLOPT_URL => 'https://hcaptcha.com/siteverify', + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => http_build_query($validatorRequest), + CURLOPT_RETURNTRANSFER => true, ]; $verify = curl_init(); curl_setopt_array($verify, $curlOptions); @@ -84,7 +84,7 @@ public function validate($validator): bool if ($responseData->success) { return true; } else { - $validator->validationError($this->name, _t('Oetiker\hCaptcha\Forms\hCaptchaField.VALIDATE_ERROR', '_Captcha could not be validated')); + $validator->validationError($this->name, _t('Oposs\hCaptcha\Forms\hCaptchaField.VALIDATE_ERROR', '_Captcha could not be validated')); return false; } diff --git a/templates/Oposs/hCaptcha/Forms/hCaptchaField.ss b/templates/Oposs/hCaptcha/Forms/hCaptchaField.ss index 77d469d..4e5ce81 100644 --- a/templates/Oposs/hCaptcha/Forms/hCaptchaField.ss +++ b/templates/Oposs/hCaptcha/Forms/hCaptchaField.ss @@ -1,5 +1,5 @@