From f14e062e04d21f82484674d2b346fecd237c233c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Wed, 26 Sep 2018 18:54:48 +0200 Subject: [PATCH] Remove Google geolocation service --- .../ext/ep_products/Classes/Hook/Tcemain.php | 11 ---- .../Classes/Service/GeolocationService.php | 50 ------------------- 2 files changed, 61 deletions(-) delete mode 100644 web/typo3conf/ext/ep_products/Classes/Service/GeolocationService.php diff --git a/web/typo3conf/ext/ep_products/Classes/Hook/Tcemain.php b/web/typo3conf/ext/ep_products/Classes/Hook/Tcemain.php index 5ccc1a36..018f6613 100644 --- a/web/typo3conf/ext/ep_products/Classes/Hook/Tcemain.php +++ b/web/typo3conf/ext/ep_products/Classes/Hook/Tcemain.php @@ -27,7 +27,6 @@ namespace EP\EpProducts\Hook; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use EP\EpProducts\Service\GeolocationService; use EP\EpProducts\Utility\DbUtility; use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Messaging\FlashMessage; @@ -55,16 +54,6 @@ class Tcemain */ public function processDatamap_preProcessFieldArray(array &$fields, $table, $id, DataHandler $obj) { - if ($fields['name'] !== '' && $fields['latitude'] === '' && $fields['longitude'] === '' && in_array($table, $this->tables)) { - $coordinates = GeolocationService::getCoordinates($fields['name']); - $fields['latitude'] = $coordinates['latitude']; - $fields['longitude'] = $coordinates['longitude']; - } - if ($table === 'tx_epproducts_domain_model_hotel' && $fields['address'] !== ''&& $fields['latitude'] === '' && $fields['longitude'] === '') { - $coordinates = GeolocationService::getCoordinates($fields['address']); - $fields['latitude'] = $coordinates['latitude']; - $fields['longitude'] = $coordinates['longitude']; - } // Render flash message in case of duplicate entry if ($table === 'tx_epproducts_domain_model_matchcode' && $fields['code'] !== '') { $code = $fields['code']; diff --git a/web/typo3conf/ext/ep_products/Classes/Service/GeolocationService.php b/web/typo3conf/ext/ep_products/Classes/Service/GeolocationService.php deleted file mode 100644 index c4176d24..00000000 --- a/web/typo3conf/ext/ep_products/Classes/Service/GeolocationService.php +++ /dev/null @@ -1,50 +0,0 @@ -, dreipunktnull - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -class GeolocationService -{ - - /** - * @param string $place - * - * @return array - */ - public static function getCoordinates($place) - { - $coordinates = []; - $apiUrl = urlencode('http://maps.googleapis.com/maps/api/geocode/xml?address=' . $place); - $result = @simplexml_load_file($apiUrl); - if ($result !== false) { - $coordinates['latitude'] = (string) $result->result->geometry->location->lat; - $coordinates['longitude'] = (string) $result->result->geometry->location->lng; - } - return $coordinates; - } - -}