private function Cleantalk::createMsg in Anti Spam by CleanTalk 8.3
Create msg for cleantalk server
Parameters
type $method:
CleantalkRequest $request:
Return value
\xmlrpcmsg
3 calls to Cleantalk::createMsg()
- Cleantalk::isAllowMessage in src/
lib/ Cleantalk/ Antispam/ Cleantalk.php - Function checks whether it is possible to publish the message
- Cleantalk::isAllowUser in src/
lib/ Cleantalk/ Antispam/ Cleantalk.php - Function checks whether it is possible to publish the message
- Cleantalk::sendFeedback in src/
lib/ Cleantalk/ Antispam/ Cleantalk.php - Function sends the results of manual moderation
File
- src/
lib/ Cleantalk/ Antispam/ Cleantalk.php, line 227
Class
- Cleantalk
- Cleantalk class create request
Namespace
Drupal\cleantalk\lib\Cleantalk\AntispamCode
private function createMsg($method, CleantalkRequest $request) {
switch ($method) {
case 'check_message':
// Convert strings to UTF8
$request->message = $this
->stringToUTF8($request->message, $this->data_codepage);
$request->example = $this
->stringToUTF8($request->example, $this->data_codepage);
$request->sender_email = $this
->stringToUTF8($request->sender_email, $this->data_codepage);
$request->sender_nickname = $this
->stringToUTF8($request->sender_nickname, $this->data_codepage);
$request->message = $this
->compressData($request->message);
$request->example = $this
->compressData($request->example);
break;
case 'check_newuser':
// Convert strings to UTF8
$request->sender_email = $this
->stringToUTF8($request->sender_email, $this->data_codepage);
$request->sender_nickname = $this
->stringToUTF8($request->sender_nickname, $this->data_codepage);
break;
case 'send_feedback':
if (is_array($request->feedback)) {
$request->feedback = implode(';', $request->feedback);
}
break;
}
$request->method_name = $method;
//
// Removing non UTF8 characters from request, because non UTF8 or malformed characters break json_encode().
//
foreach ($request as $param => $value) {
if (!preg_match('//u', $value)) {
$request->{$param} = 'Nulled. Not UTF8 encoded or malformed.';
}
}
return $request;
}