diff --git a/Classes/Configuration/ExtConf.php b/Classes/Configuration/ExtConf.php deleted file mode 100644 index acb56a8..0000000 --- a/Classes/Configuration/ExtConf.php +++ /dev/null @@ -1,84 +0,0 @@ - $value) { - $methodName = 'set' . ucfirst($key); - if (method_exists($this, $methodName)) { - if (is_array($value) && array_key_exists('value', $value)) { - $this->$methodName($value['value']); - } else { - $this->$methodName($value); - } - } - } - } - } - - /** - * Get an instance of ExtConf. - * This is a singleton interface. - * - * @return ExtConf - */ - public static function getInstance() - { - return GeneralUtility::makeInstance('JWeiland\\Avalex\\Configuration\\ExtConf'); - } - - /** - * Returns ApiBaseUrl - * - * @return string - */ - public function getApiBaseUrl() - { - return $this->apiBaseUrl; - } - - /** - * Sets ApiBaseUrl - * - * @param string $apiBaseUrl - * @return void - */ - public function setApiBaseUrl($apiBaseUrl) - { - $this->apiBaseUrl = (string)$apiBaseUrl; - } -} diff --git a/Classes/Hooks/DataHandler.php b/Classes/Hooks/DataHandler.php index 8543473..752ad38 100644 --- a/Classes/Hooks/DataHandler.php +++ b/Classes/Hooks/DataHandler.php @@ -14,7 +14,7 @@ * The TYPO3 project - inspiring people to share! */ -use JWeiland\Avalex\Configuration\ExtConf; +use JWeiland\Avalex\Utility\ApiUtility; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageQueue; use TYPO3\CMS\Core\Messaging\FlashMessageService; @@ -31,11 +31,6 @@ class DataHandler */ protected $flashMessageQueue; - /** - * @var string - */ - protected $apiBaseUrl = ''; - /** * Check API keys on save * @@ -59,7 +54,6 @@ public function processDatamap_preProcessFieldArray( /** @var FlashMessageService $flashMessageService */ $flashMessageService = $objectManager->get('TYPO3\\CMS\Core\\Messaging\\FlashMessageService'); $this->flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); - $this->apiBaseUrl = ExtConf::getInstance()->getApiBaseUrl(); if (!$this->checkApiKey($incomingFieldArray['api_key'])) { // prevent save because key is invalid unset($incomingFieldArray['api_key']); @@ -76,7 +70,7 @@ protected function checkApiKey($apiKey) { $isValid = true; $apiKey = (string)$apiKey; - $response = @file_get_contents($this->apiBaseUrl . 'api_keys/is_configured.json?apikey=' . $apiKey); + $response = @file_get_contents(ApiUtility::getApiUrl() . 'api_keys/is_configured.json?apikey=' . $apiKey); $responseArray = json_decode($response, true); if ($responseArray && array_key_exists('message', $responseArray) && $responseArray['message'] === 'OK') { // API key valid diff --git a/Classes/Task/ImporterTask.php b/Classes/Task/ImporterTask.php index b3dc1b4..7066074 100644 --- a/Classes/Task/ImporterTask.php +++ b/Classes/Task/ImporterTask.php @@ -14,9 +14,9 @@ * The TYPO3 project - inspiring people to share! */ -use JWeiland\Avalex\Configuration\ExtConf; use JWeiland\Avalex\Domain\Repository\AvalexConfigurationRepository; use JWeiland\Avalex\Domain\Repository\LegalTextRepository; +use JWeiland\Avalex\Utility\ApiUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Scheduler\Task\AbstractTask; @@ -40,11 +40,6 @@ class ImporterTask extends AbstractTask public function execute() { $this->init(); - $apiBaseURL = ExtConf::getInstance()->getApiBaseUrl(); - if (!$apiBaseURL) { - return false; - } - $configurations = $this->avalexConfigurationRepository->findAll(); foreach ($configurations as $configuration) { $configurationUid = (int)$configuration['uid']; @@ -58,7 +53,7 @@ public function execute() return false; } - $legalText = @file_get_contents($apiBaseURL . 'datenschutzerklaerung?apikey=' . $apiKey); + $legalText = @file_get_contents(ApiUtility::getApiUrl() . 'datenschutzerklaerung?apikey=' . $apiKey); if (!$this->checkResponse($legalText)) { return false; } diff --git a/Classes/Utility/ApiUtility.php b/Classes/Utility/ApiUtility.php new file mode 100644 index 0000000..36ca6ca --- /dev/null +++ b/Classes/Utility/ApiUtility.php @@ -0,0 +1,36 @@ +=6.2,<=9.5" + "typo3/cms-core": "^6.2 || ^7.6 || ^8.7 || ^9.5" }, "autoload": { "psr-4": { diff --git a/ext_conf_template.txt b/ext_conf_template.txt index bf3bf4e..c54b07b 100644 --- a/ext_conf_template.txt +++ b/ext_conf_template.txt @@ -1,4 +1,2 @@ -# cat=API/enable/22; type=string; label=API Base Url -apiBaseUrl = https://beta.avalex.de/ # cat=API/enable/23; type=string; label=API key field (deprecated):Just there for compatibility! Please donĀ“t fill in. apiKey = diff --git a/ext_emconf.php b/ext_emconf.php index 6ca4c3f..4a73f5d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -11,7 +11,7 @@ 'uploadfolder' => false, 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '6.1.0', + 'version' => '6.1.1', 'constraints' => array( 'depends' =>