Skip to content
This repository was archived by the owner on Nov 19, 2017. It is now read-only.

Commit 7ed02f9

Browse files
author
jbartels
committed
complete refactoring
compatible with Typo3 7.6 BE-Modules not yet working git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/wec_map/trunk@90686 735d13b6-9817-0410-8766-e36946ffe9aa
1 parent 01824e8 commit 7ed02f9

File tree

99 files changed

+6358
-2678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+6358
-2678
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
[FIX] French translation updated. Thanks to S�bastien Convers.
55
[FIX] Load Order of extensions. Thanks to Thorsten Krieger and Stefan Wobbe. (issue #62582)
66
[FIX] HTML5 Markup Error on URL for Google APIs. Thanks to DMK E-BUSINESS GmbH. (issue #62496)
7+
[NEW] pi2-TypoScript-options: table.additionalWhere, table.orderBy, table.limit
8+
[FIX] Use Configuration/TCA/override to extend 3rd-party tables (issue #64171)
79

810
3.1.1
911
[FIX] addressForm for radius-search is not displayed. Please check your TypoScript setup. (issue #60419)

geocode_service/class.tx_wecmap_geocode_google.php renamed to Classes/GeocodeService/Google.php

Lines changed: 19 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* (c) 2005-2009 Christian Technology Ministries International Inc.
66
* All rights reserved
7-
* (c) 2011-2013 Jan Bartels, j.bartels@arcor.de, Google API V3
7+
* (c) 2011-2015 Jan Bartels, j.bartels@arcor.de, Google API V3
88
*
99
* parts from static_info_tables:
1010
* (c) 2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
@@ -36,9 +36,7 @@
3636
* @author j.bartels
3737
*/
3838

39-
40-
#require_once(PATH_t3lib.'class.t3lib_svbase.php');
41-
#require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('wec_map').'class.tx_wecmap_domainmgr.php');
39+
namespace JBartels\WecMap\GeocodeService;
4240

4341
/**
4442
* Service providing lat/long lookup via the Google Maps web service.
@@ -47,10 +45,8 @@
4745
* @package TYPO3
4846
* @subpackage tx_wecmap
4947
*/
50-
class tx_wecmap_geocode_google extends t3lib_svbase {
51-
var $prefixId = 'tx_wecmap_geocode_google'; // Same as class name
52-
var $scriptRelPath = 'geocode_service/class.tx_wecmap_geocode_google.php'; // Path to this script relative to the extension dir.
53-
var $extKey = 'wec_map'; // The extension key.
48+
class Google extends \TYPO3\CMS\Core\Service\AbstractService {
49+
var $prefixId = 'WecMapGeocodeGoogle'; // for temporary files
5450

5551
/**
5652
* Returns the type of an iso code: nr, 2, 3
@@ -137,9 +133,6 @@ function lookup($street, $city, $state, $zip, $country, $key='') {
137133
{
138134
// format address for Google search based on local address-format for given $country
139135

140-
// load and init Static Info Tables
141-
#require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('static_info_tables').'class.tx_staticinfotables_div.php');
142-
143136
// convert $country to ISO3
144137
$countryCodeType = self::isoCodeType($country);
145138
if ($countryCodeType == 'nr') {
@@ -198,9 +191,6 @@ function lookup($street, $city, $state, $zip, $country, $key='') {
198191

199192
// build URL
200193
$lookupstr = trim( $addressString );
201-
# Google requires utf-8; convert query if neccessary
202-
// if ( $GLOBALS['TSFE']->renderCharset != 'utf-8' )
203-
// $lookupstr = utf8_encode( $lookupstr );
204194

205195
$url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=' . urlencode( $lookupstr );
206196
if ( $region )
@@ -299,57 +289,20 @@ function lookup($street, $city, $state, $zip, $country, $key='') {
299289
* @return string The formated address using the country address format (cn_address_format)
300290
*/
301291
function formatAddress ($delim, $streetAddress, $city, $zip, $subdivisionCode='', $countryCode='') {
302-
303-
if(TYPO3_MODE == 'FE')
304-
{
305-
#require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('static_info_tables').'pi1/class.tx_staticinfotables_pi1.php');
306-
$staticInfoObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('SJBR\\StaticInfoTables\\PiBaseApi');
307-
if ($staticInfoObj->needsInit()) {
292+
/** @var \SJBR\StaticInfoTables\PiBaseApi $staticInfoObj */
293+
$staticInfoObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\SJBR\StaticInfoTables\PiBaseApi::class);
294+
if ($staticInfoObj->needsInit()) {
295+
if(TYPO3_MODE == 'FE')
296+
{
308297
$staticInfoObj->init();
309298
}
310-
return $staticInfoObj->formatAddress($delim, $streetAddress, $city, $zip, $subdivisionCode, $countryCode);
311-
}
312-
313-
$conf = $this->loadTypoScriptForBEModule('tx_staticinfotables_pi1');
314-
315-
global $TYPO3_DB;
316-
317-
$formatedAddress = '';
318-
$countryCode = ($countryCode ? trim($countryCode) : $this->defaultCountry);
319-
$subdivisionCode = ($subdivisionCode ? trim($subdivisionCode) : ($countryCode == $this->defaultCountry ? $this->defaultCountryZone : ''));
320-
321-
// Get country name
322-
// $countryName = $this->getStaticInfoName('COUNTRIES', $countryCode);
323-
$countryName = tx_staticinfotables_div::getTitleFromIsoCode('static_countries', $countryCode, '', FALSE);
324-
if (!$countryName) {
325-
return $formatedAddress;
299+
else
300+
{
301+
$conf = $this->loadTypoScriptForBEModule('tx_staticinfotables_pi1');
302+
$staticInfoObj->init( $conf );
303+
}
326304
}
327-
328-
// Get address format
329-
$res = $TYPO3_DB->exec_SELECTquery(
330-
'cn_address_format',
331-
'static_countries',
332-
'cn_iso_3='.$TYPO3_DB->fullQuoteStr($countryCode,'static_countries')
333-
);
334-
$row = $TYPO3_DB->sql_fetch_assoc($res);
335-
$TYPO3_DB->sql_free_result($res);
336-
$addressFormat = $row['cn_address_format'];
337-
338-
// Get country subdivision name
339-
// $countrySubdivisionName = $this->getStaticInfoName('SUBDIVISIONS', $subdivisionCode, $countryCode);
340-
// $countrySubdivisionName = tx_staticinfotables_div::getTitleFromIsoCode('static_country_zones', $subdivisionCode, $countryCode, FALSE);
341-
342-
// Format the address
343-
$formatedAddress = $conf['addressFormat.'][$addressFormat];
344-
$formatedAddress = str_replace('%street', $streetAddress, $formatedAddress);
345-
$formatedAddress = str_replace('%city', $city, $formatedAddress);
346-
$formatedAddress = str_replace('%zip', $zip, $formatedAddress);
347-
$formatedAddress = str_replace('%countrySubdivisionCode', $subdivisionCode, $formatedAddress);
348-
$formatedAddress = str_replace('%countrySubdivisionName', $subdivisionCode, $formatedAddress);
349-
$formatedAddress = str_replace('%countryName', strtoupper($countryName), $formatedAddress);
350-
$formatedAddress = implode($delim, \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $formatedAddress, 1));
351-
352-
return $formatedAddress;
305+
return $staticInfoObj->formatAddress($delim, $streetAddress, $city, $zip, $subdivisionCode, $countryCode);
353306
}
354307

355308

@@ -360,14 +313,13 @@ function formatAddress ($delim, $streetAddress, $city, $zip, $subdivisionCode=''
360313
* @return array
361314
*/
362315
function loadTypoScriptForBEModule($extKey) {
363-
#require_once(PATH_t3lib . 'class.t3lib_page.php');
364-
#require_once(PATH_t3lib . 'class.t3lib_tstemplate.php');
365-
#require_once(PATH_t3lib . 'class.t3lib_tsparser_ext.php');
366316
list($page) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages', 'pid', 0);
367317
$pageUid = intval($page['uid']);
368-
$sysPageObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_pageSelect');
318+
/** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPageObj */
319+
$sysPageObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
369320
$rootLine = $sysPageObj->getRootLine($pageUid);
370-
$TSObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_tsparser_ext');
321+
/** @var \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService $TSObj */
322+
$TSObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
371323
$TSObj->tt_track = 0;
372324
$TSObj->init();
373325
$TSObj->runThroughTemplates($rootLine);

0 commit comments

Comments
 (0)