diff --git a/src/Plugin/PdfBackend/LocalServerPdfBackend.php b/src/Plugin/PdfBackend/LocalServerPdfBackend.php index 8b4cc6fb663adc6388d54e429867a207b4b0dcba..3e5be2e3f4ecdc917ddf846b5ca177bcf3eb69ef 100644 --- a/src/Plugin/PdfBackend/LocalServerPdfBackend.php +++ b/src/Plugin/PdfBackend/LocalServerPdfBackend.php @@ -2,6 +2,8 @@ namespace Drupal\fillpdf\Plugin\PdfBackend; +use function GuzzleHttp\json_encode; +use function GuzzleHttp\json_decode; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\file\FileInterface; use Drupal\file\Entity\File; @@ -85,7 +87,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl 'pdf' => base64_encode($pdf_content), ]; - $json = \GuzzleHttp\json_encode($request); + $json = json_encode($request); $fields = []; @@ -107,7 +109,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl } } - $fields = \GuzzleHttp\json_decode((string) $fields_response->getBody(), TRUE); + $fields = json_decode((string) $fields_response->getBody(), TRUE); return $fields; } @@ -158,7 +160,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl 'fields' => $api_fields, ]; - $json = \GuzzleHttp\json_encode($request); + $json = json_encode($request); try { $response = $this->httpClient->post($this->configuration['local_service_endpoint'] . '/api/v1/merge', [ @@ -166,7 +168,7 @@ class LocalServerPdfBackend extends PdfBackendBase implements ContainerFactoryPl 'headers' => ['Content-Type' => 'application/json'], ]); - $decoded = \GuzzleHttp\json_decode((string) $response->getBody(), TRUE); + $decoded = json_decode((string) $response->getBody(), TRUE); return base64_decode($decoded['pdf']); } catch (RequestException $e) { diff --git a/xfdf.inc b/xfdf.inc index aa40513be008bd71f550e7064de718b19ac1e37b..e861ac6366c699a6ad28cbec088479498ebbb700 100644 --- a/xfdf.inc +++ b/xfdf.inc @@ -40,7 +40,7 @@ function create_xfdf($file, array $info, $enc = 'UTF-8') { if ($file) { $ids_ele->setAttribute('original', md5($file)); } - $ids_ele->setAttribute('modified', REQUEST_TIME); + $ids_ele->setAttribute('modified', \Drupal::time()->getRequestTime()); if ($file) { $f_ele = $xfdf_ele->appendChild($doc->createElement('f'));