You are here

function gdpr_text_remote_generator in General Data Protection Regulation 7

Remote generator for text sanitize.

1 call to gdpr_text_remote_generator()
gdpr_text_sanitize in modules/gdpr_dump/plugins/sanitizer/TextSanitizer.inc
Text sanitize callback.

File

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

Code

function gdpr_text_remote_generator($input) {
  $result = NULL;
  try {
    $result = drupal_http_request('https://loripsum.net/api/1/short/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;
}