You are here

function gdpr_long_text_remote_generator in General Data Protection Regulation 7

Remote generator for long text sanitizer.

1 call to gdpr_long_text_remote_generator()
gdpr_long_text_sanitize in modules/gdpr_dump/plugins/sanitizer/LongTextSanitizer.inc
Long text sanitize callback.

File

modules/gdpr_dump/plugins/sanitizer/LongTextSanitizer.inc, line 33

Code

function gdpr_long_text_remote_generator($input) {
  $result = NULL;
  try {
    $result = drupal_http_request('https://loripsum.net/api/3/medium/plaintext');
  } catch (\Exception $e) {

    // @todo: Log?
    return $input;
  }
  if (NULL !== $result && 200 == $result->code) {
    $data = $result->data;
    if (NULL === $data) {
      return $input;
    }
    return substr(trim($data), 0, strlen($input));
  }
  return $input;
}