You are here

function _cleantalk_send_feedback in Anti Spam by CleanTalk 8

Same name and namespace in other branches
  1. 7 cleantalk.module \_cleantalk_send_feedback()
  2. 7.2 cleantalk.module \_cleantalk_send_feedback()

Cleantalk inner function - sends feedback to server.

3 calls to _cleantalk_send_feedback()
cleantalk_comment_delete in ./cleantalk.module
Implements hook_comment_delete().
cleantalk_comment_publish in ./cleantalk.module
Implements hook_comment_publish().
cleantalk_user_delete in ./cleantalk.module
Implements hook_user_delete().

File

./cleantalk.module, line 652
Main CleanTalk integration module functions.

Code

function _cleantalk_send_feedback($request_id, $feedback) {
  $ct_authkey = \Drupal::config('cleantalk.settings')
    ->get('cleantalk_authkey');
  $ct_ws = _cleantalk_get_ws();
  $ct = new Drupal\cleantalk\Cleantalk();
  $ct->work_url = $ct_ws['work_url'];
  $ct->server_url = $ct_ws['server_url'];
  $ct->server_ttl = $ct_ws['server_ttl'];
  $ct->server_changed = $ct_ws['server_changed'];
  $ct_request = new Drupal\cleantalk\CleantalkRequest();
  $ct_request->auth_key = $ct_authkey;
  $ct_request->agent = CLEANTALK_USER_AGENT;
  $ct_request->sender_ip = Drupal::request()
    ->getClientIp();
  $ct_request->feedback = $request_id . ':' . $feedback;
  $ct
    ->sendFeedback($ct_request);
}