Skip to content

Commit 82dbb89

Browse files
committed
Fix. CleantalkAntispam handler class fixed.
1 parent b7547f1 commit 82dbb89

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use Cleantalk\CleantalkAntispam;
4747
//require_once "lib/cleantalk-php-patch.php"; -- PHP-FPM
4848

4949
$cleantalk_antispam = new CleantalkAntispam($apikey, $email_field, $user_name_field, $message_field, $type_form);
50-
$cleantalk_antispam->handle();
50+
$api_result = $cleantalk_antispam->handle();
5151
?>
5252

5353
<form method="post">
@@ -67,7 +67,7 @@ $cleantalk_antispam->handle();
6767
```
6868

6969
## API Response description
70-
API returns PHP object:
70+
API returns (`$api_result`) PHP object:
7171
* allow (0|1) - allow to publish or not, in other words spam or ham
7272
* comment (string) - server comment for requests.
7373
* id (string MD5 HEX hash) - unique request idenifier.

lib/CleantalkAntispam.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,7 @@ public function handle()
5959
$ct_result = $ct->isAllowMessage($ct_request);
6060
}
6161

62-
if ($ct_result->allow == 1) {
63-
if ($this->type_form === 'signup') {
64-
echo 'User allowed. Reason ' . $ct_result->comment;
65-
}
66-
if ($this->type_form === 'contact') {
67-
echo 'Message allowed. Reason ' . $ct_result->comment;
68-
}
69-
} else {
70-
if ($this->type_form === 'signup') {
71-
echo 'User forbidden. Reason ' . $ct_result->comment;
72-
}
73-
if ($this->type_form === 'contact') {
74-
echo 'Message forbidden. Reason ' . $ct_result->comment;
75-
}
76-
}
77-
echo '<br /><br />';
62+
return $ct_result;
7863
}
7964

8065
public function frontendScript()

0 commit comments

Comments
 (0)