Skip to content

Commit

Permalink
final namespace decision, small curl bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtoobii committed Feb 25, 2022
1 parent 30188f8 commit 8c9b0bd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/.gitignore export-ignore
/img export-ignore
/img export-ignore
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.idea
.idea
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -44,7 +44,7 @@ In php:

```injectablephp
use Oetiker\hCaptcha\hCaptchaProtector\Forms
use Oposs\hCaptcha\hCaptchaProtector\Forms
new hCaptchaField('SpamProtection', 'SpamProtection', null);
Expand Down
2 changes: 1 addition & 1 deletion lang/de.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lang/en.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
14 changes: 7 additions & 7 deletions src/Froms/hCaptchaField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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;
}

Expand All @@ -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);
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion templates/Oposs/hCaptcha/Forms/hCaptchaField.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<noscript>
<p><%t Oetiker\hCaptcha\Forms\hCaptchaField.NOSCRIPT "You must enable JavaScript to submit this form" %></p>
<p><%t Oposs\hCaptcha\Forms\hCaptchaField.NOSCRIPT "You must enable JavaScript to submit this form" %></p>
</noscript>

<div class="h-captcha"
Expand Down

0 comments on commit 8c9b0bd

Please sign in to comment.