You are here

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

Compress data and encode to base64

Parameters

type string:

Return value

string

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

File

src/Cleantalk.php, line 179

Class

Cleantalk
Cleantalk class create request

Namespace

Drupal\cleantalk

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;
}