nginxMapManager->getMapFilePath(); } public function getMapContent(): string { try { return $this->nginxMapManager->readMapFile(); } catch (\Exception) { return ''; } } public function getMapUrl(): string { return $this->getUrl('*/*/map'); } public function getFormKey(): string { return $this->formKey->getFormKey(); } /** * @return array */ public function getNginxMapInitConfig(): array { return [ 'mapUrl' => $this->getMapUrl(), 'formKey' => $this->getFormKey(), 'mapConfigured' => $this->getMapFilePath() !== null, 'translations' => [ 'msgLoadingBlocks' => (string) __('Loading map blocks…'), 'msgParseFailed' => (string) __( 'Could not parse the map file. Click Parse & Load Blocks to retry.' ), 'parseSuccess' => (string) __('Map file parsed successfully.'), 'parseFailed' => (string) __('Failed to parse map file'), 'addEntry' => (string) __('Add Entry'), 'colHostname' => (string) __('Hostname'), 'colValue' => (string) __('Value'), 'colComment' => (string) __('Comment'), 'colActions' => (string) __('Actions'), 'delete' => (string) __('Delete'), 'saveBlocksValidate' => (string) __('Save Blocks & Validate'), 'switchRaw' => (string) __('Switch to Raw Editor'), 'invalidHeader' => (string) __('Invalid map block header format'), 'blocksSaved' => (string) __('Blocks saved successfully.'), 'saveBlocksFailed' => (string) __('Failed to save blocks'), 'validationPrefix' => (string) __('Warning:'), 'nginxValidationFailed' => (string) __('NGINX validation failed'), 'rawSaved' => (string) __('Raw content saved.'), 'saveFailed' => (string) __('Failed to save'), 'operationOk' => (string) __('Operation completed successfully.'), 'operationFailed' => (string) __('Operation failed'), 'nginxValidated' => (string) __('NGINX configuration validated.'), 'nginxReloaded' => (string) __('NGINX reloaded.'), 'diagPath' => (string) __('Path:'), 'diagNotConfigured' => (string) __('Not configured'), 'diagExists' => (string) __('Exists:'), 'diagReadable' => (string) __('Readable:'), 'diagWritable' => (string) __('Writable:'), 'yes' => (string) __('Yes'), 'no' => (string) __('No'), 'diagIssue' => (string) __('Issue:'), ], ]; } public function getNginxMapInitJson(): string { return $this->json->serialize($this->getNginxMapInitConfig()); } }