You are here

public static function CleantalkHelper::api_method__get_antispam_report_breif in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 7.4 src/CleantalkHelper.php \CleantalkHelper::api_method__get_antispam_report_breif()

* Function gets spam statistics * *

Parameters

string website host: * @param integer report days * @return type

File

src/CleantalkHelper.php, line 427

Class

CleantalkHelper
Cleantalk's hepler class

Code

public static function api_method__get_antispam_report_breif($api_key, $do_check = true) {
  $request = array(
    'method_name' => 'get_antispam_report_breif',
    'auth_key' => $api_key,
  );
  $result = self::api_send_request($request);
  $result = $do_check ? self::api_check_response($result, 'get_antispam_report_breif') : $result;
  $tmp = array();
  for ($i = 0; $i < 7; $i++) {
    $tmp[date('Y-m-d', time() - 86400 * 7 + 86400 * $i)] = 0;
  }
  $result['spam_stat'] = array_merge($tmp, isset($result['spam_stat']) ? $result['spam_stat'] : array());
  $result['top5_spam_ip'] = isset($result['top5_spam_ip']) ? $result['top5_spam_ip'] : array();
  return $result;
}