You are here

private function Cleantalk::compressData in Anti Spam by CleanTalk 8.4

Same name and namespace in other branches
  1. 9.1.x src/lib/Cleantalk/Antispam/Cleantalk.php \Cleantalk\Antispam\Cleantalk::compressData()

Compress data and encode to base64

Parameters

type string:

Return value

string

1 call to Cleantalk::compressData()
Cleantalk::createMsg in src/lib/Cleantalk/Antispam/Cleantalk.php
Create msg for cleantalk server

File

src/lib/Cleantalk/Antispam/Cleantalk.php, line 201

Class

Cleantalk
Cleantalk class create request

Namespace

Cleantalk\Antispam

Code

private function compressData($data = null) {
  if (strlen($data) > $this->dataMaxSise && function_exists('gzencode') && function_exists('base64_encode')) {
    $localData = gzencode($data, $this->compressRate, FORCE_GZIP);
    if ($localData === false) {
      return $data;
    }
    $localData = base64_encode($localData);
    if ($localData === false) {
      return $data;
    }
    return $localData;
  }
  return $data;
}